diff --git a/beacond/go.mod b/beacond/go.mod index 8dc7cbae6d..da9fd02179 100644 --- a/beacond/go.mod +++ b/beacond/go.mod @@ -7,8 +7,7 @@ replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240806152830-8fb47b368cd4 cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 cosmossdk.io/core/testing => cosmossdk.io/core/testing v0.0.0-20240806152830-8fb47b368cd4 - cosmossdk.io/x/auth => cosmossdk.io/x/auth v0.0.0-20240806152830-8fb47b368cd4 - cosmossdk.io/x/consensus => cosmossdk.io/x/consensus v0.0.0-20240806152830-8fb47b368cd4 + github.com/cometbft/cometbft => github.com/cometbft/cometbft v1.0.0-rc1.0.20240805134408-314422469051 github.com/cosmos/cosmos-sdk => github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 github.com/ferranbt/fastssz => github.com/itsdevbear/fastssz v0.0.0-20240731164358-a354a31813e6 @@ -37,7 +36,7 @@ require ( cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect @@ -101,7 +100,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect @@ -247,7 +246,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect diff --git a/beacond/go.sum b/beacond/go.sum index 8a9d6d30d8..5358d7d1b2 100644 --- a/beacond/go.sum +++ b/beacond/go.sum @@ -18,8 +18,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -208,8 +208,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -821,8 +821,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/build/scripts/testing.mk b/build/scripts/testing.mk index 9dd38d6707..f8e1e38c05 100644 --- a/build/scripts/testing.mk +++ b/build/scripts/testing.mk @@ -276,10 +276,6 @@ test-unit-fuzz: ## run fuzz tests go test ./mod/payload/pkg/cache/... -fuzz=FuzzPayloadIDCacheConcurrency -fuzztime=${SHORT_FUZZ_TIME} go test -fuzz=FuzzHashTreeRoot ./mod/primitives/pkg/merkle -fuzztime=${MEDIUM_FUZZ_TIME} - - - - test-e2e: ## run e2e tests @$(MAKE) build-docker VERSION=kurtosis-local test-e2e-no-build diff --git a/build/tools/go.mod b/build/tools/go.mod index 57fcdd8fc4..890630043f 100644 --- a/build/tools/go.mod +++ b/build/tools/go.mod @@ -321,7 +321,7 @@ require ( golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect diff --git a/build/tools/go.sum b/build/tools/go.sum index 4b46715312..72063666d9 100644 --- a/build/tools/go.sum +++ b/build/tools/go.sum @@ -946,8 +946,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/examples/berad/go.mod b/examples/berad/go.mod index a6e006d90d..13eca9f8a1 100644 --- a/examples/berad/go.mod +++ b/examples/berad/go.mod @@ -26,7 +26,7 @@ require ( cosmossdk.io/api v0.7.5 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect cosmossdk.io/x/tx v0.13.4-0.20240623110059-dec2d5583e39 // indirect @@ -36,7 +36,7 @@ require ( github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect @@ -147,7 +147,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/examples/berad/go.sum b/examples/berad/go.sum index 04a28104e7..97f39e30d2 100644 --- a/examples/berad/go.sum +++ b/examples/berad/go.sum @@ -13,8 +13,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -130,8 +130,8 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -595,8 +595,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/examples/berad/pkg/consensus-types/state.go b/examples/berad/pkg/consensus-types/state.go index 9ba78a026d..455a64a258 100644 --- a/examples/berad/pkg/consensus-types/state.go +++ b/examples/berad/pkg/consensus-types/state.go @@ -64,10 +64,6 @@ type BeaconState[ // Withdrawals NextWithdrawalIndex uint64 NextWithdrawalValidatorIndex math.ValidatorIndex - - // Slashing - Slashings []uint64 - TotalSlashing math.Gwei } /* -------------------------------------------------------------------------- */ @@ -78,7 +74,7 @@ type BeaconState[ func (st *BeaconState[ _, _, _, _, _, _, _, _, _, ]) SizeSSZ(fixed bool) uint32 { - var size uint32 = 300 + var size uint32 = 276 if fixed { return size @@ -91,7 +87,6 @@ func (st *BeaconState[ size += ssz.SizeSliceOfStaticObjects(st.Validators) size += ssz.SizeSliceOfUint64s(st.Balances) size += ssz.SizeSliceOfStaticBytes(st.RandaoMixes) - size += ssz.SizeSliceOfUint64s(st.Slashings) return size } @@ -123,10 +118,6 @@ func (st *BeaconState[ ssz.DefineUint64(codec, &st.NextWithdrawalIndex) ssz.DefineUint64(codec, &st.NextWithdrawalValidatorIndex) - // // Slashing - ssz.DefineSliceOfUint64sOffset(codec, &st.Slashings, 1099511627776) - ssz.DefineUint64(codec, (*uint64)(&st.TotalSlashing)) - // Dynamic content ssz.DefineSliceOfStaticBytesContent(codec, &st.BlockRoots, 8192) ssz.DefineSliceOfStaticBytesContent(codec, &st.StateRoots, 8192) @@ -134,7 +125,6 @@ func (st *BeaconState[ ssz.DefineSliceOfStaticObjectsContent(codec, &st.Validators, 1099511627776) ssz.DefineSliceOfUint64sContent(codec, &st.Balances, 1099511627776) ssz.DefineSliceOfStaticBytesContent(codec, &st.RandaoMixes, 65536) - ssz.DefineSliceOfUint64sContent(codec, &st.Slashings, 1099511627776) } // MarshalSSZ marshals the BeaconState into SSZ format. @@ -291,29 +281,6 @@ func (st *BeaconState[ // Field (12) 'NextWithdrawalValidatorIndex' hh.PutUint64(uint64(st.NextWithdrawalValidatorIndex)) - // Field (14) 'Slashings' - if size := len(st.Slashings); size > 1099511627776 { - return fastssz.ErrListTooBigFn( - "BeaconState.Slashings", - size, - 1099511627776, - ) - } - subIndx = hh.Index() - for _, i := range st.Slashings { - hh.AppendUint64(i) - } - hh.FillUpTo32() - numItems = uint64(len(st.Slashings)) - hh.MerkleizeWithMixin( - subIndx, - numItems, - fastssz.CalculateLimit(1099511627776, numItems, 8), - ) - - // Field (15) 'TotalSlashing' - hh.PutUint64(uint64(st.TotalSlashing)) - hh.Merkleize(indx) return nil } diff --git a/examples/berad/pkg/state-transition/interfaces.go b/examples/berad/pkg/state-transition/interfaces.go index 8408138182..4d05319958 100644 --- a/examples/berad/pkg/state-transition/interfaces.go +++ b/examples/berad/pkg/state-transition/interfaces.go @@ -84,9 +84,7 @@ type ReadOnlyBeaconState[ GetNextWithdrawalIndex() (uint64, error) GetNextWithdrawalValidatorIndex() (math.ValidatorIndex, error) GetSlot() (math.Slot, error) - GetSlashingAtIndex(uint64) (math.Gwei, error) GetTotalActiveBalances(uint64) (math.Gwei, error) - GetTotalSlashing() (math.Gwei, error) GetTotalValidators() (uint64, error) GetValidators() (ValidatorsT, error) GetValidatorsByEffectiveBalance() ([]ValidatorT, error) @@ -116,9 +114,7 @@ type WriteOnlyBeaconState[ SetNextWithdrawalIndex(uint64) error SetNextWithdrawalValidatorIndex(math.ValidatorIndex) error SetSlot(math.Slot) error - SetTotalSlashing(math.Gwei) error UpdateBlockRootAtIndex(uint64, common.Root) error - UpdateSlashingAtIndex(uint64, math.Gwei) error } // WriteOnlyStateRoots defines a struct which only has write access to state diff --git a/examples/berad/pkg/state-transition/state_processor_committee.go b/examples/berad/pkg/state-transition/state_processor_committee.go index e46b82a35c..4de86dbc26 100644 --- a/examples/berad/pkg/state-transition/state_processor_committee.go +++ b/examples/berad/pkg/state-transition/state_processor_committee.go @@ -26,7 +26,7 @@ import ( // processSyncCommitteeUpdates processes the sync committee updates. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, ValidatorT, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, _, ]) processSyncCommitteeUpdates( st BeaconStateT, ) (transition.ValidatorUpdates, error) { diff --git a/examples/berad/pkg/state-transition/state_processor_genesis.go b/examples/berad/pkg/state-transition/state_processor_genesis.go index 24f4246381..1b151d29db 100644 --- a/examples/berad/pkg/state-transition/state_processor_genesis.go +++ b/examples/berad/pkg/state-transition/state_processor_genesis.go @@ -33,7 +33,7 @@ import ( //nolint:gocognit // its ok func (sp *StateProcessor[ _, BeaconBlockBodyT, BeaconBlockHeaderT, BeaconStateT, _, DepositT, - _, ExecutionPayloadHeaderT, ForkT, _, _, ValidatorT, _, _, _, _, + _, ExecutionPayloadHeaderT, ForkT, _, _, _, _, _, _, _, ]) InitializePreminedBeaconStateFromEth1( st BeaconStateT, deposits []DepositT, @@ -125,10 +125,6 @@ func (sp *StateProcessor[ return nil, err } - if err = st.SetTotalSlashing(0); err != nil { - return nil, err - } - var updates transition.ValidatorUpdates updates, err = sp.processSyncCommitteeUpdates(st) if err != nil { diff --git a/examples/berad/pkg/state-transition/state_processor_slashing.go b/examples/berad/pkg/state-transition/state_processor_slashing.go index 04f66d08ed..8a715e4284 100644 --- a/examples/berad/pkg/state-transition/state_processor_slashing.go +++ b/examples/berad/pkg/state-transition/state_processor_slashing.go @@ -20,10 +20,6 @@ package transition -import ( - "github.com/berachain/beacon-kit/mod/primitives/pkg/math" -) - // processSlashingsReset as defined in the Ethereum 2.0 specification. // https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#slashings-balances-updates // @@ -31,16 +27,10 @@ import ( func (sp *StateProcessor[ _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, _, ]) processSlashingsReset( - st BeaconStateT, + _ BeaconStateT, ) error { - // Get the current epoch. - slot, err := st.GetSlot() - if err != nil { - return err - } - - index := (sp.cs.SlotToEpoch(slot.Unwrap()) + 1) % sp.cs.EpochsPerSlashingsVector() - return st.UpdateSlashingAtIndex(index, 0) + // TODO: implement this + return nil } // processProposerSlashing as defined in the Ethereum 2.0 specification. @@ -79,50 +69,9 @@ func (sp *StateProcessor[ func (sp *StateProcessor[ _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, _, ]) processSlashings( - st BeaconStateT, + _ BeaconStateT, ) error { - totalBalance, err := st.GetTotalActiveBalances(sp.cs.SlotsPerEpoch()) - if err != nil { - return err - } - - totalSlashings, err := st.GetTotalSlashing() - if err != nil { - return err - } - - adjustedTotalSlashingBalance := min( - totalSlashings.Unwrap()*sp.cs.ProportionalSlashingMultiplier(), - totalBalance.Unwrap(), - ) - - vals, err := st.GetValidators() - if err != nil { - return err - } - - // Get the current slot. - slot, err := st.GetSlot() - if err != nil { - return err - } - - //nolint:mnd // this is in the spec - slashableEpoch := (sp.cs.SlotToEpoch(slot.Unwrap()) + sp.cs.EpochsPerSlashingsVector()) / 2 - - // Iterate through the validators and slash if needed. - for _, val := range vals { - if val.IsSlashed() && - (slashableEpoch == val.GetWithdrawableEpoch().Unwrap()) { - if err = sp.processSlash( - st, val, - adjustedTotalSlashingBalance, - totalBalance.Unwrap(), - ); err != nil { - return err - } - } - } + // TODO: implement this return nil } @@ -132,22 +81,11 @@ func (sp *StateProcessor[ func (sp *StateProcessor[ _, _, _, BeaconStateT, _, _, _, _, _, _, _, ValidatorT, _, _, _, _, ]) processSlash( - st BeaconStateT, - val ValidatorT, - adjustedTotalSlashingBalance uint64, - totalBalance uint64, + _ BeaconStateT, + _ ValidatorT, + _ uint64, + _ uint64, ) error { - // Calculate the penalty. - increment := sp.cs.EffectiveBalanceIncrement() - balDivIncrement := val.GetEffectiveBalance().Unwrap() / increment - penaltyNumerator := balDivIncrement * adjustedTotalSlashingBalance - penalty := penaltyNumerator / totalBalance * increment - - // Get the val index and decrease the balance of the validator. - idx, err := st.ValidatorIndexByPubkey(val.GetPubkey()) - if err != nil { - return err - } - - return st.DecreaseBalance(idx, math.Gwei(penalty)) + // TODO: implement this + return nil } diff --git a/examples/berad/pkg/state-transition/state_processor_staking.go b/examples/berad/pkg/state-transition/state_processor_staking.go index 6aba003cf4..633134ceca 100644 --- a/examples/berad/pkg/state-transition/state_processor_staking.go +++ b/examples/berad/pkg/state-transition/state_processor_staking.go @@ -283,7 +283,7 @@ func (sp *StateProcessor[ // better way. func (sp *StateProcessor[ _, BeaconBlockBodyT, _, BeaconStateT, _, _, _, - _, _, _, _, ValidatorT, ValidatorsT, WithdrawalT, _, _, + _, _, _, _, ValidatorT, _, WithdrawalT, _, _, ]) ExpectedWithdrawals(st BeaconStateT) ([]WithdrawalT, error) { return sp.expectedWithdrawals(st) } @@ -293,7 +293,7 @@ func (sp *StateProcessor[ // //nolint:lll func (sp *StateProcessor[ - _, BeaconBlockBodyT, _, BeaconStateT, _, _, _, _, _, _, _, ValidatorT, ValidatorsT, WithdrawalT, _, _, + _, BeaconBlockBodyT, _, BeaconStateT, _, _, _, _, _, _, _, ValidatorT, _, WithdrawalT, _, _, ]) expectedWithdrawals(st BeaconStateT) ([]WithdrawalT, error) { var ( balance math.Gwei diff --git a/examples/berad/pkg/storage/eth1.go b/examples/berad/pkg/storage/eth1.go deleted file mode 100644 index affb5397b4..0000000000 --- a/examples/berad/pkg/storage/eth1.go +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2024, Berachain Foundation. All rights reserved. -// Use of this software is governed by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package beacondb - -// GetLatestExecutionPayloadHeader retrieves the latest execution payload -// header from the BeaconStore. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) GetLatestExecutionPayloadHeader() ( - ExecutionPayloadHeaderT, error, -) { - forkVersion, err := kv.latestExecutionPayloadVersion.Get(kv.ctx) - if err != nil { - var t ExecutionPayloadHeaderT - return t, err - } - kv.latestExecutionPayloadCodec.SetActiveForkVersion(forkVersion) - return kv.latestExecutionPayloadHeader.Get(kv.ctx) -} - -// SetLatestExecutionPayloadHeader sets the latest execution payload header in -// the BeaconStore. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) SetLatestExecutionPayloadHeader( - payloadHeader ExecutionPayloadHeaderT, -) error { - if err := kv.latestExecutionPayloadVersion.Set( - kv.ctx, payloadHeader.Version(), - ); err != nil { - return err - } - kv.latestExecutionPayloadCodec.SetActiveForkVersion(payloadHeader.Version()) - return kv.latestExecutionPayloadHeader.Set(kv.ctx, payloadHeader) -} - -// GetEth1DepositIndex retrieves the eth1 deposit index from the beacon state. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) GetEth1DepositIndex() (uint64, error) { - return kv.eth1DepositIndex.Get(kv.ctx) -} - -// SetEth1DepositIndex sets the eth1 deposit index in the beacon state. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) SetEth1DepositIndex( - index uint64, -) error { - return kv.eth1DepositIndex.Set(kv.ctx, index) -} diff --git a/examples/berad/pkg/storage/history.go b/examples/berad/pkg/storage/history.go index 209eb76ff9..87668bfa2a 100644 --- a/examples/berad/pkg/storage/history.go +++ b/examples/berad/pkg/storage/history.go @@ -91,3 +91,37 @@ func (kv *KVStore[ } return common.Root(bz), nil } + +// GetLatestExecutionPayloadHeader retrieves the latest execution payload +// header from the BeaconStore. +func (kv *KVStore[ + BeaconBlockHeaderT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, +]) GetLatestExecutionPayloadHeader() ( + ExecutionPayloadHeaderT, error, +) { + forkVersion, err := kv.latestExecutionPayloadVersion.Get(kv.ctx) + if err != nil { + var t ExecutionPayloadHeaderT + return t, err + } + kv.latestExecutionPayloadCodec.SetActiveForkVersion(forkVersion) + return kv.latestExecutionPayloadHeader.Get(kv.ctx) +} + +// SetLatestExecutionPayloadHeader sets the latest execution payload header in +// the BeaconStore. +func (kv *KVStore[ + BeaconBlockHeaderT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, +]) SetLatestExecutionPayloadHeader( + payloadHeader ExecutionPayloadHeaderT, +) error { + if err := kv.latestExecutionPayloadVersion.Set( + kv.ctx, payloadHeader.Version(), + ); err != nil { + return err + } + kv.latestExecutionPayloadCodec.SetActiveForkVersion(payloadHeader.Version()) + return kv.latestExecutionPayloadHeader.Set(kv.ctx, payloadHeader) +} diff --git a/examples/berad/pkg/storage/keys/keys.go b/examples/berad/pkg/storage/keys/keys.go index 8b3dc5ca23..66e87c04b0 100644 --- a/examples/berad/pkg/storage/keys/keys.go +++ b/examples/berad/pkg/storage/keys/keys.go @@ -21,21 +21,14 @@ package keys const ( - WithdrawalQueuePrefix byte = iota - RandaoMixPrefix - SlashingsPrefix - TotalSlashingPrefix + RandaoMixPrefix byte = iota ValidatorIndexPrefix BlockRootsPrefix StateRootsPrefix ValidatorByIndexPrefix - ValidatorPubkeyToIndexPrefix - ValidatorConsAddrToIndexPrefix - ValidatorEffectiveBalanceToIndexPrefix LatestBeaconBlockHeaderPrefix SlotPrefix BalancesPrefix - Eth1BlockHashPrefix Eth1DepositIndexPrefix LatestExecutionPayloadHeaderPrefix LatestExecutionPayloadVersionPrefix @@ -47,26 +40,19 @@ const ( //nolint:lll const ( - WithdrawalQueuePrefixHumanReadable = "WithdrawalQueuePrefix" - RandaoMixPrefixHumanReadable = "RandaoMixPrefix" - SlashingsPrefixHumanReadable = "SlashingsPrefix" - TotalSlashingPrefixHumanReadable = "TotalSlashingPrefix" - ValidatorIndexPrefixHumanReadable = "ValidatorIndexPrefix" - BlockRootsPrefixHumanReadable = "BlockRootsPrefix" - StateRootsPrefixHumanReadable = "StateRootsPrefix" - ValidatorByIndexPrefixHumanReadable = "ValidatorByIndexPrefix" - ValidatorPubkeyToIndexPrefixHumanReadable = "ValidatorPubkeyToIndexPrefix" - ValidatorConsAddrToIndexPrefixHumanReadable = "ValidatorConsAddrToIndexPrefix" - ValidatorEffectiveBalanceToIndexPrefixHumanReadable = "ValidatorEffectiveBalanceToIndexPrefix" - LatestBeaconBlockHeaderPrefixHumanReadable = "LatestBeaconBlockHeaderPrefix" - SlotPrefixHumanReadable = "SlotPrefix" - BalancesPrefixHumanReadable = "BalancesPrefix" - Eth1BlockHashPrefixHumanReadable = "Eth1BlockHashPrefix" - Eth1DepositIndexPrefixHumanReadable = "Eth1DepositIndexPrefix" - LatestExecutionPayloadHeaderPrefixHumanReadable = "LatestExecutionPayloadHeaderPrefix" - LatestExecutionPayloadVersionPrefixHumanReadable = "LatestExecutionPayloadVersionPrefix" - GenesisValidatorsRootPrefixHumanReadable = "GenesisValidatorsRootPrefix" - NextWithdrawalIndexPrefixHumanReadable = "NextWithdrawalIndexPrefix" - NextWithdrawalValidatorIndexPrefixHumanReadable = "NextWithdrawalValidatorIndexPrefix" - ForkPrefixHumanReadable = "ForkPrefix" + RandaoMixPrefixHumanReadable = "RandaoMixPrefix" + ValidatorIndexPrefixHumanReadable = "ValidatorIndexPrefix" + BlockRootsPrefixHumanReadable = "BlockRootsPrefix" + StateRootsPrefixHumanReadable = "StateRootsPrefix" + ValidatorByIndexPrefixHumanReadable = "ValidatorByIndexPrefix" + LatestBeaconBlockHeaderPrefixHumanReadable = "LatestBeaconBlockHeaderPrefix" + SlotPrefixHumanReadable = "SlotPrefix" + BalancesPrefixHumanReadable = "BalancesPrefix" + Eth1DepositIndexPrefixHumanReadable = "Eth1DepositIndexPrefix" + LatestExecutionPayloadHeaderPrefixHumanReadable = "LatestExecutionPayloadHeaderPrefix" + LatestExecutionPayloadVersionPrefixHumanReadable = "LatestExecutionPayloadVersionPrefix" + GenesisValidatorsRootPrefixHumanReadable = "GenesisValidatorsRootPrefix" + NextWithdrawalIndexPrefixHumanReadable = "NextWithdrawalIndexPrefix" + NextWithdrawalValidatorIndexPrefixHumanReadable = "NextWithdrawalValidatorIndexPrefix" + ForkPrefixHumanReadable = "ForkPrefix" ) diff --git a/examples/berad/pkg/storage/kvstore.go b/examples/berad/pkg/storage/kvstore.go index 5fc785dd58..812151eda3 100644 --- a/examples/berad/pkg/storage/kvstore.go +++ b/examples/berad/pkg/storage/kvstore.go @@ -94,11 +94,6 @@ type KVStore[ // Randomness // randaoMix stores the randao mix for the current epoch. randaoMix sdkcollections.Map[uint64, []byte] - // Slashings - // slashings stores the slashings for the current epoch. - slashings sdkcollections.Map[uint64, uint64] - // totalSlashing stores the total slashing in the vector range. - totalSlashing sdkcollections.Item[uint64] } // New creates a new instance of Store. @@ -219,13 +214,6 @@ func New[ sdkcollections.Uint64Key, sdkcollections.BytesValue, ), - slashings: sdkcollections.NewMap( - schemaBuilder, - sdkcollections.NewPrefix([]byte{keys.SlashingsPrefix}), - keys.SlashingsPrefixHumanReadable, - sdkcollections.Uint64Key, - sdkcollections.Uint64Value, - ), nextWithdrawalIndex: sdkcollections.NewItem( schemaBuilder, sdkcollections.NewPrefix([]byte{keys.NextWithdrawalIndexPrefix}), @@ -240,12 +228,6 @@ func New[ keys.NextWithdrawalValidatorIndexPrefixHumanReadable, sdkcollections.Uint64Value, ), - totalSlashing: sdkcollections.NewItem( - schemaBuilder, - sdkcollections.NewPrefix([]byte{keys.TotalSlashingPrefix}), - keys.TotalSlashingPrefixHumanReadable, - sdkcollections.Uint64Value, - ), latestBlockHeader: sdkcollections.NewItem( schemaBuilder, sdkcollections.NewPrefix( diff --git a/examples/berad/pkg/storage/slashing.go b/examples/berad/pkg/storage/slashing.go deleted file mode 100644 index 4d3287b1d1..0000000000 --- a/examples/berad/pkg/storage/slashing.go +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2024, Berachain Foundation. All rights reserved. -// Use of this software is governed by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package beacondb - -import ( - "cosmossdk.io/collections" - "github.com/berachain/beacon-kit/mod/errors" - "github.com/berachain/beacon-kit/mod/primitives/pkg/math" -) - -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) GetSlashings() ([]uint64, error) { - var slashings []uint64 - iter, err := kv.slashings.Iterate(kv.ctx, nil) - if err != nil { - return nil, err - } - for iter.Valid() { - var slashing uint64 - slashing, err = iter.Value() - if err != nil { - return nil, err - } - slashings = append(slashings, slashing) - iter.Next() - } - return slashings, nil -} - -// GetSlashingAtIndex retrieves the slashing amount by index from the store. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) GetSlashingAtIndex( - index uint64, -) (math.Gwei, error) { - amount, err := kv.slashings.Get(kv.ctx, index) - if errors.Is(err, collections.ErrNotFound) { - return 0, nil - } else if err != nil { - return 0, err - } - return math.Gwei(amount), nil -} - -// SetSlashingAtIndex sets the slashing amount in the store. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) SetSlashingAtIndex( - index uint64, - amount math.Gwei, -) error { - return kv.slashings.Set(kv.ctx, index, amount.Unwrap()) -} - -// GetTotalSlashing retrieves the total slashing amount from the store. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) GetTotalSlashing() (math.Gwei, error) { - total, err := kv.totalSlashing.Get(kv.ctx) - if errors.Is(err, collections.ErrNotFound) { - return 0, nil - } else if err != nil { - return 0, err - } - return math.Gwei(total), nil -} - -// SetTotalSlashing sets the total slashing amount in the store. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) SetTotalSlashing( - amount math.Gwei, -) error { - return kv.totalSlashing.Set(kv.ctx, amount.Unwrap()) -} diff --git a/examples/berad/pkg/storage/withdrawals.go b/examples/berad/pkg/storage/staking.go similarity index 80% rename from examples/berad/pkg/storage/withdrawals.go rename to examples/berad/pkg/storage/staking.go index 0d2c598bf2..201e1d3885 100644 --- a/examples/berad/pkg/storage/withdrawals.go +++ b/examples/berad/pkg/storage/staking.go @@ -22,6 +22,24 @@ package beacondb import "github.com/berachain/beacon-kit/mod/primitives/pkg/math" +// GetEth1DepositIndex retrieves the eth1 deposit index from the beacon state. +func (kv *KVStore[ + BeaconBlockHeaderT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, +]) GetEth1DepositIndex() (uint64, error) { + return kv.eth1DepositIndex.Get(kv.ctx) +} + +// SetEth1DepositIndex sets the eth1 deposit index in the beacon state. +func (kv *KVStore[ + BeaconBlockHeaderT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, +]) SetEth1DepositIndex( + index uint64, +) error { + return kv.eth1DepositIndex.Set(kv.ctx, index) +} + // GetNextWithdrawalIndex returns the next withdrawal index. func (kv *KVStore[ BeaconBlockHeaderT, ExecutionPayloadHeaderT, diff --git a/examples/berad/pkg/storage/versioning.go b/examples/berad/pkg/storage/versioning.go index c920cc79d9..f19c95df08 100644 --- a/examples/berad/pkg/storage/versioning.go +++ b/examples/berad/pkg/storage/versioning.go @@ -67,3 +67,21 @@ func (kv *KVStore[ ) error { return kv.slot.Set(kv.ctx, slot.Unwrap()) } + +// SetFork sets the fork version for the given epoch. +func (kv *KVStore[ + BeaconBlockHeaderT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, +]) SetFork( + fork ForkT, +) error { + return kv.fork.Set(kv.ctx, fork) +} + +// GetFork gets the fork version for the given epoch. +func (kv *KVStore[ + BeaconBlockHeaderT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, +]) GetFork() (ForkT, error) { + return kv.fork.Get(kv.ctx) +} diff --git a/kurtosis/src/nodes/consensus/beacond/launcher.star b/kurtosis/src/nodes/consensus/beacond/launcher.star index c6e8a8925a..422df83c78 100644 --- a/kurtosis/src/nodes/consensus/beacond/launcher.star +++ b/kurtosis/src/nodes/consensus/beacond/launcher.star @@ -9,6 +9,7 @@ COMETBFT_REST_PORT_NUM = 1317 COMETBFT_PPROF_PORT_NUM = 6060 METRICS_PORT_NUM = 26660 ENGINE_RPC_PORT_NUM = 8551 +NODE_API_PORT_NUM = 3500 # Port IDs COMETBFT_RPC_PORT_ID = "cometbft-rpc" @@ -19,6 +20,7 @@ COMETBFT_PPROF_PORT_ID = "cometbft-pprof" ENGINE_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" METRICS_PATH = "/metrics" +NODE_API_PORT_ID = "node-api" USED_PORTS = { COMETBFT_RPC_PORT_ID: shared_utils.new_port_spec(COMETBFT_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), @@ -27,6 +29,7 @@ USED_PORTS = { COMETBFT_PPROF_PORT_ID: shared_utils.new_port_spec(COMETBFT_PPROF_PORT_NUM, shared_utils.TCP_PROTOCOL), # ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL, wait = None), + NODE_API_PORT_ID: shared_utils.new_port_spec(NODE_API_PORT_NUM, shared_utils.TCP_PROTOCOL), } def get_config(node_struct, engine_dial_url, entrypoint = [], cmd = [], persistent_peers = "", expose_ports = True, jwt_file = None, kzg_trusted_setup_file = None): diff --git a/kurtosis/src/nodes/consensus/beacond/node.star b/kurtosis/src/nodes/consensus/beacond/node.star index 25f52eb4eb..038cf97ff7 100644 --- a/kurtosis/src/nodes/consensus/beacond/node.star +++ b/kurtosis/src/nodes/consensus/beacond/node.star @@ -39,6 +39,9 @@ def start(persistent_peers, is_seed, validator_index, config_settings, app_setti --beacon-kit.kzg.implementation={} \ --beacon-kit.engine.rpc-dial-url {} \ --rpc.laddr tcp://0.0.0.0:26657 --api.address tcp://0.0.0.0:1317 \ + --beacon-kit.block-store-service.enabled \ + --beacon-kit.node-api.enabled --beacon-kit.node-api.logging \ + --pruning=nothing \ --api.enable {} {}".format(kzg_impl, "$BEACOND_ENGINE_DIAL_URL", seed_option, persistent_peers_option) return "{} && {} && {}".format(mv_genesis, set_config, start_node) diff --git a/mod/async/go.mod b/mod/async/go.mod index 0052517cf6..d949015225 100644 --- a/mod/async/go.mod +++ b/mod/async/go.mod @@ -1,3 +1,23 @@ module github.com/berachain/beacon-kit/mod/async go 1.23.0 + +require ( + github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 + github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 +) + +require ( + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/getsentry/sentry-go v0.28.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect +) diff --git a/mod/async/go.sum b/mod/async/go.sum new file mode 100644 index 0000000000..704d37a052 --- /dev/null +++ b/mod/async/go.sum @@ -0,0 +1,74 @@ +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 h1:kCSrkb/uVXfMKJPKjf0c7nlJkwn5cNwMxtzRW4zNq2A= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0/go.mod h1:og0jtHZosPDTyhge9tMBlRItoZ4Iv3aZFM9n4QDpcdo= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd h1:DYSjsq80Omqqlt+z2VcYsSxjZpLqCDRz7CvUDBrLDJE= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd/go.mod h1:BilVBmqKhC4GXYCaIs8QnKaR14kpn3YmF5uYBdayF9I= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= +github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/examples/berad/pkg/storage/fork.go b/mod/async/pkg/broker/assert.go similarity index 68% rename from examples/berad/pkg/storage/fork.go rename to mod/async/pkg/broker/assert.go index f1fbd896ec..1c9f00932a 100644 --- a/examples/berad/pkg/storage/fork.go +++ b/mod/async/pkg/broker/assert.go @@ -18,22 +18,14 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package beacondb +package broker -// SetFork sets the fork version for the given epoch. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) SetFork( - fork ForkT, -) error { - return kv.fork.Set(kv.ctx, fork) -} - -// GetFork gets the fork version for the given epoch. -func (kv *KVStore[ - BeaconBlockHeaderT, ExecutionPayloadHeaderT, - ForkT, ValidatorT, ValidatorsT, -]) GetFork() (ForkT, error) { - return kv.fork.Get(kv.ctx) +// ensureType ensures that the provided entity is of type T. +// It returns a typed entity or an error if the type is not correct. +func ensureType[T any](e any) (T, error) { + typedE, ok := e.(T) + if !ok { + return *new(T), errIncompatibleAssignee(*new(T), e) + } + return typedE, nil } diff --git a/mod/async/pkg/broker/broker.go b/mod/async/pkg/broker/broker.go index 0febf78961..554c37ea69 100644 --- a/mod/async/pkg/broker/broker.go +++ b/mod/async/pkg/broker/broker.go @@ -22,40 +22,48 @@ package broker import ( "context" + "sync" "time" + + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" ) -// Broker broadcasts msgs to registered clients. -type Broker[T any] struct { - // name of the message broker. - name string - // clients is a map of registered clients. - clients map[chan T]struct{} +// Broker is responsible for broadcasting all events corresponding to the +// to all registered client channels. +type Broker[T async.BaseEvent] struct { + // eventID is a unique identifier for the event that this broker is + // responsible for. + eventID async.EventID + // subscriptions is a map of subscribed subscriptions. + subscriptions map[chan T]struct{} // msgs is the channel for publishing new messages. msgs chan T // timeout is the timeout for sending a msg to a client. timeout time.Duration + // mu is the mutex for the clients map. + mu sync.Mutex } -// New creates a new b. -func New[T any](name string) *Broker[T] { +// New creates a new broker publishing events of type T for the +// provided eventID. +func New[T async.BaseEvent](eventID string) *Broker[T] { return &Broker[T]{ - clients: make(map[chan T]struct{}), - msgs: make(chan T, defaultBufferSize), - timeout: defaultTimeout, - name: name, + eventID: async.EventID(eventID), + subscriptions: make(map[chan T]struct{}), + msgs: make(chan T, defaultBufferSize), + timeout: defaultBrokerTimeout, + mu: sync.Mutex{}, } } -// Name returns the name of the msg broker. -func (b *Broker[T]) Name() string { - return b.name +// EventID returns the event ID that the broker is responsible for. +func (b *Broker[T]) EventID() async.EventID { + return b.eventID } // Start starts the broker loop. -func (b *Broker[T]) Start(ctx context.Context) error { +func (b *Broker[T]) Start(ctx context.Context) { go b.start(ctx) - return nil } // start starts the broker loop. @@ -64,47 +72,78 @@ func (b *Broker[T]) start(ctx context.Context) { select { case <-ctx.Done(): // close all leftover clients and break the broker loop - for client := range b.clients { - b.Unsubscribe(client) - } + b.shutdown() return case msg := <-b.msgs: // broadcast published msg to all clients - for client := range b.clients { - // send msg to client (or discard msg after timeout) - select { - case client <- msg: - case <-time.After(b.timeout): - } - } + b.broadcast(msg) } } } -// Publish publishes a msg to the b. +// Publish publishes a msg to all subscribers. // Returns ErrTimeout on timeout. -func (b *Broker[T]) Publish(ctx context.Context, msg T) error { +func (b *Broker[T]) Publish(msg async.BaseEvent) error { + typedMsg, err := ensureType[T](msg) + if err != nil { + return err + } + ctx := msg.Context() select { - case b.msgs <- msg: + case b.msgs <- typedMsg: return nil case <-ctx.Done(): return ctx.Err() } } -// Subscribe registers a new client to the broker and returns it to the caller. +// Subscribe registers the provided channel to the broker, // Returns ErrTimeout on timeout. -func (b *Broker[T]) Subscribe() (chan T, error) { - client := make(chan T) - b.clients[client] = struct{}{} - return client, nil +// Contract: the channel must be a Subscription[T], where T is the expected +// type of the event data. +func (b *Broker[T]) Subscribe(ch any) error { + client, err := ensureType[chan T](ch) + if err != nil { + return err + } + b.mu.Lock() + defer b.mu.Unlock() + b.subscriptions[client] = struct{}{} + return nil } -// Unsubscribe removes a client from the b. -// Returns ErrTimeout on timeout. -func (b *Broker[T]) Unsubscribe(client chan T) { - // Remove the client from the broker - delete(b.clients, client) - // close the client channel +// Unsubscribe removes a client from the broker. +// Returns an error if the provided channel is not of type chan T. +func (b *Broker[T]) Unsubscribe(ch any) error { + client, err := ensureType[chan T](ch) + if err != nil { + return err + } + b.mu.Lock() + defer b.mu.Unlock() + delete(b.subscriptions, client) close(client) + return nil +} + +func (b *Broker[T]) broadcast(msg T) { + for client := range b.subscriptions { + // send msg to client (or discard msg after timeout) + // we could consider using a go routine for each client to allow + // for concurrent notification attempts, while respecting the timeout + // for each client individually + select { + case client <- msg: + case <-time.After(b.timeout): + } + } +} + +// shutdown closes all leftover clients. +func (b *Broker[T]) shutdown() { + for client := range b.subscriptions { + if err := b.Unsubscribe(client); err != nil { + panic(err) + } + } } diff --git a/mod/async/pkg/broker/constants.go b/mod/async/pkg/broker/constants.go index aa54901023..445e2821fa 100644 --- a/mod/async/pkg/broker/constants.go +++ b/mod/async/pkg/broker/constants.go @@ -22,11 +22,13 @@ package broker import "time" +// TODO: make timeout configurable thorugh config/context const ( - // defaultTimeout specifies the default timeout when the broker + // defaultBrokerTimeout specifies the default timeout when the publisher // tries to send a message to a client, a message is published to the - // broker, or a client subscribes or unsubscribes. - defaultTimeout = time.Second + // publisher, or a client subscribes or unsubscribes. + defaultBrokerTimeout = time.Second + // defaultBufferSize specifies the default size of the message buffer. defaultBufferSize = 10 ) diff --git a/mod/async/pkg/broker/errors.go b/mod/async/pkg/broker/errors.go index f0d88700fe..c93cf172c1 100644 --- a/mod/async/pkg/broker/errors.go +++ b/mod/async/pkg/broker/errors.go @@ -21,8 +21,24 @@ package broker import ( - "errors" + "github.com/berachain/beacon-kit/mod/errors" ) -// ErrTimeout is the error returned when a broker operation timed out. -var ErrTimeout = errors.New("timeout") +// errTimeout is the error returned when a dispatch operation timed out. +// +//nolint:gochecknoglobals // errors +var ( + ErrIncompatible = errors.New("incompatible assignee") + // errIncompatibleAssignee is the error returned when the assignee is not + // compatible with the assigner. + errIncompatibleAssignee = func( + assigner interface{}, assignee interface{}, + ) error { + return errors.Wrapf( + ErrIncompatible, + "expected: %T, received: %T", + assigner, + assignee, + ) + } +) diff --git a/mod/async/pkg/dispatcher/dispatcher.go b/mod/async/pkg/dispatcher/dispatcher.go new file mode 100644 index 0000000000..2b8a0b7c95 --- /dev/null +++ b/mod/async/pkg/dispatcher/dispatcher.go @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package dispatcher + +import ( + "context" + + "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/log" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" +) + +var _ types.Dispatcher = (*Dispatcher)(nil) + +// Dispatcher faciliates asynchronous communication between components, +// typically services. +type Dispatcher struct { + brokers map[async.EventID]types.Broker + logger log.Logger[any] +} + +// NewDispatcher creates a new event server. +func New( + logger log.Logger[any], +) *Dispatcher { + return &Dispatcher{ + brokers: make(map[async.EventID]types.Broker), + logger: logger, + } +} + +// Publish dispatches the given event to the broker with the given eventID. +func (d *Dispatcher) Publish(event async.BaseEvent) error { + broker, ok := d.brokers[event.ID()] + if !ok { + return errBrokerNotFound(event.ID()) + } + return broker.Publish(event) +} + +// Subscribe subscribes the given channel to the broker with the given +// eventID. It will error if the channel type does not match the event type +// corresponding to the broker. +// Contract: the channel must be a Subscription[T], where T is the expected +// type of the event data. +func (d *Dispatcher) Subscribe(eventID async.EventID, ch any) error { + broker, ok := d.brokers[eventID] + if !ok { + return errBrokerNotFound(eventID) + } + return broker.Subscribe(ch) +} + +// Start will start all the brokers in the Dispatcher. +func (d *Dispatcher) Start(ctx context.Context) error { + for _, broker := range d.brokers { + go broker.Start(ctx) + } + return nil +} + +func (d *Dispatcher) Name() string { + return "dispatcher" +} + +// RegisterBrokers registers the given brokers with the given eventIDs. +// Any subsequent events with dispatched to this Dispatcher must be +// consistent with the type expected by . +func (d *Dispatcher) RegisterBrokers( + brokers ...types.Broker, +) error { + var ok bool + for _, broker := range brokers { + if _, ok = d.brokers[broker.EventID()]; ok { + return errBrokerAlreadyExists(broker.EventID()) + } + d.brokers[broker.EventID()] = broker + } + return nil +} diff --git a/mod/async/pkg/dispatcher/errors.go b/mod/async/pkg/dispatcher/errors.go new file mode 100644 index 0000000000..56a6126c66 --- /dev/null +++ b/mod/async/pkg/dispatcher/errors.go @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package dispatcher + +import ( + "github.com/berachain/beacon-kit/mod/errors" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" +) + +//nolint:gochecknoglobals // errors +var ( + ErrNotFound = errors.New("not found") + ErrAlreadyExists = errors.New("already exists") + errBrokerNotFound = func(eventID async.EventID) error { + return errors.Wrapf( + ErrNotFound, + "publisher not found for eventID: %s", + eventID, + ) + } + errBrokerAlreadyExists = func(eventID async.EventID) error { + return errors.Wrapf( + ErrAlreadyExists, + "publisher already exists for eventID: %s", + eventID, + ) + } +) diff --git a/mod/async/pkg/types/dispatcher.go b/mod/async/pkg/types/dispatcher.go new file mode 100644 index 0000000000..c0dbb9ea68 --- /dev/null +++ b/mod/async/pkg/types/dispatcher.go @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package types + +import ( + "context" + + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" +) + +// Dispatcher is the full API for a dispatcher that facilitates the publishing +// of async events and the sending and receiving of async messages. +type Dispatcher interface { + EventDispatcher + // Start starts the dispatcher. + Start(ctx context.Context) error + // RegisterBrokers registers brokers to the dispatcher. + RegisterBrokers(brokers ...Broker) error + // Name returns the name of the dispatcher. + Name() string +} + +// EventDispatcher is the API for a dispatcher that facilitates the publishing +// of async events. +type EventDispatcher interface { + // Publish publishes an event to the dispatcher. + Publish(event async.BaseEvent) error + // Subscribe subscribes the given channel to all events with the given event + // ID. + // Contract: the channel must be a Subscription[T], where T is the expected + // type of the event data. + Subscribe(eventID async.EventID, ch any) error + // TODO: add unsubscribe +} + +// publisher is the interface that supports basic event publisher operations. +type Broker interface { + // Start starts the event publisher. + Start(ctx context.Context) + // Publish publishes the given event to the event publisher. + Publish(event async.BaseEvent) error + // Subscribe subscribes the given channel to the event publisher. + Subscribe(ch any) error + // Unsubscribe unsubscribes the given channel from the event publisher. + Unsubscribe(ch any) error + // EventID returns the event ID that the publisher is responsible for. + EventID() async.EventID +} diff --git a/mod/beacon/block_store/pruner.go b/mod/beacon/block_store/pruner.go index b4625d9881..82e71dc61b 100644 --- a/mod/beacon/block_store/pruner.go +++ b/mod/beacon/block_store/pruner.go @@ -17,17 +17,18 @@ // EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. - package blockstore -import asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" +import ( + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" +) // BuildPruneRangeFn builds a function that returns the range of blocks to // prune. func BuildPruneRangeFn[BeaconBlockT BeaconBlock]( cfg Config, -) func(*asynctypes.Event[BeaconBlockT]) (uint64, uint64) { - return func(event *asynctypes.Event[BeaconBlockT]) (uint64, uint64) { +) func(async.Event[BeaconBlockT]) (uint64, uint64) { + return func(event async.Event[BeaconBlockT]) (uint64, uint64) { blk := event.Data() if blk.GetSlot().Unwrap() < cfg.AvailabilityWindow { return 1, 1 diff --git a/mod/beacon/block_store/service.go b/mod/beacon/block_store/service.go index 845cd5afde..14a73eff40 100644 --- a/mod/beacon/block_store/service.go +++ b/mod/beacon/block_store/service.go @@ -23,12 +23,28 @@ package blockstore import ( "context" - "github.com/berachain/beacon-kit/mod/async/pkg/broker" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + async "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" + async1 "github.com/berachain/beacon-kit/mod/primitives/pkg/async" ) +// Service is a Service that listens for blocks and stores them in a KVStore. +type Service[ + BeaconBlockT BeaconBlock, + BlockStoreT BlockStore[BeaconBlockT], +] struct { + // config is the configuration for the block service. + config Config + // logger is used for logging information and errors. + logger log.Logger[any] + // dispatcher is the dispatcher for the service. + dispatcher async.EventDispatcher + // store is the block store for the service. + store BlockStoreT + // subFinalizedBlkEvents is a channel for receiving finalized block events. + subFinalizedBlkEvents chan async1.Event[BeaconBlockT] +} + // NewService creates a new block service. func NewService[ BeaconBlockT BeaconBlock, @@ -36,69 +52,62 @@ func NewService[ ]( config Config, logger log.Logger[any], - blkBroker *broker.Broker[*asynctypes.Event[BeaconBlockT]], + dispatcher async.EventDispatcher, store BlockStoreT, ) *Service[BeaconBlockT, BlockStoreT] { return &Service[BeaconBlockT, BlockStoreT]{ - config: config, - logger: logger, - blkBroker: blkBroker, - store: store, + config: config, + logger: logger, + dispatcher: dispatcher, + store: store, + subFinalizedBlkEvents: make(chan async1.Event[BeaconBlockT]), } } -// Service is a Service that listens for blocks and stores them in a KVStore. -type Service[ - BeaconBlockT BeaconBlock, - BlockStoreT BlockStore[BeaconBlockT], -] struct { - // config is the configuration for the block service. - config Config - // logger is used for logging information and errors. - logger log.Logger[any] - blkBroker *broker.Broker[*asynctypes.Event[BeaconBlockT]] - - store BlockStoreT -} - // Name returns the name of the service. func (s *Service[_, _]) Name() string { return "block-service" } // Start starts the block service. -func (s *Service[_, _]) Start(ctx context.Context) error { +func (s *Service[BeaconBlockT, _]) Start(ctx context.Context) error { if !s.config.Enabled { s.logger.Warn("block service is disabled, skipping storing blocks") return nil } - subBlkCh, err := s.blkBroker.Subscribe() - if err != nil { + + // subscribe a channel to the finalized block events. + if err := s.dispatcher.Subscribe( + async1.BeaconBlockFinalizedEvent, s.subFinalizedBlkEvents, + ); err != nil { s.logger.Error("failed to subscribe to block events", "error", err) return err } - go s.listenAndStore(ctx, subBlkCh) + + go s.eventLoop(ctx) return nil } -// listenAndStore listens for blocks and stores them in the KVStore. -func (s *Service[BeaconBlockT, _]) listenAndStore( - ctx context.Context, - subBlkCh <-chan *asynctypes.Event[BeaconBlockT], -) { +func (s *Service[BeaconBlockT, BlockStoreT]) eventLoop(ctx context.Context) { for { select { case <-ctx.Done(): return - case msg := <-subBlkCh: - if msg.Is(events.BeaconBlockFinalized) { - slot := msg.Data().GetSlot() - if err := s.store.Set(msg.Data()); err != nil { - s.logger.Error( - "failed to store block", "slot", slot, "error", err, - ) - } - } + case event := <-s.subFinalizedBlkEvents: + s.onFinalizeBlock(event) } } } + +// onFinalizeBlock is triggered when a finalized block event is received. +// It stores the block in the KVStore. +func (s *Service[BeaconBlockT, _]) onFinalizeBlock( + event async1.Event[BeaconBlockT], +) { + slot := event.Data().GetSlot() + if err := s.store.Set(event.Data()); err != nil { + s.logger.Error( + "failed to store block", "slot", slot, "error", err, + ) + } +} diff --git a/mod/beacon/block_store/types.go b/mod/beacon/block_store/types.go index d4928c1ffe..b722a43c52 100644 --- a/mod/beacon/block_store/types.go +++ b/mod/beacon/block_store/types.go @@ -21,6 +21,7 @@ package blockstore import ( + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/constraints" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -37,3 +38,19 @@ type BlockStore[BeaconBlockT BeaconBlock] interface { // Set sets a block at a given index. Set(blk BeaconBlockT) error } + +// Event is an interface for block events. +type Event[BeaconBlockT BeaconBlock] interface { + // ID returns the id of the event. + ID() async.EventID + // Is returns true if the event is of the given id. + Is(async.EventID) bool + // Data returns the data of the event. + Data() BeaconBlockT +} + +// EventFeed is a generic interface for sending events. +type EventFeed[EventT any] interface { + // Subscribe returns a channel that will receive events. + Subscribe() (chan EventT, error) +} diff --git a/mod/beacon/blockchain/execution_engine.go b/mod/beacon/blockchain/execution_engine.go index 26afbc0f76..581fb2cbf7 100644 --- a/mod/beacon/blockchain/execution_engine.go +++ b/mod/beacon/blockchain/execution_engine.go @@ -44,7 +44,7 @@ func (s *Service[ return } - if !s.shouldBuildOptimisticPayloads() && s.lb.Enabled() { + if !s.shouldBuildOptimisticPayloads() && s.localBuilder.Enabled() { s.sendNextFCUWithAttributes(ctx, st, blk, lph) } else { s.sendNextFCUWithoutAttributes(ctx, blk, lph) @@ -62,8 +62,11 @@ func (s *Service[ blk BeaconBlockT, lph ExecutionPayloadHeaderT, ) { + var err error stCopy := st.Copy() - if _, err := s.sp.ProcessSlots(stCopy, blk.GetSlot()+1); err != nil { + if _, err = s.stateProcessor.ProcessSlots( + stCopy, blk.GetSlot()+1, + ); err != nil { s.logger.Error( "failed to process slots in non-optimistic payload", "error", err, @@ -72,7 +75,7 @@ func (s *Service[ } prevBlockRoot := blk.HashTreeRoot() - if _, err := s.lb.RequestPayloadAsync( + if _, err = s.localBuilder.RequestPayloadAsync( ctx, stCopy, blk.GetSlot()+1, @@ -83,8 +86,7 @@ func (s *Service[ ); err != nil { s.logger.Error( "failed to send forkchoice update with attributes in non-optimistic payload", - "error", - err, + "error", err, ) } } @@ -99,7 +101,7 @@ func (s *Service[ blk BeaconBlockT, lph ExecutionPayloadHeaderT, ) { - if _, _, err := s.ee.NotifyForkchoiceUpdate( + if _, _, err := s.executionEngine.NotifyForkchoiceUpdate( ctx, // TODO: Switch to New(). engineprimitives. @@ -109,7 +111,7 @@ func (s *Service[ SafeBlockHash: lph.GetParentHash(), FinalizedBlockHash: lph.GetParentHash(), }, - s.cs.ActiveForkVersionForSlot(blk.GetSlot()), + s.chainSpec.ActiveForkVersionForSlot(blk.GetSlot()), ), ); err != nil { s.logger.Error( @@ -128,7 +130,8 @@ func (s *Service[ ]) calculateNextTimestamp(blk BeaconBlockT) uint64 { //#nosec:G701 // not an issue in practice. return max( - uint64(time.Now().Unix()+int64(s.cs.TargetSecondsPerEth1Block())), + uint64(time.Now().Unix()+ + int64(s.chainSpec.TargetSecondsPerEth1Block())), uint64(blk.GetBody().GetExecutionPayload().GetTimestamp()+1), ) } diff --git a/mod/beacon/blockchain/payload.go b/mod/beacon/blockchain/payload.go index bf5feadfe4..22d7eb1e26 100644 --- a/mod/beacon/blockchain/payload.go +++ b/mod/beacon/blockchain/payload.go @@ -46,7 +46,7 @@ func (s *Service[ // TODO: Verify if the slot number is correct here, I believe in current // form // it should be +1'd. Not a big deal until hardforks are in play though. - if err = s.lb.SendForceHeadFCU(ctx, st, slot+1); err != nil { + if err = s.localBuilder.SendForceHeadFCU(ctx, st, slot+1); err != nil { s.logger.Error( "failed to send force head FCU", "error", err, @@ -117,7 +117,7 @@ func (s *Service[ } // Submit a request for a new payload. - if _, err = s.lb.RequestPayloadAsync( + if _, err = s.localBuilder.RequestPayloadAsync( ctx, st, // We are rebuilding for the current slot. @@ -180,7 +180,7 @@ func (s *Service[ ) // We process the slot to update any RANDAO values. - if _, err := s.sp.ProcessSlots( + if _, err := s.stateProcessor.ProcessSlots( st, slot, ); err != nil { return err @@ -188,13 +188,13 @@ func (s *Service[ // We then trigger a request for the next payload. payload := blk.GetBody().GetExecutionPayload() - if _, err := s.lb.RequestPayloadAsync( + if _, err := s.localBuilder.RequestPayloadAsync( ctx, st, slot, // TODO: this is hood as fuck. max( //#nosec:G701 - uint64(time.Now().Unix()+int64(s.cs.TargetSecondsPerEth1Block())), + uint64(time.Now().Unix()+int64(s.chainSpec.TargetSecondsPerEth1Block())), uint64((payload.GetTimestamp()+1)), ), // The previous block root is simply the root of the block we just diff --git a/mod/beacon/blockchain/process.go b/mod/beacon/blockchain/process.go index 1e624b8396..e8490d2c58 100644 --- a/mod/beacon/blockchain/process.go +++ b/mod/beacon/blockchain/process.go @@ -24,8 +24,7 @@ import ( "context" "time" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" ) @@ -37,8 +36,8 @@ func (s *Service[ ctx context.Context, genesisData GenesisT, ) (transition.ValidatorUpdates, error) { - return s.sp.InitializePreminedBeaconStateFromEth1( - s.sb.StateFromContext(ctx), + return s.stateProcessor.InitializePreminedBeaconStateFromEth1( + s.storageBackend.StateFromContext(ctx), genesisData.GetDeposits(), genesisData.GetExecutionPayloadHeader(), genesisData.GetForkVersion(), @@ -63,7 +62,7 @@ func (s *Service[ // ends up not being valid later, the node will simply AppHash, // which is completely fine. This means we were syncing from a // bad peer, and we would likely AppHash anyways. - st := s.sb.StateFromContext(ctx) + st := s.storageBackend.StateFromContext(ctx) valUpdates, err := s.executeStateTransition(ctx, st, blk) if err != nil { return nil, err @@ -72,7 +71,7 @@ func (s *Service[ // If the blobs needed to process the block are not available, we // return an error. It is safe to use the slot off of the beacon block // since it has been verified as correct already. - if !s.sb.AvailabilityStore().IsDataAvailable( + if !s.storageBackend.AvailabilityStore().IsDataAvailable( ctx, blk.GetSlot(), blk.GetBody(), ) { return nil, ErrDataNotAvailable @@ -83,9 +82,9 @@ func (s *Service[ // TODO: this is hood as fuck. // We won't send a fcu if the block is bad, should be addressed // via ticker later. - if err = s.blkBroker.Publish(ctx, - asynctypes.NewEvent( - ctx, events.BeaconBlockFinalized, blk, + if err = s.dispatcher.Publish( + async.NewEvent( + ctx, async.BeaconBlockFinalizedEvent, blk, ), ); err != nil { return nil, err @@ -93,7 +92,7 @@ func (s *Service[ go s.sendPostBlockFCU(ctx, st, blk) - return valUpdates.RemoveDuplicates().Sort(), nil + return valUpdates.CanonicalSort(), nil } // executeStateTransition runs the stf. @@ -106,7 +105,7 @@ func (s *Service[ ) (transition.ValidatorUpdates, error) { startTime := time.Now() defer s.metrics.measureStateTransitionDuration(startTime) - valUpdates, err := s.sp.Transition( + valUpdates, err := s.stateProcessor.Transition( &transition.Context{ Context: ctx, OptimisticEngine: true, diff --git a/mod/beacon/blockchain/receive.go b/mod/beacon/blockchain/receive.go index 730e7fa513..33b1f7ea1d 100644 --- a/mod/beacon/blockchain/receive.go +++ b/mod/beacon/blockchain/receive.go @@ -29,17 +29,6 @@ import ( "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" ) -// ReceiveBlock receives a block and blobs from the -// network and processes them. -func (s *Service[ - _, BeaconBlockT, _, _, _, _, _, _, _, _, -]) ReceiveBlock( - ctx context.Context, - blk BeaconBlockT, -) error { - return s.VerifyIncomingBlock(ctx, blk) -} - // VerifyIncomingBlock verifies the state root of an incoming block // and logs the process. func (s *Service[ @@ -49,7 +38,7 @@ func (s *Service[ blk BeaconBlockT, ) error { // Grab a copy of the state to verify the incoming block. - preState := s.sb.StateFromContext(ctx) + preState := s.storageBackend.StateFromContext(ctx) // Force a sync of the startup head if we haven't done so already. // @@ -118,7 +107,7 @@ func (s *Service[ ) error { startTime := time.Now() defer s.metrics.measureStateRootVerificationTime(startTime) - if _, err := s.sp.Transition( + if _, err := s.stateProcessor.Transition( // We run with a non-optimistic engine here to ensure // that the proposer does not try to push through a bad block. &transition.Context{ @@ -148,5 +137,5 @@ func (s *Service[ func (s *Service[ _, _, _, _, _, _, _, _, _, _, ]) shouldBuildOptimisticPayloads() bool { - return s.optimisticPayloadBuilds && s.lb.Enabled() + return s.optimisticPayloadBuilds && s.localBuilder.Enabled() } diff --git a/mod/beacon/blockchain/service.go b/mod/beacon/blockchain/service.go index edded9c9de..6022e6e6de 100644 --- a/mod/beacon/blockchain/service.go +++ b/mod/beacon/blockchain/service.go @@ -24,11 +24,10 @@ import ( "context" "sync" - "github.com/berachain/beacon-kit/mod/async/pkg/broker" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + async "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" + async1 "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" ) @@ -45,29 +44,28 @@ type Service[ ExecutionPayloadT ExecutionPayload, ExecutionPayloadHeaderT ExecutionPayloadHeader, GenesisT Genesis[DepositT, ExecutionPayloadHeaderT], - PayloadAttributesT interface { - IsNil() bool - Version() uint32 - GetSuggestedFeeRecipient() common.ExecutionAddress - }, + PayloadAttributesT PayloadAttributes, ] struct { - // sb represents the backend storage for beacon states and associated - // sidecars. - sb StorageBackend[ + // storageBackend represents the backend storage for beacon states and + // associated sidecars. + storageBackend StorageBackend[ AvailabilityStoreT, - BeaconBlockBodyT, BeaconStateT, ] // logger is used for logging messages in the service. logger log.Logger[any] - // cs holds the chain specifications. - cs common.ChainSpec - // ee is the execution engine responsible for processing execution payloads. - ee ExecutionEngine[PayloadAttributesT] - // lb is a local builder for constructing new beacon states. - lb LocalBuilder[BeaconStateT] - // sp is the state processor for beacon blocks and states. - sp StateProcessor[ + // chainSpec holds the chain specifications. + chainSpec common.ChainSpec + // dispatcher is the dispatcher for the service. + dispatcher async.Dispatcher + // executionEngine is the execution engine responsible for processing + // + // execution payloads. + executionEngine ExecutionEngine[PayloadAttributesT] + // localBuilder is a local builder for constructing new beacon states. + localBuilder LocalBuilder[BeaconStateT] + // stateProcessor is the state processor for beacon blocks and states. + stateProcessor StateProcessor[ BeaconBlockT, BeaconStateT, *transition.Context, @@ -76,18 +74,20 @@ type Service[ ] // metrics is the metrics for the service. metrics *chainMetrics - // genesisBroker is the event feed for genesis data. - genesisBroker *broker.Broker[*asynctypes.Event[GenesisT]] - // blkBroker is the event feed for new blocks. - blkBroker *broker.Broker[*asynctypes.Event[BeaconBlockT]] - // validatorUpdateBroker is the event feed for validator updates. - //nolint:lll // annoying formatter. - validatorUpdateBroker *broker.Broker[*asynctypes.Event[transition.ValidatorUpdates]] // optimisticPayloadBuilds is a flag used when the optimistic payload // builder is enabled. optimisticPayloadBuilds bool // forceStartupSyncOnce is used to force a sync of the startup head. forceStartupSyncOnce *sync.Once + + // subFinalBlkReceived is a channel for receiving finalize beacon block + // requests. + subFinalBlkReceived chan async1.Event[BeaconBlockT] + // subBlockReceived is a channel for receiving verify beacon block requests. + subBlockReceived chan async1.Event[BeaconBlockT] + // subGenDataReceived is a subscription for receiving genesis data + // received events. + subGenDataReceived chan async1.Event[GenesisT] } // NewService creates a new validator service. @@ -104,33 +104,25 @@ func NewService[ ExecutionPayloadT ExecutionPayload, ExecutionPayloadHeaderT ExecutionPayloadHeader, GenesisT Genesis[DepositT, ExecutionPayloadHeaderT], - PayloadAttributesT interface { - IsNil() bool - Version() uint32 - GetSuggestedFeeRecipient() common.ExecutionAddress - }, + PayloadAttributesT PayloadAttributes, ]( - sb StorageBackend[ + storageBackend StorageBackend[ AvailabilityStoreT, - BeaconBlockBodyT, BeaconStateT, ], logger log.Logger[any], - cs common.ChainSpec, - ee ExecutionEngine[PayloadAttributesT], - lb LocalBuilder[BeaconStateT], - sp StateProcessor[ + chainSpec common.ChainSpec, + dispatcher async.Dispatcher, + executionEngine ExecutionEngine[PayloadAttributesT], + localBuilder LocalBuilder[BeaconStateT], + stateProcessor StateProcessor[ BeaconBlockT, BeaconStateT, *transition.Context, DepositT, ExecutionPayloadHeaderT, ], - ts TelemetrySink, - genesisBroker *broker.Broker[*asynctypes.Event[GenesisT]], - blkBroker *broker.Broker[*asynctypes.Event[BeaconBlockT]], - //nolint:lll // annoying formatter. - validatorUpdateBroker *broker.Broker[*asynctypes.Event[transition.ValidatorUpdates]], + telemetrySink TelemetrySink, optimisticPayloadBuilds bool, ) *Service[ AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT, @@ -142,18 +134,19 @@ func NewService[ BeaconStateT, DepositT, ExecutionPayloadT, ExecutionPayloadHeaderT, GenesisT, PayloadAttributesT, ]{ - sb: sb, + storageBackend: storageBackend, logger: logger, - cs: cs, - ee: ee, - lb: lb, - sp: sp, - metrics: newChainMetrics(ts), - genesisBroker: genesisBroker, - blkBroker: blkBroker, - validatorUpdateBroker: validatorUpdateBroker, + chainSpec: chainSpec, + dispatcher: dispatcher, + executionEngine: executionEngine, + localBuilder: localBuilder, + stateProcessor: stateProcessor, + metrics: newChainMetrics(telemetrySink), optimisticPayloadBuilds: optimisticPayloadBuilds, forceStartupSyncOnce: new(sync.Once), + subFinalBlkReceived: make(chan async1.Event[BeaconBlockT]), + subBlockReceived: make(chan async1.Event[BeaconBlockT]), + subGenDataReceived: make(chan async1.Event[GenesisT]), } } @@ -164,83 +157,95 @@ func (s *Service[ return "blockchain" } +// Start sets up the service to listen for FinalizeBeaconBlock, +// VerifyBeaconBlock, and ProcessGenesisData requests, and handles them +// accordingly. func (s *Service[ - _, _, _, _, _, _, _, _, _, _, + _, BeaconBlockT, _, _, _, _, _, _, GenesisT, _, ]) Start(ctx context.Context) error { - subBlkCh, err := s.blkBroker.Subscribe() - if err != nil { + if err := s.dispatcher.Subscribe( + async1.GenesisDataReceived, s.subGenDataReceived, + ); err != nil { + return err + } + + if err := s.dispatcher.Subscribe( + async1.BeaconBlockReceived, s.subBlockReceived, + ); err != nil { return err } - subGenCh, err := s.genesisBroker.Subscribe() - if err != nil { + + if err := s.dispatcher.Subscribe( + async1.FinalBeaconBlockReceived, s.subFinalBlkReceived, + ); err != nil { return err } - go s.start(ctx, subBlkCh, subGenCh) + + // start a goroutine to listen for requests and handle accordingly + go s.eventLoop(ctx) return nil } +// eventLoop listens for events and handles them accordingly. func (s *Service[ _, BeaconBlockT, _, _, _, _, _, _, GenesisT, _, -]) start( - ctx context.Context, - subBlkCh chan *asynctypes.Event[BeaconBlockT], - subGenCh chan *asynctypes.Event[GenesisT], -) { +]) eventLoop(ctx context.Context) { for { select { case <-ctx.Done(): return - case msg := <-subBlkCh: - switch msg.Type() { - case events.BeaconBlockReceived: - s.handleBeaconBlockReceived(msg) - case events.BeaconBlockFinalizedRequest: - s.handleBeaconBlockFinalization(msg) - } - case msg := <-subGenCh: - if msg.Type() == events.GenesisDataProcessRequest { - s.handleProcessGenesisDataRequest(msg) - } + case event := <-s.subGenDataReceived: + s.handleGenDataReceived(event) + case event := <-s.subBlockReceived: + s.handleBeaconBlockReceived(event) + case event := <-s.subFinalBlkReceived: + s.handleBeaconBlockFinalization(event) } } } +/* -------------------------------------------------------------------------- */ +/* Message Handlers */ +/* -------------------------------------------------------------------------- */ + func (s *Service[ _, _, _, _, _, _, _, _, GenesisT, _, -]) handleProcessGenesisDataRequest(msg *asynctypes.Event[GenesisT]) { +]) handleGenDataReceived(msg async1.Event[GenesisT]) { + var ( + valUpdates transition.ValidatorUpdates + genesisErr error + ) if msg.Error() != nil { s.logger.Error("Error processing genesis data", "error", msg.Error()) - return } // Process the genesis data. - valUpdates, err := s.ProcessGenesisData(msg.Context(), msg.Data()) - if err != nil { - s.logger.Error("Failed to process genesis data", "error", err) + valUpdates, genesisErr = s.ProcessGenesisData(msg.Context(), msg.Data()) + if genesisErr != nil { + s.logger.Error("Failed to process genesis data", "error", genesisErr) } - // Publish the validator set updated event. - if err = s.validatorUpdateBroker.Publish( - msg.Context(), - asynctypes.NewEvent( + // Emit the event containing the validator updates. + if err := s.dispatcher.Publish( + async1.NewEvent( msg.Context(), - events.ValidatorSetUpdated, + async1.GenesisDataProcessed, valUpdates, - err, + genesisErr, ), ); err != nil { s.logger.Error( - "Failed to publish validator set updated event", - "error", - err, + "Failed to emit event in process genesis data", + "error", err, ) + panic(err) } } func (s *Service[ _, BeaconBlockT, _, _, _, _, _, _, _, _, ]) handleBeaconBlockReceived( - msg *asynctypes.Event[BeaconBlockT], + msg async1.Event[BeaconBlockT], ) { // If the block is nil, exit early. if msg.Error() != nil { @@ -248,50 +253,58 @@ func (s *Service[ return } - // Publish the verified block event. - if err := s.blkBroker.Publish( - msg.Context(), - asynctypes.NewEvent( + // emit a BeaconBlockVerified event with the error result from \ + // VerifyIncomingBlock + if err := s.dispatcher.Publish( + async1.NewEvent( msg.Context(), - events.BeaconBlockVerified, + async1.BeaconBlockVerified, msg.Data(), s.VerifyIncomingBlock(msg.Context(), msg.Data()), ), ); err != nil { - s.logger.Error("Failed to publish verified block", "error", err) + s.logger.Error( + "Failed to emit event in verify beacon block", + "error", err, + ) } } func (s *Service[ _, BeaconBlockT, _, _, _, _, _, _, _, _, ]) handleBeaconBlockFinalization( - msg *asynctypes.Event[BeaconBlockT], + msg async1.Event[BeaconBlockT], ) { + var ( + valUpdates transition.ValidatorUpdates + finalizeErr error + ) // If there's an error in the event, log it and return if msg.Error() != nil { s.logger.Error("Error verifying beacon block", "error", msg.Error()) return } - // Process the verified block - valUpdates, err := s.ProcessBeaconBlock(msg.Context(), msg.Data()) - if err != nil { - s.logger.Error("Failed to process verified beacon block", "error", err) + // process the verified block and get the validator updates + valUpdates, finalizeErr = s.ProcessBeaconBlock(msg.Context(), msg.Data()) + if finalizeErr != nil { + s.logger.Error("Failed to process verified beacon block", + "error", finalizeErr, + ) } - // Publish the validator set updated event - if err = s.validatorUpdateBroker.Publish( - msg.Context(), - asynctypes.NewEvent( + // Emit the event containing the validator updates. + if err := s.dispatcher.Publish( + async1.NewEvent( msg.Context(), - events.ValidatorSetUpdated, + async1.FinalValidatorUpdatesProcessed, valUpdates, - err, - )); err != nil { + finalizeErr, + ), + ); err != nil { s.logger.Error( - "Failed to publish validator set updated event", - "error", - err, + "Failed to emit event in finalize beacon block", + "error", err, ) } } diff --git a/mod/beacon/blockchain/types.go b/mod/beacon/blockchain/types.go index c258130aa8..3a50033017 100644 --- a/mod/beacon/blockchain/types.go +++ b/mod/beacon/blockchain/types.go @@ -48,8 +48,6 @@ type BeaconBlock[BeaconBlockBodyT any] interface { constraints.Nillable // GetSlot returns the slot of the beacon block. GetSlot() math.Slot - // GetParentBlockRoot returns the parent block root of the beacon block. - GetParentBlockRoot() common.Root // GetStateRoot returns the state root of the beacon block. GetStateRoot() common.Root // GetBody returns the body of the beacon block. @@ -139,6 +137,12 @@ type LocalBuilder[BeaconStateT any] interface { ) error } +type PayloadAttributes interface { + IsNil() bool + Version() uint32 + GetSuggestedFeeRecipient() common.ExecutionAddress +} + // ReadOnlyBeaconState defines the interface for accessing various components of // the beacon state. type ReadOnlyBeaconState[ @@ -199,7 +203,6 @@ type StateProcessor[ // required by the beacon node. type StorageBackend[ AvailabilityStoreT any, - BeaconBlockBodyT, BeaconStateT any, ] interface { // AvailabilityStore returns the availability store for the given context. @@ -218,3 +221,5 @@ type TelemetrySink interface { // identified by the provided keys. MeasureSince(key string, start time.Time, args ...string) } + +type ValidatorUpdates = transition.ValidatorUpdates diff --git a/mod/beacon/go.mod b/mod/beacon/go.mod index 176e716ef9..2f50ac1bc2 100644 --- a/mod/beacon/go.mod +++ b/mod/beacon/go.mod @@ -5,9 +5,9 @@ go 1.23.0 require ( github.com/berachain/beacon-kit/mod/async v0.0.0-20240816230528-f52c938c20cc github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240809202957-3e3f169ad720 - github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd + github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 github.com/berachain/beacon-kit/mod/log v0.0.0-20240809202957-3e3f169ad720 - github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 golang.org/x/sync v0.8.0 ) @@ -76,7 +76,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/beacon/go.sum b/mod/beacon/go.sum index 81fd3a31f1..e4ac00b666 100644 --- a/mod/beacon/go.sum +++ b/mod/beacon/go.sum @@ -14,14 +14,14 @@ github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240703145037-b5612ab256d github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240703145037-b5612ab256db/go.mod h1:rbvfJqTKUIckels2AlWy+XuG+UGnegoFQuHC+TUg+zA= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240809202957-3e3f169ad720 h1:rVltwwt4JAhpvqeRDZ8J07e9XM+jzfDCJEghPA4r5lg= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240809202957-3e3f169ad720/go.mod h1:kGxAesqTkt75+QYQ73O9I5PqAicSL9JGh5wypiWgb8I= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd h1:jD/ggR959ZX+lqxsMzoRJzrGvFK7PI6UmgnRwOTh4S4= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:iXa+Q+i0q+GCpLzkusulO57K5vlkDgM77jtfMr3QdFA= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 h1:kCSrkb/uVXfMKJPKjf0c7nlJkwn5cNwMxtzRW4zNq2A= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0/go.mod h1:og0jtHZosPDTyhge9tMBlRItoZ4Iv3aZFM9n4QDpcdo= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e h1:0/FDBXtagMkpta/f4J2uAah2NM1G+0dqxngzMzrmbw4= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:7/SXz8S5VpFl2thcKuBdu1OId+SgI1o4N+S1FB92Zw8= github.com/berachain/beacon-kit/mod/log v0.0.0-20240809202957-3e3f169ad720 h1:qfFjDx7w3uU+zMw5HrghiKPZunxapgCiNHI1XqqtgmA= github.com/berachain/beacon-kit/mod/log v0.0.0-20240809202957-3e3f169ad720/go.mod h1:BilVBmqKhC4GXYCaIs8QnKaR14kpn3YmF5uYBdayF9I= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= @@ -266,8 +266,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/beacon/validator/block_builder.go b/mod/beacon/validator/block_builder.go index 303a66c6df..6cf5224f41 100644 --- a/mod/beacon/validator/block_builder.go +++ b/mod/beacon/validator/block_builder.go @@ -36,8 +36,8 @@ import ( // buildBlockAndSidecars builds a new beacon block. func (s *Service[ - AttestationDataT, BeaconBlockT, _, _, - BlobSidecarsT, _, _, _, _, _, _, SlashingInfoT, SlotDataT, + AttestationDataT, BeaconBlockT, _, _, BlobSidecarsT, _, _, _, _, _, _, + SlashingInfoT, SlotDataT, ]) buildBlockAndSidecars( ctx context.Context, slotData SlotDataT, @@ -56,7 +56,7 @@ func (s *Service[ // the next finalized block in the chain. A byproduct of this design // is that we get the nice property of lazily propagating the finalized // and safe block hashes to the execution client. - st := s.bsb.StateFromContext(ctx) + st := s.sb.StateFromContext(ctx) // Prepare the state such that it is ready to build a block for // the requested slot @@ -284,7 +284,7 @@ func (s *Service[ } // Dequeue deposits from the state. - deposits, err := s.bsb.DepositStore().GetDepositsByIndex( + deposits, err := s.sb.DepositStore().GetDepositsByIndex( depositIndex, s.chainSpec.MaxDepositsPerBlock(), ) diff --git a/mod/beacon/validator/service.go b/mod/beacon/validator/service.go index 3d4f45b3cb..309a7ea0f1 100644 --- a/mod/beacon/validator/service.go +++ b/mod/beacon/validator/service.go @@ -23,26 +23,23 @@ package validator import ( "context" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + async "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" + async1 "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" ) -// Service is responsible for building beacon blocks. +// Service is responsible for building beacon blocks and sidecars. type Service[ AttestationDataT any, - BeaconBlockT BeaconBlock[ - AttestationDataT, BeaconBlockT, BeaconBlockBodyT, DepositT, - Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ], + BeaconBlockT BeaconBlock[BeaconBlockT, BeaconBlockBodyT], BeaconBlockBodyT BeaconBlockBody[ AttestationDataT, DepositT, Eth1DataT, ExecutionPayloadT, SlashingInfoT, ], BeaconStateT BeaconState[ExecutionPayloadHeaderT], - BlobSidecarsT, + BlobSidecarsT any, DepositT any, DepositStoreT DepositStore[DepositT], Eth1DataT Eth1Data[Eth1DataT], @@ -61,14 +58,11 @@ type Service[ // signer is used to retrieve the public key of this node. signer crypto.BLSSigner // blobFactory is used to create blob sidecars for blocks. - blobFactory BlobFactory[ - AttestationDataT, BeaconBlockT, BeaconBlockBodyT, BlobSidecarsT, - DepositT, Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ] - // bsb is the beacon state backend. - bsb StorageBackend[ - BeaconStateT, DepositT, DepositStoreT, ExecutionPayloadHeaderT, - ] + blobFactory BlobFactory[BeaconBlockT, BlobSidecarsT] + // sb is the beacon state backend. + sb StorageBackend[BeaconStateT, DepositStoreT] + // dispatcher is the dispatcher. + dispatcher async.EventDispatcher // stateProcessor is responsible for processing the state. stateProcessor StateProcessor[ BeaconBlockT, @@ -86,26 +80,19 @@ type Service[ remotePayloadBuilders []PayloadBuilder[BeaconStateT, ExecutionPayloadT] // metrics is a metrics collector. metrics *validatorMetrics - // blkBroker is a publisher for blocks. - blkBroker EventPublisher[*asynctypes.Event[BeaconBlockT]] - // sidecarBroker is a publisher for sidecars. - sidecarBroker EventPublisher[*asynctypes.Event[BlobSidecarsT]] - // newSlotSub is a feed for slots. - newSlotSub chan *asynctypes.Event[SlotDataT] + // subNewSlot is a channel for new slot events. + subNewSlot chan async1.Event[SlotDataT] } // NewService creates a new validator service. func NewService[ AttestationDataT any, - BeaconBlockT BeaconBlock[ - AttestationDataT, BeaconBlockT, BeaconBlockBodyT, DepositT, - Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ], + BeaconBlockT BeaconBlock[BeaconBlockT, BeaconBlockBodyT], BeaconBlockBodyT BeaconBlockBody[ AttestationDataT, DepositT, Eth1DataT, ExecutionPayloadT, SlashingInfoT, ], BeaconStateT BeaconState[ExecutionPayloadHeaderT], - BlobSidecarsT, + BlobSidecarsT any, DepositT any, DepositStoreT DepositStore[DepositT], Eth1DataT Eth1Data[Eth1DataT], @@ -118,9 +105,7 @@ func NewService[ cfg *Config, logger log.Logger[any], chainSpec common.ChainSpec, - bsb StorageBackend[ - BeaconStateT, DepositT, DepositStoreT, ExecutionPayloadHeaderT, - ], + sb StorageBackend[BeaconStateT, DepositStoreT], stateProcessor StateProcessor[ BeaconBlockT, BeaconStateT, @@ -128,29 +113,25 @@ func NewService[ ExecutionPayloadHeaderT, ], signer crypto.BLSSigner, - blobFactory BlobFactory[ - AttestationDataT, BeaconBlockT, BeaconBlockBodyT, BlobSidecarsT, - DepositT, Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ], + blobFactory BlobFactory[BeaconBlockT, BlobSidecarsT], localPayloadBuilder PayloadBuilder[BeaconStateT, ExecutionPayloadT], remotePayloadBuilders []PayloadBuilder[BeaconStateT, ExecutionPayloadT], ts TelemetrySink, - blkBroker EventPublisher[*asynctypes.Event[BeaconBlockT]], - sidecarBroker EventPublisher[*asynctypes.Event[BlobSidecarsT]], - newSlotSub chan *asynctypes.Event[SlotDataT], + dispatcher async.EventDispatcher, ) *Service[ AttestationDataT, BeaconBlockT, BeaconBlockBodyT, BeaconStateT, BlobSidecarsT, DepositT, DepositStoreT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT, ForkDataT, SlashingInfoT, SlotDataT, ] { return &Service[ - AttestationDataT, BeaconBlockT, BeaconBlockBodyT, BeaconStateT, - BlobSidecarsT, DepositT, DepositStoreT, Eth1DataT, ExecutionPayloadT, - ExecutionPayloadHeaderT, ForkDataT, SlashingInfoT, SlotDataT, + AttestationDataT, BeaconBlockT, BeaconBlockBodyT, + BeaconStateT, BlobSidecarsT, DepositT, DepositStoreT, Eth1DataT, + ExecutionPayloadT, ExecutionPayloadHeaderT, ForkDataT, SlashingInfoT, + SlotDataT, ]{ cfg: cfg, logger: logger, - bsb: bsb, + sb: sb, chainSpec: chainSpec, signer: signer, stateProcessor: stateProcessor, @@ -158,9 +139,8 @@ func NewService[ localPayloadBuilder: localPayloadBuilder, remotePayloadBuilders: remotePayloadBuilders, metrics: newValidatorMetrics(ts), - blkBroker: blkBroker, - sidecarBroker: sidecarBroker, - newSlotSub: newSlotSub, + dispatcher: dispatcher, + subNewSlot: make(chan async1.Event[SlotDataT]), } } @@ -171,63 +151,65 @@ func (s *Service[ return "validator" } -// Start starts the service. +// Start listens for NewSlot events and builds a block and sidecars for the +// requested slot data. func (s *Service[ - _, _, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, _, _, _, SlotDataT, ]) Start( ctx context.Context, ) error { - go s.start(ctx) + // subscribe to new slot events + err := s.dispatcher.Subscribe(async1.NewSlot, s.subNewSlot) + if err != nil { + return err + } + // set the handler for new slot events + go s.eventLoop(ctx) return nil } -// start starts the service. -func (s *Service[ - _, _, _, _, _, _, _, _, _, _, _, _, _, -]) start( +func (s *Service[_, _, _, _, _, _, _, _, _, _, _, _, SlotDataT]) eventLoop( ctx context.Context, ) { for { select { case <-ctx.Done(): return - case req := <-s.newSlotSub: - if req.Type() == events.NewSlot { - s.handleNewSlot(req) - } + case event := <-s.subNewSlot: + s.handleNewSlot(event) } } } -// handleBlockRequest handles a block request. +// handleNewSlot builds a block and sidecars for the requested +// slot data and emits an event containing the built block and sidecars. func (s *Service[ - _, _, _, _, _, _, _, _, _, _, _, _, SlotDataT, -]) handleNewSlot(msg *asynctypes.Event[SlotDataT]) { - blk, sidecars, err := s.buildBlockAndSidecars( - msg.Context(), msg.Data(), + _, BeaconBlockT, _, _, BlobSidecarsT, _, _, _, _, _, _, _, SlotDataT, +]) handleNewSlot(req async1.Event[SlotDataT]) { + var ( + blk BeaconBlockT + sidecars BlobSidecarsT + err error + ) + // build the block and sidecars for the requested slot data + blk, sidecars, err = s.buildBlockAndSidecars( + req.Context(), req.Data(), ) if err != nil { s.logger.Error("failed to build block", "err", err) } - // Publish our built block to the broker. - if blkErr := s.blkBroker.Publish( - msg.Context(), - asynctypes.NewEvent( - msg.Context(), events.BeaconBlockBuilt, blk, err, - )); blkErr != nil { - // Propagate the error from buildBlockAndSidecars - s.logger.Error("failed to publish block", "err", err) + // emit a built block event with the built block and the error + if bbErr := s.dispatcher.Publish( + async1.NewEvent(req.Context(), async1.BuiltBeaconBlock, blk, err), + ); bbErr != nil { + s.logger.Error("failed to dispatch built block", "err", err) } - // Publish our built blobs to the broker. - if sidecarsErr := s.sidecarBroker.Publish( - msg.Context(), - asynctypes.NewEvent( - // Propagate the error from buildBlockAndSidecars - msg.Context(), events.BlobSidecarsBuilt, sidecars, err, - ), - ); sidecarsErr != nil { - s.logger.Error("failed to publish sidecars", "err", err) + // emit a built sidecars event with the built sidecars and the error + if scErr := s.dispatcher.Publish( + async1.NewEvent(req.Context(), async1.BuiltSidecars, sidecars, err), + ); scErr != nil { + s.logger.Error("failed to dispatch built sidecars", "err", err) } } diff --git a/mod/beacon/validator/types.go b/mod/beacon/validator/types.go index 9abc0a8344..3bde23c522 100644 --- a/mod/beacon/validator/types.go +++ b/mod/beacon/validator/types.go @@ -35,15 +35,8 @@ import ( // BeaconBlock represents a beacon block interface. type BeaconBlock[ - AttestationDataT any, - BeaconBlockT any, - BeaconBlockBodyT BeaconBlockBody[ - AttestationDataT, DepositT, Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ], - DepositT, - Eth1DataT, - ExecutionPayloadT, - SlashingInfoT any, + T any, + BeaconBlockBodyT any, ] interface { constraints.SSZMarshallable // NewWithVersion creates a new beacon block with the given parameters. @@ -52,7 +45,7 @@ type BeaconBlock[ proposerIndex math.ValidatorIndex, parentBlockRoot common.Root, forkVersion uint32, - ) (BeaconBlockT, error) + ) (T, error) // GetSlot returns the slot of the beacon block. GetSlot() math.Slot // GetParentBlockRoot returns the parent block root of the beacon block. @@ -114,19 +107,8 @@ type BeaconState[ExecutionPayloadHeaderT any] interface { // BlobFactory represents a blob factory interface. type BlobFactory[ - AttestationDataT any, - BeaconBlockT BeaconBlock[ - AttestationDataT, BeaconBlockT, BeaconBlockBodyT, DepositT, - Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ], - BeaconBlockBodyT BeaconBlockBody[ - AttestationDataT, DepositT, Eth1DataT, ExecutionPayloadT, SlashingInfoT, - ], - BlobSidecarsT, - DepositT, - Eth1DataT, - ExecutionPayloadT, - SlashingInfoT any, + BeaconBlockT any, + BlobSidecarsT any, ] interface { // BuildSidecars builds sidecars for a given block and blobs bundle. BuildSidecars( @@ -164,9 +146,6 @@ type ExecutionPayloadHeader interface { GetParentHash() common.ExecutionHash } -// EventSubscription represents the event subscription interface. -type EventSubscription[T any] chan T - // EventPublisher represents the event publisher interface. type EventPublisher[T any] interface { // PublishEvent publishes an event. @@ -222,8 +201,8 @@ type SlotData[AttestationDataT, SlashingInfoT any] interface { // StateProcessor defines the interface for processing the state. type StateProcessor[ BeaconBlockT any, - BeaconStateT BeaconState[ExecutionPayloadHeaderT], - ContextT, + BeaconStateT any, + ContextT any, ExecutionPayloadHeaderT any, ] interface { // ProcessSlot processes the slot. @@ -240,10 +219,8 @@ type StateProcessor[ // StorageBackend is the interface for the storage backend. type StorageBackend[ - BeaconStateT BeaconState[ExecutionPayloadHeaderT], - DepositT any, - DepositStoreT DepositStore[DepositT], - ExecutionPayloadHeaderT any, + BeaconStateT any, + DepositStoreT any, ] interface { // DepositStore retrieves the deposit store. DepositStore() DepositStoreT diff --git a/mod/cli/go.mod b/mod/cli/go.mod index 75bf8f398e..e2242d66fc 100644 --- a/mod/cli/go.mod +++ b/mod/cli/go.mod @@ -13,7 +13,7 @@ replace ( require ( cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 cosmossdk.io/depinject v1.0.0 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/tools/confix v0.1.1 github.com/berachain/beacon-kit/mod/config v0.0.0-20240705193247-d464364483df github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb22fd018 @@ -116,7 +116,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect @@ -238,7 +238,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect diff --git a/mod/cli/go.sum b/mod/cli/go.sum index 90d74ea3b5..f43d387f5e 100644 --- a/mod/cli/go.sum +++ b/mod/cli/go.sum @@ -16,8 +16,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -192,8 +192,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -797,8 +797,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/mod/config/go.mod b/mod/config/go.mod index 39d912e860..6694c81a34 100644 --- a/mod/config/go.mod +++ b/mod/config/go.mod @@ -47,7 +47,7 @@ require ( // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.13.0 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect @@ -120,7 +120,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect google.golang.org/grpc v1.65.0 // indirect diff --git a/mod/config/go.sum b/mod/config/go.sum index 1487ce884b..e77554f8b1 100644 --- a/mod/config/go.sum +++ b/mod/config/go.sum @@ -78,8 +78,8 @@ github.com/consensys/gnark-crypto v0.13.0 h1:VPULb/v6bbYELAPTDFINEVaMTTybV5GLxDd github.com/consensys/gnark-crypto v0.13.0/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o= github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg= @@ -383,8 +383,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/consensus-types/go.mod b/mod/consensus-types/go.mod index f106a6de36..ff7f2ce20d 100644 --- a/mod/consensus-types/go.mod +++ b/mod/consensus-types/go.mod @@ -84,7 +84,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/consensus-types/go.sum b/mod/consensus-types/go.sum index 4de37aac97..76654177e1 100644 --- a/mod/consensus-types/go.sum +++ b/mod/consensus-types/go.sum @@ -262,8 +262,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/consensus/go.mod b/mod/consensus/go.mod index ee017d808e..99976db31b 100644 --- a/mod/consensus/go.mod +++ b/mod/consensus/go.mod @@ -13,7 +13,7 @@ require ( github.com/cometbft/cometbft v1.0.0-rc1.0.20240806094948-2c4293ef36c4 github.com/cometbft/cometbft/api v1.0.0-rc.1.0.20240806094948-2c4293ef36c4 github.com/cosmos/cosmos-sdk v0.53.0 - github.com/cosmos/gogoproto v1.5.0 + github.com/cosmos/gogoproto v1.7.0 ) require ( @@ -24,7 +24,7 @@ require ( cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect cosmossdk.io/x/auth v0.0.0-20240806152830-8fb47b368cd4 // indirect @@ -108,7 +108,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect diff --git a/mod/consensus/go.sum b/mod/consensus/go.sum index a760d9cc38..a3ab8f629e 100644 --- a/mod/consensus/go.sum +++ b/mod/consensus/go.sum @@ -13,8 +13,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -111,8 +111,8 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -519,8 +519,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/mod/da/go.mod b/mod/da/go.mod index b93ee78664..db56e9b1ce 100644 --- a/mod/da/go.mod +++ b/mod/da/go.mod @@ -3,13 +3,13 @@ module github.com/berachain/beacon-kit/mod/da go 1.23.0 require ( - github.com/berachain/beacon-kit/mod/async v0.0.0-20240624003607-df94860f8eeb + github.com/berachain/beacon-kit/mod/async v0.0.0-20240807213340-5779c7a563cd github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240806160829-cde2d1347e7e github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 - github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df - github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44 - github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 + github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 + github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 github.com/crate-crypto/go-kzg-4844 v1.1.0 github.com/ethereum/c-kzg-4844 v1.0.3 github.com/karalabe/ssz v0.2.1-0.20240724074312-3d1ff7a6f7c4 @@ -99,7 +99,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect google.golang.org/grpc v1.65.0 // indirect diff --git a/mod/da/go.sum b/mod/da/go.sum index cc39ed02fa..2ebe6f40a2 100644 --- a/mod/da/go.sum +++ b/mod/da/go.sum @@ -8,8 +8,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/berachain/beacon-kit/mod/async v0.0.0-20240624003607-df94860f8eeb h1:4N/wng6MC9Kz5O7diKcJI/k7gnP0o/5hPu+cYZIJpCc= -github.com/berachain/beacon-kit/mod/async v0.0.0-20240624003607-df94860f8eeb/go.mod h1:ycwqumRG49gb8qg87cc6kVgPeiUDaFMajjLko54Ey+I= +github.com/berachain/beacon-kit/mod/async v0.0.0-20240807213340-5779c7a563cd h1:+HMz6OXQmWoWnzJRMS9gPOOaAWJ9aXScDc9MU+BupPM= +github.com/berachain/beacon-kit/mod/async v0.0.0-20240807213340-5779c7a563cd/go.mod h1:MNNFLsraZnkZZpm1Cl42Mxnwwql+BWHinn+r6+DrASQ= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df h1:mnD1LKqDQ0n+OFdDqOuvKaEiUKRJzsO4V0wyyn/gJYg= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df/go.mod h1:bTFB4Rdvm7D/WdwPYkqQ+8T0XOMBv0pzXfp1E46BFX8= github.com/berachain/beacon-kit/mod/config v0.0.0-20240705193247-d464364483df h1:I0qrcOnLkWjruhCWJMY04Cc9KT78WaY4aXCIoUj9+V4= @@ -18,14 +18,14 @@ github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240806160829-cde2d1 github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:ZU1bq1BMt6b0kPRAw+A3kP7FlSd5DSQNYePD5qL9zfQ= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 h1:wVWkiiERY/7kaXvE/VNPPUtYp/l8ky6QSuKM3ThVMXU= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:LiOiqrJhhLH/GPo0XE5fel3EYyi7X6dwBOyTqZakTeQ= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df h1:6MJllcmMFt6dtvftM5zmdl1WVDpqZkNy3hFXVZtNV0s= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df/go.mod h1:yRD7rmnyaaqgq/6+eIVqvSkFJXuLXpBddUu59HUOrtc= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 h1:kCSrkb/uVXfMKJPKjf0c7nlJkwn5cNwMxtzRW4zNq2A= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0/go.mod h1:og0jtHZosPDTyhge9tMBlRItoZ4Iv3aZFM9n4QDpcdo= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e h1:0/FDBXtagMkpta/f4J2uAah2NM1G+0dqxngzMzrmbw4= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:7/SXz8S5VpFl2thcKuBdu1OId+SgI1o4N+S1FB92Zw8= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44 h1:R4+mGOZDYA93rD4AUbYq4fSWmRsJhnlB/ww1ap09WOY= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44/go.mod h1:xP5KcG56VfbPgz2ZRHerxm90MkjXMSDaGZNOOO5yfH4= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd h1:DYSjsq80Omqqlt+z2VcYsSxjZpLqCDRz7CvUDBrLDJE= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd/go.mod h1:BilVBmqKhC4GXYCaIs8QnKaR14kpn3YmF5uYBdayF9I= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= @@ -297,8 +297,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/da/pkg/da/service.go b/mod/da/pkg/da/service.go index 3b0a7c5565..61029db397 100644 --- a/mod/da/pkg/da/service.go +++ b/mod/da/pkg/da/service.go @@ -23,20 +23,28 @@ package da import ( "context" - "github.com/berachain/beacon-kit/mod/async/pkg/broker" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + async "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" + async1 "github.com/berachain/beacon-kit/mod/primitives/pkg/async" ) +// The Data Availability service is responsible for verifying and processing +// incoming blob sidecars. +// + type Service[ AvailabilityStoreT any, BlobSidecarsT BlobSidecar, ] struct { - avs AvailabilityStoreT - bp BlobProcessor[AvailabilityStoreT, BlobSidecarsT] - sidecarsBroker *broker.Broker[*asynctypes.Event[BlobSidecarsT]] - logger log.Logger[any] + avs AvailabilityStoreT + bp BlobProcessor[ + AvailabilityStoreT, + BlobSidecarsT, + ] + dispatcher async.EventDispatcher + logger log.Logger[any] + subSidecarsReceived chan async1.Event[BlobSidecarsT] + subFinalBlobSidecars chan async1.Event[BlobSidecarsT] } // NewService returns a new DA service. @@ -45,15 +53,23 @@ func NewService[ BlobSidecarsT BlobSidecar, ]( avs AvailabilityStoreT, - bp BlobProcessor[AvailabilityStoreT, BlobSidecarsT], - sidecarsBroker *broker.Broker[*asynctypes.Event[BlobSidecarsT]], + bp BlobProcessor[ + AvailabilityStoreT, BlobSidecarsT, + ], + dispatcher async.EventDispatcher, logger log.Logger[any], -) *Service[AvailabilityStoreT, BlobSidecarsT] { - return &Service[AvailabilityStoreT, BlobSidecarsT]{ - avs: avs, - bp: bp, - sidecarsBroker: sidecarsBroker, - logger: logger, +) *Service[ + AvailabilityStoreT, BlobSidecarsT, +] { + return &Service[ + AvailabilityStoreT, BlobSidecarsT, + ]{ + avs: avs, + bp: bp, + dispatcher: dispatcher, + logger: logger, + subSidecarsReceived: make(chan async1.Event[BlobSidecarsT]), + subFinalBlobSidecars: make(chan async1.Event[BlobSidecarsT]), } } @@ -62,91 +78,91 @@ func (s *Service[_, _]) Name() string { return "da" } -// Start starts the service. -func (s *Service[_, _]) Start(ctx context.Context) error { - subSidecarsCh, err := s.sidecarsBroker.Subscribe() - if err != nil { +// Start registers this service as the recipient of ProcessSidecars and +// VerifySidecars messages, and begins listening for these requests. +func (s *Service[_, BlobSidecarsT]) Start(ctx context.Context) error { + var err error + + // subscribe to SidecarsReceived events + if err = s.dispatcher.Subscribe( + async1.SidecarsReceived, s.subSidecarsReceived, + ); err != nil { + return err + } + + // subscribe to FinalSidecarsReceived events + if err = s.dispatcher.Subscribe( + async1.FinalSidecarsReceived, s.subFinalBlobSidecars, + ); err != nil { return err } - go s.start(ctx, subSidecarsCh) + + // listen for events and handle accordingly + go s.eventLoop(ctx) return nil } -// start starts the service. -func (s *Service[_, BlobSidecarsT]) start( - ctx context.Context, - sidecarsCh chan *asynctypes.Event[BlobSidecarsT], -) { +func (s *Service[_, BlobSidecarsT]) eventLoop(ctx context.Context) { for { select { case <-ctx.Done(): return - case msg := <-sidecarsCh: - switch msg.Type() { - case events.BlobSidecarsProcessRequest: - s.handleBlobSidecarsProcessRequest(msg) - case events.BlobSidecarsReceived: - s.handleBlobSidecarsReceived(msg) - } + case event := <-s.subSidecarsReceived: + s.handleSidecarsReceived(event) + case event := <-s.subFinalBlobSidecars: + s.handleFinalSidecarsReceived(event) } } } -// handleBlobSidecarsProcessRequest handles the BlobSidecarsProcessRequest +/* -------------------------------------------------------------------------- */ +/* Event Handlers */ +/* -------------------------------------------------------------------------- */ + +// handleFinalSidecarsReceived handles the BlobSidecarsProcessRequest // event. // It processes the sidecars and publishes a BlobSidecarsProcessed event. -func (s *Service[_, BlobSidecarsT]) handleBlobSidecarsProcessRequest( - msg *asynctypes.Event[BlobSidecarsT], +func (s *Service[_, BlobSidecarsT]) handleFinalSidecarsReceived( + msg async1.Event[BlobSidecarsT], ) { - err := s.processSidecars(msg.Context(), msg.Data()) - if err != nil { + if err := s.processSidecars(msg.Context(), msg.Data()); err != nil { s.logger.Error( "Failed to process blob sidecars", "error", err, ) } - - if err = s.sidecarsBroker.Publish( - msg.Context(), - asynctypes.NewEvent( - msg.Context(), events.BlobSidecarsProcessed, msg.Data(), err, - )); err != nil { - s.logger.Error( - "Failed to publish blob sidecars processed event", - "error", - err, - ) - } } -// handleBlobSidecarsReceived handles the BlobSidecarsReceived event. -// It receives the sidecars and publishes a BlobSidecarsProcessed event. -func (s *Service[_, BlobSidecarsT]) handleBlobSidecarsReceived( - msg *asynctypes.Event[BlobSidecarsT], +// handleSidecarsReceived handles the SidecarsVerifyRequest event. +// It verifies the sidecars and publishes a SidecarsVerified event. +func (s *Service[_, BlobSidecarsT]) handleSidecarsReceived( + msg async1.Event[BlobSidecarsT], ) { - err := s.receiveSidecars(msg.Data()) - if err != nil { + var sidecarsErr error + // verify the sidecars. + if sidecarsErr = s.verifySidecars(msg.Data()); sidecarsErr != nil { s.logger.Error( "Failed to receive blob sidecars", "error", - err, + sidecarsErr, ) } - if err = s.sidecarsBroker.Publish( - msg.Context(), - asynctypes.NewEvent( - msg.Context(), events.BlobSidecarsProcessed, msg.Data(), err, - )); err != nil { - s.logger.Error( - "Failed to publish blob sidecars processed event", - "error", - err, - ) + // emit the sidecars verification event with error from verifySidecars + if err := s.dispatcher.Publish( + async1.NewEvent( + msg.Context(), async1.SidecarsVerified, msg.Data(), sidecarsErr, + ), + ); err != nil { + s.logger.Error("failed to publish event", "err", err) } } +/* -------------------------------------------------------------------------- */ +/* helpers */ +/* -------------------------------------------------------------------------- */ + // ProcessSidecars processes the blob sidecars. func (s *Service[_, BlobSidecarsT]) processSidecars( _ context.Context, @@ -161,7 +177,7 @@ func (s *Service[_, BlobSidecarsT]) processSidecars( } // VerifyIncomingBlobs receives blobs from the network and processes them. -func (s *Service[_, BlobSidecarsT]) receiveSidecars( +func (s *Service[_, BlobSidecarsT]) verifySidecars( sidecars BlobSidecarsT, ) error { // If there are no blobs to verify, return early. diff --git a/mod/da/pkg/store/pruner.go b/mod/da/pkg/store/pruner.go index aa6614d26c..a88a0a298e 100644 --- a/mod/da/pkg/store/pruner.go +++ b/mod/da/pkg/store/pruner.go @@ -21,14 +21,14 @@ package store import ( - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" ) func BuildPruneRangeFn[BeaconBlockT BeaconBlock]( cs common.ChainSpec, -) func(*asynctypes.Event[BeaconBlockT]) (uint64, uint64) { - return func(event *asynctypes.Event[BeaconBlockT]) (uint64, uint64) { +) func(async.Event[BeaconBlockT]) (uint64, uint64) { + return func(event async.Event[BeaconBlockT]) (uint64, uint64) { window := cs.MinEpochsForBlobsSidecarsRequest() * cs.SlotsPerEpoch() if event.Data().GetSlot().Unwrap() < window { return 0, 0 diff --git a/mod/da/pkg/store/pruner_test.go b/mod/da/pkg/store/pruner_test.go index b61b6eb5d0..6b3b12ee56 100644 --- a/mod/da/pkg/store/pruner_test.go +++ b/mod/da/pkg/store/pruner_test.go @@ -24,9 +24,9 @@ import ( "context" "testing" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/chain-spec/pkg/chain" "github.com/berachain/beacon-kit/mod/da/pkg/store" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/bytes" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" @@ -118,9 +118,9 @@ func TestBuildPruneRangeFn(t *testing.T) { pruneFn := store.BuildPruneRangeFn[MockBeaconBlock]( cs, ) - event := asynctypes.NewEvent[MockBeaconBlock]( + event := async.NewEvent[MockBeaconBlock]( context.Background(), - asynctypes.EventID("mock"), + async.EventID("mock"), MockBeaconBlock{ slot: tt.eventSlot, }, diff --git a/mod/engine-primitives/go.mod b/mod/engine-primitives/go.mod index 0c471cf6ee..aebf386cf0 100644 --- a/mod/engine-primitives/go.mod +++ b/mod/engine-primitives/go.mod @@ -78,7 +78,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/engine-primitives/go.sum b/mod/engine-primitives/go.sum index b53ded7107..f47e7aaafb 100644 --- a/mod/engine-primitives/go.sum +++ b/mod/engine-primitives/go.sum @@ -260,8 +260,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/execution/go.mod b/mod/execution/go.mod index bad681ff93..5b11335528 100644 --- a/mod/execution/go.mod +++ b/mod/execution/go.mod @@ -5,10 +5,10 @@ go 1.23.0 require ( github.com/berachain/beacon-kit/mod/async v0.0.0-20240624204855-d8809d5c8588 github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 - github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd + github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e - github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c - github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 + github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 github.com/ethereum/go-ethereum v1.14.7 ) @@ -82,7 +82,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/execution/go.sum b/mod/execution/go.sum index e1a2ae0eb5..24d0f62635 100644 --- a/mod/execution/go.sum +++ b/mod/execution/go.sum @@ -14,14 +14,14 @@ github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240703145037-b5612ab256d github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240703145037-b5612ab256db/go.mod h1:rbvfJqTKUIckels2AlWy+XuG+UGnegoFQuHC+TUg+zA= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 h1:wVWkiiERY/7kaXvE/VNPPUtYp/l8ky6QSuKM3ThVMXU= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:LiOiqrJhhLH/GPo0XE5fel3EYyi7X6dwBOyTqZakTeQ= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd h1:jD/ggR959ZX+lqxsMzoRJzrGvFK7PI6UmgnRwOTh4S4= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:iXa+Q+i0q+GCpLzkusulO57K5vlkDgM77jtfMr3QdFA= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 h1:kCSrkb/uVXfMKJPKjf0c7nlJkwn5cNwMxtzRW4zNq2A= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0/go.mod h1:og0jtHZosPDTyhge9tMBlRItoZ4Iv3aZFM9n4QDpcdo= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e h1:0/FDBXtagMkpta/f4J2uAah2NM1G+0dqxngzMzrmbw4= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:7/SXz8S5VpFl2thcKuBdu1OId+SgI1o4N+S1FB92Zw8= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c h1:7f9dLYGOCMoV7LxT6YRmVSWLTPbGTTcxDPLPLvHGrOk= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c/go.mod h1:nFybcw/ZhJ6Gu66dna301W2I7u61skm2HfHxQmdR68Q= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd h1:DYSjsq80Omqqlt+z2VcYsSxjZpLqCDRz7CvUDBrLDJE= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd/go.mod h1:BilVBmqKhC4GXYCaIs8QnKaR14kpn3YmF5uYBdayF9I= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= @@ -307,8 +307,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/execution/pkg/deposit/pruner.go b/mod/execution/pkg/deposit/pruner.go index ca5aeecb34..c0bc068864 100644 --- a/mod/execution/pkg/deposit/pruner.go +++ b/mod/execution/pkg/deposit/pruner.go @@ -21,7 +21,7 @@ package deposit import ( - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -33,8 +33,8 @@ func BuildPruneRangeFn[ }, DepositT Deposit[DepositT, WithdrawalCredentialsT], WithdrawalCredentialsT any, -](cs common.ChainSpec) func(*asynctypes.Event[BeaconBlockT]) (uint64, uint64) { - return func(event *asynctypes.Event[BeaconBlockT]) (uint64, uint64) { +](cs common.ChainSpec) func(async.Event[BeaconBlockT]) (uint64, uint64) { + return func(event async.Event[BeaconBlockT]) (uint64, uint64) { deposits := event.Data().GetBody().GetDeposits() if len(deposits) == 0 || cs.MaxDepositsPerBlock() == 0 { return 0, 0 diff --git a/mod/execution/pkg/deposit/service.go b/mod/execution/pkg/deposit/service.go index 0fe73fa009..934b5716a6 100644 --- a/mod/execution/pkg/deposit/service.go +++ b/mod/execution/pkg/deposit/service.go @@ -23,8 +23,9 @@ package deposit import ( "context" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + async "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" + async1 "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -44,8 +45,10 @@ type Service[ dc Contract[DepositT] // ds is the deposit store that stores deposits. ds Store[DepositT] - // feed is the block feed that provides block events. - feed chan *asynctypes.Event[BeaconBlockT] + // dispatcher is the dispatcher for the service. + dispatcher async.EventDispatcher + // subFinalizedBlockEvents is the channel that provides finalized block events. + subFinalizedBlockEvents chan async1.Event[BeaconBlockT] // metrics is the metrics for the deposit service. metrics *metrics // failedBlocks is a map of blocks that failed to be processed to be @@ -66,7 +69,7 @@ func NewService[ telemetrySink TelemetrySink, ds Store[DepositT], dc Contract[DepositT], - feed chan *asynctypes.Event[BeaconBlockT], + dispatcher async.EventDispatcher, ) *Service[ BeaconBlockT, BeaconBlockBodyT, DepositT, ExecutionPayloadT, WithdrawalCredentialsT, @@ -75,13 +78,14 @@ func NewService[ BeaconBlockT, BeaconBlockBodyT, DepositT, ExecutionPayloadT, WithdrawalCredentialsT, ]{ - feed: feed, - logger: logger, - eth1FollowDistance: eth1FollowDistance, - metrics: newMetrics(telemetrySink), - dc: dc, - ds: ds, - failedBlocks: make(map[math.Slot]struct{}), + dc: dc, + dispatcher: dispatcher, + ds: ds, + eth1FollowDistance: eth1FollowDistance, + failedBlocks: make(map[math.Slot]struct{}), + subFinalizedBlockEvents: make(chan async1.Event[BeaconBlockT]), + logger: logger, + metrics: newMetrics(telemetrySink), } } @@ -89,11 +93,35 @@ func NewService[ func (s *Service[ _, _, _, _, _, ]) Start(ctx context.Context) error { - go s.depositFetcher(ctx) + if err := s.dispatcher.Subscribe( + async1.BeaconBlockFinalizedEvent, s.subFinalizedBlockEvents, + ); err != nil { + s.logger.Error("failed to subscribe to event", "event", + async1.BeaconBlockFinalizedEvent, "err", err) + return err + } + + // Listen for finalized block events and fetch deposits for the block. + go s.eventLoop(ctx) + + // Catchup deposits for failed blocks. go s.depositCatchupFetcher(ctx) return nil } +func (s *Service[ + _, _, _, _, _, +]) eventLoop(ctx context.Context) { + for { + select { + case <-ctx.Done(): + return + case event := <-s.subFinalizedBlockEvents: + s.depositFetcher(ctx, event) + } + } +} + // Name returns the name of the service. func (s *Service[ _, _, _, _, _, diff --git a/mod/execution/pkg/deposit/sync.go b/mod/execution/pkg/deposit/sync.go index 1dd4dee228..f87281016f 100644 --- a/mod/execution/pkg/deposit/sync.go +++ b/mod/execution/pkg/deposit/sync.go @@ -24,29 +24,20 @@ import ( "context" "time" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) // defaultRetryInterval processes a deposit event. const defaultRetryInterval = 20 * time.Second -// depositFetcher processes a deposit event. +// depositFetcher returns a function that retrieves the block number from the +// event and fetches and stores the deposits for that block. func (s *Service[ - _, _, _, _, _, -]) depositFetcher(ctx context.Context) { - for { - select { - case <-ctx.Done(): - return - case msg := <-s.feed: - if msg.Is(events.BeaconBlockFinalized) { - blockNum := msg.Data(). - GetBody().GetExecutionPayload().GetNumber() - s.fetchAndStoreDeposits(ctx, blockNum-s.eth1FollowDistance) - } - } - } + BeaconBlockT, _, _, _, _, +]) depositFetcher(ctx context.Context, event async.Event[BeaconBlockT]) { + blockNum := event.Data().GetBody().GetExecutionPayload().GetNumber() + s.fetchAndStoreDeposits(ctx, blockNum-s.eth1FollowDistance) } // depositCatchupFetcher fetches deposits for blocks that failed to be diff --git a/mod/execution/pkg/deposit/types.go b/mod/execution/pkg/deposit/types.go index 36a5cde11e..6988aef84c 100644 --- a/mod/execution/pkg/deposit/types.go +++ b/mod/execution/pkg/deposit/types.go @@ -23,6 +23,7 @@ package deposit import ( "context" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -41,6 +42,19 @@ type BeaconBlock[BeaconBlockBodyT any] interface { GetBody() BeaconBlockBodyT } +// BlockEvent is an interface for block events. +type BlockEvent[ + DepositT any, + BeaconBlockBodyT BeaconBlockBody[DepositT, ExecutionPayloadT], + BeaconBlockT BeaconBlock[BeaconBlockBodyT], + ExecutionPayloadT ExecutionPayload, +] interface { + ID() async.EventID + Is(async.EventID) bool + Data() BeaconBlockT + Context() context.Context +} + // ExecutionPayload is an interface for execution payloads. type ExecutionPayload interface { GetNumber() math.U64 diff --git a/mod/execution/pkg/engine/engine.go b/mod/execution/pkg/engine/engine.go index 0ca4e71711..8e5144e01f 100644 --- a/mod/execution/pkg/engine/engine.go +++ b/mod/execution/pkg/engine/engine.go @@ -24,8 +24,6 @@ import ( "bytes" "context" - broker "github.com/berachain/beacon-kit/mod/async/pkg/broker" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" engineprimitives "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/engine-primitives" engineerrors "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/errors" "github.com/berachain/beacon-kit/mod/errors" @@ -33,7 +31,6 @@ import ( "github.com/berachain/beacon-kit/mod/log" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" jsonrpc "github.com/berachain/beacon-kit/mod/primitives/pkg/net/json-rpc" - "github.com/berachain/beacon-kit/mod/primitives/pkg/service" ) // Engine is Beacon-Kit's implementation of the `ExecutionEngine` @@ -54,8 +51,6 @@ type Engine[ logger log.Logger[any] // metrics is the metrics for the engine. metrics *engineMetrics - // statusPublisher is the status publishder for the engine. - statusPublisher *broker.Broker[*asynctypes.Event[*service.StatusEvent]] } // New creates a new Engine. @@ -68,9 +63,8 @@ func New[ EncodeIndex(int, *bytes.Buffer) }, ]( - ec *client.EngineClient[ExecutionPayloadT, PayloadAttributesT], + engineClient *client.EngineClient[ExecutionPayloadT, PayloadAttributesT], logger log.Logger[any], - statusPublisher *broker.Broker[*asynctypes.Event[*service.StatusEvent]], telemtrySink TelemetrySink, ) *Engine[ ExecutionPayloadT, PayloadAttributesT, @@ -80,10 +74,9 @@ func New[ ExecutionPayloadT, PayloadAttributesT, PayloadIDT, WithdrawalsT, ]{ - ec: ec, - logger: logger, - metrics: newEngineMetrics(telemtrySink, logger), - statusPublisher: statusPublisher, + ec: engineClient, + logger: logger, + metrics: newEngineMetrics(telemtrySink, logger), } } diff --git a/mod/geth-primitives/go.mod b/mod/geth-primitives/go.mod index 03a0f0fbeb..4f62a20e12 100644 --- a/mod/geth-primitives/go.mod +++ b/mod/geth-primitives/go.mod @@ -73,7 +73,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect rsc.io/tmplfunc v0.0.3 // indirect diff --git a/mod/geth-primitives/go.sum b/mod/geth-primitives/go.sum index 490dee28c5..8e226cbdb6 100644 --- a/mod/geth-primitives/go.sum +++ b/mod/geth-primitives/go.sum @@ -271,8 +271,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/node-api/backend/mocks/beacon_state.mock.go b/mod/node-api/backend/mocks/beacon_state.mock.go index eeab5dbbc5..192810cb5f 100644 --- a/mod/node-api/backend/mocks/beacon_state.mock.go +++ b/mod/node-api/backend/mocks/beacon_state.mock.go @@ -3,9 +3,7 @@ package mocks import ( - backend "github.com/berachain/beacon-kit/mod/node-api/backend" bytes "github.com/berachain/beacon-kit/mod/primitives/pkg/bytes" - common "github.com/berachain/beacon-kit/mod/primitives/pkg/common" math "github.com/berachain/beacon-kit/mod/primitives/pkg/math" @@ -14,11 +12,11 @@ import ( ) // BeaconState is an autogenerated mock type for the BeaconState type -type BeaconState[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { mock.Mock } -type BeaconState_Expecter[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_Expecter[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { mock *mock.Mock } @@ -57,7 +55,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_ExpectedWithdrawals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExpectedWithdrawals' -type BeaconState_ExpectedWithdrawals_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ExpectedWithdrawals_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -112,7 +110,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBalance' -type BeaconState_GetBalance_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetBalance_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -170,7 +168,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetBlockRootAtIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlockRootAtIndex' -type BeaconState_GetBlockRootAtIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetBlockRootAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -226,7 +224,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetEth1Data_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEth1Data' -type BeaconState_GetEth1Data_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetEth1Data_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -281,7 +279,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetEth1DepositIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEth1DepositIndex' -type BeaconState_GetEth1DepositIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetEth1DepositIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -336,7 +334,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetFork_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFork' -type BeaconState_GetFork_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetFork_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -393,7 +391,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetGenesisValidatorsRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGenesisValidatorsRoot' -type BeaconState_GetGenesisValidatorsRoot_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetGenesisValidatorsRoot_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -448,7 +446,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetLatestBlockHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestBlockHeader' -type BeaconState_GetLatestBlockHeader_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetLatestBlockHeader_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -503,7 +501,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetLatestExecutionPayloadHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestExecutionPayloadHeader' -type BeaconState_GetLatestExecutionPayloadHeader_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetLatestExecutionPayloadHeader_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -558,7 +556,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetNextWithdrawalIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNextWithdrawalIndex' -type BeaconState_GetNextWithdrawalIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetNextWithdrawalIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -613,7 +611,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetNextWithdrawalValidatorIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNextWithdrawalValidatorIndex' -type BeaconState_GetNextWithdrawalValidatorIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetNextWithdrawalValidatorIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -670,7 +668,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetRandaoMixAtIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRandaoMixAtIndex' -type BeaconState_GetRandaoMixAtIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetRandaoMixAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -726,7 +724,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetSlashingAtIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlashingAtIndex' -type BeaconState_GetSlashingAtIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetSlashingAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -782,7 +780,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetSlot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlot' -type BeaconState_GetSlot_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetSlot_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -837,7 +835,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetTotalActiveBalances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTotalActiveBalances' -type BeaconState_GetTotalActiveBalances_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetTotalActiveBalances_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -893,7 +891,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetTotalSlashing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTotalSlashing' -type BeaconState_GetTotalSlashing_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetTotalSlashing_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -948,7 +946,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetTotalValidators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTotalValidators' -type BeaconState_GetTotalValidators_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetTotalValidators_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1003,7 +1001,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetValidators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValidators' -type BeaconState_GetValidators_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetValidators_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1060,7 +1058,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_GetValidatorsByEffectiveBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValidatorsByEffectiveBalance' -type BeaconState_GetValidatorsByEffectiveBalance_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetValidatorsByEffectiveBalance_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1105,7 +1103,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_SetSlot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetSlot' -type BeaconState_SetSlot_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_SetSlot_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1163,7 +1161,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_StateRootAtIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StateRootAtIndex' -type BeaconState_StateRootAtIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_StateRootAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1219,7 +1217,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_ValidatorByIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatorByIndex' -type BeaconState_ValidatorByIndex_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ValidatorByIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1275,7 +1273,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_ValidatorIndexByCometBFTAddress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatorIndexByCometBFTAddress' -type BeaconState_ValidatorIndexByCometBFTAddress_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ValidatorIndexByCometBFTAddress_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1331,7 +1329,7 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo } // BeaconState_ValidatorIndexByPubkey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatorIndexByPubkey' -type BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1360,7 +1358,7 @@ func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, // NewBeaconState creates a new instance of BeaconState. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. -func NewBeaconState[BeaconBlockHeaderT backend.BeaconBlockHeader[BeaconBlockHeaderT], Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}](t interface { +func NewBeaconState[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}](t interface { mock.TestingT Cleanup(func()) }) *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { diff --git a/mod/node-api/backend/types.go b/mod/node-api/backend/types.go index 01d25ff322..0ae940772f 100644 --- a/mod/node-api/backend/types.go +++ b/mod/node-api/backend/types.go @@ -64,9 +64,8 @@ type BeaconBlockHeader[BeaconBlockHeaderT any] interface { // BeaconState is the interface for the beacon state. type BeaconState[ - BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], - Eth1DataT, ExecutionPayloadHeaderT, ForkT, - ValidatorT, ValidatorsT, WithdrawalT any, + BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, WithdrawalT any, ] interface { // SetSlot sets the slot on the beacon state. SetSlot(math.Slot) error diff --git a/mod/node-api/backend/validator.go b/mod/node-api/backend/validator.go index 67755397ca..9efcf61c56 100644 --- a/mod/node-api/backend/validator.go +++ b/mod/node-api/backend/validator.go @@ -55,7 +55,7 @@ func (b Backend[ Index: index.Unwrap(), Balance: balance.Unwrap(), }, - Status: "active", // TODO: fix + Status: "active_ongoing", // TODO: fix Validator: validator, }, nil } diff --git a/mod/node-api/engines/echo/vaildator.go b/mod/node-api/engines/echo/vaildator.go index 6ac9fc64dc..8792cfbacf 100644 --- a/mod/node-api/engines/echo/vaildator.go +++ b/mod/node-api/engines/echo/vaildator.go @@ -32,6 +32,10 @@ import ( "github.com/labstack/echo/v4" ) +// TODO: these validators need to be un-janked to 1) not use `FieldLevel` for +// repeated `.Field().String()` calls and 2) strongly type the allowed IDs, +// putting validation logic on each type. + // CustomValidator is a custom validator for the API. type CustomValidator struct { Validator *validator.Validate diff --git a/mod/node-api/engines/go.mod b/mod/node-api/engines/go.mod index 921772c949..0ea27e4b6b 100644 --- a/mod/node-api/engines/go.mod +++ b/mod/node-api/engines/go.mod @@ -37,7 +37,7 @@ require ( github.com/valyala/fasttemplate v1.2.2 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect ) diff --git a/mod/node-api/engines/go.sum b/mod/node-api/engines/go.sum index e356e4448a..977b185191 100644 --- a/mod/node-api/engines/go.sum +++ b/mod/node-api/engines/go.sum @@ -104,8 +104,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= diff --git a/mod/node-api/go.mod b/mod/node-api/go.mod index 5b93742279..34d69c4916 100644 --- a/mod/node-api/go.mod +++ b/mod/node-api/go.mod @@ -82,7 +82,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/node-api/go.sum b/mod/node-api/go.sum index 391d9e0f39..634b8a44aa 100644 --- a/mod/node-api/go.sum +++ b/mod/node-api/go.sum @@ -270,8 +270,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/node-api/handlers/beacon/historical.go b/mod/node-api/handlers/beacon/historical.go index 44fc21c081..b97e26f55b 100644 --- a/mod/node-api/handlers/beacon/historical.go +++ b/mod/node-api/handlers/beacon/historical.go @@ -47,9 +47,7 @@ func (h *Handler[_, ContextT, _, _]) GetStateRoot(c ContextT) (any, error) { return beacontypes.ValidatorResponse{ ExecutionOptimistic: false, // stubbed Finalized: false, // stubbed - Data: types.Wrap( - beacontypes.RootData{Root: stateRoot}, - ), + Data: beacontypes.RootData{Root: stateRoot}, }, nil } diff --git a/mod/node-api/handlers/handlers.go b/mod/node-api/handlers/handlers.go index 1dce2b18a9..1d5373390d 100644 --- a/mod/node-api/handlers/handlers.go +++ b/mod/node-api/handlers/handlers.go @@ -23,14 +23,13 @@ package handlers import ( "github.com/berachain/beacon-kit/mod/errors" "github.com/berachain/beacon-kit/mod/log" - "github.com/berachain/beacon-kit/mod/node-api/server/context" ) // handlerFn enforces a signature for all handler functions. -type handlerFn[ContextT context.Context] func(c ContextT) (any, error) +type handlerFn[ContextT any] func(c ContextT) (any, error) // Handlers is an interface that all handlers must implement. -type Handlers[ContextT context.Context] interface { +type Handlers[ContextT any] interface { // RegisterRoutes is a method that registers the routes for the handler. RegisterRoutes(logger log.Logger[any]) RouteSet() *RouteSet[ContextT] @@ -38,14 +37,14 @@ type Handlers[ContextT context.Context] interface { // BaseHandler is a base handler for all handlers. It abstracts the route set // and logger from the handler. -type BaseHandler[ContextT context.Context] struct { +type BaseHandler[ContextT any] struct { routes *RouteSet[ContextT] logger log.Logger[any] } // NewBaseHandler initializes a new base handler with the given routes and // logger. -func NewBaseHandler[ContextT context.Context]( +func NewBaseHandler[ContextT any]( routes *RouteSet[ContextT], ) *BaseHandler[ContextT] { return &BaseHandler[ContextT]{ diff --git a/mod/node-api/handlers/node/handler.go b/mod/node-api/handlers/node/handler.go index 0f7c5c91a7..6ad6c29a43 100644 --- a/mod/node-api/handlers/node/handler.go +++ b/mod/node-api/handlers/node/handler.go @@ -31,7 +31,7 @@ type Handler[ContextT context.Context] struct { func NewHandler[ContextT context.Context]() *Handler[ContextT] { h := &Handler[ContextT]{ - BaseHandler: handlers.NewBaseHandler[ContextT]( + BaseHandler: handlers.NewBaseHandler( handlers.NewRouteSet[ContextT](""), ), } diff --git a/mod/node-api/handlers/node/placeholders.go b/mod/node-api/handlers/node/placeholders.go new file mode 100644 index 0000000000..cdc9dca2f3 --- /dev/null +++ b/mod/node-api/handlers/node/placeholders.go @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package node + +// Syncing is a placeholder so that beacon API clients don't break. +// +// TODO: Implement with real data. +func (h *Handler[ContextT]) Syncing(ContextT) (any, error) { + type SyncingResponse struct { + Data struct { + HeadSlot string `json:"head_slot"` + SyncDistance string `json:"sync_distance"` + IsSyncing bool `json:"is_syncing"` + IsOptimistic bool `json:"is_optimistic"` + ELOffline bool `json:"el_offline"` + } `json:"data"` + } + + response := SyncingResponse{} + response.Data.HeadSlot = "0" + response.Data.SyncDistance = "1" + response.Data.IsSyncing = false + response.Data.IsOptimistic = true + response.Data.ELOffline = false + + return response, nil +} + +// Version is a placeholder so that beacon API clients don't break. +// +// TODO: Implement with real data. +func (h *Handler[ContextT]) Version(ContextT) (any, error) { + type VersionResponse struct { + Data struct { + Version string `json:"version"` + } `json:"data"` + } + + response := VersionResponse{} + response.Data.Version = "1.0.0" + + return response, nil +} diff --git a/mod/node-api/handlers/node/routes.go b/mod/node-api/handlers/node/routes.go index 370b2803f4..f0b8dca54a 100644 --- a/mod/node-api/handlers/node/routes.go +++ b/mod/node-api/handlers/node/routes.go @@ -55,12 +55,12 @@ func (h *Handler[ContextT]) RegisterRoutes( { Method: http.MethodGet, Path: "/eth/v1/node/version", - Handler: h.NotImplemented, + Handler: h.Version, }, { Method: http.MethodGet, Path: "/eth/v1/node/syncing", - Handler: h.NotImplemented, + Handler: h.Syncing, }, { Method: http.MethodGet, diff --git a/mod/node-api/handlers/proof/block_proposer.go b/mod/node-api/handlers/proof/block_proposer.go index 431268dc0b..234f521091 100644 --- a/mod/node-api/handlers/proof/block_proposer.go +++ b/mod/node-api/handlers/proof/block_proposer.go @@ -29,7 +29,7 @@ import ( // GetBlockProposer returns the block proposer pubkey for the given block id // along with a merkle proof that can be verified against the beacon block root. func (h *Handler[ - ContextT, BeaconBlockHeaderT, _, _, _, _, + BeaconBlockHeaderT, _, _, ContextT, _, _, ]) GetBlockProposer(c ContextT) (any, error) { params, err := utils.BindAndValidate[types.BlockProposerRequest]( c, h.Logger(), diff --git a/mod/node-api/handlers/proof/execution_fee_recipient.go b/mod/node-api/handlers/proof/execution_fee_recipient.go index 7f6a423632..0617207bb6 100644 --- a/mod/node-api/handlers/proof/execution_fee_recipient.go +++ b/mod/node-api/handlers/proof/execution_fee_recipient.go @@ -30,7 +30,7 @@ import ( // payload header for the given block id, along with the proof that can be // verified against the beacon block root. func (h *Handler[ - ContextT, BeaconBlockHeaderT, _, _, _, _, + BeaconBlockHeaderT, _, _, ContextT, _, _, ]) GetExecutionFeeRecipient(c ContextT) (any, error) { params, err := utils.BindAndValidate[types.ExecutionFeeRecipientRequest]( c, h.Logger(), diff --git a/mod/node-api/handlers/proof/execution_number.go b/mod/node-api/handlers/proof/execution_number.go index c8bda7c495..1fe9e4a8f9 100644 --- a/mod/node-api/handlers/proof/execution_number.go +++ b/mod/node-api/handlers/proof/execution_number.go @@ -30,7 +30,7 @@ import ( // payload header for the given block id, along with the proof that can be // verified against the beacon block root. func (h *Handler[ - ContextT, BeaconBlockHeaderT, _, _, _, _, + BeaconBlockHeaderT, _, _, ContextT, _, _, ]) GetExecutionNumber(c ContextT) (any, error) { params, err := utils.BindAndValidate[types.ExecutionNumberRequest]( c, h.Logger(), diff --git a/mod/node-api/handlers/proof/handler.go b/mod/node-api/handlers/proof/handler.go index 0a28252218..c70eba6e52 100644 --- a/mod/node-api/handlers/proof/handler.go +++ b/mod/node-api/handlers/proof/handler.go @@ -30,12 +30,12 @@ import ( // Handler is the handler for the proof API. type Handler[ - ContextT context.Context, BeaconBlockHeaderT types.BeaconBlockHeader, BeaconStateT types.BeaconState[ BeaconStateMarshallableT, ExecutionPayloadHeaderT, ValidatorT, ], BeaconStateMarshallableT types.BeaconStateMarshallable, + ContextT context.Context, ExecutionPayloadHeaderT types.ExecutionPayloadHeader, ValidatorT types.Validator, ] struct { @@ -45,23 +45,23 @@ type Handler[ // NewHandler creates a new handler for the proof API. func NewHandler[ - ContextT context.Context, BeaconBlockHeaderT types.BeaconBlockHeader, BeaconStateT types.BeaconState[ BeaconStateMarshallableT, ExecutionPayloadHeaderT, ValidatorT, ], BeaconStateMarshallableT types.BeaconStateMarshallable, + ContextT context.Context, ExecutionPayloadHeaderT types.ExecutionPayloadHeader, ValidatorT types.Validator, ]( backend Backend[BeaconBlockHeaderT, BeaconStateT, ValidatorT], ) *Handler[ - ContextT, BeaconBlockHeaderT, BeaconStateT, BeaconStateMarshallableT, - ExecutionPayloadHeaderT, ValidatorT, + BeaconBlockHeaderT, BeaconStateT, BeaconStateMarshallableT, + ContextT, ExecutionPayloadHeaderT, ValidatorT, ] { h := &Handler[ - ContextT, BeaconBlockHeaderT, BeaconStateT, BeaconStateMarshallableT, - ExecutionPayloadHeaderT, ValidatorT, + BeaconBlockHeaderT, BeaconStateT, BeaconStateMarshallableT, + ContextT, ExecutionPayloadHeaderT, ValidatorT, ]{ BaseHandler: handlers.NewBaseHandler( handlers.NewRouteSet[ContextT](""), @@ -74,7 +74,7 @@ func NewHandler[ // Get the slot from the given input of execution id, beacon state, and beacon // block header for the resolved slot. func (h *Handler[ - ContextT, BeaconBlockHeaderT, BeaconStateT, _, _, _, + BeaconBlockHeaderT, BeaconStateT, _, _, _, _, ]) resolveExecutionID(executionID string) ( math.Slot, BeaconStateT, BeaconBlockHeaderT, error, ) { diff --git a/mod/node-api/handlers/proof/routes.go b/mod/node-api/handlers/proof/routes.go index ceea74f5e2..af22df0112 100644 --- a/mod/node-api/handlers/proof/routes.go +++ b/mod/node-api/handlers/proof/routes.go @@ -28,7 +28,7 @@ import ( ) func ( - h *Handler[ContextT, _, _, _, _, _], + h *Handler[_, _, _, ContextT, _, _], ) RegisterRoutes(logger log.Logger[any]) { h.SetLogger(logger) h.BaseHandler.AddRoutes([]*handlers.Route[ContextT]{ diff --git a/mod/node-api/handlers/routes.go b/mod/node-api/handlers/routes.go index 2bae7f833e..54f1dae81c 100644 --- a/mod/node-api/handlers/routes.go +++ b/mod/node-api/handlers/routes.go @@ -22,11 +22,10 @@ package handlers import ( "github.com/berachain/beacon-kit/mod/log" - "github.com/berachain/beacon-kit/mod/node-api/server/context" ) // Route is a route for the node API. -type Route[ContextT context.Context] struct { +type Route[ContextT any] struct { Method string Path string Handler handlerFn[ContextT] @@ -48,13 +47,13 @@ func (r *Route[ContextT]) DecorateWithLogs(logger log.Logger[any]) { } // RouteSet is a set of routes for the node API. -type RouteSet[ContextT context.Context] struct { +type RouteSet[ContextT any] struct { BasePath string Routes []*Route[ContextT] } // NewRouteSet creates a new route set. -func NewRouteSet[ContextT context.Context]( +func NewRouteSet[ContextT any]( basePath string, routes ...*Route[ContextT], ) *RouteSet[ContextT] { return &RouteSet[ContextT]{ diff --git a/mod/node-api/handlers/utils/id.go b/mod/node-api/handlers/utils/id.go index 813da1ae28..eced1532f9 100644 --- a/mod/node-api/handlers/utils/id.go +++ b/mod/node-api/handlers/utils/id.go @@ -28,6 +28,10 @@ import ( "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) +// TODO: define unique types for each of the query-able IDs (state & block from +// spec, execution unique to beacon-kit). For each type define validation +// functions and resolvers to slot number. + // SlotFromStateID returns a slot from the state ID. // // NOTE: Right now, `stateID` only supports querying by "head" (all of "head", diff --git a/mod/node-api/server/server.go b/mod/node-api/server/server.go index 818283cb53..5388e61712 100644 --- a/mod/node-api/server/server.go +++ b/mod/node-api/server/server.go @@ -32,9 +32,8 @@ import ( // Server is the API Server service. type Server[ ContextT apicontext.Context, - EngineT Engine[ContextT, EngineT], ] struct { - engine EngineT + engine Engine[ContextT] config Config logger log.Logger[any] } @@ -44,13 +43,12 @@ type Server[ // disabled. func New[ ContextT apicontext.Context, - EngineT Engine[ContextT, EngineT], ]( config Config, - engine EngineT, + engine Engine[ContextT], logger log.Logger[any], handlers ...handlers.Handlers[ContextT], -) *Server[ContextT, EngineT] { +) *Server[ContextT] { apiLogger := logger if !config.Logging { apiLogger = noop.NewLogger[log.Logger[any]]() @@ -59,7 +57,7 @@ func New[ handler.RegisterRoutes(apiLogger) engine.RegisterRoutes(handler.RouteSet(), apiLogger) } - return &Server[ContextT, EngineT]{ + return &Server[ContextT]{ engine: engine, config: config, logger: logger, @@ -67,7 +65,7 @@ func New[ } // Start starts the API Server at the configured address. -func (s *Server[_, _]) Start(ctx context.Context) error { +func (s *Server[_]) Start(ctx context.Context) error { if !s.config.Enabled { return nil } @@ -75,7 +73,7 @@ func (s *Server[_, _]) Start(ctx context.Context) error { return nil } -func (s *Server[_, _]) start(ctx context.Context) { +func (s *Server[_]) start(ctx context.Context) { errCh := make(chan error) go func() { errCh <- s.engine.Run(s.config.Address) @@ -91,6 +89,6 @@ func (s *Server[_, _]) start(ctx context.Context) { } // Name returns the name of the API server service. -func (s *Server[_, _]) Name() string { +func (s *Server[_]) Name() string { return "node-api-server" } diff --git a/mod/node-api/server/types.go b/mod/node-api/server/types.go index aba01f43df..9ded0f2bb3 100644 --- a/mod/node-api/server/types.go +++ b/mod/node-api/server/types.go @@ -27,7 +27,7 @@ import ( ) // Engine is a generic interface for an API engine. -type Engine[ContextT context.Context, T any] interface { +type Engine[ContextT context.Context] interface { Run(addr string) error RegisterRoutes(*handlers.RouteSet[ContextT], log.Logger[any]) } diff --git a/mod/node-core/go.mod b/mod/node-core/go.mod index 53369fac8b..bc573fb072 100644 --- a/mod/node-core/go.mod +++ b/mod/node-core/go.mod @@ -12,31 +12,30 @@ replace ( require ( cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 cosmossdk.io/depinject v1.0.0 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/store/v2 v2.0.0-20240515130459-16437119e0d8 - github.com/berachain/beacon-kit/mod/beacon v0.0.0-20240718074353-1a991cfeed63 + github.com/berachain/beacon-kit/mod/beacon v0.0.0-20240820191615-398849c34954 github.com/berachain/beacon-kit/mod/cli v0.0.0-20240806160829-cde2d1347e7e github.com/berachain/beacon-kit/mod/config v0.0.0-20240705193247-d464364483df github.com/berachain/beacon-kit/mod/consensus v0.0.0-20240809163303-a4ebb22fd018 github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb22fd018 - github.com/berachain/beacon-kit/mod/da v0.0.0-20240705193247-d464364483df - github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 - github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df - github.com/berachain/beacon-kit/mod/execution v0.0.0-20240705193247-d464364483df - github.com/berachain/beacon-kit/mod/log v0.0.0-20240705193247-d464364483df + github.com/berachain/beacon-kit/mod/da v0.0.0-20240820191615-398849c34954 + github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240809202957-3e3f169ad720 + github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 + github.com/berachain/beacon-kit/mod/execution v0.0.0-20240820191615-398849c34954 + github.com/berachain/beacon-kit/mod/log v0.0.0-20240809202957-3e3f169ad720 github.com/berachain/beacon-kit/mod/node-api v0.0.0-20240806160829-cde2d1347e7e github.com/berachain/beacon-kit/mod/node-api/engines v0.0.0-20240806160829-cde2d1347e7e github.com/berachain/beacon-kit/mod/payload v0.0.0-20240705193247-d464364483df - github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 - github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240809202957-3e3f169ad720 + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 + github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240820191615-398849c34954 github.com/berachain/beacon-kit/mod/state-transition v0.0.0-20240717225334-64ec6650da31 - github.com/berachain/beacon-kit/mod/storage v0.0.0-20240806160829-cde2d1347e7e + github.com/berachain/beacon-kit/mod/storage v0.0.0-20240820191615-398849c34954 github.com/cometbft/cometbft v1.0.0-rc1.0.20240806094948-2c4293ef36c4 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-sdk v0.53.0 github.com/crate-crypto/go-kzg-4844 v1.1.0 github.com/hashicorp/go-metrics v0.5.3 - github.com/itsdevbear/comet-bls12-381 v0.0.0-20240413212931-2ae2f204cde7 github.com/spf13/afero v1.11.0 github.com/spf13/cast v1.6.0 ) @@ -95,7 +94,7 @@ require ( github.com/DataDog/zstd v1.5.6 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/berachain/beacon-kit/mod/async v0.0.0-20240705193247-d464364483df + github.com/berachain/beacon-kit/mod/async v0.0.0-20240820191615-398849c34954 github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd // indirect github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect @@ -113,7 +112,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect @@ -232,7 +231,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect diff --git a/mod/node-core/go.sum b/mod/node-core/go.sum index 186ab73ec3..f6f0b99312 100644 --- a/mod/node-core/go.sum +++ b/mod/node-core/go.sum @@ -16,8 +16,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -72,10 +72,10 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/berachain/beacon-kit/mod/async v0.0.0-20240705193247-d464364483df h1:f44S4M0BLiTLeX+lGvAkt1+tAM8ri+q2XsPQOl962FE= -github.com/berachain/beacon-kit/mod/async v0.0.0-20240705193247-d464364483df/go.mod h1:MNNFLsraZnkZZpm1Cl42Mxnwwql+BWHinn+r6+DrASQ= -github.com/berachain/beacon-kit/mod/beacon v0.0.0-20240718074353-1a991cfeed63 h1:OYw3r0MV8Wt7NipYbQ0bi5yed9ffudYsevAvbhp275Y= -github.com/berachain/beacon-kit/mod/beacon v0.0.0-20240718074353-1a991cfeed63/go.mod h1:dJ4i7uEGjc6KwMrSDexeXdkFqzEOXXOelWLq8KjcNqo= +github.com/berachain/beacon-kit/mod/async v0.0.0-20240820191615-398849c34954 h1:6L1t2jqlWTX57foMKHWQDOyiz8Try+ExTbdxwDhbP9k= +github.com/berachain/beacon-kit/mod/async v0.0.0-20240820191615-398849c34954/go.mod h1:Vo42KxryEPpQ2xjvEXIgxBFWd43PPEx5au7WksmYXu8= +github.com/berachain/beacon-kit/mod/beacon v0.0.0-20240820191615-398849c34954 h1:FqKjz3lgHCPVKugS+SGS4wHaomcLunA0oaEEjOjNj0w= +github.com/berachain/beacon-kit/mod/beacon v0.0.0-20240820191615-398849c34954/go.mod h1:knLVlJb+p06hd0FJhBekTTPgsSOxYMttTqEDaGiCxDY= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df h1:mnD1LKqDQ0n+OFdDqOuvKaEiUKRJzsO4V0wyyn/gJYg= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df/go.mod h1:bTFB4Rdvm7D/WdwPYkqQ+8T0XOMBv0pzXfp1E46BFX8= github.com/berachain/beacon-kit/mod/cli v0.0.0-20240806160829-cde2d1347e7e h1:sPD08g07FrZWrDnKDgWXn0P311WRFP+sd6kgBZiqz8k= @@ -86,18 +86,18 @@ github.com/berachain/beacon-kit/mod/consensus v0.0.0-20240809163303-a4ebb22fd018 github.com/berachain/beacon-kit/mod/consensus v0.0.0-20240809163303-a4ebb22fd018/go.mod h1:AabKi0yGSwa1FW9fZnuQXJi6OUcUzIWa4o4e8zm/5RM= github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb22fd018 h1:VN+glgL0JqQXf/N/8toDa9EnehltgBD4DbsHx65Macc= github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb22fd018/go.mod h1:A3Ohrylv4Dx2sf8EKJImC7ii091dUaWEAMp/AK5N6+s= -github.com/berachain/beacon-kit/mod/da v0.0.0-20240705193247-d464364483df h1:yZtRZBkhDJ2xMlMLx5DdUFtrtH9iWyPNl4HSW2uJyb8= -github.com/berachain/beacon-kit/mod/da v0.0.0-20240705193247-d464364483df/go.mod h1:iGTR+iYsqpj79WLX1RUVbV7hDs0rQtr+Iqa/VkAF4x8= -github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 h1:wVWkiiERY/7kaXvE/VNPPUtYp/l8ky6QSuKM3ThVMXU= -github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:LiOiqrJhhLH/GPo0XE5fel3EYyi7X6dwBOyTqZakTeQ= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df h1:6MJllcmMFt6dtvftM5zmdl1WVDpqZkNy3hFXVZtNV0s= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df/go.mod h1:yRD7rmnyaaqgq/6+eIVqvSkFJXuLXpBddUu59HUOrtc= -github.com/berachain/beacon-kit/mod/execution v0.0.0-20240705193247-d464364483df h1:H6BHipSq4spa06PGLp8osdJ8LTwz7POQa015RruWJfw= -github.com/berachain/beacon-kit/mod/execution v0.0.0-20240705193247-d464364483df/go.mod h1:RwyZdP3Th3Qxgr/tdmEt0Zev92Ue30/CwEvvwksP76c= +github.com/berachain/beacon-kit/mod/da v0.0.0-20240820191615-398849c34954 h1:uFAdG6vtoOFxvz0pjkl5D0XGc4PcR0Ukf3M7gU3B92o= +github.com/berachain/beacon-kit/mod/da v0.0.0-20240820191615-398849c34954/go.mod h1:n6pq+wYP5+jBZbxsVwL0Y9pspcXhNYcA3gHOaJ4rxeA= +github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240809202957-3e3f169ad720 h1:rVltwwt4JAhpvqeRDZ8J07e9XM+jzfDCJEghPA4r5lg= +github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240809202957-3e3f169ad720/go.mod h1:kGxAesqTkt75+QYQ73O9I5PqAicSL9JGh5wypiWgb8I= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 h1:kCSrkb/uVXfMKJPKjf0c7nlJkwn5cNwMxtzRW4zNq2A= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0/go.mod h1:og0jtHZosPDTyhge9tMBlRItoZ4Iv3aZFM9n4QDpcdo= +github.com/berachain/beacon-kit/mod/execution v0.0.0-20240820191615-398849c34954 h1:n68WUPCAFBsk439G7YQB91sSnBEPZ83c2sJlGQ4B3Wc= +github.com/berachain/beacon-kit/mod/execution v0.0.0-20240820191615-398849c34954/go.mod h1:Hz9RML6GtY9eiCy6lhtf2HtzW5GEoazcv/IHbMw6R1A= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e h1:0/FDBXtagMkpta/f4J2uAah2NM1G+0dqxngzMzrmbw4= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:7/SXz8S5VpFl2thcKuBdu1OId+SgI1o4N+S1FB92Zw8= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240705193247-d464364483df h1:SnzeY9SCmKyEx0iGC/C/8E39ozpl/g5yI7lFXpmbMBI= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240705193247-d464364483df/go.mod h1:mJ0ZlK+izcPWcveHAtM4+W0a+8jhu5Y4DMPL2Takacg= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240809202957-3e3f169ad720 h1:qfFjDx7w3uU+zMw5HrghiKPZunxapgCiNHI1XqqtgmA= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240809202957-3e3f169ad720/go.mod h1:BilVBmqKhC4GXYCaIs8QnKaR14kpn3YmF5uYBdayF9I= github.com/berachain/beacon-kit/mod/node-api v0.0.0-20240806160829-cde2d1347e7e h1:fzW/jTq01yOTdrEoi0cucTqadvbZLROr9dGFtXfjBl8= github.com/berachain/beacon-kit/mod/node-api v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:wgOdrP96dMsXDXHItO4tRLuf8IaHP14RY4MbUPFAc4s= github.com/berachain/beacon-kit/mod/node-api/engines v0.0.0-20240806160829-cde2d1347e7e h1:RJSPVKiuK4h2IJEIsJDX2JGbqY3ZdKGzvaEN8Dx7kYc= @@ -106,14 +106,14 @@ github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd h1:QH github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:ft214cxJaqrRPOuAjpYwgA9AOElJnHrDZZEQ0jZPWwQ= github.com/berachain/beacon-kit/mod/payload v0.0.0-20240705193247-d464364483df h1:fLL+7ZZcbVOmE3XE0o+ZGS8zyPLjki7LrZAsXpcG4Sc= github.com/berachain/beacon-kit/mod/payload v0.0.0-20240705193247-d464364483df/go.mod h1:wbSa9W1CDDzR9AptQfYf/16bWqktaIQIZdJsuKWeqC8= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= -github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240809202957-3e3f169ad720 h1:dSBzTgN/h5WYNVs7Pbo6ZEkHecFUm0miGd8w+XT3BVA= -github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240809202957-3e3f169ad720/go.mod h1:DwPFy0Q9D9zFaeXOrBcGRC1vHmbk4SH1ujT5xFXASd4= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= +github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240820191615-398849c34954 h1:679nzsxMX50cZWpAvdO/FbrkcnpqzPlVnb5Q/WCDYGI= +github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240820191615-398849c34954/go.mod h1:4uL1CFA4H3/GLtpD/Rd2QNksVvL3KYdvc7YesQnPS+c= github.com/berachain/beacon-kit/mod/state-transition v0.0.0-20240717225334-64ec6650da31 h1:1bJbJcoksyXfYMiga8YxPnkVKqT1lKwym/8kZnEPz58= github.com/berachain/beacon-kit/mod/state-transition v0.0.0-20240717225334-64ec6650da31/go.mod h1:sIzib45R7B9Q99yvsYUcj2xJZPBpe3J9JbcBDMZNp7E= -github.com/berachain/beacon-kit/mod/storage v0.0.0-20240806160829-cde2d1347e7e h1:eIHdeGNL87GlWxFqAgsuUZpA/EBGvaOWXFMDuXSJgjU= -github.com/berachain/beacon-kit/mod/storage v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:1Hti34fIHtniBapeikvYF3KyA038+6If8BRkRKqWUy4= +github.com/berachain/beacon-kit/mod/storage v0.0.0-20240820191615-398849c34954 h1:xRK4BfHEePgzg8qydue+hIH9Vz7/49O/GzdjPJhZCAs= +github.com/berachain/beacon-kit/mod/storage v0.0.0-20240820191615-398849c34954/go.mod h1:o7IHRs6l1qfiVcizr3/uuRbGybfbLP8fRTjoJQQQSwA= github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 h1:4qwOPga+dKeDelSJ6pseasQq6fcjd7iXhah0y7enuco= github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2/go.mod h1:DUyJJMMuFJ9OZAhnFMLA0KTFGoVw61p8wnqtV3Wgx3c= github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= @@ -190,8 +190,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -436,8 +436,6 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/itsdevbear/comet-bls12-381 v0.0.0-20240413212931-2ae2f204cde7 h1:BUSaPdT9CP76kpyPwudkYvl4y0Gah4gxNVrETpjGXo0= -github.com/itsdevbear/comet-bls12-381 v0.0.0-20240413212931-2ae2f204cde7/go.mod h1:6ANZ/zuQlNdrYjIuv2ZyG2bXa3c7Dtl5I5jCMARBjOM= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jhump/protoreflect v1.16.0 h1:54fZg+49widqXYQ0b+usAFHbMkBGR4PpXrsHc8+TBDg= @@ -786,8 +784,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/mod/node-core/pkg/components/api.go b/mod/node-core/pkg/components/api.go index 3cf96384c2..094527a1b2 100644 --- a/mod/node-core/pkg/components/api.go +++ b/mod/node-core/pkg/components/api.go @@ -92,10 +92,7 @@ func ProvideNodeAPIServer[ ](in NodeAPIServerInput[LoggerT]) *NodeAPIServer { in.Logger.AddKeyValColor("service", "node-api-server", log.Blue) - return server.New[ - NodeAPIContext, - *NodeAPIEngine, - ]( + return server.New[NodeAPIContext]( in.Config.NodeAPI, in.Engine, in.Logger.With("service", "node-api-server"), diff --git a/mod/node-core/pkg/components/api_handlers.go b/mod/node-core/pkg/components/api_handlers.go index 9ff3d9c2a1..0b4eb8bf89 100644 --- a/mod/node-core/pkg/components/api_handlers.go +++ b/mod/node-core/pkg/components/api_handlers.go @@ -88,7 +88,10 @@ func ProvideNodeAPINodeHandler() *NodeAPIHandler { } func ProvideNodeAPIProofHandler(b *NodeAPIBackend) *ProofAPIHandler { - return proofapi.NewHandler[NodeAPIContext](b) + return proofapi.NewHandler[ + *BeaconBlockHeader, *BeaconState, *BeaconStateMarshallable, + NodeAPIContext, *ExecutionPayloadHeader, *Validator, + ](b) } func DefaultNodeAPIHandlers() []any { diff --git a/mod/node-core/pkg/components/availability_store.go b/mod/node-core/pkg/components/availability_store.go index bc8f305cb7..da4a4e206e 100644 --- a/mod/node-core/pkg/components/availability_store.go +++ b/mod/node-core/pkg/components/availability_store.go @@ -27,6 +27,7 @@ import ( "cosmossdk.io/depinject" dastore "github.com/berachain/beacon-kit/mod/da/pkg/store" "github.com/berachain/beacon-kit/mod/log" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/storage/pkg/filedb" "github.com/berachain/beacon-kit/mod/storage/pkg/manager" @@ -78,8 +79,8 @@ type AvailabilityPrunerInput[ ] struct { depinject.In AvailabilityStore *AvailabilityStore - BlockBroker *BlockBroker ChainSpec common.ChainSpec + Dispatcher *Dispatcher Logger LoggerT } @@ -96,18 +97,27 @@ func ProvideAvailabilityPruner[ return nil, errors.New("availability store does not have a range db") } - subCh, err := in.BlockBroker.Subscribe() - if err != nil { - in.Logger.Error("failed to subscribe to block feed", "err", err) + // TODO: add dispatcher field in the pruner or something, the provider + // should not execute any business logic. + // create new subscription for finalized blocks. + subFinalizedBlocks := make(chan FinalizedBlockEvent) + if err := in.Dispatcher.Subscribe( + async.BeaconBlockFinalizedEvent, subFinalizedBlocks, + ); err != nil { + in.Logger.Error("failed to subscribe to event", "event", + async.BeaconBlockFinalizedEvent, "err", err) return nil, err } // build the availability pruner if IndexDB is available. - return pruner.NewPruner[*BeaconBlock, *IndexDB]( + return pruner.NewPruner[ + *BeaconBlock, + *IndexDB, + ]( in.Logger.With("service", manager.AvailabilityPrunerName), rangeDB, manager.AvailabilityPrunerName, - subCh, + subFinalizedBlocks, dastore.BuildPruneRangeFn[*BeaconBlock](in.ChainSpec), ), nil } diff --git a/mod/node-core/pkg/components/blobs.go b/mod/node-core/pkg/components/blobs.go index c4605a2b04..15e35985bf 100644 --- a/mod/node-core/pkg/components/blobs.go +++ b/mod/node-core/pkg/components/blobs.go @@ -109,8 +109,8 @@ type DAServiceIn[ depinject.In AvailabilityStore *AvailabilityStore - SidecarsBroker *SidecarsBroker BlobProcessor *BlobProcessor + Dispatcher *Dispatcher Logger LoggerT } @@ -127,7 +127,7 @@ func ProvideDAService[ ]( in.AvailabilityStore, in.BlobProcessor, - in.SidecarsBroker, + in.Dispatcher, in.Logger.With("service", "da"), ) } diff --git a/mod/node-core/pkg/components/block_store.go b/mod/node-core/pkg/components/block_store.go index e1a924bd99..1fd2760357 100644 --- a/mod/node-core/pkg/components/block_store.go +++ b/mod/node-core/pkg/components/block_store.go @@ -23,11 +23,13 @@ package components import ( "cosmossdk.io/depinject" storev2 "cosmossdk.io/store/v2/db" + "github.com/berachain/beacon-kit/mod/async/pkg/dispatcher" blockservice "github.com/berachain/beacon-kit/mod/beacon/block_store" "github.com/berachain/beacon-kit/mod/config" "github.com/berachain/beacon-kit/mod/log" "github.com/berachain/beacon-kit/mod/node-core/pkg/components/metrics" "github.com/berachain/beacon-kit/mod/node-core/pkg/components/storage" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/storage/pkg/block" "github.com/berachain/beacon-kit/mod/storage/pkg/manager" @@ -75,11 +77,10 @@ type BlockPrunerInput[ LoggerT log.AdvancedLogger[any, LoggerT], ] struct { depinject.In - - BlockBroker *BlockBroker - BlockStore *BlockStore - Config *config.Config - Logger LoggerT + BlockStore *BlockStore + Config *config.Config + Dispatcher *dispatcher.Dispatcher + Logger LoggerT } // ProvideBlockPruner provides a block pruner for the depinject framework. @@ -88,17 +89,25 @@ func ProvideBlockPruner[ ]( in BlockPrunerInput[LoggerT], ) (BlockPruner, error) { - subCh, err := in.BlockBroker.Subscribe() - if err != nil { - in.Logger.Error("failed to subscribe to block feed", "err", err) + // TODO: provider should not execute any business logic. + // create new subscription for finalized blocks. + subFinalizedBlocks := make(chan FinalizedBlockEvent) + if err := in.Dispatcher.Subscribe( + async.BeaconBlockFinalizedEvent, subFinalizedBlocks, + ); err != nil { + in.Logger.Error("failed to subscribe to event", "event", + async.BeaconBlockFinalizedEvent, "err", err) return nil, err } - return pruner.NewPruner[*BeaconBlock, *BlockStore]( + return pruner.NewPruner[ + *BeaconBlock, + *BlockStore, + ]( in.Logger.With("service", manager.BlockPrunerName), in.BlockStore, manager.BlockPrunerName, - subCh, + subFinalizedBlocks, blockservice.BuildPruneRangeFn[*BeaconBlock]( in.Config.BlockStoreService, ), diff --git a/mod/node-core/pkg/components/block_store_service.go b/mod/node-core/pkg/components/block_store_service.go index c67bd09395..9b33464e15 100644 --- a/mod/node-core/pkg/components/block_store_service.go +++ b/mod/node-core/pkg/components/block_store_service.go @@ -33,10 +33,10 @@ type BlockServiceInput[ ] struct { depinject.In - BlockBroker *BlockBroker - BlockStore *BlockStore - Config *config.Config - Logger LoggerT + BlockStore *BlockStore + Config *config.Config + Dispatcher *Dispatcher + Logger LoggerT } // ProvideBlockStoreService provides the block service. @@ -48,7 +48,7 @@ func ProvideBlockStoreService[ return blockstore.NewService( in.Config.BlockStoreService, in.Logger, - in.BlockBroker, + in.Dispatcher, in.BlockStore, ) } diff --git a/mod/node-core/pkg/components/brokers.go b/mod/node-core/pkg/components/brokers.go deleted file mode 100644 index 0cc9d84d2c..0000000000 --- a/mod/node-core/pkg/components/brokers.go +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2024, Berachain Foundation. All rights reserved. -// Use of this software is governed by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package components - -import ( - "github.com/berachain/beacon-kit/mod/async/pkg/broker" -) - -// ProvideBlobBroker provides a blob feed for the depinject framework. -func ProvideBlobBroker() *SidecarsBroker { - return broker.New[*SidecarEvent]( - "blob-broker", - ) -} - -// ProvideBlockBroker provides a block feed for the depinject framework. -func ProvideBlockBroker() *BlockBroker { - return broker.New[*BlockEvent]( - "blk-broker", - ) -} - -// ProvideGenesisBroker provides a genesis feed for the depinject framework. -func ProvideGenesisBroker() *GenesisBroker { - return broker.New[*GenesisEvent]( - "genesis-broker", - ) -} - -// ProvideSlotBroker provides a slot feed for the depinject framework. -func ProvideSlotBroker() *SlotBroker { - return broker.New[*SlotEvent]( - "slot-broker", - ) -} - -// ProvideStatusBroker provides a status feed. -func ProvideStatusBroker() *StatusBroker { - return broker.New[*StatusEvent]( - "status-broker", - ) -} - -// ProvideValidatorUpdateBroker provides a validator updates feed. -func ProvideValidatorUpdateBroker() *ValidatorUpdateBroker { - return broker.New[*ValidatorUpdateEvent]( - "validator-updates-broker", - ) -} - -// DefaultBrokerProviders returns a slice of the default broker providers. -func DefaultBrokerProviders() []interface{} { - return []interface{}{ - ProvideBlobBroker, - ProvideBlockBroker, - ProvideGenesisBroker, - ProvideSlotBroker, - ProvideStatusBroker, - ProvideValidatorUpdateBroker, - } -} diff --git a/mod/node-core/pkg/components/chain_service.go b/mod/node-core/pkg/components/chain_service.go index 2bd210465b..825353ea9c 100644 --- a/mod/node-core/pkg/components/chain_service.go +++ b/mod/node-core/pkg/components/chain_service.go @@ -36,20 +36,18 @@ type ChainServiceInput[ ] struct { depinject.In - BlockBroker *BlockBroker - ChainSpec common.ChainSpec - Cfg *config.Config - DepositService *DepositService - EngineClient *EngineClient - ExecutionEngine *ExecutionEngine - GenesisBrocker *GenesisBroker - LocalBuilder *LocalBuilder - Logger LoggerT - Signer crypto.BLSSigner - StateProcessor *StateProcessor - StorageBackend *StorageBackend - TelemetrySink *metrics.TelemetrySink - ValidatorUpdateBroker *ValidatorUpdateBroker + ChainSpec common.ChainSpec + Cfg *config.Config + DepositService *DepositService + Dispatcher *Dispatcher + EngineClient *EngineClient + ExecutionEngine *ExecutionEngine + LocalBuilder *LocalBuilder + Logger LoggerT + Signer crypto.BLSSigner + StateProcessor *StateProcessor + StorageBackend *StorageBackend + TelemetrySink *metrics.TelemetrySink } // ProvideChainService is a depinject provider for the blockchain service. @@ -73,13 +71,11 @@ func ProvideChainService[ in.StorageBackend, in.Logger.With("service", "blockchain"), in.ChainSpec, + in.Dispatcher, in.ExecutionEngine, in.LocalBuilder, in.StateProcessor, in.TelemetrySink, - in.GenesisBrocker, - in.BlockBroker, - in.ValidatorUpdateBroker, // If optimistic is enabled, we want to skip post finalization FCUs. in.Cfg.Validator.EnableOptimisticPayloadBuilds, ) diff --git a/mod/node-core/pkg/components/defaults.go b/mod/node-core/pkg/components/defaults.go index 17bd66dd92..ff631738da 100644 --- a/mod/node-core/pkg/components/defaults.go +++ b/mod/node-core/pkg/components/defaults.go @@ -65,6 +65,8 @@ func DefaultComponents() []any { // TODO Hacks ProvideKVStoreService, ProvideKVStoreKey, + ProvideDispatcher[LoggerT], + ProvidePublishers, } components = append(components, ProvideNodeAPIServer[LoggerT], @@ -72,6 +74,5 @@ func DefaultComponents() []any { ProvideNodeAPIBackend, ) components = append(components, DefaultNodeAPIHandlers()...) - components = append(components, DefaultBrokerProviders()...) return components } diff --git a/mod/node-core/pkg/components/deposit_service.go b/mod/node-core/pkg/components/deposit_service.go index b842cf2a94..0238843116 100644 --- a/mod/node-core/pkg/components/deposit_service.go +++ b/mod/node-core/pkg/components/deposit_service.go @@ -21,8 +21,6 @@ package components import ( - "errors" - "cosmossdk.io/depinject" "github.com/berachain/beacon-kit/mod/execution/pkg/deposit" "github.com/berachain/beacon-kit/mod/log" @@ -37,9 +35,9 @@ type DepositServiceIn[ ] struct { depinject.In BeaconDepositContract *DepositContract - BlockBroker *BlockBroker ChainSpec common.ChainSpec DepositStore *DepositStore + Dispatcher *Dispatcher EngineClient *EngineClient Logger LoggerT TelemetrySink *metrics.TelemetrySink @@ -52,12 +50,6 @@ func ProvideDepositService[ ]( in DepositServiceIn[LoggerT], ) (*DepositService, error) { - blkSub, err := in.BlockBroker.Subscribe() - if err != nil { - in.Logger.Error("failed to subscribe to block feed", "err", err) - return nil, errors.New("failed to subscribe to block feed") - } - // Build the deposit service. return deposit.NewService[ *BeaconBlock, @@ -70,6 +62,6 @@ func ProvideDepositService[ in.TelemetrySink, in.DepositStore, in.BeaconDepositContract, - blkSub, + in.Dispatcher, ), nil } diff --git a/mod/node-core/pkg/components/deposit_store.go b/mod/node-core/pkg/components/deposit_store.go index edf36c6aa8..729977dc2f 100644 --- a/mod/node-core/pkg/components/deposit_store.go +++ b/mod/node-core/pkg/components/deposit_store.go @@ -26,6 +26,7 @@ import ( "github.com/berachain/beacon-kit/mod/execution/pkg/deposit" "github.com/berachain/beacon-kit/mod/log" "github.com/berachain/beacon-kit/mod/node-core/pkg/components/storage" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" depositstore "github.com/berachain/beacon-kit/mod/storage/pkg/deposit" "github.com/berachain/beacon-kit/mod/storage/pkg/manager" @@ -61,9 +62,9 @@ type DepositPrunerInput[ LoggerT log.AdvancedLogger[any, LoggerT], ] struct { depinject.In - BlockBroker *BlockBroker ChainSpec common.ChainSpec DepositStore *DepositStore + Dispatcher *Dispatcher Logger LoggerT } @@ -73,17 +74,25 @@ func ProvideDepositPruner[ ]( in DepositPrunerInput[LoggerT], ) (DepositPruner, error) { - subCh, err := in.BlockBroker.Subscribe() - if err != nil { - in.Logger.Error("failed to subscribe to block feed", "err", err) + // initialize a subscription for finalized blocks. + subFinalizedBlocks := make(chan FinalizedBlockEvent) + if err := in.Dispatcher.Subscribe( + async.BeaconBlockFinalizedEvent, subFinalizedBlocks, + ); err != nil { + in.Logger.Error("failed to subscribe to event", "event", + async.BeaconBlockFinalizedEvent, "err", err) return nil, err } - return pruner.NewPruner[*BeaconBlock, *DepositStore]( + // return a new pruner for the deposit store. + return pruner.NewPruner[ + *BeaconBlock, + *DepositStore, + ]( in.Logger.With("service", manager.DepositPrunerName), in.DepositStore, manager.DepositPrunerName, - subCh, + subFinalizedBlocks, deposit.BuildPruneRangeFn[ *BeaconBlock, *BeaconBlockBody, diff --git a/mod/node-core/pkg/components/dispatcher.go b/mod/node-core/pkg/components/dispatcher.go new file mode 100644 index 0000000000..8de12189cf --- /dev/null +++ b/mod/node-core/pkg/components/dispatcher.go @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package components + +import ( + "cosmossdk.io/depinject" + "github.com/berachain/beacon-kit/mod/async/pkg/dispatcher" + asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/log" +) + +// DispatcherInput is the input for the Dispatcher. +type DispatcherInput[ + LoggerT log.AdvancedLogger[any, LoggerT], +] struct { + depinject.In + Logger LoggerT + Publishers []asynctypes.Broker +} + +// ProvideDispatcher provides a new Dispatcher. +func ProvideDispatcher[ + LoggerT log.AdvancedLogger[any, LoggerT], +]( + in DispatcherInput[LoggerT], +) (*Dispatcher, error) { + d := dispatcher.New( + in.Logger.With("service", "dispatcher"), + ) + if err := d.RegisterBrokers(in.Publishers...); err != nil { + return nil, err + } + return d, nil +} diff --git a/mod/node-core/pkg/components/engine.go b/mod/node-core/pkg/components/engine.go index dd01f9fe2d..08ad6a1ca3 100644 --- a/mod/node-core/pkg/components/engine.go +++ b/mod/node-core/pkg/components/engine.go @@ -72,7 +72,6 @@ type ExecutionEngineInputs[ depinject.In EngineClient *EngineClient Logger LoggerT - StatusBroker *StatusBroker TelemetrySink *metrics.TelemetrySink } @@ -91,7 +90,6 @@ func ProvideExecutionEngine[ ]( in.EngineClient, in.Logger.With("service", "execution-engine"), - in.StatusBroker, in.TelemetrySink, ) } diff --git a/mod/node-core/pkg/components/events.go b/mod/node-core/pkg/components/events.go new file mode 100644 index 0000000000..36c3b0b785 --- /dev/null +++ b/mod/node-core/pkg/components/events.go @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package components + +import ( + "github.com/berachain/beacon-kit/mod/async/pkg/broker" + asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" +) + +// ProvidePublishers provides a publisher for beacon block +// finalized events. +func ProvidePublishers() []asynctypes.Broker { + return []asynctypes.Broker{ + broker.New[GenesisDataReceivedEvent]( + async.GenesisDataReceived, + ), + broker.New[GenesisDataProcessedEvent]( + async.GenesisDataProcessed, + ), + broker.New[NewSlotEvent]( + async.NewSlot, + ), + broker.New[BuiltBeaconBlockEvent]( + async.BuiltBeaconBlock, + ), + broker.New[BuiltSidecarsEvent]( + async.BuiltSidecars, + ), + broker.New[BeaconBlockReceivedEvent]( + async.BeaconBlockReceived, + ), + broker.New[SidecarsReceivedEvent]( + async.SidecarsReceived, + ), + broker.New[BeaconBlockVerifiedEvent]( + async.BeaconBlockVerified, + ), + broker.New[SidecarsVerifiedEvent]( + async.SidecarsVerified, + ), + broker.New[FinalBeaconBlockReceivedEvent]( + async.FinalBeaconBlockReceived, + ), + broker.New[FinalSidecarsReceivedEvent]( + async.FinalSidecarsReceived, + ), + broker.New[FinalValidatorUpdatesProcessedEvent]( + async.FinalValidatorUpdatesProcessed, + ), + broker.New[FinalizedBlockEvent]( + async.BeaconBlockFinalizedEvent, + ), + } +} diff --git a/mod/node-core/pkg/components/middleware.go b/mod/node-core/pkg/components/middleware.go index b773ee1dfb..35512847e1 100644 --- a/mod/node-core/pkg/components/middleware.go +++ b/mod/node-core/pkg/components/middleware.go @@ -33,14 +33,10 @@ type ABCIMiddlewareInput[ LoggerT log.Logger[any], ] struct { depinject.In - BeaconBlockFeed *BlockBroker - ChainSpec common.ChainSpec - GenesisBroker *GenesisBroker - Logger LoggerT - SidecarsFeed *SidecarsBroker - SlotBroker *SlotBroker - TelemetrySink *metrics.TelemetrySink - ValidatorUpdateBroker *ValidatorUpdateBroker + ChainSpec common.ChainSpec + Logger LoggerT + TelemetrySink *metrics.TelemetrySink + Dispatcher *Dispatcher } // ProvideABCIMiddleware is a depinject provider for the validator @@ -50,20 +46,12 @@ func ProvideABCIMiddleware[ ]( in ABCIMiddlewareInput[LoggerT], ) (*ABCIMiddleware, error) { - validatorUpdatesSub, err := in.ValidatorUpdateBroker.Subscribe() - if err != nil { - return nil, err - } return middleware.NewABCIMiddleware[ *BeaconBlock, *BlobSidecars, *Genesis, *SlotData, ]( in.ChainSpec, in.Logger, in.TelemetrySink, - in.GenesisBroker, - in.BeaconBlockFeed, - in.SidecarsFeed, - in.SlotBroker, - validatorUpdatesSub, + in.Dispatcher, ), nil } diff --git a/mod/node-core/pkg/components/service_registry.go b/mod/node-core/pkg/components/service_registry.go index 2c44350444..9294add654 100644 --- a/mod/node-core/pkg/components/service_registry.go +++ b/mod/node-core/pkg/components/service_registry.go @@ -32,23 +32,19 @@ type ServiceRegistryInput[ LoggerT log.AdvancedLogger[any, LoggerT], ] struct { depinject.In - ABCIService *ABCIMiddleware - BlockBroker *BlockBroker - BlockStoreService *BlockStoreService - ChainService *ChainService - DAService *DAService - DBManager *DBManager - DepositService *DepositService - EngineClient *EngineClient - GenesisBroker *GenesisBroker - Logger LoggerT - NodeAPIServer *NodeAPIServer - ReportingService *ReportingService - SidecarsBroker *SidecarsBroker - SlotBroker *SlotBroker - TelemetrySink *metrics.TelemetrySink - ValidatorService *ValidatorService - ValidatorUpdateBroker *ValidatorUpdateBroker + Middleware *ABCIMiddleware + BlockStoreService *BlockStoreService + ChainService *ChainService + DAService *DAService + DBManager *DBManager + DepositService *DepositService + EngineClient *EngineClient + Logger LoggerT + NodeAPIServer *NodeAPIServer + ReportingService *ReportingService + TelemetrySink *metrics.TelemetrySink + ValidatorService *ValidatorService + Dispatcher *Dispatcher } // ProvideServiceRegistry is the depinject provider for the service registry. @@ -59,20 +55,16 @@ func ProvideServiceRegistry[ ) *service.Registry { return service.NewRegistry( service.WithLogger(in.Logger), + service.WithService(in.Middleware), + service.WithService(in.Dispatcher), service.WithService(in.ValidatorService), service.WithService(in.BlockStoreService), service.WithService(in.ChainService), service.WithService(in.DAService), service.WithService(in.DepositService), - service.WithService(in.ABCIService), service.WithService(in.NodeAPIServer), service.WithService(in.ReportingService), service.WithService(in.DBManager), - service.WithService(in.GenesisBroker), - service.WithService(in.BlockBroker), - service.WithService(in.SlotBroker), - service.WithService(in.SidecarsBroker), - service.WithService(in.ValidatorUpdateBroker), service.WithService(in.EngineClient), ) } diff --git a/mod/node-core/pkg/components/signer/legacy.go b/mod/node-core/pkg/components/signer/legacy.go index ea49bb1791..faa3069b06 100644 --- a/mod/node-core/pkg/components/signer/legacy.go +++ b/mod/node-core/pkg/components/signer/legacy.go @@ -25,38 +25,39 @@ import ( "github.com/berachain/beacon-kit/mod/primitives/pkg/constants" "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" - "github.com/itsdevbear/comet-bls12-381/bls" - "github.com/itsdevbear/comet-bls12-381/bls/blst" + "github.com/cometbft/cometbft/crypto/bls12381" ) -// LegacySigner is a BLS12-381 signer that uses a bls.SecretKey for signing. +// LegacySigner is a BLS12-381 signer that uses a bls.PrivKey for signing. type LegacySigner struct { - bls.SecretKey + *bls12381.PrivKey } // NewLegacySigner creates a new Signer instance given a secret key. func NewLegacySigner( keyBz LegacyKey, ) (*LegacySigner, error) { - secretKey, err := blst.SecretKeyFromBytes(keyBz[:]) + pk, err := bls12381.NewPrivateKeyFromBytes(keyBz[:]) if err != nil { return nil, err } - return &LegacySigner{ - SecretKey: secretKey, - }, nil + return &LegacySigner{PrivKey: &pk}, nil } // PublicKey returns the public key of the signer. func (b *LegacySigner) PublicKey() crypto.BLSPubkey { - return crypto.BLSPubkey(b.SecretKey.PublicKey().Marshal()) + return crypto.BLSPubkey(b.PubKey().Bytes()) } // Sign generates a signature for a given message using the signer's secret key. // It returns the signature and any error encountered during the signing // process. func (b *LegacySigner) Sign(msg []byte) (crypto.BLSSignature, error) { - return crypto.BLSSignature(b.SecretKey.Sign(msg).Marshal()), nil + sig, err := b.PrivKey.Sign(msg) + if err != nil { + return crypto.BLSSignature{}, err + } + return crypto.BLSSignature(sig), nil } // VerifySignature verifies a signature against a message and public key. @@ -65,17 +66,8 @@ func (LegacySigner) VerifySignature( msg []byte, signature crypto.BLSSignature, ) error { - pubkey, err := blst.PublicKeyFromBytes(pubKey[:]) - if err != nil { - return err - } - - sig, err := blst.SignatureFromBytes(signature[:]) - if err != nil { - return err - } - - if !sig.Verify(pubkey, msg) { + if ok := bls12381.PubKey(pubKey[:]). + VerifySignature(msg, signature[:]); !ok { return ErrInvalidSignature } return nil diff --git a/mod/node-core/pkg/components/signer/signer.go b/mod/node-core/pkg/components/signer/signer.go index 5fe193b916..f3e9d080f2 100644 --- a/mod/node-core/pkg/components/signer/signer.go +++ b/mod/node-core/pkg/components/signer/signer.go @@ -24,9 +24,9 @@ import ( "github.com/berachain/beacon-kit/mod/errors" "github.com/berachain/beacon-kit/mod/primitives/pkg/constants" "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" + "github.com/cometbft/cometbft/crypto/bls12381" "github.com/cometbft/cometbft/privval" "github.com/cometbft/cometbft/types" - "github.com/itsdevbear/comet-bls12-381/bls/blst" ) // BLSSigner utilize an underlying PrivValidator signer using data persisted to @@ -71,21 +71,12 @@ func (f BLSSigner) Sign(msg []byte) (crypto.BLSSignature, error) { // VerifySignature verifies a signature against a message and a public key. func (f BLSSigner) VerifySignature( - blsPk crypto.BLSPubkey, + pubKey crypto.BLSPubkey, msg []byte, signature crypto.BLSSignature, ) error { - pk, err := blst.PublicKeyFromBytes(blsPk[:]) - if err != nil { - return err - } - - sig, err := blst.SignatureFromBytes(signature[:]) - if err != nil { - return err - } - - if !sig.Verify(pk, msg) { + if ok := bls12381.PubKey(pubKey[:]). + VerifySignature(msg, signature[:]); !ok { return ErrInvalidSignature } return nil diff --git a/mod/node-core/pkg/components/storage/provider.go b/mod/node-core/pkg/components/storage/provider.go index 31a7b5b0e2..02503aad1d 100644 --- a/mod/node-core/pkg/components/storage/provider.go +++ b/mod/node-core/pkg/components/storage/provider.go @@ -32,9 +32,9 @@ type KVStoreProvider struct { } // NewKVStoreProvider creates a new KV store provider. -func NewKVStoreProvider(kvsp store.KVStoreWithBatch) *KVStoreProvider { +func NewKVStoreProvider(kvsb store.KVStoreWithBatch) *KVStoreProvider { return &KVStoreProvider{ - KVStoreWithBatch: kvsp, + KVStoreWithBatch: kvsb, } } diff --git a/mod/node-core/pkg/components/storage/storage.go b/mod/node-core/pkg/components/storage/storage.go index b3577f5a01..ae633af5d7 100644 --- a/mod/node-core/pkg/components/storage/storage.go +++ b/mod/node-core/pkg/components/storage/storage.go @@ -35,11 +35,11 @@ type Backend[ DepositStoreT any, KVStoreT KVStore[KVStoreT], ] struct { - cs common.ChainSpec - as AvailabilityStoreT - kvs KVStoreT - ds DepositStoreT - bs BlockStoreT + chainSpec common.ChainSpec + availabilityStore AvailabilityStoreT + kvStore KVStoreT + depositStore DepositStoreT + blockStore BlockStoreT } func NewBackend[ @@ -49,22 +49,22 @@ func NewBackend[ DepositStoreT any, KVStoreT KVStore[KVStoreT], ]( - cs common.ChainSpec, - as AvailabilityStoreT, - kvs KVStoreT, - ds DepositStoreT, - bs BlockStoreT, + chainSpec common.ChainSpec, + availabilityStore AvailabilityStoreT, + kvStore KVStoreT, + depositStore DepositStoreT, + blockStore BlockStoreT, ) *Backend[ AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositStoreT, KVStoreT, ] { return &Backend[ AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositStoreT, KVStoreT, ]{ - cs: cs, - as: as, - kvs: kvs, - ds: ds, - bs: bs, + chainSpec: chainSpec, + availabilityStore: availabilityStore, + kvStore: kvStore, + depositStore: depositStore, + blockStore: blockStore, } } @@ -73,7 +73,7 @@ func NewBackend[ func (k Backend[ AvailabilityStoreT, _, _, _, _, ]) AvailabilityStore() AvailabilityStoreT { - return k.as + return k.availabilityStore } // BeaconState returns the beacon state struct initialized with a given @@ -84,25 +84,25 @@ func (k Backend[ ctx context.Context, ) BeaconStateT { var st BeaconStateT - return st.NewFromDB(k.kvs.WithContext(ctx), k.cs) + return st.NewFromDB(k.kvStore.WithContext(ctx), k.chainSpec) } // BeaconStore returns the beacon store struct. func (k Backend[ _, _, _, _, KVStoreT, ]) BeaconStore() KVStoreT { - return k.kvs + return k.kvStore } func (k Backend[ _, _, BlockStoreT, _, _, ]) BlockStore() BlockStoreT { - return k.bs + return k.blockStore } // DepositStore returns the deposit store struct initialized with a. func (k Backend[ _, _, _, DepositStoreT, _, ]) DepositStore() DepositStoreT { - return k.ds + return k.depositStore } diff --git a/mod/node-core/pkg/components/storage/types.go b/mod/node-core/pkg/components/storage/types.go index c8befbe057..1440803fd2 100644 --- a/mod/node-core/pkg/components/storage/types.go +++ b/mod/node-core/pkg/components/storage/types.go @@ -24,23 +24,8 @@ import ( "context" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" - "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) -// The AvailabilityStore interface is responsible for validating and storing -// sidecars for specific blocks, as well as verifying sidecars that have already -// been stored. -type AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT any] interface { - // IsDataAvailable ensures that all blobs referenced in the block are - // securely stored before it returns without an error. - IsDataAvailable( - context.Context, math.Slot, BeaconBlockBodyT, - ) bool - // Persist makes sure that the sidecar remains accessible for data - // availability checks throughout the beacon node's operation. - Persist(math.Slot, BlobSidecarsT) error -} - type BeaconState[T, KVStoreT any] interface { NewFromDB(KVStoreT, common.ChainSpec) T } diff --git a/mod/node-core/pkg/components/types.go b/mod/node-core/pkg/components/types.go index 391fc817b5..55764119ae 100644 --- a/mod/node-core/pkg/components/types.go +++ b/mod/node-core/pkg/components/types.go @@ -22,8 +22,8 @@ package components import ( "cosmossdk.io/core/appmodule/v2" - broker "github.com/berachain/beacon-kit/mod/async/pkg/broker" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/async/pkg/broker" + "github.com/berachain/beacon-kit/mod/async/pkg/dispatcher" blockstore "github.com/berachain/beacon-kit/mod/beacon/block_store" "github.com/berachain/beacon-kit/mod/beacon/blockchain" "github.com/berachain/beacon-kit/mod/beacon/validator" @@ -54,6 +54,7 @@ import ( nodetypes "github.com/berachain/beacon-kit/mod/node-core/pkg/types" "github.com/berachain/beacon-kit/mod/payload/pkg/attributes" payloadbuilder "github.com/berachain/beacon-kit/mod/payload/pkg/builder" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/service" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" "github.com/berachain/beacon-kit/mod/runtime/pkg/middleware" @@ -312,10 +313,7 @@ type ( NodeAPIEngine = echo.Engine // NodeAPIServer is a type alias for the node API server. - NodeAPIServer = server.Server[ - NodeAPIContext, - *NodeAPIEngine, - ] + NodeAPIServer = server.Server[NodeAPIContext] // PayloadAttributes is a type alias for the payload attributes. PayloadAttributes = engineprimitives.PayloadAttributes[*Withdrawal] @@ -400,51 +398,87 @@ type ( ) /* -------------------------------------------------------------------------- */ -/* Events */ +/* Messages */ /* -------------------------------------------------------------------------- */ +// Events. +// +//nolint:lll // long generic types type ( - // BlockEvent is a type alias for the block event. - BlockEvent = asynctypes.Event[*BeaconBlock] - // GenesisEvent is a type alias for the genesis event. - GenesisEvent = asynctypes.Event[*Genesis] + // GenesisDataReceivedEvent is a type alias for the genesis data received event. + GenesisDataReceivedEvent = async.Event[*Genesis] - // SidecarEvent is a type alias for the sidecar event. - SidecarEvent = asynctypes.Event[*BlobSidecars] + // GenesisDataProcessedEvent is a type alias for the genesis data processed event. + GenesisDataProcessedEvent = async.Event[transition.ValidatorUpdates] - // SlotEvent is a type alias for the slot event. - SlotEvent = asynctypes.Event[*SlotData] + // NewSlotEvent is a type alias for the new slot event. + NewSlotEvent = async.Event[*SlotData] - // StatusEvent is a type alias for the status event. - StatusEvent = asynctypes.Event[*service.StatusEvent] + // BuiltBeaconBlockEvent is a type alias for the built beacon block event. + BuiltBeaconBlockEvent = async.Event[*BeaconBlock] - // ValidatorUpdateEvent is a type alias for the validator update event. - ValidatorUpdateEvent = asynctypes.Event[transition.ValidatorUpdates] -) + // BuiltSidecarsEvent is a type alias for the built sidecars event. + BuiltSidecarsEvent = async.Event[*BlobSidecars] -/* -------------------------------------------------------------------------- */ -/* Brokers */ -/* -------------------------------------------------------------------------- */ + // BeaconBlockReceivedEvent is a type alias for the beacon block received event. + BeaconBlockReceivedEvent = async.Event[*BeaconBlock] + + // SidecarsReceivedEvent is a type alias for the sidecars received event. + SidecarsReceivedEvent = async.Event[*BlobSidecars] + + // BeaconBlockVerifiedEvent is a type alias for the beacon block verified event. + BeaconBlockVerifiedEvent = async.Event[*BeaconBlock] + + // SidecarsVerifiedEvent is a type alias for the sidecars verified event. + SidecarsVerifiedEvent = async.Event[*BlobSidecars] + + // FinalBeaconBlockReceivedEvent is a type alias for the final beacon block received event. + FinalBeaconBlockReceivedEvent = async.Event[*BeaconBlock] + + // FinalSidecarsReceivedEvent is a type alias for the final sidecars received event. + FinalSidecarsReceivedEvent = async.Event[*BlobSidecars] + + // FinalValidatorUpdatesProcessedEvent is a type alias for the final validator updates processed event. + FinalValidatorUpdatesProcessedEvent = async.Event[transition.ValidatorUpdates] + + // FinalizedBlockEvent is a type alias for the block event. + FinalizedBlockEvent = async.Event[*BeaconBlock] +) +// Messages. type ( - // GenesisBroker is a type alias for the genesis feed. - GenesisBroker = broker.Broker[*GenesisEvent] + // BlockMessage is a type alias for the block message. + BlockMessage = async.Event[*BeaconBlock] + + // GenesisMessage is a type alias for the genesis message. + GenesisMessage = async.Event[*Genesis] + + // SidecarMessage is a type alias for the sidecar message. + SidecarMessage = async.Event[*BlobSidecars] - // SidecarsBroker is a type alias for the blob feed. - SidecarsBroker = broker.Broker[*SidecarEvent] + // SlotMessage is a type alias for the slot message. + SlotMessage = async.Event[*SlotData] - // BlockBroker is a type alias for the block feed. - BlockBroker = broker.Broker[*BlockEvent] + // StatusMessage is a type alias for the status message. + StatusMessage = async.Event[*service.StatusEvent] +) + +/* -------------------------------------------------------------------------- */ +/* Publishers */ +/* -------------------------------------------------------------------------- */ - // SlotBroker is a type alias for the slot feed. - SlotBroker = broker.Broker[*SlotEvent] +type ( + BeaconBlockFinalizedPublisher = broker.Broker[FinalizedBlockEvent] +) - // StatusBroker is a type alias for the status feed. - StatusBroker = broker.Broker[*StatusEvent] +/* -------------------------------------------------------------------------- */ +/* Dispatcher */ +/* -------------------------------------------------------------------------- */ - // ValidatorUpdateBroker is a type alias for the validator update feed. - ValidatorUpdateBroker = broker.Broker[*ValidatorUpdateEvent] +type ( + // Dispatcher is a type alias for the dispatcher. + Dispatcher = dispatcher.Dispatcher ) /* -------------------------------------------------------------------------- */ @@ -489,7 +523,7 @@ type ( // ProofAPIHandler is a type alias for the proof handler. ProofAPIHandler = proofapi.Handler[ - NodeAPIContext, *BeaconBlockHeader, *BeaconState, - *BeaconStateMarshallable, *ExecutionPayloadHeader, *Validator, + *BeaconBlockHeader, *BeaconState, *BeaconStateMarshallable, + NodeAPIContext, *ExecutionPayloadHeader, *Validator, ] ) diff --git a/mod/node-core/pkg/components/validator_service.go b/mod/node-core/pkg/components/validator_service.go index ab6c958a7f..ca3a41f04c 100644 --- a/mod/node-core/pkg/components/validator_service.go +++ b/mod/node-core/pkg/components/validator_service.go @@ -35,19 +35,17 @@ type ValidatorServiceInput[ LoggerT log.AdvancedLogger[any, LoggerT], ] struct { depinject.In - BeaconBlockFeed *BlockBroker - BlobProcessor *BlobProcessor - Cfg *config.Config - ChainSpec common.ChainSpec - LocalBuilder *LocalBuilder - Logger LoggerT - StateProcessor *StateProcessor - StorageBackend *StorageBackend - Signer crypto.BLSSigner - SidecarsFeed *SidecarsBroker - SidecarFactory *SidecarFactory - SlotBroker *SlotBroker - TelemetrySink *metrics.TelemetrySink + BlobProcessor *BlobProcessor + Cfg *config.Config + ChainSpec common.ChainSpec + Dispatcher *Dispatcher + LocalBuilder *LocalBuilder + Logger LoggerT + StateProcessor *StateProcessor + StorageBackend *StorageBackend + Signer crypto.BLSSigner + SidecarFactory *SidecarFactory + TelemetrySink *metrics.TelemetrySink } // ProvideValidatorService is a depinject provider for the validator service. @@ -56,11 +54,6 @@ func ProvideValidatorService[ ]( in ValidatorServiceInput[LoggerT], ) (*ValidatorService, error) { - slotSubscription, err := in.SlotBroker.Subscribe() - if err != nil { - in.Logger.Error("failed to subscribe to slot feed", "err", err) - return nil, err - } // Build the builder service. return validator.NewService[ *AttestationData, @@ -89,8 +82,6 @@ func ProvideValidatorService[ in.LocalBuilder, }, in.TelemetrySink, - in.BeaconBlockFeed, - in.SidecarsFeed, - slotSubscription, + in.Dispatcher, ), nil } diff --git a/mod/payload/go.mod b/mod/payload/go.mod index c5223b50d3..51f6d87e7a 100644 --- a/mod/payload/go.mod +++ b/mod/payload/go.mod @@ -78,7 +78,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/payload/go.sum b/mod/payload/go.sum index f03665aa9f..39492fb7e6 100644 --- a/mod/payload/go.sum +++ b/mod/payload/go.sum @@ -264,8 +264,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/payload/pkg/builder/builder.go b/mod/payload/pkg/builder/builder.go index edd681f66f..089429f8ae 100644 --- a/mod/payload/pkg/builder/builder.go +++ b/mod/payload/pkg/builder/builder.go @@ -22,8 +22,6 @@ package builder import ( "github.com/berachain/beacon-kit/mod/log" - "github.com/berachain/beacon-kit/mod/payload/pkg/attributes" - "github.com/berachain/beacon-kit/mod/payload/pkg/cache" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -49,13 +47,9 @@ type PayloadBuilder[ // pc is the payload ID cache, it is used to store // "in-flight" payloads that are being built on // the execution client. - pc *cache.PayloadIDCache[ - PayloadIDT, [32]byte, math.Slot, - ] + pc PayloadCache[PayloadIDT, [32]byte, math.Slot] // attributesFactory is used to create attributes for the - attributesFactory *attributes.Factory[ - BeaconStateT, PayloadAttributesT, WithdrawalT, - ] + attributesFactory AttributesFactory[BeaconStateT, PayloadAttributesT] } // New creates a new service. @@ -71,12 +65,8 @@ func New[ chainSpec common.ChainSpec, logger log.Logger[any], ee ExecutionEngine[ExecutionPayloadT, PayloadAttributesT, PayloadIDT], - pc *cache.PayloadIDCache[ - PayloadIDT, [32]byte, math.Slot, - ], - af *attributes.Factory[ - BeaconStateT, PayloadAttributesT, WithdrawalT, - ], + pc PayloadCache[PayloadIDT, [32]byte, math.Slot], + af AttributesFactory[BeaconStateT, PayloadAttributesT], ) *PayloadBuilder[ BeaconStateT, ExecutionPayloadT, ExecutionPayloadHeaderT, PayloadAttributesT, PayloadIDT, WithdrawalT, diff --git a/mod/payload/pkg/builder/types.go b/mod/payload/pkg/builder/types.go index 7788abb941..1e784a9784 100644 --- a/mod/payload/pkg/builder/types.go +++ b/mod/payload/pkg/builder/types.go @@ -33,7 +33,7 @@ import ( // BeaconState defines the interface for accessing various state-related data // required for block processing. type BeaconState[ - ExecutionPayloadHeaderT ExecutionPayloadHeader, + ExecutionPayloadHeaderT any, WithdrawalT any, ] interface { // GetRandaoMixAtIndex retrieves the RANDAO mix at a specified index. @@ -52,8 +52,15 @@ type BeaconState[ GetBlockRootAtIndex(uint64) (common.Root, error) } +type PayloadCache[PayloadIDT, RootT, SlotT any] interface { + Get(slot SlotT, stateRoot RootT) (PayloadIDT, bool) + Has(slot SlotT, stateRoot RootT) bool + Set(slot SlotT, stateRoot RootT, pid PayloadIDT) + UnsafePrunePrior(slot SlotT) +} + // ExecutionPayload is the interface for the execution payload. -type ExecutionPayload[T constraints.ForkTyped[T]] interface { +type ExecutionPayload[T any] interface { constraints.ForkTyped[T] // GetBlockHash returns the block hash. GetBlockHash() common.ExecutionHash @@ -71,6 +78,19 @@ type ExecutionPayloadHeader interface { GetParentHash() common.ExecutionHash } +// AttributesFactory is the interface for the attributes factory. +type AttributesFactory[ + BeaconStateT any, + PayloadAttributesT any, +] interface { + BuildPayloadAttributes( + st BeaconStateT, + slot math.U64, + timestamp uint64, + prevHeadRoot [32]byte, + ) (PayloadAttributesT, error) +} + // PayloadAttributes is the interface for the payload attributes. type PayloadAttributes[ SelfT any, diff --git a/mod/primitives/go.mod b/mod/primitives/go.mod index d40100edb1..02637436e7 100644 --- a/mod/primitives/go.mod +++ b/mod/primitives/go.mod @@ -33,7 +33,7 @@ require ( github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/objx v0.5.2 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/mod/primitives/go.sum b/mod/primitives/go.sum index 3f8444f8cb..e5cb4b5ff7 100644 --- a/mod/primitives/go.sum +++ b/mod/primitives/go.sum @@ -81,8 +81,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= diff --git a/mod/async/pkg/types/event.go b/mod/primitives/pkg/async/event.go similarity index 58% rename from mod/async/pkg/types/event.go rename to mod/primitives/pkg/async/event.go index 51238cec51..68f1cf2781 100644 --- a/mod/async/pkg/types/event.go +++ b/mod/primitives/pkg/async/event.go @@ -18,63 +18,76 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package types +package async import ( "context" "errors" ) -// EventID represents the type of an event. -type EventID string +// BaseEvent defines the minimal interface that the dispatcher expects from a +// message. +type BaseEvent interface { + ID() EventID + Context() context.Context +} -// Event represents a generic event in the beacon chain. -type Event[DataT any] struct { - // ctx is the context associated with the event. - ctx context.Context - // eventType is the name of the event. - eventType EventID - // event is the actual beacon event. - data DataT - // error is the error associated with the event. - err error +// Event defines the interface that the underlying route expects from a +// message with data. +type Event[DataT any] interface { + BaseEvent + Data() DataT + Error() error + Is(id EventID) bool } // NewEvent creates a new Event with the given context and beacon event. func NewEvent[ DataT any, ]( - ctx context.Context, eventType EventID, data DataT, errs ...error, -) *Event[DataT] { - return &Event[DataT]{ - ctx: ctx, - eventType: eventType, - data: data, - err: errors.Join(errs...), + ctx context.Context, id EventID, data DataT, errs ...error, +) Event[DataT] { + return &event[DataT]{ + ctx: ctx, + id: id, + data: data, + err: errors.Join(errs...), } } -// Type returns the type of the event. -func (e Event[DataT]) Type() EventID { - return e.eventType +// An event is a hard type implementation of the Event interface. +type event[DataT any] struct { + // ctx is the context associated with the event. + ctx context.Context + // id is the name of the event. + id EventID + // event is the actual beacon event. + data DataT + // err is the error associated with the event. + err error +} + +// ID returns the ID of the event. +func (m *event[DataT]) ID() EventID { + return m.id } // Context returns the context associated with the event. -func (e Event[DataT]) Context() context.Context { - return e.ctx +func (m *event[DataT]) Context() context.Context { + return m.ctx } // Data returns the data associated with the event. -func (e Event[DataT]) Data() DataT { - return e.data +func (m *event[DataT]) Data() DataT { + return m.data } // Error returns the error associated with the event. -func (e Event[DataT]) Error() error { - return e.err +func (m *event[DataT]) Error() error { + return m.err } // Is returns true if the event has the given type. -func (e Event[DataT]) Is(eventType EventID) bool { - return e.eventType == eventType +func (m *event[DataT]) Is(messageType EventID) bool { + return m.id == messageType } diff --git a/mod/primitives/pkg/async/id.go b/mod/primitives/pkg/async/id.go new file mode 100644 index 0000000000..69c77fe10c --- /dev/null +++ b/mod/primitives/pkg/async/id.go @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package async + +// EventID represents the type of a message. +type EventID string + +// event ids, topologically sorted. +const ( + + // genesis data events. + GenesisDataReceived = "genesis-data-received" + GenesisDataProcessed = "genesis-data-processed" + + // pre proposal events. + NewSlot = "new-slot" + BuiltBeaconBlock = "built-beacon-block" + BuiltSidecars = "built-sidecars" + + // proposal processing events. + BeaconBlockReceived = "beacon-block-received" + SidecarsReceived = "sidecars-received" + BeaconBlockVerified = "beacon-block-verified" + SidecarsVerified = "sidecars-verified" + + // finalize block events. + FinalBeaconBlockReceived = "final-beacon-block-received" + FinalSidecarsReceived = "final-blob-sidecars-received" + FinalValidatorUpdatesProcessed = "final-validator-updates" + BeaconBlockFinalizedEvent = "beacon-block-finalized" +) diff --git a/mod/primitives/pkg/transition/validator_update.go b/mod/primitives/pkg/transition/validator_update.go index 191f4f6458..a5f752c9b2 100644 --- a/mod/primitives/pkg/transition/validator_update.go +++ b/mod/primitives/pkg/transition/validator_update.go @@ -32,16 +32,26 @@ type ValidatorUpdates []*ValidatorUpdate // ValidatorUpdate is a struct that holds the validator update. type ValidatorUpdate struct { - // Pubkey is the public key of the validator. + // Pubkey is the public key of the validator. PubKey identifies + // updates, meaning that two validator updates are considered equal + // if they refer to the same PubKey Pubkey crypto.BLSPubkey // EffectiveBalance is the effective balance of the validator. EffectiveBalance math.Gwei } -// RemoveDuplicates removes duplicate validator updates. We +// CanonicalSort sorts validator updates in the canonical order. +// Canonical order requires validators updates being sorted +// by their PubKey, with no duplicates. In case of duplicates +// the latest is preferred. +func (vu ValidatorUpdates) CanonicalSort() ValidatorUpdates { + return vu.removeDuplicates().sort() +} + +// removeDuplicates removes duplicate validator updates. We // iterate through the list backwards since we want the last // update to be the one that is kept. -func (vu ValidatorUpdates) RemoveDuplicates() ValidatorUpdates { +func (vu ValidatorUpdates) removeDuplicates() ValidatorUpdates { duplicateCheck := make(map[crypto.BLSPubkey]struct{}) j := len(vu) - 1 for i := j; i >= 0; i-- { @@ -56,8 +66,8 @@ func (vu ValidatorUpdates) RemoveDuplicates() ValidatorUpdates { return vu } -// Sort sorts the validator updates. -func (vu ValidatorUpdates) Sort() ValidatorUpdates { +// sort sorts the validator updates. +func (vu ValidatorUpdates) sort() ValidatorUpdates { sort.SliceStable(vu, func(i, j int) bool { return string((vu)[i].Pubkey[:]) < string((vu)[j].Pubkey[:]) }) diff --git a/mod/primitives/pkg/transition/validator_update_test.go b/mod/primitives/pkg/transition/validator_update_test.go index 4b7e6f53af..e851dd34e0 100644 --- a/mod/primitives/pkg/transition/validator_update_test.go +++ b/mod/primitives/pkg/transition/validator_update_test.go @@ -26,78 +26,85 @@ import ( "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) -func TestValidatorUpdates_RemoveDuplicates(t *testing.T) { - pubkey1 := crypto.BLSPubkey{1} - pubkey2 := crypto.BLSPubkey{2} - - updates := transition.ValidatorUpdates{ - &transition.ValidatorUpdate{ - Pubkey: pubkey1, - EffectiveBalance: math.Gwei(1000), - }, - &transition.ValidatorUpdate{ - Pubkey: pubkey1, - EffectiveBalance: math.Gwei(1000), - }, - &transition.ValidatorUpdate{ - Pubkey: pubkey2, - EffectiveBalance: math.Gwei(2000), - }, - } - - expected := transition.ValidatorUpdates{ - &transition.ValidatorUpdate{ - Pubkey: pubkey1, - EffectiveBalance: math.Gwei(1000), - }, - &transition.ValidatorUpdate{ - Pubkey: pubkey2, - EffectiveBalance: math.Gwei(2000), - }, - } - - result := updates.RemoveDuplicates() - assert.Equal(t, expected, result) -} - -func TestValidatorUpdates_Sort(t *testing.T) { +func TestValidatorUpdate_CanonicalSort(t *testing.T) { pubkey1 := crypto.BLSPubkey{1} pubkey2 := crypto.BLSPubkey{2} pubkey3 := crypto.BLSPubkey{3} - updates := transition.ValidatorUpdates{ - &transition.ValidatorUpdate{ - Pubkey: pubkey3, - EffectiveBalance: math.Gwei(3000), - }, - &transition.ValidatorUpdate{ - Pubkey: pubkey1, - EffectiveBalance: math.Gwei(1000), - }, - &transition.ValidatorUpdate{ - Pubkey: pubkey2, - EffectiveBalance: math.Gwei(2000), - }, + type test struct { + name string + input transition.ValidatorUpdates + want transition.ValidatorUpdates } - expected := transition.ValidatorUpdates{ - &transition.ValidatorUpdate{ - Pubkey: pubkey1, - EffectiveBalance: math.Gwei(1000), + tests := []test{ + { + name: "RemoveDuplicates-PickLatest", + input: transition.ValidatorUpdates{ + &transition.ValidatorUpdate{ + Pubkey: pubkey1, + EffectiveBalance: math.Gwei(1000), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey1, + EffectiveBalance: math.Gwei(500), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey2, + EffectiveBalance: math.Gwei(2000), + }, + }, + want: transition.ValidatorUpdates{ + &transition.ValidatorUpdate{ + Pubkey: pubkey1, + EffectiveBalance: math.Gwei(500), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey2, + EffectiveBalance: math.Gwei(2000), + }, + }, }, - &transition.ValidatorUpdate{ - Pubkey: pubkey2, - EffectiveBalance: math.Gwei(2000), - }, - &transition.ValidatorUpdate{ - Pubkey: pubkey3, - EffectiveBalance: math.Gwei(3000), + { + name: "SortByPubKey", + input: transition.ValidatorUpdates{ + &transition.ValidatorUpdate{ + Pubkey: pubkey3, + EffectiveBalance: math.Gwei(2000), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey1, + EffectiveBalance: math.Gwei(5000), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey2, + EffectiveBalance: math.Gwei(1000), + }, + }, + want: transition.ValidatorUpdates{ + &transition.ValidatorUpdate{ + Pubkey: pubkey1, + EffectiveBalance: math.Gwei(5000), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey2, + EffectiveBalance: math.Gwei(1000), + }, + &transition.ValidatorUpdate{ + Pubkey: pubkey3, + EffectiveBalance: math.Gwei(2000), + }, + }, }, } - result := updates.Sort() - assert.Equal(t, expected, result) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + got := tc.input.CanonicalSort() + require.Equal(t, tc.want, got) + }) + } } diff --git a/mod/runtime/go.mod b/mod/runtime/go.mod index 1486985388..360eb7d8fb 100644 --- a/mod/runtime/go.mod +++ b/mod/runtime/go.mod @@ -7,21 +7,20 @@ replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240806152830-8fb47b368cd4 cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 cosmossdk.io/core/testing => cosmossdk.io/core/testing v0.0.0-20240806152830-8fb47b368cd4 - cosmossdk.io/x/auth => cosmossdk.io/x/auth v0.0.0-20240806152830-8fb47b368cd4 - cosmossdk.io/x/consensus => cosmossdk.io/x/consensus v0.0.0-20240806152830-8fb47b368cd4 + cosmossdk.io/x/staking => cosmossdk.io/x/staking v0.0.0-20240806152830-8fb47b368cd4 github.com/cosmos/cosmos-sdk => github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 ) require ( - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc github.com/berachain/beacon-kit/mod/consensus v0.0.0-20240809163303-a4ebb22fd018 github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb22fd018 - github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df - github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c + github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 + github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd - github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 github.com/cometbft/cometbft v1.0.0-rc1.0.20240806094948-2c4293ef36c4 github.com/cometbft/cometbft/api v1.0.0-rc.1.0.20240806094948-2c4293ef36c4 github.com/cosmos/cosmos-db v1.0.2 @@ -173,7 +172,7 @@ require ( github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cosmos/gogoproto v1.5.0 + github.com/cosmos/gogoproto v1.7.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/getsentry/sentry-go v0.28.1 // indirect @@ -196,8 +195,8 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sync v0.8.0 - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect google.golang.org/grpc v1.65.0 // indirect diff --git a/mod/runtime/go.sum b/mod/runtime/go.sum index 1847b25a12..3c5ed0ac11 100644 --- a/mod/runtime/go.sum +++ b/mod/runtime/go.sum @@ -14,8 +14,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -71,16 +71,16 @@ github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb2 github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240809163303-a4ebb22fd018/go.mod h1:A3Ohrylv4Dx2sf8EKJImC7ii091dUaWEAMp/AK5N6+s= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 h1:wVWkiiERY/7kaXvE/VNPPUtYp/l8ky6QSuKM3ThVMXU= github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:LiOiqrJhhLH/GPo0XE5fel3EYyi7X6dwBOyTqZakTeQ= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df h1:6MJllcmMFt6dtvftM5zmdl1WVDpqZkNy3hFXVZtNV0s= -github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df/go.mod h1:yRD7rmnyaaqgq/6+eIVqvSkFJXuLXpBddUu59HUOrtc= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0 h1:kCSrkb/uVXfMKJPKjf0c7nlJkwn5cNwMxtzRW4zNq2A= +github.com/berachain/beacon-kit/mod/errors v0.0.0-20240806211103-d1105603bfc0/go.mod h1:og0jtHZosPDTyhge9tMBlRItoZ4Iv3aZFM9n4QDpcdo= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e h1:0/FDBXtagMkpta/f4J2uAah2NM1G+0dqxngzMzrmbw4= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:7/SXz8S5VpFl2thcKuBdu1OId+SgI1o4N+S1FB92Zw8= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c h1:7f9dLYGOCMoV7LxT6YRmVSWLTPbGTTcxDPLPLvHGrOk= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c/go.mod h1:nFybcw/ZhJ6Gu66dna301W2I7u61skm2HfHxQmdR68Q= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd h1:DYSjsq80Omqqlt+z2VcYsSxjZpLqCDRz7CvUDBrLDJE= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240807213340-5779c7a563cd/go.mod h1:BilVBmqKhC4GXYCaIs8QnKaR14kpn3YmF5uYBdayF9I= github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd h1:QHAukFEWl62kscPjRvpqfxCPvd3RSg8cD4mw8qIBhU4= github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:ft214cxJaqrRPOuAjpYwgA9AOElJnHrDZZEQ0jZPWwQ= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 h1:4qwOPga+dKeDelSJ6pseasQq6fcjd7iXhah0y7enuco= github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2/go.mod h1:DUyJJMMuFJ9OZAhnFMLA0KTFGoVw61p8wnqtV3Wgx3c= github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= @@ -149,8 +149,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -648,8 +648,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/mod/runtime/pkg/middleware/abci.go b/mod/runtime/pkg/middleware/abci.go index 8812fa04a3..0490754269 100644 --- a/mod/runtime/pkg/middleware/abci.go +++ b/mod/runtime/pkg/middleware/abci.go @@ -24,16 +24,14 @@ import ( "context" "time" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/errors" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/encoding/json" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" "github.com/berachain/beacon-kit/mod/runtime/pkg/encoding" cmtabci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/gogoproto/proto" - "golang.org/x/sync/errgroup" ) /* -------------------------------------------------------------------------- */ @@ -48,50 +46,39 @@ func (h *ABCIMiddleware[ bz []byte, ) (transition.ValidatorUpdates, error) { var ( - g errgroup.Group - valUpdates transition.ValidatorUpdates - genesisErr error + err error + waitCtx, cancel = context.WithTimeout(ctx, AwaitTimeout) ) + defer cancel() + // TODO: in theory the GenesisDataReceived channel should be empty, but we + // should clear it anyways here to ensure that data is valid. + data := new(GenesisT) - if err := json.Unmarshal(bz, data); err != nil { - return nil, err - } - // Send a request to the chain service to process the genesis data. - if err := h.genesisBroker.Publish(ctx, asynctypes.NewEvent( - ctx, events.GenesisDataProcessRequest, *data, - )); err != nil { + if err = json.Unmarshal(bz, data); err != nil { + h.logger.Error("Failed to unmarshal genesis data", "error", err) return nil, err } - // Wait for the genesis data to be processed. - g.Go(func() error { - valUpdates, genesisErr = h.waitForGenesisData(ctx) - return genesisErr - }) - - if err := g.Wait(); err != nil { + if err = h.dispatcher.Publish( + async.NewEvent(ctx, async.GenesisDataReceived, *data), + ); err != nil { return nil, err } - return valUpdates, nil + return h.waitForGenesisProcessed(waitCtx) } -// waitForGenesisData waits for the genesis data to be processed and returns -// the validator updates. +// waitForGenesisProcessed waits until the genesis data has been processed and +// returns the validator updates, or err if the context is cancelled. func (h *ABCIMiddleware[ - _, _, GenesisT, _, -]) waitForGenesisData(ctx context.Context) ( - transition.ValidatorUpdates, error) { + _, _, _, _, +]) waitForGenesisProcessed( + ctx context.Context, +) (transition.ValidatorUpdates, error) { select { - case msg := <-h.valUpdateSub: - if msg.Type() != events.ValidatorSetUpdated { - return nil, errors.Wrapf( - ErrUnexpectedEvent, - "unexpected event type: %s", msg.Type(), - ) - } - return msg.Data(), msg.Error() case <-ctx.Done(): - return nil, ctx.Err() + return nil, ErrInitGenesisTimeout(ctx.Err()) + case gdpEvent := <-h.subGenDataProcessed: + return gdpEvent.Data(), gdpEvent.Error() } } @@ -101,75 +88,99 @@ func (h *ABCIMiddleware[ // prepareProposal is the internal handler for preparing proposals. func (h *ABCIMiddleware[ - _, _, _, SlotDataT, + BeaconBlockT, BlobSidecarsT, _, SlotDataT, ]) PrepareProposal( ctx context.Context, slotData SlotDataT, ) ([]byte, []byte, error) { var ( - g errgroup.Group - startTime = time.Now() - beaconBlockErr, sidecarsErr error - beaconBlockBz, sidecarsBz []byte + err error + builtBeaconBlock BeaconBlockT + builtSidecars BlobSidecarsT + startTime = time.Now() + awaitCtx, cancel = context.WithTimeout(ctx, AwaitTimeout) ) + // TODO: clear the built beacon block and sidecars channels, else we may + // end up handling old data from previous slots. + defer cancel() defer h.metrics.measurePrepareProposalDuration(startTime) - // Send a request to the validator service to give us a beacon block - // and blob sidecards to pass to ABCI. - if err := h.slotBroker.Publish(ctx, asynctypes.NewEvent( - ctx, events.NewSlot, slotData, - )); err != nil { + if err = h.dispatcher.Publish( + async.NewEvent( + ctx, async.NewSlot, slotData, + ), + ); err != nil { return nil, nil, err } - // Wait for the beacon block to be built. - g.Go(func() error { - beaconBlockBz, beaconBlockErr = h.waitforBeaconBlk(ctx) - return beaconBlockErr - }) - - // Wait for the sidecars to be built. - g.Go(func() error { - sidecarsBz, sidecarsErr = h.waitForSidecars(ctx) - return sidecarsErr - }) - - // Wait for both processes to complete and then - // return the appropriate response. - return beaconBlockBz, sidecarsBz, g.Wait() + // wait for built beacon block + builtBeaconBlock, err = h.waitForBuiltBeaconBlock(awaitCtx) + if err != nil { + return nil, nil, err + } + + // wait for built sidecars + builtSidecars, err = h.waitForBuiltSidecars(awaitCtx) + if err != nil { + return nil, nil, err + } + + // gossip the built beacon block and blob sidecars + return h.handleBuiltBeaconBlockAndSidecars( + ctx, builtBeaconBlock, builtSidecars, + ) } -// waitForSidecars waits for the sidecars to be built and returns them. +// waitForBuiltBeaconBlock waits for the built beacon block to be received. func (h *ABCIMiddleware[ - _, _, _, _, -]) waitForSidecars(ctx context.Context) ([]byte, error) { + BeaconBlockT, BlobSidecarsT, _, SlotDataT, +]) waitForBuiltBeaconBlock( + ctx context.Context, +) (BeaconBlockT, error) { select { case <-ctx.Done(): - return nil, ctx.Err() - case msg := <-h.sidecarsCh: - if msg.Error() != nil { - return nil, msg.Error() - } - return h.blobGossiper.Publish(ctx, msg.Data()) + return *new(BeaconBlockT), ErrBuildBeaconBlockTimeout(ctx.Err()) + case bbEvent := <-h.subBuiltBeaconBlock: + return bbEvent.Data(), bbEvent.Error() } } -// waitforBeaconBlk waits for the beacon block to be built and returns it. +// waitForBuiltSidecars waits for the built sidecars to be received. func (h *ABCIMiddleware[ - _, _, _, _, -]) waitforBeaconBlk(ctx context.Context) ([]byte, error) { + _, BlobSidecarsT, _, _, +]) waitForBuiltSidecars( + ctx context.Context, +) (BlobSidecarsT, error) { select { case <-ctx.Done(): - return nil, ctx.Err() - case beaconBlock := <-h.blkCh: - if beaconBlock.Error() != nil { - return nil, beaconBlock.Error() - } - return h.beaconBlockGossiper.Publish( - ctx, - beaconBlock.Data(), - ) + return *new(BlobSidecarsT), ErrBuildSidecarsTimeout(ctx.Err()) + case scEvent := <-h.subBuiltSidecars: + return scEvent.Data(), scEvent.Error() + } +} + +// handleBuiltBeaconBlockAndSidecars gossips the built beacon block and blob +// sidecars to the network. +func (h *ABCIMiddleware[ + BeaconBlockT, BlobSidecarsT, _, _, +]) handleBuiltBeaconBlockAndSidecars( + ctx context.Context, + bb BeaconBlockT, + sc BlobSidecarsT, +) ([]byte, []byte, error) { + // gossip beacon block + bbBz, bbErr := h.beaconBlockGossiper.Publish( + ctx, bb, + ) + if bbErr != nil { + return nil, nil, bbErr + } + // gossip blob sidecars + scBz, scErr := h.blobGossiper.Publish(ctx, sc) + if scErr != nil { + return nil, nil, scErr } + return bbBz, scBz, nil } /* -------------------------------------------------------------------------- */ @@ -185,12 +196,13 @@ func (h *ABCIMiddleware[ req proto.Message, ) (proto.Message, error) { var ( - blk BeaconBlockT - sidecars BlobSidecarsT - err error - g, _ = errgroup.WithContext(ctx) - startTime = time.Now() + err error + startTime = time.Now() + blk BeaconBlockT + sidecars BlobSidecarsT + awaitCtx, cancel = context.WithTimeout(ctx, AwaitTimeout) ) + defer cancel() abciReq, ok := req.(*cmtabci.ProcessProposalRequest) if !ok { return nil, ErrInvalidProcessProposalRequestType @@ -203,85 +215,63 @@ func (h *ABCIMiddleware[ return h.createProcessProposalResponse(errors.WrapNonFatal(err)) } - // Begin processing the beacon block. - g.Go(func() error { - return h.verifyBeaconBlock(ctx, blk) - }) + // notify that the beacon block has been received. + if err = h.dispatcher.Publish( + async.NewEvent(ctx, async.BeaconBlockReceived, blk), + ); err != nil { + return h.createProcessProposalResponse(errors.WrapNonFatal(err)) + } // Request the blob sidecars. if sidecars, err = h.blobGossiper.Request(ctx, abciReq); err != nil { return h.createProcessProposalResponse(errors.WrapNonFatal(err)) } - // Begin processing the blob sidecars. - g.Go(func() error { - return h.verifyBlobSidecars(ctx, sidecars) - }) + // notify that the sidecars have been received. + if err = h.dispatcher.Publish( + async.NewEvent(ctx, async.SidecarsReceived, sidecars), + ); err != nil { + return h.createProcessProposalResponse(errors.WrapNonFatal(err)) + } - // Wait for both processes to complete and then - // return the appropriate response.s - return h.createProcessProposalResponse(g.Wait()) + // err if the built beacon block or sidecars failed verification. + _, err = h.waitForBeaconBlockVerification(awaitCtx) + if err != nil { + return h.createProcessProposalResponse(err) + } + _, err = h.waitForSidecarVerification(awaitCtx) + if err != nil { + return h.createProcessProposalResponse(err) + } + return h.createProcessProposalResponse(nil) } -// verifyBeaconBlock handles the processing of the beacon block. -// It requests the block, publishes a received event, and waits for -// verification. +// waitForBeaconBlockVerification waits for the built beacon block to be +// verified. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, _, -]) verifyBeaconBlock( + BeaconBlockT, _, _, _, +]) waitForBeaconBlockVerification( ctx context.Context, - blk BeaconBlockT, -) error { - // Publish the received event. - if err := h.blkBroker.Publish( - ctx, - asynctypes.NewEvent(ctx, events.BeaconBlockReceived, blk, nil), - ); err != nil { - return err - } - - // Wait for a response. +) (BeaconBlockT, error) { select { case <-ctx.Done(): - return ctx.Err() - case msg := <-h.blkCh: - if msg.Type() != events.BeaconBlockVerified { - return errors.Wrapf( - ErrUnexpectedEvent, "unexpected event type: %s", msg.Type(), - ) - } - return msg.Error() + return *new(BeaconBlockT), ErrVerifyBeaconBlockTimeout(ctx.Err()) + case vEvent := <-h.subBBVerified: + return vEvent.Data(), vEvent.Error() } } -// processBlobSidecars handles the processing of blob sidecars. -// It requests the sidecars, publishes a received event, and waits for -// processing. +// waitForSidecarVerification waits for the built sidecars to be verified. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, _, -]) verifyBlobSidecars( + _, BlobSidecarsT, _, _, +]) waitForSidecarVerification( ctx context.Context, - sidecars BlobSidecarsT, -) error { - // Publish the received event. - if err := h.sidecarsBroker.Publish( - ctx, - asynctypes.NewEvent(ctx, events.BlobSidecarsReceived, sidecars), - ); err != nil { - return err - } - - // Wait for a response. +) (BlobSidecarsT, error) { select { case <-ctx.Done(): - return ctx.Err() - case msg := <-h.sidecarsCh: - if msg.Type() != events.BlobSidecarsProcessed { - return errors.Wrapf( - ErrUnexpectedEvent, "unexpected event type: %s", msg.Type(), - ) - } - return msg.Error() + return *new(BlobSidecarsT), ErrVerifySidecarsTimeout(ctx.Err()) + case vEvent := <-h.subSCVerified: + return vEvent.Data(), vEvent.Error() } } @@ -310,11 +300,19 @@ func (h *ABCIMiddleware[ ]) FinalizeBlock( ctx context.Context, req proto.Message, ) (transition.ValidatorUpdates, error) { + var ( + err error + blk BeaconBlockT + blobs BlobSidecarsT + finalValUpdates transition.ValidatorUpdates + awaitCtx, cancel = context.WithTimeout(ctx, AwaitTimeout) + ) + defer cancel() abciReq, ok := req.(*cmtabci.FinalizeBlockRequest) if !ok { return nil, ErrInvalidFinalizeBlockRequestType } - blk, blobs, err := encoding. + blk, blobs, err = encoding. ExtractBlobsAndBlockFromRequest[BeaconBlockT, BlobSidecarsT]( abciReq, BeaconBlockTxIndex, @@ -324,72 +322,43 @@ func (h *ABCIMiddleware[ )) if err != nil { // If we don't have a block, we can't do anything. - //nolint:nilerr // by design. return nil, nil } - // Send the sidecars to the sidecars feed and wait for a response - if err = h.processSidecars(ctx, blobs); err != nil { + // notify that the final beacon block has been received. + if err = h.dispatcher.Publish( + async.NewEvent(ctx, async.FinalBeaconBlockReceived, blk), + ); err != nil { return nil, err } - // Process the beacon block and return the validator updates. - return h.processBeaconBlock( - ctx, blk, - ) -} - -// processSidecars publishes the sidecars and waits for a response. -func (h *ABCIMiddleware[ - _, BlobSidecarsT, _, _, -]) processSidecars(ctx context.Context, blobs BlobSidecarsT) error { - // Publish the sidecars. - if err := h.sidecarsBroker.Publish(ctx, asynctypes.NewEvent( - ctx, events.BlobSidecarsProcessRequest, blobs, - )); err != nil { - return err + // notify that the final blob sidecars have been received. + if err = h.dispatcher.Publish( + async.NewEvent(ctx, async.FinalSidecarsReceived, blobs), + ); err != nil { + return nil, err } - // Wait for the sidecars to be processed. - select { - case <-ctx.Done(): - return ctx.Err() - case msg := <-h.sidecarsCh: - if msg.Type() != events.BlobSidecarsProcessed { - return errors.Wrapf( - ErrUnexpectedEvent, - "unexpected event type: %s", msg.Type(), - ) - } - return msg.Error() + // wait for the final validator updates. + finalValUpdates, err = h.waitForFinalValidatorUpdates(awaitCtx) + if err != nil { + return nil, err } + + return finalValUpdates, nil } -// processBeaconBlock processes the beacon block and returns validator updates. +// waitForFinalValidatorUpdates waits for the final validator updates to be +// received. func (h *ABCIMiddleware[ - BeaconBlockT, _, _, _, -]) processBeaconBlock( - ctx context.Context, blk BeaconBlockT, + _, _, _, _, +]) waitForFinalValidatorUpdates( + ctx context.Context, ) (transition.ValidatorUpdates, error) { - // Publish the verified block event. - if err := h.blkBroker.Publish( - ctx, asynctypes.NewEvent( - ctx, events.BeaconBlockFinalizedRequest, blk, - )); err != nil { - return nil, err - } - - // Wait for the block to be processed. select { - case msg := <-h.valUpdateSub: - if msg.Type() != events.ValidatorSetUpdated { - return nil, errors.Wrapf( - ErrUnexpectedEvent, - "unexpected event type: %s", msg.Type(), - ) - } - return msg.Data(), msg.Error() case <-ctx.Done(): - return nil, ctx.Err() + return nil, ErrFinalValidatorUpdatesTimeout(ctx.Err()) + case event := <-h.subFinalValidatorUpdates: + return event.Data(), event.Error() } } diff --git a/mod/runtime/pkg/middleware/constants.go b/mod/runtime/pkg/middleware/constants.go index 4862a9a5b9..283b75aa59 100644 --- a/mod/runtime/pkg/middleware/constants.go +++ b/mod/runtime/pkg/middleware/constants.go @@ -20,6 +20,8 @@ package middleware +import "time" + const ( // BeaconBlockTxIndex represents the index of the beacon block transaction. // It is the first transaction in the tx list. @@ -27,4 +29,6 @@ const ( // BlobSidecarsTxIndex represents the index of the blob sidecar transaction. // It follows the beacon block transaction in the tx list. BlobSidecarsTxIndex + // AwaitTimeout is the timeout for awaiting events. + AwaitTimeout = 2 * time.Second ) diff --git a/mod/runtime/pkg/middleware/errors.go b/mod/runtime/pkg/middleware/errors.go index 94de197ecd..dccdc6df60 100644 --- a/mod/runtime/pkg/middleware/errors.go +++ b/mod/runtime/pkg/middleware/errors.go @@ -20,8 +20,9 @@ package middleware -import "errors" +import "github.com/berachain/beacon-kit/mod/errors" +//nolint:gochecknoglobals // errors var ( // ErrUnexpectedEvent is returned when an unexpected event is encountered. ErrUnexpectedEvent = errors.New("unexpected event") @@ -30,9 +31,46 @@ var ( ErrInvalidProcessProposalRequestType = errors.New( "invalid process proposal request type", ) + // ErrInvalidFinalizeBlockRequestType is returned when an invalid // finalize block request type is encountered. ErrInvalidFinalizeBlockRequestType = errors.New( - "invalid pre block request type", + "invalid finalize block request type", ) + + ErrInitGenesisTimeout = func(errTimeout error) error { + return errors.Wrapf(errTimeout, + "A timeout occurred while waiting for genesis data processing", + ) + } + + ErrBuildBeaconBlockTimeout = func(errTimeout error) error { + return errors.Wrapf(errTimeout, + "A timeout occurred while waiting for a beacon block to be built", + ) + } + + ErrBuildSidecarsTimeout = func(errTimeout error) error { + return errors.Wrapf(errTimeout, + "A timeout occurred while waiting for blob sidecars to be built", + ) + } + + ErrVerifyBeaconBlockTimeout = func(errTimeout error) error { + return errors.Wrapf(errTimeout, + "A timeout occurred while waiting for a beacon block to be verified", + ) + } + + ErrVerifySidecarsTimeout = func(errTimeout error) error { + return errors.Wrapf(errTimeout, + "A timeout occurred while waiting for blob sidecars to be verified", + ) + } + + ErrFinalValidatorUpdatesTimeout = func(errTimeout error) error { + return errors.Wrapf(errTimeout, + "A timeout occurred while waiting for final validator updates", + ) + } ) diff --git a/mod/runtime/pkg/middleware/middleware.go b/mod/runtime/pkg/middleware/middleware.go index 7beb5b12ab..d5fff4594a 100644 --- a/mod/runtime/pkg/middleware/middleware.go +++ b/mod/runtime/pkg/middleware/middleware.go @@ -24,13 +24,11 @@ import ( "context" "encoding/json" - "github.com/berachain/beacon-kit/mod/async/pkg/broker" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" "github.com/berachain/beacon-kit/mod/p2p" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" - "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" "github.com/berachain/beacon-kit/mod/runtime/pkg/encoding" rp2p "github.com/berachain/beacon-kit/mod/runtime/pkg/p2p" ) @@ -60,33 +58,23 @@ type ABCIMiddleware[ encoding.ABCIRequest, BeaconBlockT, ] + dispatcher types.Dispatcher // metrics is the metrics emitter. metrics *ABCIMiddlewareMetrics // logger is the logger for the middleware. logger log.Logger[any] - - // Feeds - // - // genesisBroker is a feed for genesis data. - genesisBroker *broker.Broker[*asynctypes.Event[GenesisT]] - // blkBroker is a feed for blocks. - blkBroker *broker.Broker[*asynctypes.Event[BeaconBlockT]] - // sidecarsBroker is a feed for sidecars. - sidecarsBroker *broker.Broker[*asynctypes.Event[BlobSidecarsT]] - // slotBroker is a feed for slots. - slotBroker *broker.Broker[*asynctypes.Event[SlotDataT]] - - // Channels - // blkCh is used to communicate the beacon block to the EndBlock method. - blkCh chan *asynctypes.Event[BeaconBlockT] - // sidecarsCh is used to communicate the sidecars to the EndBlock method. - sidecarsCh chan *asynctypes.Event[BlobSidecarsT] - // valUpdateSub is the channel for listening for incoming validator set - // updates. - valUpdateSub chan *asynctypes.Event[transition.ValidatorUpdates] + // subscription channels + subGenDataProcessed chan async.Event[validatorUpdates] + subBuiltBeaconBlock chan async.Event[BeaconBlockT] + subBuiltSidecars chan async.Event[BlobSidecarsT] + subBBVerified chan async.Event[BeaconBlockT] + subSCVerified chan async.Event[BlobSidecarsT] + subFinalValidatorUpdates chan async.Event[validatorUpdates] } // NewABCIMiddleware creates a new instance of the Handler struct. +// + func NewABCIMiddleware[ BeaconBlockT BeaconBlock[BeaconBlockT], BlobSidecarsT BlobSidecars[BlobSidecarsT], @@ -96,11 +84,7 @@ func NewABCIMiddleware[ chainSpec common.ChainSpec, logger log.Logger[any], telemetrySink TelemetrySink, - genesisBroker *broker.Broker[*asynctypes.Event[GenesisT]], - blkBroker *broker.Broker[*asynctypes.Event[BeaconBlockT]], - sidecarsBroker *broker.Broker[*asynctypes.Event[BlobSidecarsT]], - slotBroker *broker.Broker[*asynctypes.Event[SlotDataT]], - valUpdateSub chan *asynctypes.Event[transition.ValidatorUpdates], + dispatcher types.Dispatcher, ) *ABCIMiddleware[ BeaconBlockT, BlobSidecarsT, GenesisT, SlotDataT, ] { @@ -117,73 +101,59 @@ func NewABCIMiddleware[ ]( chainSpec, ), - logger: logger, - metrics: newABCIMiddlewareMetrics(telemetrySink), - genesisBroker: genesisBroker, - blkBroker: blkBroker, - sidecarsBroker: sidecarsBroker, - slotBroker: slotBroker, - blkCh: make( - chan *asynctypes.Event[BeaconBlockT], - 1, - ), - sidecarsCh: make( - chan *asynctypes.Event[BlobSidecarsT], - 1, - ), - valUpdateSub: valUpdateSub, + logger: logger, + metrics: newABCIMiddlewareMetrics(telemetrySink), + dispatcher: dispatcher, + subGenDataProcessed: make(chan async.Event[validatorUpdates]), + subBuiltBeaconBlock: make(chan async.Event[BeaconBlockT]), + subBuiltSidecars: make(chan async.Event[BlobSidecarsT]), + subBBVerified: make(chan async.Event[BeaconBlockT]), + subSCVerified: make(chan async.Event[BlobSidecarsT]), + subFinalValidatorUpdates: make(chan async.Event[validatorUpdates]), } } -// Name returns the name of the middleware. -func (am *ABCIMiddleware[_, _, _, _]) Name() string { - return "abci-middleware" -} - -// Start the middleware. +// Start subscribes the middleware to the events it needs to listen for. func (am *ABCIMiddleware[_, _, _, _]) Start( - ctx context.Context, + _ context.Context, ) error { - subBlkCh, err := am.blkBroker.Subscribe() - if err != nil { + var err error + if err = am.dispatcher.Subscribe( + async.GenesisDataProcessed, am.subGenDataProcessed, + ); err != nil { return err } - - subSidecarsCh, err := am.sidecarsBroker.Subscribe() - if err != nil { + if err = am.dispatcher.Subscribe( + async.BuiltBeaconBlock, am.subBuiltBeaconBlock, + ); err != nil { + return err + } + if err = am.dispatcher.Subscribe( + async.BuiltSidecars, am.subBuiltSidecars, + ); err != nil { + return err + } + if err = am.dispatcher.Subscribe( + async.BeaconBlockVerified, am.subBBVerified, + ); err != nil { + return err + } + if err = am.dispatcher.Subscribe( + async.SidecarsVerified, am.subSCVerified, + ); err != nil { + return err + } + if err = am.dispatcher.Subscribe( + async.FinalValidatorUpdatesProcessed, am.subFinalValidatorUpdates, + ); err != nil { return err } - - go am.start(ctx, subBlkCh, subSidecarsCh) return nil } -// start starts the middleware. +// Name returns the name of the middleware. func (am *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, _, -]) start( - ctx context.Context, - blkCh chan *asynctypes.Event[BeaconBlockT], - sidecarsCh chan *asynctypes.Event[BlobSidecarsT], -) { - for { - select { - case <-ctx.Done(): - return - case msg := <-blkCh: - switch msg.Type() { - case events.BeaconBlockBuilt: - fallthrough - case events.BeaconBlockVerified: - am.blkCh <- msg - } - case msg := <-sidecarsCh: - switch msg.Type() { - case events.BlobSidecarsBuilt: - fallthrough - case events.BlobSidecarsProcessed: - am.sidecarsCh <- msg - } - } - } + _, _, _, _, +]) Name() string { + return "abci-middleware" } diff --git a/mod/runtime/pkg/middleware/types.go b/mod/runtime/pkg/middleware/types.go index 278e4df050..53423b6520 100644 --- a/mod/runtime/pkg/middleware/types.go +++ b/mod/runtime/pkg/middleware/types.go @@ -24,7 +24,7 @@ import ( "time" "github.com/berachain/beacon-kit/mod/primitives/pkg/constraints" - "github.com/berachain/beacon-kit/mod/primitives/pkg/math" + "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" ) // BeaconBlock is an interface for accessing the beacon block. @@ -32,7 +32,6 @@ type BeaconBlock[SelfT any] interface { constraints.SSZMarshallable constraints.Nillable constraints.Empty[SelfT] - GetSlot() math.Slot NewFromSSZ([]byte, uint32) (SelfT, error) } @@ -44,5 +43,7 @@ type TelemetrySink interface { type BlobSidecars[T any] interface { constraints.SSZMarshallable - Empty() T + constraints.Empty[T] } + +type validatorUpdates = transition.ValidatorUpdates diff --git a/mod/runtime/pkg/service/mocks/dispatcher.mock.go b/mod/runtime/pkg/service/mocks/dispatcher.mock.go new file mode 100644 index 0000000000..4302b03893 --- /dev/null +++ b/mod/runtime/pkg/service/mocks/dispatcher.mock.go @@ -0,0 +1,82 @@ +// Code generated by mockery v2.44.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" +) + +// Dispatcher is an autogenerated mock type for the Dispatcher type +type Dispatcher struct { + mock.Mock +} + +type Dispatcher_Expecter struct { + mock *mock.Mock +} + +func (_m *Dispatcher) EXPECT() *Dispatcher_Expecter { + return &Dispatcher_Expecter{mock: &_m.Mock} +} + +// Start provides a mock function with given fields: ctx +func (_m *Dispatcher) Start(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Start") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Dispatcher_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Dispatcher_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - ctx context.Context +func (_e *Dispatcher_Expecter) Start(ctx interface{}) *Dispatcher_Start_Call { + return &Dispatcher_Start_Call{Call: _e.mock.On("Start", ctx)} +} + +func (_c *Dispatcher_Start_Call) Run(run func(ctx context.Context)) *Dispatcher_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Dispatcher_Start_Call) Return(_a0 error) *Dispatcher_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Dispatcher_Start_Call) RunAndReturn(run func(context.Context) error) *Dispatcher_Start_Call { + _c.Call.Return(run) + return _c +} + +// NewDispatcher creates a new instance of Dispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewDispatcher(t interface { + mock.TestingT + Cleanup(func()) +}) *Dispatcher { + mock := &Dispatcher{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mod/runtime/pkg/service/options.go b/mod/runtime/pkg/service/options.go index 481639b921..f6d43d6a83 100644 --- a/mod/runtime/pkg/service/options.go +++ b/mod/runtime/pkg/service/options.go @@ -20,7 +20,9 @@ package service -import "github.com/berachain/beacon-kit/mod/log" +import ( + "github.com/berachain/beacon-kit/mod/log" +) // RegistryOption is a functional option for the Registry. type RegistryOption func(*Registry) error diff --git a/mod/runtime/pkg/service/registry.go b/mod/runtime/pkg/service/registry.go index 31556d5914..0749a95a42 100644 --- a/mod/runtime/pkg/service/registry.go +++ b/mod/runtime/pkg/service/registry.go @@ -35,6 +35,10 @@ type Basic interface { Name() string } +type Dispatcher interface { + Start(ctx context.Context) error +} + // Registry provides a useful pattern for managing services. // It allows for ease of dependency management and ensures services // dependent on others use the same references in memory. @@ -48,7 +52,8 @@ type Registry struct { } // NewRegistry starts a registry instance for convenience. -func NewRegistry(opts ...RegistryOption) *Registry { +func NewRegistry( + opts ...RegistryOption) *Registry { r := &Registry{ services: make(map[string]Basic), } @@ -63,6 +68,7 @@ func NewRegistry(opts ...RegistryOption) *Registry { // StartAll initialized each service in order of registration. func (s *Registry) StartAll(ctx context.Context) error { + // start all services s.logger.Info("Starting services", "num", len(s.serviceTypes)) for _, typeName := range s.serviceTypes { s.logger.Info("Starting service", "type", typeName) diff --git a/mod/state-transition/go.mod b/mod/state-transition/go.mod index 40f1bbd82b..7aff67e351 100644 --- a/mod/state-transition/go.mod +++ b/mod/state-transition/go.mod @@ -77,7 +77,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/mod/state-transition/go.sum b/mod/state-transition/go.sum index a54a62b4a3..9dd96b8c23 100644 --- a/mod/state-transition/go.sum +++ b/mod/state-transition/go.sum @@ -266,8 +266,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mod/state-transition/pkg/core/interfaces.go b/mod/state-transition/pkg/core/interfaces.go index f0097646cd..6631e65374 100644 --- a/mod/state-transition/pkg/core/interfaces.go +++ b/mod/state-transition/pkg/core/interfaces.go @@ -32,7 +32,7 @@ import ( // is a combination of the read-only and write-only beacon state types. type BeaconState[ T any, - BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], + BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, @@ -60,9 +60,8 @@ type BeaconState[ // ReadOnlyBeaconState is the interface for a read-only beacon state. type ReadOnlyBeaconState[ - BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], - Eth1DataT, ExecutionPayloadHeaderT, ForkT, - ValidatorT, ValidatorsT, WithdrawalT any, + BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, + ForkT, ValidatorT, ValidatorsT, WithdrawalT any, ] interface { ReadOnlyEth1Data[Eth1DataT, ExecutionPayloadHeaderT] ReadOnlyRandaoMixes diff --git a/mod/storage/go.mod b/mod/storage/go.mod index ac6bfafb41..9ace716654 100644 --- a/mod/storage/go.mod +++ b/mod/storage/go.mod @@ -11,10 +11,10 @@ replace ( require ( cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 github.com/berachain/beacon-kit/mod/errors v0.0.0-20240617161612-ab1257fcf5a1 github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c - github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 + github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 github.com/cometbft/cometbft v1.0.0-rc1.0.20240806094948-2c4293ef36c4 github.com/cosmos/cosmos-sdk v0.53.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -55,7 +55,6 @@ require ( cosmossdk.io/x/tx v0.13.4-0.20240623110059-dec2d5583e39 // indirect github.com/DataDog/zstd v1.5.6 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/berachain/beacon-kit/mod/async v0.0.0-20240618214413-d5ec0e66b3dd github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect @@ -68,7 +67,7 @@ require ( github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect @@ -123,7 +122,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect diff --git a/mod/storage/go.sum b/mod/storage/go.sum index 8e90a65e2d..1b98668881 100644 --- a/mod/storage/go.sum +++ b/mod/storage/go.sum @@ -13,8 +13,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -51,16 +51,14 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/berachain/beacon-kit/mod/async v0.0.0-20240618214413-d5ec0e66b3dd h1:YXZN5EGMFId+MlDU1HTo672c1+oAC2ubRzRJFriaNP4= -github.com/berachain/beacon-kit/mod/async v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:ycwqumRG49gb8qg87cc6kVgPeiUDaFMajjLko54Ey+I= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240703145037-b5612ab256db h1:vGczI1vJ6s86tSDS4tsllzlWZUVZ42xZ710GoHMd4to= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240703145037-b5612ab256db/go.mod h1:rbvfJqTKUIckels2AlWy+XuG+UGnegoFQuHC+TUg+zA= github.com/berachain/beacon-kit/mod/errors v0.0.0-20240617161612-ab1257fcf5a1 h1:KlGloi0bl9DevoJPwFPyKcH7fXavgMhUQnwexvFNbY0= github.com/berachain/beacon-kit/mod/errors v0.0.0-20240617161612-ab1257fcf5a1/go.mod h1:iXa+Q+i0q+GCpLzkusulO57K5vlkDgM77jtfMr3QdFA= github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c h1:7f9dLYGOCMoV7LxT6YRmVSWLTPbGTTcxDPLPLvHGrOk= github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c/go.mod h1:nFybcw/ZhJ6Gu66dna301W2I7u61skm2HfHxQmdR68Q= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= -github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954 h1:uNBQB9BcCdLrUA337DJHucrx97KobLsdWNkMA6QFcCg= +github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240820191615-398849c34954/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus= github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 h1:4qwOPga+dKeDelSJ6pseasQq6fcjd7iXhah0y7enuco= github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2/go.mod h1:DUyJJMMuFJ9OZAhnFMLA0KTFGoVw61p8wnqtV3Wgx3c= github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= @@ -115,8 +113,8 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -531,8 +529,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= diff --git a/mod/storage/pkg/manager/manager_test.go b/mod/storage/pkg/manager/manager_test.go index 7f850c23b6..d54e5ca984 100644 --- a/mod/storage/pkg/manager/manager_test.go +++ b/mod/storage/pkg/manager/manager_test.go @@ -31,7 +31,7 @@ import ( "time" "cosmossdk.io/log" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/storage/pkg/manager" "github.com/berachain/beacon-kit/mod/storage/pkg/pruner" "github.com/berachain/beacon-kit/mod/storage/pkg/pruner/mocks" @@ -40,10 +40,9 @@ import ( func TestDBManager_Start(t *testing.T) { mockPrunable := new(mocks.Prunable) - - ch := make(chan *asynctypes.Event[manager.BeaconBlock], 1) + ch := make(chan async.Event[manager.BeaconBlock]) pruneParamsFn := func( - _ *asynctypes.Event[manager.BeaconBlock], + _ async.Event[manager.BeaconBlock], ) (uint64, uint64) { return 0, 0 } diff --git a/mod/storage/pkg/manager/types.go b/mod/storage/pkg/manager/types.go index d4b5ae2ca6..fb50b114eb 100644 --- a/mod/storage/pkg/manager/types.go +++ b/mod/storage/pkg/manager/types.go @@ -26,7 +26,9 @@ package manager import ( - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" + "context" + + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -37,6 +39,8 @@ type BeaconBlock interface { // BlockEvent is an interface for block events. type BlockEvent[BeaconBlockT BeaconBlock] interface { - Is(asynctypes.EventID) bool + Is(async.EventID) bool + ID() async.EventID Data() BeaconBlockT + Context() context.Context } diff --git a/mod/storage/pkg/pruner/mocks/block_event.mock.go b/mod/storage/pkg/pruner/mocks/block_event.mock.go index ac8409728a..93e23bc1be 100644 --- a/mod/storage/pkg/pruner/mocks/block_event.mock.go +++ b/mod/storage/pkg/pruner/mocks/block_event.mock.go @@ -3,9 +3,13 @@ package mocks import ( - types "github.com/berachain/beacon-kit/mod/async/pkg/types" - pruner "github.com/berachain/beacon-kit/mod/storage/pkg/pruner" + context "context" + + async "github.com/berachain/beacon-kit/mod/primitives/pkg/async" + mock "github.com/stretchr/testify/mock" + + pruner "github.com/berachain/beacon-kit/mod/storage/pkg/pruner" ) // BlockEvent is an autogenerated mock type for the BlockEvent type @@ -21,6 +25,53 @@ func (_m *BlockEvent[BeaconBlockT]) EXPECT() *BlockEvent_Expecter[BeaconBlockT] return &BlockEvent_Expecter[BeaconBlockT]{mock: &_m.Mock} } +// Context provides a mock function with given fields: +func (_m *BlockEvent[BeaconBlockT]) Context() context.Context { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Context") + } + + var r0 context.Context + if rf, ok := ret.Get(0).(func() context.Context); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(context.Context) + } + } + + return r0 +} + +// BlockEvent_Context_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Context' +type BlockEvent_Context_Call[BeaconBlockT pruner.BeaconBlock] struct { + *mock.Call +} + +// Context is a helper method to define mock.On call +func (_e *BlockEvent_Expecter[BeaconBlockT]) Context() *BlockEvent_Context_Call[BeaconBlockT] { + return &BlockEvent_Context_Call[BeaconBlockT]{Call: _e.mock.On("Context")} +} + +func (_c *BlockEvent_Context_Call[BeaconBlockT]) Run(run func()) *BlockEvent_Context_Call[BeaconBlockT] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *BlockEvent_Context_Call[BeaconBlockT]) Return(_a0 context.Context) *BlockEvent_Context_Call[BeaconBlockT] { + _c.Call.Return(_a0) + return _c +} + +func (_c *BlockEvent_Context_Call[BeaconBlockT]) RunAndReturn(run func() context.Context) *BlockEvent_Context_Call[BeaconBlockT] { + _c.Call.Return(run) + return _c +} + // Data provides a mock function with given fields: func (_m *BlockEvent[BeaconBlockT]) Data() BeaconBlockT { ret := _m.Called() @@ -66,8 +117,53 @@ func (_c *BlockEvent_Data_Call[BeaconBlockT]) RunAndReturn(run func() BeaconBloc return _c } +// ID provides a mock function with given fields: +func (_m *BlockEvent[BeaconBlockT]) ID() async.EventID { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ID") + } + + var r0 async.EventID + if rf, ok := ret.Get(0).(func() async.EventID); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(async.EventID) + } + + return r0 +} + +// BlockEvent_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type BlockEvent_ID_Call[BeaconBlockT pruner.BeaconBlock] struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *BlockEvent_Expecter[BeaconBlockT]) ID() *BlockEvent_ID_Call[BeaconBlockT] { + return &BlockEvent_ID_Call[BeaconBlockT]{Call: _e.mock.On("ID")} +} + +func (_c *BlockEvent_ID_Call[BeaconBlockT]) Run(run func()) *BlockEvent_ID_Call[BeaconBlockT] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *BlockEvent_ID_Call[BeaconBlockT]) Return(_a0 async.EventID) *BlockEvent_ID_Call[BeaconBlockT] { + _c.Call.Return(_a0) + return _c +} + +func (_c *BlockEvent_ID_Call[BeaconBlockT]) RunAndReturn(run func() async.EventID) *BlockEvent_ID_Call[BeaconBlockT] { + _c.Call.Return(run) + return _c +} + // Is provides a mock function with given fields: _a0 -func (_m *BlockEvent[BeaconBlockT]) Is(_a0 types.EventID) bool { +func (_m *BlockEvent[BeaconBlockT]) Is(_a0 async.EventID) bool { ret := _m.Called(_a0) if len(ret) == 0 { @@ -75,7 +171,7 @@ func (_m *BlockEvent[BeaconBlockT]) Is(_a0 types.EventID) bool { } var r0 bool - if rf, ok := ret.Get(0).(func(types.EventID) bool); ok { + if rf, ok := ret.Get(0).(func(async.EventID) bool); ok { r0 = rf(_a0) } else { r0 = ret.Get(0).(bool) @@ -90,14 +186,14 @@ type BlockEvent_Is_Call[BeaconBlockT pruner.BeaconBlock] struct { } // Is is a helper method to define mock.On call -// - _a0 types.EventID +// - _a0 async.EventID func (_e *BlockEvent_Expecter[BeaconBlockT]) Is(_a0 interface{}) *BlockEvent_Is_Call[BeaconBlockT] { return &BlockEvent_Is_Call[BeaconBlockT]{Call: _e.mock.On("Is", _a0)} } -func (_c *BlockEvent_Is_Call[BeaconBlockT]) Run(run func(_a0 types.EventID)) *BlockEvent_Is_Call[BeaconBlockT] { +func (_c *BlockEvent_Is_Call[BeaconBlockT]) Run(run func(_a0 async.EventID)) *BlockEvent_Is_Call[BeaconBlockT] { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.EventID)) + run(args[0].(async.EventID)) }) return _c } @@ -107,7 +203,7 @@ func (_c *BlockEvent_Is_Call[BeaconBlockT]) Return(_a0 bool) *BlockEvent_Is_Call return _c } -func (_c *BlockEvent_Is_Call[BeaconBlockT]) RunAndReturn(run func(types.EventID) bool) *BlockEvent_Is_Call[BeaconBlockT] { +func (_c *BlockEvent_Is_Call[BeaconBlockT]) RunAndReturn(run func(async.EventID) bool) *BlockEvent_Is_Call[BeaconBlockT] { _c.Call.Return(run) return _c } diff --git a/mod/storage/pkg/pruner/pruner.go b/mod/storage/pkg/pruner/pruner.go index 59e935b2c2..566d5f5ebf 100644 --- a/mod/storage/pkg/pruner/pruner.go +++ b/mod/storage/pkg/pruner/pruner.go @@ -29,9 +29,8 @@ package pruner import ( "context" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" "github.com/berachain/beacon-kit/mod/log" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" ) // Compile-time check to ensure pruner implements the Pruner interface. @@ -43,11 +42,11 @@ type pruner[ BeaconBlockT BeaconBlock, PrunableT Prunable, ] struct { - prunable Prunable - logger log.Logger[any] - name string - feed chan *asynctypes.Event[BeaconBlockT] - pruneRangeFn func(*asynctypes.Event[BeaconBlockT]) (uint64, uint64) + prunable Prunable + logger log.Logger[any] + name string + subBeaconBlockFinalized chan async.Event[BeaconBlockT] + pruneRangeFn func(async.Event[BeaconBlockT]) (uint64, uint64) } // NewPruner creates a new Pruner. @@ -58,40 +57,47 @@ func NewPruner[ logger log.Logger[any], prunable Prunable, name string, - feed chan *asynctypes.Event[BeaconBlockT], - pruneRangeFn func(*asynctypes.Event[BeaconBlockT]) (uint64, uint64), + subBeaconBlockFinalized chan async.Event[BeaconBlockT], + pruneRangeFn func(async.Event[BeaconBlockT]) (uint64, uint64), ) Pruner[PrunableT] { return &pruner[BeaconBlockT, PrunableT]{ - logger: logger, - prunable: prunable, - name: name, - feed: feed, - pruneRangeFn: pruneRangeFn, + logger: logger, + prunable: prunable, + name: name, + pruneRangeFn: pruneRangeFn, + subBeaconBlockFinalized: subBeaconBlockFinalized, } } // Start starts the Pruner by listening for new indexes to prune. -func (p *pruner[_, _]) Start(ctx context.Context) { - go p.start(ctx) +func (p *pruner[BeaconBlockT, PrunableT]) Start(ctx context.Context) { + go p.listen(ctx) } -// start listens for new indexes to prune. -func (p *pruner[_, _]) start(ctx context.Context) { +// listen listens for new finalized blocks and prunes the prunable store based +// on the received finalized block event. +func (p *pruner[_, PrunableT]) listen(ctx context.Context) { for { select { case <-ctx.Done(): return - case event := <-p.feed: - if event.Is(events.BeaconBlockFinalized) { - start, end := p.pruneRangeFn(event) - if err := p.prunable.Prune(start, end); err != nil { - p.logger.Error("‼️ error pruning index ‼️", "error", err) - } - } + case event := <-p.subBeaconBlockFinalized: + p.onFinalizeBlock(event) } } } +// onFinalizeBlock will prune the prunable store based on the received +// finalized block event. +func (p *pruner[BeaconBlockT, PrunableT]) onFinalizeBlock( + event async.Event[BeaconBlockT], +) { + start, end := p.pruneRangeFn(event) + if err := p.prunable.Prune(start, end); err != nil { + p.logger.Error("‼️ error pruning index ‼️", "error", err) + } +} + // Name returns the name of the Pruner. func (p *pruner[_, _]) Name() string { return p.name diff --git a/mod/storage/pkg/pruner/pruner_test.go b/mod/storage/pkg/pruner/pruner_test.go index c716eab188..610ad1ec11 100644 --- a/mod/storage/pkg/pruner/pruner_test.go +++ b/mod/storage/pkg/pruner/pruner_test.go @@ -31,8 +31,7 @@ import ( "time" "cosmossdk.io/log" - asynctypes "github.com/berachain/beacon-kit/mod/async/pkg/types" - "github.com/berachain/beacon-kit/mod/primitives/pkg/events" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" "github.com/berachain/beacon-kit/mod/storage/pkg/pruner" "github.com/berachain/beacon-kit/mod/storage/pkg/pruner/mocks" @@ -40,7 +39,7 @@ import ( ) func pruneRangeFn[BlockT pruner.BeaconBlock]( - event *asynctypes.Event[BlockT], + event async.Event[BlockT], ) (uint64, uint64) { slot := event.Data().GetSlot().Unwrap() return slot, slot @@ -72,7 +71,7 @@ func TestPruner(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { logger := log.NewNopLogger() - ch := make(chan *asynctypes.Event[pruner.BeaconBlock]) + ch := make(chan async.Event[pruner.BeaconBlock]) mockPrunable := new(mocks.Prunable) mockPrunable.On("Prune", mock.Anything, mock.Anything). Return(nil) @@ -93,9 +92,9 @@ func TestPruner(t *testing.T) { for _, index := range tt.pruneIndexes { block := mocks.BeaconBlock{} block.On("GetSlot").Return(math.U64(index)) - event := asynctypes.NewEvent[pruner.BeaconBlock]( + event := async.NewEvent[pruner.BeaconBlock]( context.Background(), - events.BeaconBlockFinalized, + async.BeaconBlockFinalizedEvent, &block, ) ch <- event diff --git a/mod/storage/pkg/pruner/types.go b/mod/storage/pkg/pruner/types.go index 57db6a9884..1080a79116 100644 --- a/mod/storage/pkg/pruner/types.go +++ b/mod/storage/pkg/pruner/types.go @@ -28,6 +28,7 @@ package pruner import ( "context" + "github.com/berachain/beacon-kit/mod/primitives/pkg/async" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" ) @@ -36,6 +37,14 @@ type BeaconBlock interface { GetSlot() math.U64 } +// BlockEvent is an interface for block events. +type BlockEvent[BeaconBlockT BeaconBlock] interface { + Is(async.EventID) bool + Data() BeaconBlockT + Context() context.Context + ID() async.EventID +} + // Prunable is an interface representing a store that can be pruned. type Prunable interface { // Prune prunes the store from [start, end). diff --git a/testing/benchmarks/logger_benchmark_test.go b/testing/benchmarks/logger_benchmark_test.go index 482749dda9..336b1ec2cf 100644 --- a/testing/benchmarks/logger_benchmark_test.go +++ b/testing/benchmarks/logger_benchmark_test.go @@ -24,9 +24,7 @@ import ( "bytes" "testing" - "cosmossdk.io/log" "github.com/berachain/beacon-kit/mod/log/pkg/phuslu" - "github.com/cosmos/cosmos-sdk/server" ) /* -------------------------------------------------------------------------- */ @@ -51,15 +49,6 @@ func BenchmarkPhusluLoggerJSONInfo(b *testing.B) { } } -// Benchmark function for SDK logger Info. -func BenchmarkSDKLoggerInfo(b *testing.B) { - logger := newSDKLoggerWithLevel(b, "Info") - b.ResetTimer() - for n := 0; n < b.N; n++ { - logger.Info("This is an info message", "key1", "value1", "key2", 2) - } -} - /* -------------------------------------------------------------------------- */ /* Warn */ /* -------------------------------------------------------------------------- */ @@ -82,15 +71,6 @@ func BenchmarkPhusluLoggerJSONWarn(b *testing.B) { } } -// Benchmark function for cosmos logger Warn. -func BenchmarkSDKLoggerWarn(b *testing.B) { - logger := newSDKLoggerWithLevel(b, "Warn") - b.ResetTimer() - for n := 0; n < b.N; n++ { - logger.Warn("This is a warning message", "key1", "value1", "key2", 2) - } -} - /* -------------------------------------------------------------------------- */ /* Error */ /* -------------------------------------------------------------------------- */ @@ -113,15 +93,6 @@ func BenchmarkPhusluLoggerJSONError(b *testing.B) { } } -// Benchmark function for cosmos logger Error. -func BenchmarkSDKLoggerError(b *testing.B) { - logger := newSDKLoggerWithLevel(b, "Error") - b.ResetTimer() - for n := 0; n < b.N; n++ { - logger.Error("This is an error message", "key1", "value1", "key2", 2) - } -} - /* -------------------------------------------------------------------------- */ /* Debug */ /* -------------------------------------------------------------------------- */ @@ -160,23 +131,6 @@ func BenchmarkPhusluLoggerJSONDebugSilent(b *testing.B) { } } -// Benchmark function for cosmos logger Debug. -func BenchmarkSDKLoggerDebug(b *testing.B) { - logger := newSDKLoggerWithLevel(b, "Debug") - b.ResetTimer() - for n := 0; n < b.N; n++ { - logger.Debug("This is a debug message", "key1", "value1", "key2", 2) - } -} - -func BenchmarkSDKLoggerDebugSilent(b *testing.B) { - logger := newSDKLoggerWithLevel(b, "Info") - b.ResetTimer() - for n := 0; n < b.N; n++ { - logger.Debug("This is a debug message", "key1", "value1", "key2", 2) - } -} - /* -------------------------------------------------------------------------- */ /* With */ /* -------------------------------------------------------------------------- */ @@ -203,33 +157,10 @@ func BenchmarkPhusluLoggerJSONWith(b *testing.B) { } } -// Benchmark function for cosmos logger With. -func BenchmarkSDKLoggerWith(b *testing.B) { - logger := newSDKLoggerWithLevel(b, "Debug") - b.ResetTimer() - for n := 0; n < b.N; n++ { - newLogger := logger.With("contextKey", "contextValue") - newLogger.Info("This is a contextual info message", "key1", "value1", - "key2", 2) - } -} - /* -------------------------------------------------------------------------- */ /* Helpers */ /* -------------------------------------------------------------------------- */ -// setup func to create a new cosmos logger with the given log level. -func newSDKLoggerWithLevel(b *testing.B, level string) log.Logger { - b.Helper() - serverCtx := server.NewDefaultContext() - serverCtx.Viper.Set("log_level", level) - logger, err := server.CreateSDKLogger(serverCtx, &bytes.Buffer{}) - if err != nil { - b.Fatalf("failed to create cosmos logger: %v", err) - } - return logger -} - // setup func to create a new phuslu logger with the given log level. func newPhusluLogger() *phuslu.Logger { cfg := phuslu.DefaultConfig() // dummy config diff --git a/mod/primitives/pkg/events/events.go b/testing/e2e/config/defaults.go similarity index 58% rename from mod/primitives/pkg/events/events.go rename to testing/e2e/config/defaults.go index 77f4fa17b3..5cb40423d0 100644 --- a/mod/primitives/pkg/events/events.go +++ b/testing/e2e/config/defaults.go @@ -18,19 +18,16 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package events +package config +// Consensus clients. const ( - NewSlot = "new-slot" - BeaconBlockBuilt = "beacon-block-built" - BeaconBlockReceived = "beacon-block-received" - BeaconBlockVerified = "beacon-block-verified" - BeaconBlockFinalizedRequest = "beacon-block-finalized-request" - BeaconBlockFinalized = "beacon-block-finalized" - ValidatorSetUpdated = "validator-set-updated" - BlobSidecarsBuilt = "blob-sidecars-built" - BlobSidecarsReceived = "blob-sidecars-received" - BlobSidecarsProcessRequest = "blob-sidecars-process-request" - BlobSidecarsProcessed = "blob-sidecars-processed" - GenesisDataProcessRequest = "genesis-data-process-request" + DefaultClient = "cl-validator-beaconkit-0" + AlternateClient = "cl-validator-beaconkit-1" +) + +// Deposits. +const ( + DepositContractAddress = "0x4242424242424242424242424242424242424242" + NumDepositsLoad = 500 ) diff --git a/testing/e2e/e2e_api_test.go b/testing/e2e/e2e_api_test.go new file mode 100644 index 0000000000..b9e14ab04a --- /dev/null +++ b/testing/e2e/e2e_api_test.go @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package e2e_test + +import ( + beaconapi "github.com/attestantio/go-eth2-client/api" + "github.com/berachain/beacon-kit/mod/node-api/handlers/utils" + "github.com/berachain/beacon-kit/testing/e2e/config" +) + +// TestBeaconAPISuite tests that the api test suite is setup correctly with a +// working beacon node-api client. +func (s *BeaconKitE2ESuite) TestBeaconAPIStartup() { + // Wait for execution block 5. + err := s.WaitForFinalizedBlockNumber(5) + s.Require().NoError(err) + + // Get the consensus client. + client := s.ConsensusClients()[config.DefaultClient] + s.Require().NotNil(client) + + // Ensure the state root is not nil. + stateRootResp, err := client.BeaconStateRoot( + s.Ctx(), + &beaconapi.BeaconStateRootOpts{ + State: utils.StateIDHead, + }, + ) + s.Require().NoError(err) + s.Require().NotEmpty(stateRootResp) + s.Require().False(stateRootResp.Data.IsZero()) +} diff --git a/testing/e2e/e2e_staking_test.go b/testing/e2e/e2e_staking_test.go index 36931d8d10..29c87d194f 100644 --- a/testing/e2e/e2e_staking_test.go +++ b/testing/e2e/e2e_staking_test.go @@ -26,26 +26,19 @@ import ( "github.com/berachain/beacon-kit/mod/consensus-types/pkg/types" "github.com/berachain/beacon-kit/mod/geth-primitives/pkg/deposit" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" + "github.com/berachain/beacon-kit/testing/e2e/config" "github.com/berachain/beacon-kit/testing/e2e/suite" "github.com/ethereum/go-ethereum/accounts/abi/bind" gethcommon "github.com/ethereum/go-ethereum/common" coretypes "github.com/ethereum/go-ethereum/core/types" ) -const ( - // DepositContractAddress is the address of the deposit contract. - DepositContractAddress = "0x4242424242424242424242424242424242424242" - DefaultClient = "cl-validator-beaconkit-0" - AlternateClient = "cl-validator-beaconkit-1" - NumDepositsLoad = 500 -) - func (s *BeaconKitE2ESuite) TestDepositRobustness() { // Get the consensus client. - client := s.ConsensusClients()[DefaultClient] + client := s.ConsensusClients()[config.DefaultClient] s.Require().NotNil(client) - client2 := s.ConsensusClients()[AlternateClient] + client2 := s.ConsensusClients()[config.AlternateClient] s.Require().NotNil(client2) // Sender account @@ -80,7 +73,7 @@ func (s *BeaconKitE2ESuite) TestDepositRobustness() { // Bind the deposit contract. dc, err := deposit.NewBeaconDepositContract( - gethcommon.HexToAddress(DepositContractAddress), + gethcommon.HexToAddress(config.DepositContractAddress), s.JSONRPCBalancer(), ) s.Require().NoError(err) @@ -99,7 +92,7 @@ func (s *BeaconKitE2ESuite) TestDepositRobustness() { tx, err = dc.AllowDeposit(&bind.TransactOpts{ From: genesisAccount.Address(), Signer: genesisAccount.SignerFunc(chainID), - }, sender.Address(), NumDepositsLoad) + }, sender.Address(), config.NumDepositsLoad) s.Require().NoError(err) // Wait for the transaction to be mined. @@ -115,7 +108,7 @@ func (s *BeaconKitE2ESuite) TestDepositRobustness() { ) s.Require().NoError(err) - for i := range NumDepositsLoad { + for i := range config.NumDepositsLoad { // Create a deposit transaction. tx, err = s.generateNewDepositTx( dc, @@ -126,7 +119,7 @@ func (s *BeaconKitE2ESuite) TestDepositRobustness() { s.Require().NoError(err) s.Logger(). Info("Deposit transaction created", "txHash", tx.Hash().Hex()) - if i == NumDepositsLoad-1 { + if i == config.NumDepositsLoad-1 { s.Logger().Info( "Waiting for deposit transaction to be mined", "txHash", tx.Hash().Hex(), @@ -158,7 +151,9 @@ func (s *BeaconKitE2ESuite) TestDepositRobustness() { // upper bound: 32ether * 500 + 1ether // lower bound: 32ether * 500 oneEther := big.NewInt(1e18) - totalAmt := new(big.Int).Mul(oneEther, big.NewInt(NumDepositsLoad*32)) + totalAmt := new(big.Int).Mul( + oneEther, big.NewInt(config.NumDepositsLoad*32), + ) upperBound := new(big.Int).Add(totalAmt, oneEther) amtSpent := new(big.Int).Sub(balance, postDepositBalance) @@ -197,7 +192,7 @@ func (s *BeaconKitE2ESuite) generateNewDepositTx( nonce *big.Int, ) (*coretypes.Transaction, error) { // Get the consensus client. - client := s.ConsensusClients()[DefaultClient] + client := s.ConsensusClients()[config.DefaultClient] s.Require().NotNil(client) pubkey, err := client.GetPubKey(s.Ctx()) diff --git a/testing/e2e/suite/setup.go b/testing/e2e/suite/setup.go index c2dcb5f4c3..397e13fc68 100644 --- a/testing/e2e/suite/setup.go +++ b/testing/e2e/suite/setup.go @@ -112,6 +112,7 @@ func (s *KurtosisE2ESuite) SetupSuiteWithOptions(opts ...Option) { "num_full_nodes", len(s.cfg.NetworkConfiguration.FullNodes.Nodes), ) + result, err := s.enclave.RunStarlarkPackageBlocking( s.ctx, "../../kurtosis", diff --git a/testing/e2e/suite/types/beacon_client.go b/testing/e2e/suite/types/beacon_client.go new file mode 100644 index 0000000000..fd029af4ba --- /dev/null +++ b/testing/e2e/suite/types/beacon_client.go @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package types + +import ( + "context" + + client "github.com/attestantio/go-eth2-client" + beaconhttp "github.com/attestantio/go-eth2-client/http" + "github.com/berachain/beacon-kit/mod/errors" +) + +// BeaconKitNodeClient is a wrapper around the client.Service interface to add +// additional methods specific to a beacon-kit node's API. +type BeaconKitNodeClient interface { + client.Service + + client.FarFutureEpochProvider + client.SignedBeaconBlockProvider + client.BlobSidecarsProvider + client.BeaconCommitteesProvider + client.SyncCommitteesProvider + client.AggregateAttestationProvider + client.AggregateAttestationsSubmitter + client.AttestationDataProvider + client.AttestationPoolProvider + client.AttestationsSubmitter + client.AttesterSlashingSubmitter + client.AttesterDutiesProvider + client.SyncCommitteeDutiesProvider + client.SyncCommitteeMessagesSubmitter + client.SyncCommitteeSubscriptionsSubmitter + client.SyncCommitteeContributionProvider + client.SyncCommitteeContributionsSubmitter + client.BLSToExecutionChangesSubmitter + client.BeaconBlockHeadersProvider + client.ProposalProvider + client.ProposalSlashingSubmitter + client.BeaconBlockRootProvider + client.ProposalSubmitter + client.BeaconCommitteeSubscriptionsSubmitter + client.BeaconStateProvider + client.BeaconStateRandaoProvider + client.BeaconStateRootProvider + client.BlindedProposalSubmitter + client.ValidatorRegistrationsSubmitter + client.EventsProvider + client.FinalityProvider + client.ForkChoiceProvider + client.ForkProvider + client.ForkScheduleProvider + client.GenesisProvider + client.NodePeersProvider + client.NodeSyncingProvider + client.NodeVersionProvider + client.ProposalPreparationsSubmitter + client.ProposerDutiesProvider + client.SpecProvider + client.ValidatorBalancesProvider + client.ValidatorsProvider + client.VoluntaryExitSubmitter + client.VoluntaryExitPoolProvider + client.DomainProvider + client.NodeClientProvider + + // Other beacon-kit node-api methods here... +} + +// NewBeaconKitNodeClient creates a new beacon-kit node-api client instance +// with the given cancel context. +func NewBeaconKitNodeClient( + cancelCtx context.Context, + params ...beaconhttp.Parameter, +) (BeaconKitNodeClient, error) { + service, err := beaconhttp.New( + cancelCtx, + params..., + ) + if err != nil { + return nil, err + } + + client, ok := service.(BeaconKitNodeClient) + if !ok { + return nil, errors.New("failed to cast service to BeaconKitNodeClient") + } + + return client, nil +} diff --git a/testing/e2e/suite/types/consensus_client.go b/testing/e2e/suite/types/consensus_client.go index e81a73ba9f..8f7edfc351 100644 --- a/testing/e2e/suite/types/consensus_client.go +++ b/testing/e2e/suite/types/consensus_client.go @@ -24,16 +24,26 @@ import ( "context" "fmt" + beaconhttp "github.com/attestantio/go-eth2-client/http" "github.com/berachain/beacon-kit/mod/errors" rpcclient "github.com/cometbft/cometbft/rpc/client" httpclient "github.com/cometbft/cometbft/rpc/client/http" "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/enclaves" + "github.com/rs/zerolog" ) // ConsensusClient represents a consensus client. type ConsensusClient struct { *WrappedServiceContext + + // Comet JSON-RPC client rpcclient.Client + + // Beacon node-api client + BeaconKitNodeClient + + // Cancel function for the context + cancelFunc context.CancelFunc } // NewConsensusClient creates a new consensus client. @@ -42,7 +52,7 @@ func NewConsensusClient(serviceCtx *WrappedServiceContext) *ConsensusClient { WrappedServiceContext: serviceCtx, } - if err := cc.Connect(); err != nil { + if err := cc.Connect(context.Background()); err != nil { panic(err) } @@ -50,18 +60,38 @@ func NewConsensusClient(serviceCtx *WrappedServiceContext) *ConsensusClient { } // Connect connects the consensus client to the consensus client. -func (cc *ConsensusClient) Connect() error { - // Start by trying to get the public port for the JSON-RPC WebSocket - port, ok := cc.WrappedServiceContext.GetPublicPorts()["cometbft-rpc"] +func (cc *ConsensusClient) Connect(ctx context.Context) error { + // Start by trying to get the public port for the comet JSON-RPC. + cometPort, ok := cc.WrappedServiceContext.GetPublicPorts()["cometbft-rpc"] if !ok { - panic("Couldn't find the public port for the JSON-RPC WebSocket") + panic("Couldn't find the public port for the comet JSON-RPC") } - clientURL := fmt.Sprintf("http://0.0.0.0:%d", port.GetNumber()) + clientURL := fmt.Sprintf("http://0.0.0.0:%d", cometPort.GetNumber()) client, err := httpclient.New(clientURL) if err != nil { return err } cc.Client = client + + // Then try to get the public port for the node API. + nodePort, ok := cc.WrappedServiceContext.GetPublicPorts()["node-api"] + if !ok { + panic("Couldn't find the public port for the node API") + } + cancelCtx, cancel := context.WithCancel(ctx) + cc.BeaconKitNodeClient, err = NewBeaconKitNodeClient( + cancelCtx, + beaconhttp.WithAddress( + fmt.Sprintf("http://0.0.0.0:%d", nodePort.GetNumber()), + ), + beaconhttp.WithLogLevel(zerolog.DebugLevel), + ) + if err != nil { + cancel() + return err + } + cc.cancelFunc = cancel + return nil } @@ -75,13 +105,14 @@ func (cc ConsensusClient) Start( return nil, err } - return res, cc.Connect() + return res, cc.Connect(ctx) } // Stop stops the consensus client. func (cc ConsensusClient) Stop( ctx context.Context, ) (*enclaves.StarlarkRunResult, error) { + cc.cancelFunc() return cc.WrappedServiceContext.Stop(ctx) } @@ -119,3 +150,6 @@ func (cc ConsensusClient) IsActive(ctx context.Context) (bool, error) { return res.ValidatorInfo.VotingPower > 0, nil } + +// TODO: Add helpers for the beacon node-api client (converting from +// go-eth2-client types to beacon-kit consensus types). diff --git a/testing/go.mod b/testing/go.mod index 78aea335b1..0a4bfb1fef 100644 --- a/testing/go.mod +++ b/testing/go.mod @@ -2,57 +2,27 @@ module github.com/berachain/beacon-kit/testing go 1.23.0 -replace ( - // The following are required to build with the latest version of the cosmos-sdk main branch: - cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240806152830-8fb47b368cd4 - cosmossdk.io/core/testing => cosmossdk.io/core/testing v0.0.0-20240806152830-8fb47b368cd4 - github.com/cosmos/cosmos-sdk => github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 -) - require ( - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 + github.com/attestantio/go-eth2-client v0.21.10 github.com/berachain/beacon-kit/mod/consensus-types v0.0.0-20240806160829-cde2d1347e7e github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e - github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44 + github.com/berachain/beacon-kit/mod/log v0.0.0-20240705193247-d464364483df + github.com/berachain/beacon-kit/mod/node-api v0.0.0-20240801184637-7dce5a0acd5b github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 github.com/cometbft/cometbft v1.0.0-rc1.0.20240806094948-2c4293ef36c4 - github.com/cosmos/cosmos-sdk v0.53.0 github.com/ethereum/go-ethereum v1.14.7 github.com/holiman/uint256 v1.3.1 - github.com/kurtosis-tech/kurtosis/api/golang v1.0.0 + github.com/kurtosis-tech/kurtosis/api/golang v1.1.0 github.com/protolambda/zrnt v0.32.2 github.com/protolambda/ztyp v0.2.2 + github.com/rs/zerolog v1.33.0 github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 github.com/stretchr/testify v1.9.0 ) require ( - github.com/cometbft/cometbft/api v1.0.0-rc.1.0.20240806094948-2c4293ef36c4 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/umbracle/fastrlp v0.1.0 // indirect -) - -require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/api v0.7.5 // indirect - cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 // indirect - cosmossdk.io/depinject v1.0.0 // indirect - cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/math v1.3.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect - cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect - cosmossdk.io/x/auth v0.0.0-20240806152830-8fb47b368cd4 // indirect - cosmossdk.io/x/bank v0.0.0-20240806152830-8fb47b368cd4 // indirect - cosmossdk.io/x/consensus v0.0.0-20240806152830-8fb47b368cd4 // indirect - cosmossdk.io/x/staking v0.0.0-20240806152830-8fb47b368cd4 // indirect - cosmossdk.io/x/tx v0.13.4-0.20240623110059-dec2d5583e39 // indirect - filippo.io/edwards25519 v1.1.0 // indirect - github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.2 // indirect - github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.6 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect @@ -62,10 +32,8 @@ require ( github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df // indirect github.com/berachain/beacon-kit/mod/config v0.0.0-20240705193247-d464364483df // indirect github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240808194557-e72e74f58197 // indirect - github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect - github.com/bufbuild/protocompile v0.14.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect @@ -74,50 +42,38 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.13.0 // indirect - // indirect + github.com/cometbft/cometbft/api v1.0.0-rc.1.0.20240806094948-2c4293ef36c4 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.13.0 // indirect - github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/crypto v0.1.2 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect - github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect - github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/docker/go-connections v0.5.0 // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.7.0 // indirect - github.com/emicklei/dot v1.6.2 // indirect github.com/ethereum/c-kzg-4844 v1.0.3 // indirect github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect github.com/fatih/color v1.17.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect github.com/ferranbt/fastssz v0.1.4-0.20240629094022-eac385e6ee79 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.4 // indirect github.com/getsentry/sentry-go v0.28.1 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-playground/validator/v10 v10.22.0 // indirect github.com/go-yaml/yaml v2.1.0+incompatible // indirect github.com/goccy/go-json v0.10.3 // indirect - github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/goccy/go-yaml v1.9.2 // indirect github.com/gofrs/flock v0.12.1 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect - github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -126,63 +82,38 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/orderedcode v0.0.1 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/handlers v1.5.2 // indirect - github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/hashicorp/go-hclog v1.6.3 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-metrics v0.5.3 // indirect - github.com/hashicorp/go-plugin v1.6.1 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect - github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/huandu/skiplist v1.2.0 // indirect - github.com/iancoleman/strcase v0.3.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jhump/protoreflect v1.16.0 // indirect + github.com/huandu/go-clone v1.6.0 // indirect github.com/karalabe/ssz v0.2.1-0.20240724074312-3d1ff7a6f7c4 // indirect github.com/kilic/bls12-381 v0.1.0 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20231031173452-349f1ec9a443 // indirect - github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20240618201332-f662d454b084 // indirect - github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20240618201332-f662d454b084 // indirect - github.com/kurtosis-tech/kurtosis/path-compression v0.0.0-20240618201332-f662d454b084 // indirect + github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230818182330-1a86869414d2 // indirect + github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20230818184218-f4e3e773463b // indirect + github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230803130419-099ee7a4e3dc // indirect + github.com/kurtosis-tech/kurtosis/path-compression v0.0.0-20240307154559-64d2929cd265 // indirect github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 // indirect - github.com/lib/pq v1.10.9 // indirect github.com/linxGnu/grocksdb v1.9.2 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mholt/archiver v3.1.1+incompatible // indirect - github.com/minio/highwayhash v1.0.3 // indirect github.com/minio/sha256-simd v1.0.1 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect - github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nwaples/rardecode v1.1.3 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect - github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/opencontainers/image-spec v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/phuslu/log v1.0.108-0.20240705160716-a8f8c12ae6c6 // indirect github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pk910/dynamic-ssz v0.0.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -192,54 +123,40 @@ require ( github.com/protolambda/bls12-381-util v0.1.0 // indirect github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15 // indirect github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b // indirect + github.com/r3labs/sse/v2 v2.10.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect - github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.6.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.13 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.7.0 // indirect github.com/tklauser/go-sysconf v0.3.14 // indirect github.com/tklauser/numcpus v0.8.0 // indirect - github.com/ulikunitz/xz v0.5.12 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect + github.com/umbracle/fastrlp v0.1.0 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - github.com/zondax/hid v0.9.2 // indirect - github.com/zondax/ledger-go v0.14.3 // indirect - gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect - gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/otel v1.27.0 // indirect + go.opentelemetry.io/otel/metric v1.27.0 // indirect + go.opentelemetry.io/otel/trace v1.27.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/term v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect + gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools/v3 v3.5.1 // indirect - pgregory.net/rapid v1.1.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/testing/go.sum b/testing/go.sum index e422a0c648..4f09c768ad 100644 --- a/testing/go.sum +++ b/testing/go.sum @@ -1,77 +1,23 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.7.3-0.20240806152830-8fb47b368cd4 h1:GWHIYxkZnQZ2/BVzBV0Qu2xyPRcysPI3kHToCGmRmh0= -cosmossdk.io/api v0.7.3-0.20240806152830-8fb47b368cd4/go.mod h1:vV3VnJvvK4IWkc1deNEJ1OAL028zw1WPezwKKDAsq60= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4 h1:YtoU1Rrq8fbvOmLlkS/8bnHTyzjCCS0PE8jvOi0Rwj8= -cosmossdk.io/core v0.12.1-0.20240806152830-8fb47b368cd4/go.mod h1:sLzMwAW9HW+Nm3GltUVHDRSRZbcXLy9+2AYgi2bwt/s= -cosmossdk.io/core/testing v0.0.0-20240806152830-8fb47b368cd4 h1:M/Rcz6Bp6mQLgBdysfnu0ABUWWWcATQ1192/W8jBGy0= -cosmossdk.io/core/testing v0.0.0-20240806152830-8fb47b368cd4/go.mod h1:s6VKCgPZqs+CnW+18fNQqKoQtqxZ+U9bjz9BcySgNPs= -cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= -cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= -cosmossdk.io/x/auth v0.0.0-20240806152830-8fb47b368cd4 h1:e+6AXOLdjp0j+ZCdOyJVJ+zAMF2PVLlMwyBFiVm+gWk= -cosmossdk.io/x/auth v0.0.0-20240806152830-8fb47b368cd4/go.mod h1:B9HtgWG6fy6XZZLvOnGqMxU31CUVaC3q+yWvZ1IXCqk= -cosmossdk.io/x/bank v0.0.0-20240806152830-8fb47b368cd4 h1:p11oqqwpPM+YpVmk3zl0MHlNQBp4y61p/GZpSw9DVMg= -cosmossdk.io/x/bank v0.0.0-20240806152830-8fb47b368cd4/go.mod h1:b9+OQO/zoDDLjKK20CwhPjU7GDpLIeVw3gyYxjam/DM= -cosmossdk.io/x/consensus v0.0.0-20240806152830-8fb47b368cd4 h1:CISlpOSE+2UGSPA0WNwAqjwKLrT1rHSEGwLZ3QCug2M= -cosmossdk.io/x/consensus v0.0.0-20240806152830-8fb47b368cd4/go.mod h1:eMHEvLm6/1ijhYtaZw/D4SxVXrufrx6d4UhcY/Zr3xI= -cosmossdk.io/x/staking v0.0.0-20240806152830-8fb47b368cd4 h1:k5VbC0/BYAkMg/BJKFNQBSE3/B/I+NMuPO99jIhAAm0= -cosmossdk.io/x/staking v0.0.0-20240806152830-8fb47b368cd4/go.mod h1:iZUWClYP5k18b6vRY8Xaq+qlhr9a/VB8gdq6XqRvF1s= -cosmossdk.io/x/tx v0.13.4-0.20240623110059-dec2d5583e39 h1:fZvdmYfQdJ+CX5axx3ChtLOCAIXoLzLoFf7hHAI+fws= -cosmossdk.io/x/tx v0.13.4-0.20240623110059-dec2d5583e39/go.mod h1:iEnMX34NiupZH074wbEtyiozWEGhsk2OSNB3AriYl3A= -filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= -filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= -github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= -github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= -github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/attestantio/go-eth2-client v0.21.10 h1:1DWn42WKjk8mR8jKkjbaDCGNMVnh2IfAWRUmt7iemRo= +github.com/attestantio/go-eth2-client v0.21.10/go.mod h1:d7ZPNrMX8jLfIgML5u7QZxFo2AukLM+5m08iMaLdqb8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/berachain/beacon-kit/mod/chain-spec v0.0.0-20240705193247-d464364483df h1:mnD1LKqDQ0n+OFdDqOuvKaEiUKRJzsO4V0wyyn/gJYg= @@ -86,14 +32,12 @@ github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df h1 github.com/berachain/beacon-kit/mod/errors v0.0.0-20240705193247-d464364483df/go.mod h1:yRD7rmnyaaqgq/6+eIVqvSkFJXuLXpBddUu59HUOrtc= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e h1:0/FDBXtagMkpta/f4J2uAah2NM1G+0dqxngzMzrmbw4= github.com/berachain/beacon-kit/mod/geth-primitives v0.0.0-20240806160829-cde2d1347e7e/go.mod h1:7/SXz8S5VpFl2thcKuBdu1OId+SgI1o4N+S1FB92Zw8= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44 h1:R4+mGOZDYA93rD4AUbYq4fSWmRsJhnlB/ww1ap09WOY= -github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44/go.mod h1:xP5KcG56VfbPgz2ZRHerxm90MkjXMSDaGZNOOO5yfH4= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240705193247-d464364483df h1:SnzeY9SCmKyEx0iGC/C/8E39ozpl/g5yI7lFXpmbMBI= +github.com/berachain/beacon-kit/mod/log v0.0.0-20240705193247-d464364483df/go.mod h1:mJ0ZlK+izcPWcveHAtM4+W0a+8jhu5Y4DMPL2Takacg= +github.com/berachain/beacon-kit/mod/node-api v0.0.0-20240801184637-7dce5a0acd5b h1:TZpt+fWXXnyQOTOSjhZU4fPGAYZaEB5UZ02ZUqRYiVk= +github.com/berachain/beacon-kit/mod/node-api v0.0.0-20240801184637-7dce5a0acd5b/go.mod h1:wgOdrP96dMsXDXHItO4tRLuf8IaHP14RY4MbUPFAc4s= github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197 h1:hk8N7Q1CCKMW/05pRu5rbfRnbTUou5TjULaeeRtbU+E= github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240808194557-e72e74f58197/go.mod h1:7kNnd9rhYjyZJHuXs/ku5drL9EMM64ekJVR181fGmbM= -github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2 h1:4qwOPga+dKeDelSJ6pseasQq6fcjd7iXhah0y7enuco= -github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240808182639-7bdbf06a94f2/go.mod h1:DUyJJMMuFJ9OZAhnFMLA0KTFGoVw61p8wnqtV3Wgx3c= -github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= -github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= @@ -102,10 +46,6 @@ github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdi github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/bufbuild/protocompile v0.14.0 h1:z3DW4IvXE5G/uTOnSQn+qwQQxvhckkTWLS/0No/o7KU= -github.com/bufbuild/protocompile v0.14.0/go.mod h1:N6J1NYzkspJo3ZwyL4Xjvli86XOj1xq4qAasUFxGups= -github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -116,16 +56,8 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= @@ -150,30 +82,9 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.13.0 h1:VPULb/v6bbYELAPTDFINEVaMTTybV5GLxDdcjnS+4oc= github.com/consensys/gnark-crypto v0.13.0/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= -github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= -github.com/cosmos/crypto v0.1.2/go.mod h1:b6VWz3HczIpBaQPvI7KrbQeF3pXHh0al3T5e0uwMBQw= -github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= -github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= -github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= -github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg= @@ -181,8 +92,6 @@ github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwz github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= -github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -200,26 +109,15 @@ github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkz github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= -github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY= github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.7.0 h1:bnQc8+GMnidJZA8zc6lLEAb4xNrIqHwO+9TzqvtQZPo= -github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= -github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/c-kzg-4844 v1.0.3 h1:IEnbOHwjixW2cTvKRUlAAUOeleV7nNM/umJR+qy4WDs= github.com/ethereum/c-kzg-4844 v1.0.3/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= @@ -227,11 +125,9 @@ github.com/ethereum/go-ethereum v1.14.7 h1:EHpv3dE8evQmpVEQ/Ne2ahB06n2mQptdwqaMN github.com/ethereum/go-ethereum v1.14.7/go.mod h1:Mq0biU2jbdmKSZoqOj29017ygFrMnB5/Rifwp980W4o= github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4= github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/ferranbt/fastssz v0.1.4-0.20240629094022-eac385e6ee79 h1:oMYkNRlaY+YxcbYW4U84mQQkujiloBbxQFnTOHUbkec= github.com/ferranbt/fastssz v0.1.4-0.20240629094022-eac385e6ee79/go.mod h1:EGSbefgAPd3M0hlBwOCw4Mkj+0YAaSnXw1QeLasY6XQ= github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= @@ -245,6 +141,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I= +github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= @@ -253,39 +151,42 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/validator/v10 v10.22.0 h1:k6HsTZ0sTnROkhS//R0O+55JgM8C4Bx7ia+JlgcnOao= +github.com/go-playground/validator/v10 v10.22.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/goccy/go-yaml v1.9.2 h1:2Njwzw+0+pjU2gb805ZC1B/uBuAs2VcZ3K+ZgHwDs7w= +github.com/goccy/go-yaml v1.9.2/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= @@ -297,13 +198,8 @@ github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -330,12 +226,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= @@ -345,45 +237,13 @@ github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= -github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= -github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= -github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/go-bexpr v0.1.14 h1:uKDeyuOhWhT1r5CiMTjdVY4Aoxdxs6EtwgTGnlosyp4= github.com/hashicorp/go-bexpr v0.1.14/go.mod h1:gN7hRKB3s7yT+YvTdnhZVLTENejvhlkZ8UE4YVBS+Q8= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= -github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= -github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= -github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= -github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/billy v0.0.0-20240322075458-72a4e81ec6da h1:8qEhdMGSUx67L2s5aGQinJhOwLfIRKLRBHPQq8m6WxE= github.com/holiman/billy v0.0.0-20240322075458-72a4e81ec6da/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -394,27 +254,19 @@ github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXei github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= -github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= -github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/huandu/go-clone v1.6.0 h1:HMo5uvg4wgfiy5FoGOqlFLQED/VGRm2D9Pi8g1FXPGc= +github.com/huandu/go-clone v1.6.0/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= +github.com/huandu/go-clone/generic v1.6.0 h1:Wgmt/fUZ28r16F2Y3APotFD59sHk1p78K0XLdbUYN5U= +github.com/huandu/go-clone/generic v1.6.0/go.mod h1:xgd9ZebcMsBWWcBx5mVMCoqMX24gLWr5lQicr+nVXNs= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jhump/protoreflect v1.16.0 h1:54fZg+49widqXYQ0b+usAFHbMkBGR4PpXrsHc8+TBDg= -github.com/jhump/protoreflect v1.16.0/go.mod h1:oYPd7nPvcBw/5wlDfm/AVmU9zH9BgqGCI469pGxfj/8= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/karalabe/ssz v0.2.1-0.20240724074312-3d1ff7a6f7c4 h1:CvO92iWYv7SS7hWzd1cYaAhGVZmanD/DtUfe0s+kTeg= github.com/karalabe/ssz v0.2.1-0.20240724074312-3d1ff7a6f7c4/go.mod h1:SUFJO5R2VkUK3vT80pjfIB/g7eaQgSU2RhbuL8GOJq4= github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -423,43 +275,37 @@ github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ib github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20231031173452-349f1ec9a443 h1:jqFVT4FcZU+wG+y5FV+Xz9+IwNqSyredbcFKHfK2Kh8= -github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20231031173452-349f1ec9a443/go.mod h1:bWSMQK3WHVTGHX9CjxPAb/LtzcmfOxID2wdzakSWQxo= -github.com/kurtosis-tech/kurtosis/api/golang v1.0.0 h1:1yDQk/xmNkUzsSKIU+catjp00w4bMv9SQerWeTam6ls= -github.com/kurtosis-tech/kurtosis/api/golang v1.0.0/go.mod h1:9T22P7Vv3j5g6sbm78DxHQ4s9C4Cj3s9JjFQ7DFyYpM= -github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20240618201332-f662d454b084 h1:p5aYsEPEK63ksjy4ITv/6UiNhG6Or5qdM0CJuJLJr5o= -github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20240618201332-f662d454b084/go.mod h1:e/6F1JCyK1qVAit/9nQxzBF/EVja11Fc1lzjLeBcDw4= -github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20240618201332-f662d454b084 h1:mHyQDd/97Dj/QCLv1ppoHuD+ljyrSr/J7OUn4XZpQHU= -github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20240618201332-f662d454b084/go.mod h1:xiv0Gc3MWaG43dPC70lTIuoLqhD6MgopEXHoj7cbMNU= -github.com/kurtosis-tech/kurtosis/path-compression v0.0.0-20240618201332-f662d454b084 h1:UydRFCSE24s2sWUOWxpgOyiEcxmK/Y5c3uxh6MA5ef8= -github.com/kurtosis-tech/kurtosis/path-compression v0.0.0-20240618201332-f662d454b084/go.mod h1:aDMrPeS7Gii8W6SDKSKyrBNgEQAUYidriyeKGf+Ml3I= +github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230818182330-1a86869414d2 h1:izciXrFyFR+ihJ7nLTOkoIX5GzBPIp8gVKlw94gIc98= +github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230818182330-1a86869414d2/go.mod h1:bWSMQK3WHVTGHX9CjxPAb/LtzcmfOxID2wdzakSWQxo= +github.com/kurtosis-tech/kurtosis/api/golang v1.1.0 h1:7W7uOwvqmtWmGEDMVGLUvTVWTtFATFFsmFC+DWjrQ8M= +github.com/kurtosis-tech/kurtosis/api/golang v1.1.0/go.mod h1:9T22P7Vv3j5g6sbm78DxHQ4s9C4Cj3s9JjFQ7DFyYpM= +github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20230818184218-f4e3e773463b h1:hMoIM99QKcYQqsnK4AF7Lovi9ZD9ac6lZLZ5D/jx2x8= +github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20230818184218-f4e3e773463b/go.mod h1:4pFdrRwDz5R+Fov2ZuTaPhAVgjA2jhGh1Izf832sX7A= +github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230803130419-099ee7a4e3dc h1:7IlEpSehmWcNXOFpNP24Cu5HQI3af7GCBQw//m+LnvQ= +github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230803130419-099ee7a4e3dc/go.mod h1:TOWMQgvAJH/NiWWERGXg/plT9lS7aFcXFxCa0M5sfHo= +github.com/kurtosis-tech/kurtosis/path-compression v0.0.0-20240307154559-64d2929cd265 h1:uSDftcGStwuAjHv8fV2TleNCKSWPvUKe7EaplFG3yBI= +github.com/kurtosis-tech/kurtosis/path-compression v0.0.0-20240307154559-64d2929cd265/go.mod h1:aDMrPeS7Gii8W6SDKSKyrBNgEQAUYidriyeKGf+Ml3I= github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 h1:YQTATifMUwZEtZYb0LVA7DK2pj8s71iY8rzweuUQ5+g= github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409/go.mod h1:y5weVs5d9wXXHcDA1awRxkIhhHC1xxYJN8a7aXnE6S8= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/linxGnu/grocksdb v1.9.2 h1:O3mzvO0wuzQ9mtlHbDrShixyVjVbmuqTjFrzlf43wZ8= github.com/linxGnu/grocksdb v1.9.2/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -467,15 +313,12 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.1 h1:ZhBBeX8tSlRpu/FFhXH4RC4OJzFlqsQhoHZAz4x7TIw= @@ -483,16 +326,8 @@ github.com/mitchellh/pointerstructure v1.2.1/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8oh github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -501,8 +336,6 @@ github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -517,19 +350,6 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= -github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= -github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 h1:CtBLeckhC0zAXgp5V8uR30CNYH0JgCJoxCg5+6i2zQk= github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -539,32 +359,21 @@ github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9F github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pk910/dynamic-ssz v0.0.3 h1:fCWzFowq9P6SYCc7NtJMkZcIHk+r5hSVD+32zVi6Aio= +github.com/pk910/dynamic-ssz v0.0.3/go.mod h1:b6CrLaB2X7pYA+OSEEbkgXDEcRnjLOZIxZTsMuO/Y9c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/protolambda/bls12-381-util v0.1.0 h1:05DU2wJN7DTU7z28+Q+zejXkIsA/MF8JZQGhtBZZiWk= @@ -577,12 +386,13 @@ github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15 h1:lC8ki github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15/go.mod h1:8svFBIKKu31YriBG/pNizo9N0Jr9i5PQ+dFkxWg3x5k= github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b h1:VK7thFOnhxAZ/5aolr5Os4beiubuD08WiuiHyRqgwks= github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b/go.mod h1:HRuvtXLZ4WkaB1MItToVH2e8ZwKwZPY5/Rcby+CvvLY= +github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0= +github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= @@ -591,74 +401,46 @@ github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= -github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/status-im/keycard-go v0.3.2 h1:YusIF/bHx6YZis8UTOJrpZFnTs4IkRBdmJXqdiXkpFE= github.com/status-im/keycard-go v0.3.2/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= -github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= -github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY= github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= -github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/umbracle/fastrlp v0.1.0 h1:V0W3f6ZKWqbu1KggdhnRWOi+t7+PfL3VyAffJqayI5s= github.com/umbracle/fastrlp v0.1.0/go.mod h1:5RHgqiFjd4vLJESMWagP/E7su+5Gzk0iqqmrotR8WdA= github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= @@ -671,26 +453,17 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= -github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= -github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= -gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= -gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= -gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= -gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -699,73 +472,54 @@ golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbR golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -775,16 +529,13 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= @@ -792,12 +543,10 @@ golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -807,17 +556,13 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4/go.mod h1:EvuUDCulqGgV80RvP1BHuom+smhX4qtlhnNatHuroGQ= google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= @@ -826,12 +571,7 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -845,44 +585,32 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/Knetic/govaluate.v3 v3.0.0 h1:18mUyIt4ZlRlFZAAfVetz4/rzlJs9yhN+U02F4u1AOc= +gopkg.in/Knetic/govaluate.v3 v3.0.0/go.mod h1:csKLBORsPbafmSCGTEh3U7Ozmsuq8ZSIlKk1bcqph0E= +gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= +gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= -pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=