From 882b91e3eccd30fed78c852dff489259dad3171f Mon Sep 17 00:00:00 2001 From: aBear Date: Fri, 8 Nov 2024 23:11:53 +0100 Subject: [PATCH 01/17] added processEffectiveBalanceUpdates --- mod/chain-spec/pkg/chain/chain_spec.go | 24 +++++++ mod/chain-spec/pkg/chain/data.go | 5 ++ .../pkg/core/state_processor.go | 70 +++++++++++++++---- 3 files changed, 86 insertions(+), 13 deletions(-) diff --git a/mod/chain-spec/pkg/chain/chain_spec.go b/mod/chain-spec/pkg/chain/chain_spec.go index 5d65f45e2c..2e76c60ae0 100644 --- a/mod/chain-spec/pkg/chain/chain_spec.go +++ b/mod/chain-spec/pkg/chain/chain_spec.go @@ -45,6 +45,12 @@ type Spec[ // calculations. EffectiveBalanceIncrement() uint64 + HysteresisQuotient() uint64 + + HysteresisDownwardMultiplier() uint64 + + HysteresisUpwardMultiplier() uint64 + // Time parameters constants. // SlotsPerEpoch returns the number of slots in an epoch. @@ -245,6 +251,24 @@ func (c chainSpec[ return c.Data.EffectiveBalanceIncrement } +func (c chainSpec[ + DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT, +]) HysteresisQuotient() uint64 { + return c.Data.HysteresisQuotient +} + +func (c chainSpec[ + DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT, +]) HysteresisDownwardMultiplier() uint64 { + return c.Data.HysteresisDownwardMultiplier +} + +func (c chainSpec[ + DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT, +]) HysteresisUpwardMultiplier() uint64 { + return c.Data.HysteresisUpwardMultiplier +} + // SlotsPerEpoch returns the number of slots per epoch. func (c chainSpec[ DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT, diff --git a/mod/chain-spec/pkg/chain/data.go b/mod/chain-spec/pkg/chain/data.go index 3c3ae2a637..b8eefc34e6 100644 --- a/mod/chain-spec/pkg/chain/data.go +++ b/mod/chain-spec/pkg/chain/data.go @@ -43,6 +43,11 @@ type SpecData[ // EffectiveBalanceIncrement is the effective balance increment. EffectiveBalanceIncrement uint64 `mapstructure:"effective-balance-increment"` + HysteresisQuotient uint64 `mapstructure:"hysteresis-quotient"` + + HysteresisDownwardMultiplier uint64 `mapstructure:"hysteresis-downward-multiplier"` + + HysteresisUpwardMultiplier uint64 `mapstructure:"hysteresis-upward-multiplier"` // Time parameters constants. // // SlotsPerEpoch is the number of slots per epoch. diff --git a/mod/state-transition/pkg/core/state_processor.go b/mod/state-transition/pkg/core/state_processor.go index 34e92d6be7..1e5a97ff61 100644 --- a/mod/state-transition/pkg/core/state_processor.go +++ b/mod/state-transition/pkg/core/state_processor.go @@ -23,6 +23,7 @@ package core import ( "bytes" + "github.com/berachain/beacon-kit/mod/consensus-types/pkg/types" "github.com/berachain/beacon-kit/mod/errors" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/constants" @@ -197,11 +198,7 @@ func (sp *StateProcessor[ ]) ProcessSlots( st BeaconStateT, slot math.Slot, ) (transition.ValidatorUpdates, error) { - var ( - validatorUpdates transition.ValidatorUpdates - epochValidatorUpdates transition.ValidatorUpdates - ) - + var res transition.ValidatorUpdates stateSlot, err := st.GetSlot() if err != nil { return nil, err @@ -209,7 +206,6 @@ func (sp *StateProcessor[ // Iterate until we are "caught up". for ; stateSlot < slot; stateSlot++ { - // Process the slot if err = sp.processSlot(st); err != nil { return nil, err } @@ -217,14 +213,11 @@ func (sp *StateProcessor[ // Process the Epoch Boundary. boundary := (stateSlot.Unwrap()+1)%sp.cs.SlotsPerEpoch() == 0 if boundary { - if epochValidatorUpdates, err = - sp.processEpoch(st); err != nil { + var epochUpdates transition.ValidatorUpdates + if epochUpdates, err = sp.processEpoch(st); err != nil { return nil, err } - validatorUpdates = append( - validatorUpdates, - epochValidatorUpdates..., - ) + res = append(res, epochUpdates...) } // We update on the state because we need to @@ -234,7 +227,7 @@ func (sp *StateProcessor[ } } - return validatorUpdates, nil + return res, nil } // processSlot is run when a slot is missed. @@ -336,6 +329,9 @@ func (sp *StateProcessor[ if err := sp.processRewardsAndPenalties(st); err != nil { return nil, err } + if err := sp.processEffectiveBalanceUpdates(st); err != nil { + return nil, err + } if err := sp.processSlashingsReset(st); err != nil { return nil, err } @@ -516,3 +512,51 @@ func (sp *StateProcessor[ return nil } + +// processEffectiveBalanceUpdates as defined in the Ethereum 2.0 specification. +// https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#effective-balances-updates +// +//nolint:lll +func (sp *StateProcessor[ + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, _, _, +]) processEffectiveBalanceUpdates( + st BeaconStateT, +) error { + // Update effective balances with hysteresis + validators, err := st.GetValidators() + if err != nil { + return err + } + + hysteresisIncrement := sp.cs.EffectiveBalanceIncrement() / sp.cs.HysteresisQuotient() + downwardThreshold := hysteresisIncrement * sp.cs.HysteresisDownwardMultiplier() + upwardThreshold := hysteresisIncrement * sp.cs.HysteresisUpwardMultiplier() + + for _, val := range validators { + var idx math.U64 + idx, err = st.ValidatorIndexByPubkey(val.GetPubkey()) + if err != nil { + return err + } + + var balance math.Gwei + balance, err = st.GetBalance(idx) + if err != nil { + return err + } + + if balance+math.Gwei(downwardThreshold) < val.GetEffectiveBalance() || + val.GetEffectiveBalance()+math.Gwei(upwardThreshold) < balance { + updatedBalance := types.ComputeEffectiveBalance( + balance, + math.U64(sp.cs.EffectiveBalanceIncrement()), + math.U64(sp.cs.MaxEffectiveBalance()), + ) + val.SetEffectiveBalance(updatedBalance) + if err = st.UpdateValidatorAtIndex(idx, val); err != nil { + return err + } + } + } + return nil +} From ebcf8b471804a8211fb8a6cda23583f813897b4f Mon Sep 17 00:00:00 2001 From: aBear Date: Fri, 8 Nov 2024 23:24:44 +0100 Subject: [PATCH 02/17] wip: update validator set returned to consensus --- .../pkg/core/state_processor_committee.go | 11 ++- .../pkg/core/state_processor_genesis_test.go | 84 +++++++++++-------- 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor_committee.go b/mod/state-transition/pkg/core/state_processor_committee.go index 073371a807..2bcc794e4f 100644 --- a/mod/state-transition/pkg/core/state_processor_committee.go +++ b/mod/state-transition/pkg/core/state_processor_committee.go @@ -21,6 +21,7 @@ package core import ( + "github.com/berachain/beacon-kit/mod/primitives/pkg/math" "github.com/berachain/beacon-kit/mod/primitives/pkg/transition" "github.com/sourcegraph/conc/iter" ) @@ -36,8 +37,16 @@ func (sp *StateProcessor[ return nil, err } + // filter out validators whose effective balance is not sufficient to validate + activeVals := make([]ValidatorT, 0, len(vals)) + for _, val := range vals { + if val.GetEffectiveBalance() > math.U64(sp.cs.EjectionBalance()) { + activeVals = append(activeVals, val) + } + } + return iter.MapErr( - vals, + activeVals, func(val *ValidatorT) (*transition.ValidatorUpdate, error) { v := (*val) return &transition.ValidatorUpdate{ diff --git a/mod/state-transition/pkg/core/state_processor_genesis_test.go b/mod/state-transition/pkg/core/state_processor_genesis_test.go index 95a88c0272..f5da46a549 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis_test.go +++ b/mod/state-transition/pkg/core/state_processor_genesis_test.go @@ -55,39 +55,48 @@ func TestInitialize(t *testing.T) { dummyProposerAddressVerifier, ) - // create test inputs kvStore, err := initStore() require.NoError(t, err) beaconState := new(TestBeaconStateT).NewFromDB(kvStore, cs) var ( - deposits = []*types.Deposit{ + maxBalance = math.Gwei(cs.MaxEffectiveBalance()) + increment = math.Gwei(cs.EffectiveBalanceIncrement()) + minBalance = math.Gwei(cs.EjectionBalance()) + ) + + // create test inputs + var ( + goodDeposits = []*types.Deposit{ { Pubkey: [48]byte{0x01}, - Amount: math.Gwei(cs.MaxEffectiveBalance()), + Amount: maxBalance, Index: uint64(0), }, { Pubkey: [48]byte{0x02}, - Amount: math.Gwei(cs.MaxEffectiveBalance() / 2), + Amount: minBalance + increment, Index: uint64(1), }, - { - Pubkey: [48]byte{0x03}, - Amount: math.Gwei(cs.EffectiveBalanceIncrement()), - Index: uint64(2), - }, { Pubkey: [48]byte{0x04}, - Amount: math.Gwei(2 * cs.MaxEffectiveBalance()), + Amount: 2 * maxBalance, Index: uint64(3), }, + } + badDeposits = []*types.Deposit{ + { + Pubkey: [48]byte{0x03}, + Amount: minBalance, + Index: uint64(2), + }, { Pubkey: [48]byte{0x05}, - Amount: math.Gwei(cs.EffectiveBalanceIncrement() * 2 / 3), + Amount: minBalance * 2 / 3, Index: uint64(4), }, } + genDeposits = append(goodDeposits, badDeposits...) executionPayloadHeader = new(types.ExecutionPayloadHeader).Empty() fork = &types.Fork{ PreviousVersion: version.FromUint32[common.Version](version.Deneb), @@ -105,14 +114,14 @@ func TestInitialize(t *testing.T) { // run test vals, err := sp.InitializePreminedBeaconStateFromEth1( beaconState, - deposits, + genDeposits, executionPayloadHeader, fork.CurrentVersion, ) // check outputs require.NoError(t, err) - require.Len(t, vals, len(deposits)) + require.Len(t, vals, len(goodDeposits)) // check beacon state changes resSlot, err := beaconState.GetSlot() @@ -123,14 +132,14 @@ func TestInitialize(t *testing.T) { require.NoError(t, err) require.Equal(t, fork, resFork) - for _, dep := range deposits { + for _, dep := range goodDeposits { checkValidatorNonBartio(t, cs, beaconState, dep) } // check that validator index is duly set latestValIdx, err := beaconState.GetEth1DepositIndex() require.NoError(t, err) - require.Equal(t, uint64(len(deposits)-1), latestValIdx) + require.Equal(t, uint64(len(genDeposits)-1), latestValIdx) } func checkValidatorNonBartio( @@ -176,39 +185,48 @@ func TestInitializeBartio(t *testing.T) { dummyProposerAddressVerifier, ) - // create test inputs kvStore, err := initStore() require.NoError(t, err) beaconState := new(TestBeaconStateT).NewFromDB(kvStore, cs) var ( - deposits = []*types.Deposit{ + maxBalance = math.Gwei(cs.MaxEffectiveBalance()) + increment = math.Gwei(cs.EffectiveBalanceIncrement()) + minBalance = math.Gwei(cs.EjectionBalance()) + ) + + // create test inputs + var ( + goodDeposits = []*types.Deposit{ { Pubkey: [48]byte{0x01}, - Amount: math.Gwei(cs.MaxEffectiveBalance()), + Amount: maxBalance, Index: uint64(0), }, { Pubkey: [48]byte{0x02}, - Amount: math.Gwei(cs.MaxEffectiveBalance() / 2), + Amount: minBalance + increment, Index: uint64(1), }, - { - Pubkey: [48]byte{0x03}, - Amount: math.Gwei(cs.EffectiveBalanceIncrement()), - Index: uint64(2), - }, { Pubkey: [48]byte{0x04}, - Amount: math.Gwei(2 * cs.MaxEffectiveBalance()), + Amount: 2 * maxBalance, Index: uint64(3), }, + } + badDeposits = []*types.Deposit{ + { + Pubkey: [48]byte{0x03}, + Amount: minBalance, + Index: uint64(2), + }, { Pubkey: [48]byte{0x05}, - Amount: math.Gwei(cs.EffectiveBalanceIncrement() * 2 / 3), + Amount: minBalance * 2 / 3, Index: uint64(4), }, } + genDeposits = append(goodDeposits, badDeposits...) executionPayloadHeader = new(types.ExecutionPayloadHeader).Empty() fork = &types.Fork{ PreviousVersion: version.FromUint32[common.Version](version.Deneb), @@ -226,14 +244,14 @@ func TestInitializeBartio(t *testing.T) { // run test vals, err := sp.InitializePreminedBeaconStateFromEth1( beaconState, - deposits, + genDeposits, executionPayloadHeader, fork.CurrentVersion, ) // check outputs require.NoError(t, err) - require.Len(t, vals, len(deposits)) + require.Len(t, vals, len(goodDeposits)) // check beacon state changes resSlot, err := beaconState.GetSlot() @@ -244,14 +262,14 @@ func TestInitializeBartio(t *testing.T) { require.NoError(t, err) require.Equal(t, fork, resFork) - for _, dep := range deposits { + for _, dep := range goodDeposits { checkValidatorBartio(t, cs, beaconState, dep) } // check that validator index is duly set latestValIdx, err := beaconState.GetEth1DepositIndex() require.NoError(t, err) - require.Equal(t, uint64(len(deposits)-1), latestValIdx) + require.Equal(t, uint64(len(genDeposits)-1), latestValIdx) } func checkValidatorBartio( @@ -298,7 +316,6 @@ func commonChecksValidators( idx, err := bs.ValidatorIndexByPubkey(dep.Pubkey) require.NoError(t, err) - require.Equal(t, math.U64(dep.Index), idx) val, err := bs.ValidatorByIndex(idx) require.NoError(t, err) @@ -306,7 +323,8 @@ func commonChecksValidators( var ( maxBalance = math.Gwei(cs.MaxEffectiveBalance()) - minBalance = math.Gwei(cs.EffectiveBalanceIncrement()) + increment = math.Gwei(cs.EffectiveBalanceIncrement()) + minBalance = math.Gwei(cs.EjectionBalance()) ) switch { case dep.Amount >= maxBalance: @@ -315,7 +333,7 @@ func commonChecksValidators( require.Equal(t, dep.Amount, val.EffectiveBalance) // validator balance must be multiple of EffectiveBalanceIncrement - require.Equal(t, math.U64(0), val.EffectiveBalance%minBalance) + require.Equal(t, math.U64(0), val.EffectiveBalance%increment) case dep.Amount < minBalance: require.Equal(t, math.Gwei(0), val.EffectiveBalance) } From d4ec3e7f087fad1d2ab78032f7999d99ce350b9a Mon Sep 17 00:00:00 2001 From: aBear Date: Fri, 8 Nov 2024 23:55:27 +0100 Subject: [PATCH 03/17] nit --- .../pkg/core/state_processor_genesis_test.go | 44 ++++++++++--------- .../pkg/core/state_processor_staking_test.go | 27 +++++++----- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor_genesis_test.go b/mod/state-transition/pkg/core/state_processor_genesis_test.go index f5da46a549..ed694e00b8 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis_test.go +++ b/mod/state-transition/pkg/core/state_processor_genesis_test.go @@ -67,7 +67,7 @@ func TestInitialize(t *testing.T) { // create test inputs var ( - goodDeposits = []*types.Deposit{ + genDeposits = []*types.Deposit{ { Pubkey: [48]byte{0x01}, Amount: maxBalance, @@ -78,25 +78,27 @@ func TestInitialize(t *testing.T) { Amount: minBalance + increment, Index: uint64(1), }, - { - Pubkey: [48]byte{0x04}, - Amount: 2 * maxBalance, - Index: uint64(3), - }, - } - badDeposits = []*types.Deposit{ { Pubkey: [48]byte{0x03}, Amount: minBalance, Index: uint64(2), }, + { + Pubkey: [48]byte{0x04}, + Amount: 2 * maxBalance, + Index: uint64(3), + }, { Pubkey: [48]byte{0x05}, Amount: minBalance * 2 / 3, Index: uint64(4), }, } - genDeposits = append(goodDeposits, badDeposits...) + goodDeposits = []*types.Deposit{ + genDeposits[0], + genDeposits[1], + genDeposits[3], + } executionPayloadHeader = new(types.ExecutionPayloadHeader).Empty() fork = &types.Fork{ PreviousVersion: version.FromUint32[common.Version](version.Deneb), @@ -197,7 +199,7 @@ func TestInitializeBartio(t *testing.T) { // create test inputs var ( - goodDeposits = []*types.Deposit{ + genDeposits = []*types.Deposit{ { Pubkey: [48]byte{0x01}, Amount: maxBalance, @@ -208,25 +210,27 @@ func TestInitializeBartio(t *testing.T) { Amount: minBalance + increment, Index: uint64(1), }, - { - Pubkey: [48]byte{0x04}, - Amount: 2 * maxBalance, - Index: uint64(3), - }, - } - badDeposits = []*types.Deposit{ { Pubkey: [48]byte{0x03}, Amount: minBalance, Index: uint64(2), }, + { + Pubkey: [48]byte{0x04}, + Amount: 2 * maxBalance, + Index: uint64(3), + }, { Pubkey: [48]byte{0x05}, Amount: minBalance * 2 / 3, Index: uint64(4), }, } - genDeposits = append(goodDeposits, badDeposits...) + goodDeposits = []*types.Deposit{ + genDeposits[0], + genDeposits[1], + genDeposits[3], + } executionPayloadHeader = new(types.ExecutionPayloadHeader).Empty() fork = &types.Fork{ PreviousVersion: version.FromUint32[common.Version](version.Deneb), @@ -329,12 +333,12 @@ func commonChecksValidators( switch { case dep.Amount >= maxBalance: require.Equal(t, maxBalance, val.EffectiveBalance) - case dep.Amount >= minBalance && dep.Amount < maxBalance: + case dep.Amount > minBalance && dep.Amount < maxBalance: require.Equal(t, dep.Amount, val.EffectiveBalance) // validator balance must be multiple of EffectiveBalanceIncrement require.Equal(t, math.U64(0), val.EffectiveBalance%increment) - case dep.Amount < minBalance: + case dep.Amount <= minBalance: require.Equal(t, math.Gwei(0), val.EffectiveBalance) } } diff --git a/mod/state-transition/pkg/core/state_processor_staking_test.go b/mod/state-transition/pkg/core/state_processor_staking_test.go index 8ed6c99b9c..162d5afbb7 100644 --- a/mod/state-transition/pkg/core/state_processor_staking_test.go +++ b/mod/state-transition/pkg/core/state_processor_staking_test.go @@ -37,6 +37,8 @@ import ( "github.com/stretchr/testify/require" ) +// TestTransitionUpdateValidators shows that when validator is +// updated (increasing amount), corresponding balance is updated. func TestTransitionUpdateValidators(t *testing.T) { // Create state processor to test cs := spec.BetnetChainSpec() @@ -63,7 +65,8 @@ func TestTransitionUpdateValidators(t *testing.T) { var ( maxBalance = math.Gwei(cs.MaxEffectiveBalance()) - minBalance = math.Gwei(cs.EffectiveBalanceIncrement()) + increment = math.Gwei(cs.EffectiveBalanceIncrement()) + minBalance = math.Gwei(cs.EjectionBalance()) emptyAddress = common.ExecutionAddress{} emptyCredentials = types.NewCredentialsFromExecutionAddress( emptyAddress, @@ -77,15 +80,21 @@ func TestTransitionUpdateValidators(t *testing.T) { { Pubkey: [48]byte{0x01}, Credentials: emptyCredentials, - Amount: maxBalance - 3*minBalance, + Amount: maxBalance - 3*increment, Index: uint64(0), }, { Pubkey: [48]byte{0x02}, Credentials: emptyCredentials, - Amount: maxBalance - 6*minBalance, + Amount: maxBalance - 6*increment, Index: uint64(1), }, + { + Pubkey: [48]byte{0x03}, + Credentials: emptyCredentials, + Amount: minBalance + increment, + Index: uint64(2), + }, } genPayloadHeader = new(types.ExecutionPayloadHeader).Empty() genVersion = version.FromUint32[common.Version](version.Deneb) @@ -96,13 +105,14 @@ func TestTransitionUpdateValidators(t *testing.T) { mock.Anything, mock.Anything, mock.Anything, ).Return(nil) - _, err = sp.InitializePreminedBeaconStateFromEth1( + vals, err := sp.InitializePreminedBeaconStateFromEth1( beaconState, genDeposits, genPayloadHeader, genVersion, ) require.NoError(t, err) + require.Len(t, vals, len(genDeposits)) // create test inputs var ( @@ -115,8 +125,8 @@ func TestTransitionUpdateValidators(t *testing.T) { { Pubkey: genDeposits[0].Pubkey, Credentials: emptyCredentials, - Amount: minBalance, // avoid breaching maxBalance - Index: genDeposits[0].Index, + Amount: increment, // avoid breaching maxBalance + Index: uint64(len(genDeposits)), }, } ) @@ -138,11 +148,8 @@ func TestTransitionUpdateValidators(t *testing.T) { ) // run the test - vals, err := sp.Transition(ctx, beaconState, blk) - - // check outputs + _, err = sp.Transition(ctx, beaconState, blk) require.NoError(t, err) - require.Zero(t, vals) // just update, no new validators // check validator is duly updated expectedValBalance := genDeposits[0].Amount + blkDeposits[0].Amount From 3245f96c5cb59cf0fcbbca3543d14c0957081bfb Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 00:09:50 +0100 Subject: [PATCH 04/17] nit --- mod/state-transition/pkg/core/state_processor.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor.go b/mod/state-transition/pkg/core/state_processor.go index 1e5a97ff61..e5498ceaf5 100644 --- a/mod/state-transition/pkg/core/state_processor.go +++ b/mod/state-transition/pkg/core/state_processor.go @@ -528,18 +528,21 @@ func (sp *StateProcessor[ return err } - hysteresisIncrement := sp.cs.EffectiveBalanceIncrement() / sp.cs.HysteresisQuotient() - downwardThreshold := hysteresisIncrement * sp.cs.HysteresisDownwardMultiplier() - upwardThreshold := hysteresisIncrement * sp.cs.HysteresisUpwardMultiplier() + var ( + hysteresisIncrement = sp.cs.EffectiveBalanceIncrement() / sp.cs.HysteresisQuotient() + downwardThreshold = hysteresisIncrement * sp.cs.HysteresisDownwardMultiplier() + upwardThreshold = hysteresisIncrement * sp.cs.HysteresisUpwardMultiplier() + + idx math.U64 + balance math.Gwei + ) for _, val := range validators { - var idx math.U64 idx, err = st.ValidatorIndexByPubkey(val.GetPubkey()) if err != nil { return err } - var balance math.Gwei balance, err = st.GetBalance(idx) if err != nil { return err From bfca9712fb0a9a28868f9d6abc378776129a8993 Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 00:46:08 +0100 Subject: [PATCH 05/17] added cases for genesis initialization UTs --- .../pkg/core/state_processor_genesis_test.go | 57 +++++++++++++++---- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor_genesis_test.go b/mod/state-transition/pkg/core/state_processor_genesis_test.go index ed694e00b8..a1eb6f6091 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis_test.go +++ b/mod/state-transition/pkg/core/state_processor_genesis_test.go @@ -90,14 +90,28 @@ func TestInitialize(t *testing.T) { }, { Pubkey: [48]byte{0x05}, - Amount: minBalance * 2 / 3, + Amount: minBalance - increment, Index: uint64(4), }, + { + Pubkey: [48]byte{0x06}, + Amount: minBalance + increment*3/2, + Index: uint64(5), + }, + { + Pubkey: [48]byte{0x07}, + Amount: maxBalance + increment/10, + Index: uint64(6), + }, + { + Pubkey: [48]byte{0x08}, + Amount: minBalance + increment*99/100, + Index: uint64(7), + }, } goodDeposits = []*types.Deposit{ - genDeposits[0], - genDeposits[1], - genDeposits[3], + genDeposits[0], genDeposits[1], genDeposits[3], + genDeposits[5], genDeposits[6], } executionPayloadHeader = new(types.ExecutionPayloadHeader).Empty() fork = &types.Fork{ @@ -222,14 +236,28 @@ func TestInitializeBartio(t *testing.T) { }, { Pubkey: [48]byte{0x05}, - Amount: minBalance * 2 / 3, + Amount: minBalance - increment, Index: uint64(4), }, + { + Pubkey: [48]byte{0x06}, + Amount: minBalance + increment*3/2, + Index: uint64(5), + }, + { + Pubkey: [48]byte{0x07}, + Amount: maxBalance + increment/10, + Index: uint64(6), + }, + { + Pubkey: [48]byte{0x08}, + Amount: minBalance + increment*99/100, + Index: uint64(7), + }, } goodDeposits = []*types.Deposit{ - genDeposits[0], - genDeposits[1], - genDeposits[3], + genDeposits[0], genDeposits[1], genDeposits[3], + genDeposits[5], genDeposits[6], } executionPayloadHeader = new(types.ExecutionPayloadHeader).Empty() fork = &types.Fork{ @@ -334,10 +362,15 @@ func commonChecksValidators( case dep.Amount >= maxBalance: require.Equal(t, maxBalance, val.EffectiveBalance) case dep.Amount > minBalance && dep.Amount < maxBalance: - require.Equal(t, dep.Amount, val.EffectiveBalance) - - // validator balance must be multiple of EffectiveBalanceIncrement - require.Equal(t, math.U64(0), val.EffectiveBalance%increment) + // Effective balance must be a multiple of increment. + // If balance is not, effective balance is rounded down + if dep.Amount%increment == 0 { + require.Equal(t, dep.Amount, val.EffectiveBalance) + } else { + require.Less(t, val.EffectiveBalance, dep.Amount) + require.Greater(t, val.EffectiveBalance, dep.Amount-increment) + require.Zero(t, val.EffectiveBalance%increment) + } case dep.Amount <= minBalance: require.Equal(t, math.Gwei(0), val.EffectiveBalance) } From b89878820cbe7fbb5e7970247b324324f97392ee Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 10:14:04 +0100 Subject: [PATCH 06/17] made process deposits closer to eth 2.0 specs --- .../pkg/core/state_processor.go | 37 ++++++----------- .../pkg/core/state_processor_staking.go | 41 ++++++------------- 2 files changed, 25 insertions(+), 53 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor.go b/mod/state-transition/pkg/core/state_processor.go index e5498ceaf5..d15ab8e5a3 100644 --- a/mod/state-transition/pkg/core/state_processor.go +++ b/mod/state-transition/pkg/core/state_processor.go @@ -358,13 +358,12 @@ func (sp *StateProcessor[ } if blk.GetSlot() != slot { return errors.Wrapf( - ErrSlotMismatch, - "expected: %d, got: %d", + ErrSlotMismatch, "expected: %d, got: %d", slot, blk.GetSlot(), ) } - // Verify the parent block root is correct. + // Verify that the block is newer than latest block header latestBlockHeader, err := st.GetLatestBlockHeader() if err != nil { return err @@ -376,14 +375,6 @@ func (sp *StateProcessor[ ) } - parentBlockRoot := latestBlockHeader.HashTreeRoot() - if parentBlockRoot != blk.GetParentBlockRoot() { - return errors.Wrapf(ErrParentRootMismatch, - "expected: %s, got: %s", - parentBlockRoot.String(), blk.GetParentBlockRoot().String(), - ) - } - // Verify that proposer matches with what consensus declares as proposer proposer, err := st.ValidatorByIndex(blk.GetProposerIndex()) if err != nil { @@ -400,26 +391,24 @@ func (sp *StateProcessor[ ) } - // Check to make sure the proposer isn't slashed. - if proposer.IsSlashed() { + // Verify that the parent matches + parentBlockRoot := latestBlockHeader.HashTreeRoot() + if parentBlockRoot != blk.GetParentBlockRoot() { return errors.Wrapf( - ErrSlashedProposer, - "index: %d", - blk.GetProposerIndex(), + ErrParentRootMismatch, "expected: %s, got: %s", + parentBlockRoot.String(), blk.GetParentBlockRoot().String(), ) } - // Ensure the block is within the acceptable range. - // TODO: move this is in the wrong spot. - deposits := blk.GetBody().GetDeposits() - if uint64(len(deposits)) > sp.cs.MaxDepositsPerBlock() { - return errors.Wrapf(ErrExceedsBlockDepositLimit, - "expected: %d, got: %d", - sp.cs.MaxDepositsPerBlock(), len(deposits), + // Verify proposer is not slashed + if proposer.IsSlashed() { + return errors.Wrapf( + ErrSlashedProposer, "index: %d", + blk.GetProposerIndex(), ) } - // Calculate the body root to place on the header. + // Cache current block as the new latest block bodyRoot := blk.GetBody().HashTreeRoot() var lbh BeaconBlockHeaderT lbh = lbh.New( diff --git a/mod/state-transition/pkg/core/state_processor_staking.go b/mod/state-transition/pkg/core/state_processor_staking.go index e6387c41bb..1cfb8fe90b 100644 --- a/mod/state-transition/pkg/core/state_processor_staking.go +++ b/mod/state-transition/pkg/core/state_processor_staking.go @@ -39,38 +39,21 @@ func (sp *StateProcessor[ st BeaconStateT, blk BeaconBlockT, ) error { - // Verify that outstanding deposits are processed up to the maximum number - // of deposits. + // Verify that outstanding deposits are processed + // up to the maximum number of deposits + + // TODO we should assert here that + // len(body.deposits) == min(MAX_DEPOSITS, + // state.eth1_data.deposit_count - state.eth1_deposit_index) + // Until we fix eth1Data we do a partial check deposits := blk.GetBody().GetDeposits() - index, err := st.GetEth1DepositIndex() - if err != nil { - return err - } - eth1Data, err := st.GetEth1Data() - if err != nil { - return err + if uint64(len(deposits)) > sp.cs.MaxDepositsPerBlock() { + return errors.Wrapf( + ErrExceedsBlockDepositLimit, "expected: %d, got: %d", + sp.cs.MaxDepositsPerBlock(), len(deposits), + ) } - depositCount := min( - sp.cs.MaxDepositsPerBlock(), - eth1Data.GetDepositCount().Unwrap()-index, - ) - _ = depositCount - // TODO: Update eth1data count and check this. - // if uint64(len(deposits)) != depositCount { - // return errors.New("deposit count mismatch") - // } - return sp.processDeposits(st, deposits) -} -// processDeposits processes the deposits and ensures they match the -// local state. -func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, DepositT, _, _, _, _, _, _, _, _, _, _, _, -]) processDeposits( - st BeaconStateT, - deposits []DepositT, -) error { - // Ensure the deposits match the local state. for _, dep := range deposits { if err := sp.processDeposit(st, dep); err != nil { return err From 34ea814d609ddb7b2d966810727e6a8aa04eebd8 Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 10:32:29 +0100 Subject: [PATCH 07/17] nit --- mod/state-transition/pkg/core/state_processor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor.go b/mod/state-transition/pkg/core/state_processor.go index d15ab8e5a3..c85b27f762 100644 --- a/mod/state-transition/pkg/core/state_processor.go +++ b/mod/state-transition/pkg/core/state_processor.go @@ -519,8 +519,8 @@ func (sp *StateProcessor[ var ( hysteresisIncrement = sp.cs.EffectiveBalanceIncrement() / sp.cs.HysteresisQuotient() - downwardThreshold = hysteresisIncrement * sp.cs.HysteresisDownwardMultiplier() - upwardThreshold = hysteresisIncrement * sp.cs.HysteresisUpwardMultiplier() + downwardThreshold = math.Gwei(hysteresisIncrement * sp.cs.HysteresisDownwardMultiplier()) + upwardThreshold = math.Gwei(hysteresisIncrement * sp.cs.HysteresisUpwardMultiplier()) idx math.U64 balance math.Gwei @@ -537,8 +537,8 @@ func (sp *StateProcessor[ return err } - if balance+math.Gwei(downwardThreshold) < val.GetEffectiveBalance() || - val.GetEffectiveBalance()+math.Gwei(upwardThreshold) < balance { + if balance+downwardThreshold < val.GetEffectiveBalance() || + val.GetEffectiveBalance()+upwardThreshold < balance { updatedBalance := types.ComputeEffectiveBalance( balance, math.U64(sp.cs.EffectiveBalanceIncrement()), From e2962ac250a74ad6395b37cdfb0bc0a86da55a8d Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 14:46:00 +0100 Subject: [PATCH 08/17] fixed expectations in UTs --- mod/config/pkg/spec/testnet.go | 11 ++- .../pkg/core/state_processor_genesis_test.go | 8 +- .../pkg/core/state_processor_staking_test.go | 98 +++++++++++++++---- 3 files changed, 92 insertions(+), 25 deletions(-) diff --git a/mod/config/pkg/spec/testnet.go b/mod/config/pkg/spec/testnet.go index a9d2970506..29d3072949 100644 --- a/mod/config/pkg/spec/testnet.go +++ b/mod/config/pkg/spec/testnet.go @@ -60,10 +60,13 @@ func BaseSpec() chain.SpecData[ any, ]{ // // Gwei value constants. - MinDepositAmount: uint64(1e9), - MaxEffectiveBalance: uint64(32e9), - EjectionBalance: uint64(16e9), - EffectiveBalanceIncrement: uint64(1e9), + MinDepositAmount: uint64(1e9), + MaxEffectiveBalance: uint64(32e9), + EjectionBalance: uint64(16e9), + EffectiveBalanceIncrement: uint64(1e9), + HysteresisQuotient: uint64(4), + HysteresisDownwardMultiplier: uint64(1), + HysteresisUpwardMultiplier: uint64(5), // Time parameters constants. SlotsPerEpoch: 32, MinEpochsToInactivityPenalty: 4, diff --git a/mod/state-transition/pkg/core/state_processor_genesis_test.go b/mod/state-transition/pkg/core/state_processor_genesis_test.go index a1eb6f6091..66737dceb9 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis_test.go +++ b/mod/state-transition/pkg/core/state_processor_genesis_test.go @@ -128,7 +128,7 @@ func TestInitialize(t *testing.T) { ).Return(nil) // run test - vals, err := sp.InitializePreminedBeaconStateFromEth1( + genVals, err := sp.InitializePreminedBeaconStateFromEth1( beaconState, genDeposits, executionPayloadHeader, @@ -137,7 +137,7 @@ func TestInitialize(t *testing.T) { // check outputs require.NoError(t, err) - require.Len(t, vals, len(goodDeposits)) + require.Len(t, genVals, len(goodDeposits)) // check beacon state changes resSlot, err := beaconState.GetSlot() @@ -274,7 +274,7 @@ func TestInitializeBartio(t *testing.T) { ).Return(nil) // run test - vals, err := sp.InitializePreminedBeaconStateFromEth1( + genVals, err := sp.InitializePreminedBeaconStateFromEth1( beaconState, genDeposits, executionPayloadHeader, @@ -283,7 +283,7 @@ func TestInitializeBartio(t *testing.T) { // check outputs require.NoError(t, err) - require.Len(t, vals, len(goodDeposits)) + require.Len(t, genVals, len(goodDeposits)) // check beacon state changes resSlot, err := beaconState.GetSlot() diff --git a/mod/state-transition/pkg/core/state_processor_staking_test.go b/mod/state-transition/pkg/core/state_processor_staking_test.go index 162d5afbb7..072c8829f6 100644 --- a/mod/state-transition/pkg/core/state_processor_staking_test.go +++ b/mod/state-transition/pkg/core/state_processor_staking_test.go @@ -73,8 +73,7 @@ func TestTransitionUpdateValidators(t *testing.T) { ) ) - // Setup initial state via genesis - // TODO: consider instead setting state artificially + // STEP 0: Setup initial state via genesis var ( genDeposits = []*types.Deposit{ { @@ -105,16 +104,16 @@ func TestTransitionUpdateValidators(t *testing.T) { mock.Anything, mock.Anything, mock.Anything, ).Return(nil) - vals, err := sp.InitializePreminedBeaconStateFromEth1( + genVals, err := sp.InitializePreminedBeaconStateFromEth1( beaconState, genDeposits, genPayloadHeader, genVersion, ) require.NoError(t, err) - require.Len(t, vals, len(genDeposits)) + require.Len(t, genVals, len(genDeposits)) - // create test inputs + // STEP 1: top up a genesis validator balance var ( ctx = &transition.Context{ SkipPayloadVerification: true, @@ -131,7 +130,7 @@ func TestTransitionUpdateValidators(t *testing.T) { } ) - blk := buildNextBlock( + blk1 := buildNextBlock( t, beaconState, &types.BeaconBlockBody{ @@ -148,27 +147,92 @@ func TestTransitionUpdateValidators(t *testing.T) { ) // run the test - _, err = sp.Transition(ctx, beaconState, blk) + updatedVals, err := sp.Transition(ctx, beaconState, blk1) require.NoError(t, err) + require.Empty(t, updatedVals) // validators set updates only at epoch turn - // check validator is duly updated - expectedValBalance := genDeposits[0].Amount + blkDeposits[0].Amount + // check validator balances are duly updated, that is: + // - balance is updated immediately + // - effective balance is updated only at the epoch turn + expectedBalance := genDeposits[0].Amount + blkDeposits[0].Amount + expectedEffectiveBalance := genDeposits[0].Amount idx, err := beaconState.ValidatorIndexByPubkey(genDeposits[0].Pubkey) require.NoError(t, err) - require.Equal(t, math.U64(genDeposits[0].Index), idx) - val, err := beaconState.ValidatorByIndex(idx) + balance, err := beaconState.GetBalance(idx) require.NoError(t, err) - require.Equal(t, genDeposits[0].Pubkey, val.Pubkey) - require.Equal(t, expectedValBalance, val.EffectiveBalance) + require.Equal(t, expectedBalance, balance) - // check validator balance is updated - valBal, err := beaconState.GetBalance(idx) + val, err := beaconState.ValidatorByIndex(idx) require.NoError(t, err) - require.Equal(t, expectedValBalance, valBal) + require.Equal(t, expectedEffectiveBalance, val.EffectiveBalance) - // check that validator index is duly set (1-indexed here, to be fixed) + // check that validator index is still correct latestValIdx, err := beaconState.GetEth1DepositIndex() require.NoError(t, err) require.Equal(t, uint64(len(genDeposits)), latestValIdx) + + // STEP 2: check that effective balance is updated once next epoch arrives + var blk = blk1 + for i := 1; i < int(cs.SlotsPerEpoch())-1; i++ { + blk = buildNextBlock( + t, + beaconState, + &types.BeaconBlockBody{ + ExecutionPayload: &types.ExecutionPayload{ + Timestamp: blk.Body.ExecutionPayload.Timestamp + 1, + ExtraData: []byte("testing"), + Transactions: [][]byte{}, + Withdrawals: []*engineprimitives.Withdrawal{}, + BaseFeePerGas: math.NewU256(0), + }, + Eth1Data: &types.Eth1Data{}, + Deposits: []*types.Deposit{}, + }, + ) + + updatedVals, err = sp.Transition(ctx, beaconState, blk) + require.NoError(t, err) + require.Empty(t, updatedVals) // validators set updates only at epoch + } + + // finally the block turning epoch + blk = buildNextBlock( + t, + beaconState, + &types.BeaconBlockBody{ + ExecutionPayload: &types.ExecutionPayload{ + Timestamp: blk.Body.ExecutionPayload.Timestamp + 1, + ExtraData: []byte("testing"), + Transactions: [][]byte{}, + Withdrawals: []*engineprimitives.Withdrawal{}, + BaseFeePerGas: math.NewU256(0), + }, + Eth1Data: &types.Eth1Data{}, + Deposits: []*types.Deposit{}, + }, + ) + + nextEpochVals, err := sp.Transition(ctx, beaconState, blk) + require.NoError(t, err) + require.Len(t, nextEpochVals, len(genDeposits)) // just topped up one validator + + // Assuming genesis order is preserved here which is not necessary + // TODO: remove this assumption + + // all genesis validators other than the first are unchanged + for i := 1; i < len(genDeposits); i++ { + require.Equal(t, genVals[1], nextEpochVals[1]) + } + + expectedBalance = genDeposits[0].Amount + blkDeposits[0].Amount + expectedEffectiveBalance = expectedBalance + + balance, err = beaconState.GetBalance(idx) + require.NoError(t, err) + require.Equal(t, expectedBalance, balance) + + val, err = beaconState.ValidatorByIndex(idx) + require.NoError(t, err) + require.Equal(t, expectedEffectiveBalance, val.EffectiveBalance) } From 0cdb569e00a2c7c306cd64063696752b284dd1a2 Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 15:55:46 +0100 Subject: [PATCH 09/17] fixed validators balance update --- .../pkg/core/state_processor_committee.go | 3 ++ .../pkg/core/state_processor_genesis.go | 31 ++++++++++++++++--- .../pkg/core/state_processor_staking.go | 22 ++----------- .../pkg/core/state_processor_staking_test.go | 2 +- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor_committee.go b/mod/state-transition/pkg/core/state_processor_committee.go index 2bcc794e4f..70487a0acd 100644 --- a/mod/state-transition/pkg/core/state_processor_committee.go +++ b/mod/state-transition/pkg/core/state_processor_committee.go @@ -45,6 +45,9 @@ func (sp *StateProcessor[ } } + // TODO: a more efficient handling would be to only send back to consensus + // updated validators (including evicted ones), rather than the full list + return iter.MapErr( activeVals, func(val *ValidatorT) (*transition.ValidatorUpdate, error) { diff --git a/mod/state-transition/pkg/core/state_processor_genesis.go b/mod/state-transition/pkg/core/state_processor_genesis.go index 9e7502b0df..1b6d51c7b1 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis.go +++ b/mod/state-transition/pkg/core/state_processor_genesis.go @@ -21,6 +21,7 @@ package core import ( + "github.com/berachain/beacon-kit/mod/consensus-types/pkg/types" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/constants" "github.com/berachain/beacon-kit/mod/primitives/pkg/encoding/hex" @@ -106,17 +107,41 @@ func (sp *StateProcessor[ } } + // Process deposits for _, deposit := range deposits { if err := sp.processDeposit(st, deposit); err != nil { return nil, err } } - // TODO: process activations. + // Process activations validators, err := st.GetValidators() if err != nil { return nil, err } + for _, val := range validators { + var idx math.ValidatorIndex + idx, err = st.ValidatorIndexByPubkey(val.GetPubkey()) + if err != nil { + return nil, err + } + + var balance math.Gwei + balance, err = st.GetBalance(idx) + if err != nil { + return nil, err + } + + updatedBalance := types.ComputeEffectiveBalance( + balance, + math.Gwei(sp.cs.EffectiveBalanceIncrement()), + math.Gwei(sp.cs.MaxEffectiveBalance()), + ) + val.SetEffectiveBalance(updatedBalance) + if err = st.UpdateValidatorAtIndex(idx, val); err != nil { + return nil, err + } + } // Handle special case bartio genesis. if sp.cs.DepositEth1ChainID() == bArtioChainID { @@ -150,9 +175,7 @@ func (sp *StateProcessor[ return nil, err } - if err = st.SetNextWithdrawalValidatorIndex( - 0, - ); err != nil { + if err = st.SetNextWithdrawalValidatorIndex(0); err != nil { return nil, err } diff --git a/mod/state-transition/pkg/core/state_processor_staking.go b/mod/state-transition/pkg/core/state_processor_staking.go index 1cfb8fe90b..a055dff262 100644 --- a/mod/state-transition/pkg/core/state_processor_staking.go +++ b/mod/state-transition/pkg/core/state_processor_staking.go @@ -23,7 +23,6 @@ package core import ( "fmt" - "github.com/berachain/beacon-kit/mod/consensus-types/pkg/types" "github.com/berachain/beacon-kit/mod/errors" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" @@ -103,27 +102,12 @@ func (sp *StateProcessor[ idx, err := st.ValidatorIndexByPubkey(dep.GetPubkey()) if err != nil { // If the validator does not exist, we add the validator. - // Add the validator to the registry. + // TODO: improve error handling by distinguishing + // validator not found from other kind of errors return sp.createValidator(st, dep) } - // If the validator already exists, we update the balance. - var val ValidatorT - val, err = st.ValidatorByIndex(idx) - if err != nil { - return err - } - - // TODO: Modify balance here and then effective balance once per epoch. - updatedBalance := types.ComputeEffectiveBalance( - val.GetEffectiveBalance()+dep.GetAmount(), - math.Gwei(sp.cs.EffectiveBalanceIncrement()), - math.Gwei(sp.cs.MaxEffectiveBalance()), - ) - val.SetEffectiveBalance(updatedBalance) - if err = st.UpdateValidatorAtIndex(idx, val); err != nil { - return err - } + // if validator exist, just update its balance return st.IncreaseBalance(idx, dep.GetAmount()) } diff --git a/mod/state-transition/pkg/core/state_processor_staking_test.go b/mod/state-transition/pkg/core/state_processor_staking_test.go index 072c8829f6..b1f82e12c7 100644 --- a/mod/state-transition/pkg/core/state_processor_staking_test.go +++ b/mod/state-transition/pkg/core/state_processor_staking_test.go @@ -124,7 +124,7 @@ func TestTransitionUpdateValidators(t *testing.T) { { Pubkey: genDeposits[0].Pubkey, Credentials: emptyCredentials, - Amount: increment, // avoid breaching maxBalance + Amount: 2 * increment, // twice to account for hysteresis Index: uint64(len(genDeposits)), }, } From 3f3d4ebcf0c512136612bcee21c95be750d8bb45 Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 16:21:06 +0100 Subject: [PATCH 10/17] nits --- .../pkg/core/state_processor_genesis.go | 69 ++++++++----------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor_genesis.go b/mod/state-transition/pkg/core/state_processor_genesis.go index 1b6d51c7b1..502447f21c 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis.go +++ b/mod/state-transition/pkg/core/state_processor_genesis.go @@ -45,7 +45,7 @@ func (sp *StateProcessor[ ]) InitializePreminedBeaconStateFromEth1( st BeaconStateT, deposits []DepositT, - executionPayloadHeader ExecutionPayloadHeaderT, + execPayloadHeader ExecutionPayloadHeaderT, genesisVersion common.Version, ) (transition.ValidatorUpdates, error) { sp.processingGenesis = true @@ -53,55 +53,53 @@ func (sp *StateProcessor[ sp.processingGenesis = false }() - var ( - blkHeader BeaconBlockHeaderT - blkBody BeaconBlockBodyT - fork ForkT - eth1Data Eth1DataT - ) + if err := st.SetSlot(0); err != nil { + return nil, err + } + + var fork ForkT fork = fork.New( genesisVersion, genesisVersion, math.U64(constants.GenesisEpoch), ) - - if err := st.SetSlot(0); err != nil { - return nil, err - } - if err := st.SetFork(fork); err != nil { return nil, err } // Eth1DepositIndex will be set in processDeposit - if err := st.SetEth1Data( - eth1Data.New( - common.Root{}, - 0, - executionPayloadHeader.GetBlockHash(), - )); err != nil { + var eth1Data Eth1DataT + eth1Data = eth1Data.New( + common.Root{}, + 0, + execPayloadHeader.GetBlockHash(), + ) + if err := st.SetEth1Data(eth1Data); err != nil { return nil, err } - // TODO: we need to handle common.Version vs - // uint32 better. - bodyRoot := blkBody.Empty(version.ToUint32(genesisVersion)).HashTreeRoot() - if err := st.SetLatestBlockHeader( - blkHeader.New( - 0, // slot - 0, // proposer index - common.Root{}, // parent block root - common.Root{}, // state root - bodyRoot, - )); err != nil { + // TODO: we need to handle common.Version vs uint32 better. + var blkBody BeaconBlockBodyT + blkBody = blkBody.Empty(version.ToUint32(genesisVersion)) + + var blkHeader BeaconBlockHeaderT + blkHeader = blkHeader.New( + 0, // slot + 0, // proposer index + common.Root{}, // parent block root + common.Root{}, // state root + blkBody.HashTreeRoot(), // body root + + ) + if err := st.SetLatestBlockHeader(blkHeader); err != nil { return nil, err } for i := range sp.cs.EpochsPerHistoricalVector() { if err := st.UpdateRandaoMixAtIndex( i, - common.Bytes32(executionPayloadHeader.GetBlockHash()), + common.Bytes32(execPayloadHeader.GetBlockHash()), ); err != nil { return nil, err } @@ -154,9 +152,7 @@ func (sp *StateProcessor[ return nil, err } - if err = st.SetLatestExecutionPayloadHeader( - executionPayloadHeader, - ); err != nil { + if err = st.SetLatestExecutionPayloadHeader(execPayloadHeader); err != nil { return nil, err } @@ -183,10 +179,5 @@ func (sp *StateProcessor[ return nil, err } - var updates transition.ValidatorUpdates - updates, err = sp.processSyncCommitteeUpdates(st) - if err != nil { - return nil, err - } - return updates, nil + return sp.processSyncCommitteeUpdates(st) } From 3d9e3abb0a15edf694908eb581099b2c571a7d19 Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 16:56:28 +0100 Subject: [PATCH 11/17] fixed faulty assertion in UTs --- .../pkg/core/state_processor_staking_test.go | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/mod/state-transition/pkg/core/state_processor_staking_test.go b/mod/state-transition/pkg/core/state_processor_staking_test.go index b1f82e12c7..600c263ccb 100644 --- a/mod/state-transition/pkg/core/state_processor_staking_test.go +++ b/mod/state-transition/pkg/core/state_processor_staking_test.go @@ -21,6 +21,7 @@ package core_test import ( + "fmt" "testing" "github.com/berachain/beacon-kit/mod/config/pkg/spec" @@ -79,7 +80,7 @@ func TestTransitionUpdateValidators(t *testing.T) { { Pubkey: [48]byte{0x01}, Credentials: emptyCredentials, - Amount: maxBalance - 3*increment, + Amount: minBalance + increment, Index: uint64(0), }, { @@ -91,7 +92,7 @@ func TestTransitionUpdateValidators(t *testing.T) { { Pubkey: [48]byte{0x03}, Credentials: emptyCredentials, - Amount: minBalance + increment, + Amount: maxBalance - 3*increment, Index: uint64(2), }, } @@ -120,13 +121,11 @@ func TestTransitionUpdateValidators(t *testing.T) { SkipValidateResult: true, ProposerAddress: dummyProposerAddr, } - blkDeposits = []*types.Deposit{ - { - Pubkey: genDeposits[0].Pubkey, - Credentials: emptyCredentials, - Amount: 2 * increment, // twice to account for hysteresis - Index: uint64(len(genDeposits)), - }, + blkDeposit = &types.Deposit{ + Pubkey: genDeposits[2].Pubkey, + Credentials: emptyCredentials, + Amount: 2 * increment, // twice to account for hysteresis + Index: uint64(len(genDeposits)), } ) @@ -142,7 +141,7 @@ func TestTransitionUpdateValidators(t *testing.T) { BaseFeePerGas: math.NewU256(0), }, Eth1Data: &types.Eth1Data{}, - Deposits: blkDeposits, + Deposits: []*types.Deposit{blkDeposit}, }, ) @@ -154,9 +153,9 @@ func TestTransitionUpdateValidators(t *testing.T) { // check validator balances are duly updated, that is: // - balance is updated immediately // - effective balance is updated only at the epoch turn - expectedBalance := genDeposits[0].Amount + blkDeposits[0].Amount - expectedEffectiveBalance := genDeposits[0].Amount - idx, err := beaconState.ValidatorIndexByPubkey(genDeposits[0].Pubkey) + expectedBalance := genDeposits[2].Amount + blkDeposit.Amount + expectedEffectiveBalance := genDeposits[2].Amount + idx, err := beaconState.ValidatorIndexByPubkey(genDeposits[2].Pubkey) require.NoError(t, err) balance, err := beaconState.GetBalance(idx) @@ -213,19 +212,19 @@ func TestTransitionUpdateValidators(t *testing.T) { }, ) - nextEpochVals, err := sp.Transition(ctx, beaconState, blk) + newEpochVals, err := sp.Transition(ctx, beaconState, blk) require.NoError(t, err) - require.Len(t, nextEpochVals, len(genDeposits)) // just topped up one validator + require.Len(t, newEpochVals, len(genDeposits)) // just topped up one validator // Assuming genesis order is preserved here which is not necessary // TODO: remove this assumption - // all genesis validators other than the first are unchanged - for i := 1; i < len(genDeposits); i++ { - require.Equal(t, genVals[1], nextEpochVals[1]) + // all genesis validators other than the last are unchanged + for i := range len(genDeposits) - 1 { + require.Equal(t, genVals[i], newEpochVals[i], fmt.Sprintf("idx: %d", i)) } - expectedBalance = genDeposits[0].Amount + blkDeposits[0].Amount + expectedBalance = genDeposits[2].Amount + blkDeposit.Amount expectedEffectiveBalance = expectedBalance balance, err = beaconState.GetBalance(idx) From 01839149b5d59cc99c7aee03cffcad0924fe8455 Mon Sep 17 00:00:00 2001 From: aBear Date: Sat, 9 Nov 2024 20:30:39 +0100 Subject: [PATCH 12/17] added UT for validator creation --- mod/state-transition/pkg/core/errors.go | 2 + .../pkg/core/state_processor_genesis.go | 63 +++--- .../pkg/core/state_processor_staking_test.go | 192 +++++++++++++++++- 3 files changed, 216 insertions(+), 41 deletions(-) diff --git a/mod/state-transition/pkg/core/errors.go b/mod/state-transition/pkg/core/errors.go index a0e2160ac8..5d6bc8ebe6 100644 --- a/mod/state-transition/pkg/core/errors.go +++ b/mod/state-transition/pkg/core/errors.go @@ -30,6 +30,8 @@ var ( // match the expected value. ErrSlotMismatch = errors.New("slot mismatch") + // ErrProposerMismatch is returned when block builder does not match + // with the proposer reported by consensus. ErrProposerMismatch = errors.New("proposer key mismatch") // ErrParentRootMismatch is returned when the parent root in an execution diff --git a/mod/state-transition/pkg/core/state_processor_genesis.go b/mod/state-transition/pkg/core/state_processor_genesis.go index 502447f21c..4d5531aea4 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis.go +++ b/mod/state-transition/pkg/core/state_processor_genesis.go @@ -21,7 +21,6 @@ package core import ( - "github.com/berachain/beacon-kit/mod/consensus-types/pkg/types" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/constants" "github.com/berachain/beacon-kit/mod/primitives/pkg/encoding/hex" @@ -112,70 +111,58 @@ func (sp *StateProcessor[ } } - // Process activations - validators, err := st.GetValidators() - if err != nil { - return nil, err - } - for _, val := range validators { - var idx math.ValidatorIndex - idx, err = st.ValidatorIndexByPubkey(val.GetPubkey()) - if err != nil { - return nil, err - } + // Currently we don't really process activations for validator. + // We do not update ActivationEligibilityEpoch nor ActivationEpoch + // for validators. + // A validator is created with its EffectiveBalance duly set + // (as in Eth 2.0 specs). The EffectiveBalance is updated at the + // turn of the epoch, when the consensus is made aware of the + // validator existence as well. + // TODO: this is likely to change once we introduce a cap on + // the validators set, in which case some validators may be evicted + // from the validator set because the cap is reached. - var balance math.Gwei - balance, err = st.GetBalance(idx) - if err != nil { + // Handle special case bartio genesis. + if sp.cs.DepositEth1ChainID() == bArtioChainID { + validatorsRoot := common.Root(hex.MustToBytes(bArtioValRoot)) + if err := st.SetGenesisValidatorsRoot(validatorsRoot); err != nil { return nil, err } - - updatedBalance := types.ComputeEffectiveBalance( - balance, - math.Gwei(sp.cs.EffectiveBalanceIncrement()), - math.Gwei(sp.cs.MaxEffectiveBalance()), - ) - val.SetEffectiveBalance(updatedBalance) - if err = st.UpdateValidatorAtIndex(idx, val); err != nil { + } else { + validators, err := st.GetValidators() + if err != nil { return nil, err } - } - - // Handle special case bartio genesis. - if sp.cs.DepositEth1ChainID() == bArtioChainID { - if err = st.SetGenesisValidatorsRoot( - common.Root(hex.MustToBytes(bArtioValRoot))); err != nil { + if err = st. + SetGenesisValidatorsRoot(validators.HashTreeRoot()); err != nil { return nil, err } - } else if err = st. - SetGenesisValidatorsRoot(validators.HashTreeRoot()); err != nil { - return nil, err } - if err = st.SetLatestExecutionPayloadHeader(execPayloadHeader); err != nil { + if err := st.SetLatestExecutionPayloadHeader(execPayloadHeader); err != nil { return nil, err } // Setup a bunch of 0s to prime the DB. for i := range sp.cs.HistoricalRootsLimit() { //#nosec:G701 // won't overflow in practice. - if err = st.UpdateBlockRootAtIndex(i, common.Root{}); err != nil { + if err := st.UpdateBlockRootAtIndex(i, common.Root{}); err != nil { return nil, err } - if err = st.UpdateStateRootAtIndex(i, common.Root{}); err != nil { + if err := st.UpdateStateRootAtIndex(i, common.Root{}); err != nil { return nil, err } } - if err = st.SetNextWithdrawalIndex(0); err != nil { + if err := st.SetNextWithdrawalIndex(0); err != nil { return nil, err } - if err = st.SetNextWithdrawalValidatorIndex(0); err != nil { + if err := st.SetNextWithdrawalValidatorIndex(0); err != nil { return nil, err } - if err = st.SetTotalSlashing(0); err != nil { + if err := st.SetTotalSlashing(0); err != nil { return nil, err } diff --git a/mod/state-transition/pkg/core/state_processor_staking_test.go b/mod/state-transition/pkg/core/state_processor_staking_test.go index 600c263ccb..6cc2c055dd 100644 --- a/mod/state-transition/pkg/core/state_processor_staking_test.go +++ b/mod/state-transition/pkg/core/state_processor_staking_test.go @@ -38,9 +38,9 @@ import ( "github.com/stretchr/testify/require" ) -// TestTransitionUpdateValidators shows that when validator is -// updated (increasing amount), corresponding balance is updated. -func TestTransitionUpdateValidators(t *testing.T) { +// TestTransitionUpdateValidator shows the lifecycle +// of a validator's balance updates. +func TestTransitionUpdateValidator(t *testing.T) { // Create state processor to test cs := spec.BetnetChainSpec() execEngine := mocks.NewExecutionEngine[ @@ -235,3 +235,189 @@ func TestTransitionUpdateValidators(t *testing.T) { require.NoError(t, err) require.Equal(t, expectedEffectiveBalance, val.EffectiveBalance) } + +// TestTransitionCreateValidator shows the lifecycle +// of a validator creation. +func TestTransitionCreateValidator(t *testing.T) { + // Create state processor to test + cs := spec.BetnetChainSpec() + execEngine := mocks.NewExecutionEngine[ + *types.ExecutionPayload, + *types.ExecutionPayloadHeader, + engineprimitives.Withdrawals, + ](t) + mocksSigner := &cryptomocks.BLSSigner{} + dummyProposerAddr := []byte{0xff} + + sp := createStateProcessor( + cs, + execEngine, + mocksSigner, + func(bytes.B48) ([]byte, error) { + return dummyProposerAddr, nil + }, + ) + + kvStore, err := initStore() + require.NoError(t, err) + beaconState := new(TestBeaconStateT).NewFromDB(kvStore, cs) + + var ( + maxBalance = math.Gwei(cs.MaxEffectiveBalance()) + increment = math.Gwei(cs.EffectiveBalanceIncrement()) + minBalance = math.Gwei(cs.EjectionBalance()) + emptyAddress = common.ExecutionAddress{} + emptyCredentials = types.NewCredentialsFromExecutionAddress( + emptyAddress, + ) + ) + + // STEP 0: Setup initial state via genesis + var ( + genDeposits = []*types.Deposit{ + { + Pubkey: [48]byte{0x01}, + Credentials: emptyCredentials, + Amount: minBalance + increment, + Index: uint64(0), + }, + } + genPayloadHeader = new(types.ExecutionPayloadHeader).Empty() + genVersion = version.FromUint32[common.Version](version.Deneb) + ) + + mocksSigner.On( + "VerifySignature", + mock.Anything, mock.Anything, mock.Anything, + ).Return(nil) + + genVals, err := sp.InitializePreminedBeaconStateFromEth1( + beaconState, + genDeposits, + genPayloadHeader, + genVersion, + ) + require.NoError(t, err) + require.Len(t, genVals, len(genDeposits)) + + // STEP 1: top up a genesis validator balance + var ( + ctx = &transition.Context{ + SkipPayloadVerification: true, + SkipValidateResult: true, + ProposerAddress: dummyProposerAddr, + } + blkDeposit = &types.Deposit{ + Pubkey: [48]byte{0xff}, // a new key for a new validator + Credentials: emptyCredentials, + Amount: maxBalance, + Index: uint64(len(genDeposits)), + } + ) + + blk1 := buildNextBlock( + t, + beaconState, + &types.BeaconBlockBody{ + ExecutionPayload: &types.ExecutionPayload{ + Timestamp: 10, + ExtraData: []byte("testing"), + Transactions: [][]byte{}, + Withdrawals: []*engineprimitives.Withdrawal{}, // no withdrawals + BaseFeePerGas: math.NewU256(0), + }, + Eth1Data: &types.Eth1Data{}, + Deposits: []*types.Deposit{blkDeposit}, + }, + ) + + // run the test + updatedVals, err := sp.Transition(ctx, beaconState, blk1) + require.NoError(t, err) + require.Empty(t, updatedVals) // validators set updates only at epoch turn + + // check validator balances are duly updated + var ( + expectedBalance = blkDeposit.Amount + expectedEffectiveBalance = expectedBalance + ) + idx, err := beaconState.ValidatorIndexByPubkey(blkDeposit.Pubkey) + require.NoError(t, err) + + balance, err := beaconState.GetBalance(idx) + require.NoError(t, err) + require.Equal(t, expectedBalance, balance) + + val, err := beaconState.ValidatorByIndex(idx) + require.NoError(t, err) + require.Equal(t, expectedEffectiveBalance, val.EffectiveBalance) + + // check that validator index is still correct + latestValIdx, err := beaconState.GetEth1DepositIndex() + require.NoError(t, err) + require.Equal(t, uint64(len(genDeposits)), latestValIdx) + + // STEP 2: check that effective balance is updated once next epoch arrives + var blk = blk1 + for i := 1; i < int(cs.SlotsPerEpoch())-1; i++ { + blk = buildNextBlock( + t, + beaconState, + &types.BeaconBlockBody{ + ExecutionPayload: &types.ExecutionPayload{ + Timestamp: blk.Body.ExecutionPayload.Timestamp + 1, + ExtraData: []byte("testing"), + Transactions: [][]byte{}, + Withdrawals: []*engineprimitives.Withdrawal{}, + BaseFeePerGas: math.NewU256(0), + }, + Eth1Data: &types.Eth1Data{}, + Deposits: []*types.Deposit{}, + }, + ) + + updatedVals, err = sp.Transition(ctx, beaconState, blk) + require.NoError(t, err) + require.Empty(t, updatedVals) // validators set updates only at epoch + } + + // finally the block turning epoch + blk = buildNextBlock( + t, + beaconState, + &types.BeaconBlockBody{ + ExecutionPayload: &types.ExecutionPayload{ + Timestamp: blk.Body.ExecutionPayload.Timestamp + 1, + ExtraData: []byte("testing"), + Transactions: [][]byte{}, + Withdrawals: []*engineprimitives.Withdrawal{}, + BaseFeePerGas: math.NewU256(0), + }, + Eth1Data: &types.Eth1Data{}, + Deposits: []*types.Deposit{}, + }, + ) + + newEpochVals, err := sp.Transition(ctx, beaconState, blk) + require.NoError(t, err) + require.Len(t, newEpochVals, len(genDeposits)+1) + + // Assuming genesis order is preserved here which is not necessary + // TODO: remove this assumption + + // all genesis validators are unchanged + for i := range len(genDeposits) { + require.Equal(t, genVals[i], newEpochVals[i], fmt.Sprintf("idx: %d", i)) + } + + expectedBalance = blkDeposit.Amount + expectedEffectiveBalance = expectedBalance + + balance, err = beaconState.GetBalance(idx) + require.NoError(t, err) + require.Equal(t, expectedBalance, balance) + + val, err = beaconState.ValidatorByIndex(idx) + require.NoError(t, err) + require.Equal(t, expectedEffectiveBalance, val.EffectiveBalance) +} From 679da518c3bbb246bb74436c9f2c259254621cf7 Mon Sep 17 00:00:00 2001 From: aBear Date: Sun, 10 Nov 2024 16:03:16 +0100 Subject: [PATCH 13/17] nits --- mod/chain-spec/pkg/chain/chain_spec.go | 7 +++++++ mod/chain-spec/pkg/chain/data.go | 5 +++-- .../pkg/core/state_processor_genesis.go | 11 ----------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/mod/chain-spec/pkg/chain/chain_spec.go b/mod/chain-spec/pkg/chain/chain_spec.go index 2e76c60ae0..21877edcad 100644 --- a/mod/chain-spec/pkg/chain/chain_spec.go +++ b/mod/chain-spec/pkg/chain/chain_spec.go @@ -45,10 +45,17 @@ type Spec[ // calculations. EffectiveBalanceIncrement() uint64 + // HysteresisQuotient returns the quotient used in effective balance + // calculations to create hysteresis. This provides resistance to small + // balance changes triggering effective balance updates. HysteresisQuotient() uint64 + // HysteresisDownwardMultiplier returns the multiplier used when checking + // if the effective balance should be decreased. HysteresisDownwardMultiplier() uint64 + // HysteresisUpwardMultiplier returns the multiplier used when checking + // if the effective balance should be increased. HysteresisUpwardMultiplier() uint64 // Time parameters constants. diff --git a/mod/chain-spec/pkg/chain/data.go b/mod/chain-spec/pkg/chain/data.go index b8eefc34e6..d41ffa4479 100644 --- a/mod/chain-spec/pkg/chain/data.go +++ b/mod/chain-spec/pkg/chain/data.go @@ -43,10 +43,11 @@ type SpecData[ // EffectiveBalanceIncrement is the effective balance increment. EffectiveBalanceIncrement uint64 `mapstructure:"effective-balance-increment"` + // HysteresisQuotient is the quotient used in effective balance calculations HysteresisQuotient uint64 `mapstructure:"hysteresis-quotient"` - + // HysteresisDownwardMultiplier is the multiplier for downward balance adjustments. HysteresisDownwardMultiplier uint64 `mapstructure:"hysteresis-downward-multiplier"` - + // HysteresisUpwardMultiplier is the multiplier for upward balance adjustments. HysteresisUpwardMultiplier uint64 `mapstructure:"hysteresis-upward-multiplier"` // Time parameters constants. // diff --git a/mod/state-transition/pkg/core/state_processor_genesis.go b/mod/state-transition/pkg/core/state_processor_genesis.go index 4d5531aea4..13907fb4fe 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis.go +++ b/mod/state-transition/pkg/core/state_processor_genesis.go @@ -111,17 +111,6 @@ func (sp *StateProcessor[ } } - // Currently we don't really process activations for validator. - // We do not update ActivationEligibilityEpoch nor ActivationEpoch - // for validators. - // A validator is created with its EffectiveBalance duly set - // (as in Eth 2.0 specs). The EffectiveBalance is updated at the - // turn of the epoch, when the consensus is made aware of the - // validator existence as well. - // TODO: this is likely to change once we introduce a cap on - // the validators set, in which case some validators may be evicted - // from the validator set because the cap is reached. - // Handle special case bartio genesis. if sp.cs.DepositEth1ChainID() == bArtioChainID { validatorsRoot := common.Root(hex.MustToBytes(bArtioValRoot)) From b6d62c5f509b01f95a16d3143043159f50834f43 Mon Sep 17 00:00:00 2001 From: aBear Date: Sun, 10 Nov 2024 16:18:25 +0100 Subject: [PATCH 14/17] minor readme --- mod/state-transition/pkg/core/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mod/state-transition/pkg/core/README.md diff --git a/mod/state-transition/pkg/core/README.md b/mod/state-transition/pkg/core/README.md new file mode 100644 index 0000000000..27d755d97b --- /dev/null +++ b/mod/state-transition/pkg/core/README.md @@ -0,0 +1,11 @@ +# State Processor + +## Validators handling + +Currently: + +- Any validator whose effective balance is above `EjectionBalance` will stay a validator forever, as we have not (yet) implemented withdrawals facilities. +- Withdrawals are automatically generated only if a validator effective balance goes beyond `MaxEffectiveBalance`. In this case enough balance is scheduled for withdrawal, just enough to make validator's effective balance equal to `MaxEffectiveBalance`. Since `MaxEffectiveBalance` > `EjectionBalance`, the validator will keep being a validator. +- If a deposit is made for a validator with a balance smaller or equal to `EjectionBalance`, no validator will be created[^1] because of the insufficient balance. However currently the whole deposited balance is **not** scheduled for withdrawal at the next epoch. + +[^1]: Technically a validator is made in the BeaconKit state to track the deposit, but such a validator is never returned to the consensus engine. Moreover the deposit should be evicted at the next epoch. From ffa814202ede0cdc687d09a4b0dfb3308f1a7977 Mon Sep 17 00:00:00 2001 From: aBear Date: Sun, 24 Nov 2024 09:59:14 +0100 Subject: [PATCH 15/17] run make generate-check --- .../mocks/blobs_bundle.mock.go | 2 +- .../mocks/built_execution_payload_env.mock.go | 16 ++-- .../mocks/payload_attributer.mock.go | 2 +- .../backend/mocks/availability_store.mock.go | 12 +-- .../backend/mocks/beacon_block_header.mock.go | 28 +++---- .../backend/mocks/beacon_state.mock.go | 74 +++++++++---------- .../backend/mocks/block_store.mock.go | 14 ++-- .../backend/mocks/deposit_store.mock.go | 14 ++-- mod/node-api/backend/mocks/node.mock.go | 10 +-- .../backend/mocks/state_processor.mock.go | 10 +-- .../backend/mocks/storage_backend.mock.go | 16 ++-- mod/node-api/backend/mocks/validator.mock.go | 2 +- mod/node-api/backend/mocks/withdrawal.mock.go | 10 +-- .../mocks/withdrawal_credentials.mock.go | 2 +- .../pkg/services/registry/mocks/basic.mock.go | 2 +- .../registry/mocks/dispatcher.mock.go | 2 +- .../registry/mocks/registry_option.mock.go | 2 +- .../pkg/crypto/mocks/bls_signer.mock.go | 47 ++++++------ .../pkg/core/mocks/execution_engine.mock.go | 10 +-- mod/storage/pkg/interfaces/mocks/db.mock.go | 2 +- .../pkg/pruner/mocks/beacon_block.mock.go | 2 +- .../pkg/pruner/mocks/block_event.mock.go | 2 +- mod/storage/pkg/pruner/mocks/prunable.mock.go | 2 +- mod/storage/pkg/pruner/mocks/pruner.mock.go | 2 +- 24 files changed, 140 insertions(+), 145 deletions(-) diff --git a/mod/engine-primitives/pkg/engine-primitives/mocks/blobs_bundle.mock.go b/mod/engine-primitives/pkg/engine-primitives/mocks/blobs_bundle.mock.go index 67afc56b70..a9755a8c7a 100644 --- a/mod/engine-primitives/pkg/engine-primitives/mocks/blobs_bundle.mock.go +++ b/mod/engine-primitives/pkg/engine-primitives/mocks/blobs_bundle.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go b/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go index df3a200894..3b1b6b73f3 100644 --- a/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go +++ b/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -10,11 +10,11 @@ import ( ) // BuiltExecutionPayloadEnv is an autogenerated mock type for the BuiltExecutionPayloadEnv type -type BuiltExecutionPayloadEnv[ExecutionPayloadT any] struct { +type BuiltExecutionPayloadEnv[ExecutionPayloadT interface{}] struct { mock.Mock } -type BuiltExecutionPayloadEnv_Expecter[ExecutionPayloadT any] struct { +type BuiltExecutionPayloadEnv_Expecter[ExecutionPayloadT interface{}] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) GetBlobsBundle() enginepr } // BuiltExecutionPayloadEnv_GetBlobsBundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlobsBundle' -type BuiltExecutionPayloadEnv_GetBlobsBundle_Call[ExecutionPayloadT any] struct { +type BuiltExecutionPayloadEnv_GetBlobsBundle_Call[ExecutionPayloadT interface{}] struct { *mock.Call } @@ -90,7 +90,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) GetExecutionPayload() Exe } // BuiltExecutionPayloadEnv_GetExecutionPayload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExecutionPayload' -type BuiltExecutionPayloadEnv_GetExecutionPayload_Call[ExecutionPayloadT any] struct { +type BuiltExecutionPayloadEnv_GetExecutionPayload_Call[ExecutionPayloadT interface{}] struct { *mock.Call } @@ -137,7 +137,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) GetValue() *uint256.Int { } // BuiltExecutionPayloadEnv_GetValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValue' -type BuiltExecutionPayloadEnv_GetValue_Call[ExecutionPayloadT any] struct { +type BuiltExecutionPayloadEnv_GetValue_Call[ExecutionPayloadT interface{}] struct { *mock.Call } @@ -182,7 +182,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) ShouldOverrideBuilder() b } // BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShouldOverrideBuilder' -type BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call[ExecutionPayloadT any] struct { +type BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call[ExecutionPayloadT interface{}] struct { *mock.Call } @@ -210,7 +210,7 @@ func (_c *BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call[ExecutionPayloadT] // NewBuiltExecutionPayloadEnv creates a new instance of BuiltExecutionPayloadEnv. 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 NewBuiltExecutionPayloadEnv[ExecutionPayloadT any](t interface { +func NewBuiltExecutionPayloadEnv[ExecutionPayloadT interface{}](t interface { mock.TestingT Cleanup(func()) }) *BuiltExecutionPayloadEnv[ExecutionPayloadT] { diff --git a/mod/engine-primitives/pkg/engine-primitives/mocks/payload_attributer.mock.go b/mod/engine-primitives/pkg/engine-primitives/mocks/payload_attributer.mock.go index 0edbc8091a..ce712b7f28 100644 --- a/mod/engine-primitives/pkg/engine-primitives/mocks/payload_attributer.mock.go +++ b/mod/engine-primitives/pkg/engine-primitives/mocks/payload_attributer.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/node-api/backend/mocks/availability_store.mock.go b/mod/node-api/backend/mocks/availability_store.mock.go index 20eb2e5b6e..dce9967a8a 100644 --- a/mod/node-api/backend/mocks/availability_store.mock.go +++ b/mod/node-api/backend/mocks/availability_store.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -10,11 +10,11 @@ import ( ) // AvailabilityStore is an autogenerated mock type for the AvailabilityStore type -type AvailabilityStore[BeaconBlockBodyT any, BlobSidecarsT any] struct { +type AvailabilityStore[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { mock.Mock } -type AvailabilityStore_Expecter[BeaconBlockBodyT any, BlobSidecarsT any] struct { +type AvailabilityStore_Expecter[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { mock *mock.Mock } @@ -41,7 +41,7 @@ func (_m *AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT]) IsDataAvailable(_a } // AvailabilityStore_IsDataAvailable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDataAvailable' -type AvailabilityStore_IsDataAvailable_Call[BeaconBlockBodyT any, BlobSidecarsT any] struct { +type AvailabilityStore_IsDataAvailable_Call[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { *mock.Call } @@ -89,7 +89,7 @@ func (_m *AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT]) Persist(_a0 math.U } // AvailabilityStore_Persist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Persist' -type AvailabilityStore_Persist_Call[BeaconBlockBodyT any, BlobSidecarsT any] struct { +type AvailabilityStore_Persist_Call[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { *mock.Call } @@ -119,7 +119,7 @@ func (_c *AvailabilityStore_Persist_Call[BeaconBlockBodyT, BlobSidecarsT]) RunAn // NewAvailabilityStore creates a new instance of AvailabilityStore. 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 NewAvailabilityStore[BeaconBlockBodyT any, BlobSidecarsT any](t interface { +func NewAvailabilityStore[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}](t interface { mock.TestingT Cleanup(func()) }) *AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT] { diff --git a/mod/node-api/backend/mocks/beacon_block_header.mock.go b/mod/node-api/backend/mocks/beacon_block_header.mock.go index eb238bac1e..f62b151595 100644 --- a/mod/node-api/backend/mocks/beacon_block_header.mock.go +++ b/mod/node-api/backend/mocks/beacon_block_header.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -10,11 +10,11 @@ import ( ) // BeaconBlockHeader is an autogenerated mock type for the BeaconBlockHeader type -type BeaconBlockHeader[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader[BeaconBlockHeaderT interface{}] struct { mock.Mock } -type BeaconBlockHeader_Expecter[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_Expecter[BeaconBlockHeaderT interface{}] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetBodyRoot() common.Root { } // BeaconBlockHeader_GetBodyRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBodyRoot' -type BeaconBlockHeader_GetBodyRoot_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_GetBodyRoot_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -90,7 +90,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetParentBlockRoot() common.Roo } // BeaconBlockHeader_GetParentBlockRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParentBlockRoot' -type BeaconBlockHeader_GetParentBlockRoot_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_GetParentBlockRoot_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -135,7 +135,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetProposerIndex() math.U64 { } // BeaconBlockHeader_GetProposerIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProposerIndex' -type BeaconBlockHeader_GetProposerIndex_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_GetProposerIndex_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -180,7 +180,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetSlot() math.U64 { } // BeaconBlockHeader_GetSlot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlot' -type BeaconBlockHeader_GetSlot_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_GetSlot_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -227,7 +227,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetStateRoot() common.Root { } // BeaconBlockHeader_GetStateRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStateRoot' -type BeaconBlockHeader_GetStateRoot_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_GetStateRoot_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -274,7 +274,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) HashTreeRoot() common.Root { } // BeaconBlockHeader_HashTreeRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HashTreeRoot' -type BeaconBlockHeader_HashTreeRoot_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_HashTreeRoot_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -331,7 +331,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) MarshalSSZ() ([]byte, error) { } // BeaconBlockHeader_MarshalSSZ_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarshalSSZ' -type BeaconBlockHeader_MarshalSSZ_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_MarshalSSZ_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -378,7 +378,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) New(slot math.U64, proposerInde } // BeaconBlockHeader_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New' -type BeaconBlockHeader_New_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_New_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -415,7 +415,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) SetStateRoot(_a0 common.Root) { } // BeaconBlockHeader_SetStateRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStateRoot' -type BeaconBlockHeader_SetStateRoot_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_SetStateRoot_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -461,7 +461,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) UnmarshalSSZ(_a0 []byte) error } // BeaconBlockHeader_UnmarshalSSZ_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnmarshalSSZ' -type BeaconBlockHeader_UnmarshalSSZ_Call[BeaconBlockHeaderT any] struct { +type BeaconBlockHeader_UnmarshalSSZ_Call[BeaconBlockHeaderT interface{}] struct { *mock.Call } @@ -490,7 +490,7 @@ func (_c *BeaconBlockHeader_UnmarshalSSZ_Call[BeaconBlockHeaderT]) RunAndReturn( // NewBeaconBlockHeader creates a new instance of BeaconBlockHeader. 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 NewBeaconBlockHeader[BeaconBlockHeaderT any](t interface { +func NewBeaconBlockHeader[BeaconBlockHeaderT interface{}](t interface { mock.TestingT Cleanup(func()) }) *BeaconBlockHeader[BeaconBlockHeaderT] { diff --git a/mod/node-api/backend/mocks/beacon_state.mock.go b/mod/node-api/backend/mocks/beacon_state.mock.go index 6d9fb92e2b..a783c6fd6e 100644 --- a/mod/node-api/backend/mocks/beacon_state.mock.go +++ b/mod/node-api/backend/mocks/beacon_state.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -6,19 +6,17 @@ import ( bytes "github.com/berachain/beacon-kit/mod/primitives/pkg/bytes" common "github.com/berachain/beacon-kit/mod/primitives/pkg/common" - crypto "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" - math "github.com/berachain/beacon-kit/mod/primitives/pkg/math" mock "github.com/stretchr/testify/mock" ) // BeaconState is an autogenerated mock type for the BeaconState type -type BeaconState[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { mock.Mock } -type BeaconState_Expecter[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] 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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] 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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] 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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetBlockRootAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -228,7 +226,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetEth1Data_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -283,7 +281,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetEth1DepositIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -340,7 +338,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetFork_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -397,7 +395,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetGenesisValidatorsRoot_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -454,7 +452,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetLatestBlockHeader_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -511,7 +509,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetLatestExecutionPayloadHeader_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -566,7 +564,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetNextWithdrawalIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -621,7 +619,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetNextWithdrawalValidatorIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -678,7 +676,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetRandaoMixAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -734,7 +732,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetSlashingAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -790,7 +788,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetSlot_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -845,7 +843,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetTotalActiveBalances_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -901,7 +899,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetTotalSlashing_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -956,7 +954,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetTotalValidators_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1013,7 +1011,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetValidators_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1070,7 +1068,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_GetValidatorsByEffectiveBalance_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1115,7 +1113,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_SetSlot_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1173,7 +1171,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_StateRootAtIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1231,7 +1229,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_ValidatorByIndex_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1287,7 +1285,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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_ValidatorIndexByCometBFTAddress_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } @@ -1315,7 +1313,7 @@ func (_c *BeaconState_ValidatorIndexByCometBFTAddress_Call[BeaconBlockHeaderT, E } // ValidatorIndexByPubkey provides a mock function with given fields: _a0 -func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) ValidatorIndexByPubkey(_a0 crypto.BLSPubkey) (math.U64, error) { +func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) ValidatorIndexByPubkey(_a0 [48]byte) (math.U64, error) { ret := _m.Called(_a0) if len(ret) == 0 { @@ -1324,16 +1322,16 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo var r0 math.U64 var r1 error - if rf, ok := ret.Get(0).(func(crypto.BLSPubkey) (math.U64, error)); ok { + if rf, ok := ret.Get(0).(func([48]byte) (math.U64, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(crypto.BLSPubkey) math.U64); ok { + if rf, ok := ret.Get(0).(func([48]byte) math.U64); ok { r0 = rf(_a0) } else { r0 = ret.Get(0).(math.U64) } - if rf, ok := ret.Get(1).(func(crypto.BLSPubkey) error); ok { + if rf, ok := ret.Get(1).(func([48]byte) error); ok { r1 = rf(_a0) } else { r1 = ret.Error(1) @@ -1343,19 +1341,19 @@ 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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { +type BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { *mock.Call } // ValidatorIndexByPubkey is a helper method to define mock.On call -// - _a0 crypto.BLSPubkey +// - _a0 [48]byte func (_e *BeaconState_Expecter[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) ValidatorIndexByPubkey(_a0 interface{}) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { return &BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]{Call: _e.mock.On("ValidatorIndexByPubkey", _a0)} } -func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) Run(run func(_a0 crypto.BLSPubkey)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { +func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) Run(run func(_a0 [48]byte)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(crypto.BLSPubkey)) + run(args[0].([48]byte)) }) return _c } @@ -1365,14 +1363,14 @@ func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, return _c } -func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) RunAndReturn(run func(crypto.BLSPubkey) (math.U64, error)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { +func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) RunAndReturn(run func([48]byte) (math.U64, error)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { _c.Call.Return(run) return _c } // 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 any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any](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/mocks/block_store.mock.go b/mod/node-api/backend/mocks/block_store.mock.go index df70ab86b5..6035973164 100644 --- a/mod/node-api/backend/mocks/block_store.mock.go +++ b/mod/node-api/backend/mocks/block_store.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -10,11 +10,11 @@ import ( ) // BlockStore is an autogenerated mock type for the BlockStore type -type BlockStore[BeaconBlockT any] struct { +type BlockStore[BeaconBlockT interface{}] struct { mock.Mock } -type BlockStore_Expecter[BeaconBlockT any] struct { +type BlockStore_Expecter[BeaconBlockT interface{}] struct { mock *mock.Mock } @@ -51,7 +51,7 @@ func (_m *BlockStore[BeaconBlockT]) GetParentSlotByTimestamp(timestamp math.U64) } // BlockStore_GetParentSlotByTimestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParentSlotByTimestamp' -type BlockStore_GetParentSlotByTimestamp_Call[BeaconBlockT any] struct { +type BlockStore_GetParentSlotByTimestamp_Call[BeaconBlockT interface{}] struct { *mock.Call } @@ -107,7 +107,7 @@ func (_m *BlockStore[BeaconBlockT]) GetSlotByBlockRoot(root common.Root) (math.U } // BlockStore_GetSlotByBlockRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotByBlockRoot' -type BlockStore_GetSlotByBlockRoot_Call[BeaconBlockT any] struct { +type BlockStore_GetSlotByBlockRoot_Call[BeaconBlockT interface{}] struct { *mock.Call } @@ -163,7 +163,7 @@ func (_m *BlockStore[BeaconBlockT]) GetSlotByStateRoot(root common.Root) (math.U } // BlockStore_GetSlotByStateRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotByStateRoot' -type BlockStore_GetSlotByStateRoot_Call[BeaconBlockT any] struct { +type BlockStore_GetSlotByStateRoot_Call[BeaconBlockT interface{}] struct { *mock.Call } @@ -192,7 +192,7 @@ func (_c *BlockStore_GetSlotByStateRoot_Call[BeaconBlockT]) RunAndReturn(run fun // NewBlockStore creates a new instance of BlockStore. 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 NewBlockStore[BeaconBlockT any](t interface { +func NewBlockStore[BeaconBlockT interface{}](t interface { mock.TestingT Cleanup(func()) }) *BlockStore[BeaconBlockT] { diff --git a/mod/node-api/backend/mocks/deposit_store.mock.go b/mod/node-api/backend/mocks/deposit_store.mock.go index 32e8381059..9ab8b9c40b 100644 --- a/mod/node-api/backend/mocks/deposit_store.mock.go +++ b/mod/node-api/backend/mocks/deposit_store.mock.go @@ -1,15 +1,15 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks import mock "github.com/stretchr/testify/mock" // DepositStore is an autogenerated mock type for the DepositStore type -type DepositStore[DepositT any] struct { +type DepositStore[DepositT interface{}] struct { mock.Mock } -type DepositStore_Expecter[DepositT any] struct { +type DepositStore_Expecter[DepositT interface{}] struct { mock *mock.Mock } @@ -36,7 +36,7 @@ func (_m *DepositStore[DepositT]) EnqueueDeposits(deposits []DepositT) error { } // DepositStore_EnqueueDeposits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnqueueDeposits' -type DepositStore_EnqueueDeposits_Call[DepositT any] struct { +type DepositStore_EnqueueDeposits_Call[DepositT interface{}] struct { *mock.Call } @@ -94,7 +94,7 @@ func (_m *DepositStore[DepositT]) GetDepositsByIndex(startIndex uint64, numView } // DepositStore_GetDepositsByIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDepositsByIndex' -type DepositStore_GetDepositsByIndex_Call[DepositT any] struct { +type DepositStore_GetDepositsByIndex_Call[DepositT interface{}] struct { *mock.Call } @@ -141,7 +141,7 @@ func (_m *DepositStore[DepositT]) Prune(start uint64, end uint64) error { } // DepositStore_Prune_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prune' -type DepositStore_Prune_Call[DepositT any] struct { +type DepositStore_Prune_Call[DepositT interface{}] struct { *mock.Call } @@ -171,7 +171,7 @@ func (_c *DepositStore_Prune_Call[DepositT]) RunAndReturn(run func(uint64, uint6 // NewDepositStore creates a new instance of DepositStore. 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 NewDepositStore[DepositT any](t interface { +func NewDepositStore[DepositT interface{}](t interface { mock.TestingT Cleanup(func()) }) *DepositStore[DepositT] { diff --git a/mod/node-api/backend/mocks/node.mock.go b/mod/node-api/backend/mocks/node.mock.go index b806434428..5ac750d029 100644 --- a/mod/node-api/backend/mocks/node.mock.go +++ b/mod/node-api/backend/mocks/node.mock.go @@ -1,15 +1,15 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks import mock "github.com/stretchr/testify/mock" // Node is an autogenerated mock type for the Node type -type Node[ContextT any] struct { +type Node[ContextT interface{}] struct { mock.Mock } -type Node_Expecter[ContextT any] struct { +type Node_Expecter[ContextT interface{}] struct { mock *mock.Mock } @@ -48,7 +48,7 @@ func (_m *Node[ContextT]) CreateQueryContext(height int64, prove bool) (ContextT } // Node_CreateQueryContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateQueryContext' -type Node_CreateQueryContext_Call[ContextT any] struct { +type Node_CreateQueryContext_Call[ContextT interface{}] struct { *mock.Call } @@ -78,7 +78,7 @@ func (_c *Node_CreateQueryContext_Call[ContextT]) RunAndReturn(run func(int64, b // NewNode creates a new instance of Node. 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 NewNode[ContextT any](t interface { +func NewNode[ContextT interface{}](t interface { mock.TestingT Cleanup(func()) }) *Node[ContextT] { diff --git a/mod/node-api/backend/mocks/state_processor.mock.go b/mod/node-api/backend/mocks/state_processor.mock.go index ac2b23b03a..bb70ffd086 100644 --- a/mod/node-api/backend/mocks/state_processor.mock.go +++ b/mod/node-api/backend/mocks/state_processor.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -10,11 +10,11 @@ import ( ) // StateProcessor is an autogenerated mock type for the StateProcessor type -type StateProcessor[BeaconStateT any] struct { +type StateProcessor[BeaconStateT interface{}] struct { mock.Mock } -type StateProcessor_Expecter[BeaconStateT any] struct { +type StateProcessor_Expecter[BeaconStateT interface{}] struct { mock *mock.Mock } @@ -53,7 +53,7 @@ func (_m *StateProcessor[BeaconStateT]) ProcessSlots(_a0 BeaconStateT, _a1 math. } // StateProcessor_ProcessSlots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessSlots' -type StateProcessor_ProcessSlots_Call[BeaconStateT any] struct { +type StateProcessor_ProcessSlots_Call[BeaconStateT interface{}] struct { *mock.Call } @@ -83,7 +83,7 @@ func (_c *StateProcessor_ProcessSlots_Call[BeaconStateT]) RunAndReturn(run func( // NewStateProcessor creates a new instance of StateProcessor. 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 NewStateProcessor[BeaconStateT any](t interface { +func NewStateProcessor[BeaconStateT interface{}](t interface { mock.TestingT Cleanup(func()) }) *StateProcessor[BeaconStateT] { diff --git a/mod/node-api/backend/mocks/storage_backend.mock.go b/mod/node-api/backend/mocks/storage_backend.mock.go index dd28160b49..ff93a1dfbb 100644 --- a/mod/node-api/backend/mocks/storage_backend.mock.go +++ b/mod/node-api/backend/mocks/storage_backend.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -9,11 +9,11 @@ import ( ) // StorageBackend is an autogenerated mock type for the StorageBackend type -type StorageBackend[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { +type StorageBackend[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { mock.Mock } -type StorageBackend_Expecter[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { +type StorageBackend_Expecter[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { mock *mock.Mock } @@ -42,7 +42,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_AvailabilityStore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AvailabilityStore' -type StorageBackend_AvailabilityStore_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { +type StorageBackend_AvailabilityStore_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { *mock.Call } @@ -89,7 +89,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_BlockStore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockStore' -type StorageBackend_BlockStore_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { +type StorageBackend_BlockStore_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { *mock.Call } @@ -136,7 +136,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_DepositStore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DepositStore' -type StorageBackend_DepositStore_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { +type StorageBackend_DepositStore_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { *mock.Call } @@ -183,7 +183,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_StateFromContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StateFromContext' -type StorageBackend_StateFromContext_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { +type StorageBackend_StateFromContext_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { *mock.Call } @@ -212,7 +212,7 @@ func (_c *StorageBackend_StateFromContext_Call[AvailabilityStoreT, BeaconStateT, // NewStorageBackend creates a new instance of StorageBackend. 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 NewStorageBackend[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any](t interface { +func NewStorageBackend[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}](t interface { mock.TestingT Cleanup(func()) }) *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositStoreT] { diff --git a/mod/node-api/backend/mocks/validator.mock.go b/mod/node-api/backend/mocks/validator.mock.go index 3f904a98e8..997eae07ac 100644 --- a/mod/node-api/backend/mocks/validator.mock.go +++ b/mod/node-api/backend/mocks/validator.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/node-api/backend/mocks/withdrawal.mock.go b/mod/node-api/backend/mocks/withdrawal.mock.go index 654d5f85e2..5370de0b45 100644 --- a/mod/node-api/backend/mocks/withdrawal.mock.go +++ b/mod/node-api/backend/mocks/withdrawal.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -10,11 +10,11 @@ import ( ) // Withdrawal is an autogenerated mock type for the Withdrawal type -type Withdrawal[T any] struct { +type Withdrawal[T interface{}] struct { mock.Mock } -type Withdrawal_Expecter[T any] struct { +type Withdrawal_Expecter[T interface{}] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *Withdrawal[T]) New(index math.U64, validator math.U64, address common. } // Withdrawal_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New' -type Withdrawal_New_Call[T any] struct { +type Withdrawal_New_Call[T interface{}] struct { *mock.Call } @@ -75,7 +75,7 @@ func (_c *Withdrawal_New_Call[T]) RunAndReturn(run func(math.U64, math.U64, comm // NewWithdrawal creates a new instance of Withdrawal. 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 NewWithdrawal[T any](t interface { +func NewWithdrawal[T interface{}](t interface { mock.TestingT Cleanup(func()) }) *Withdrawal[T] { diff --git a/mod/node-api/backend/mocks/withdrawal_credentials.mock.go b/mod/node-api/backend/mocks/withdrawal_credentials.mock.go index 5189b3b6b8..6abab4521a 100644 --- a/mod/node-api/backend/mocks/withdrawal_credentials.mock.go +++ b/mod/node-api/backend/mocks/withdrawal_credentials.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/node-core/pkg/services/registry/mocks/basic.mock.go b/mod/node-core/pkg/services/registry/mocks/basic.mock.go index 5636cc2499..c72558a571 100644 --- a/mod/node-core/pkg/services/registry/mocks/basic.mock.go +++ b/mod/node-core/pkg/services/registry/mocks/basic.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/node-core/pkg/services/registry/mocks/dispatcher.mock.go b/mod/node-core/pkg/services/registry/mocks/dispatcher.mock.go index 8c02d26466..13003c3117 100644 --- a/mod/node-core/pkg/services/registry/mocks/dispatcher.mock.go +++ b/mod/node-core/pkg/services/registry/mocks/dispatcher.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/node-core/pkg/services/registry/mocks/registry_option.mock.go b/mod/node-core/pkg/services/registry/mocks/registry_option.mock.go index cf55bbcda8..d0239c9f3d 100644 --- a/mod/node-core/pkg/services/registry/mocks/registry_option.mock.go +++ b/mod/node-core/pkg/services/registry/mocks/registry_option.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go b/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go index 4abffe8962..359ea77810 100644 --- a/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go +++ b/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go @@ -1,11 +1,8 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks -import ( - crypto "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" // BLSSigner is an autogenerated mock type for the BLSSigner type type BLSSigner struct { @@ -21,19 +18,19 @@ func (_m *BLSSigner) EXPECT() *BLSSigner_Expecter { } // PublicKey provides a mock function with given fields: -func (_m *BLSSigner) PublicKey() crypto.BLSPubkey { +func (_m *BLSSigner) PublicKey() [48]byte { ret := _m.Called() if len(ret) == 0 { panic("no return value specified for PublicKey") } - var r0 crypto.BLSPubkey - if rf, ok := ret.Get(0).(func() crypto.BLSPubkey); ok { + var r0 [48]byte + if rf, ok := ret.Get(0).(func() [48]byte); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(crypto.BLSPubkey) + r0 = ret.Get(0).([48]byte) } } @@ -57,34 +54,34 @@ func (_c *BLSSigner_PublicKey_Call) Run(run func()) *BLSSigner_PublicKey_Call { return _c } -func (_c *BLSSigner_PublicKey_Call) Return(_a0 crypto.BLSPubkey) *BLSSigner_PublicKey_Call { +func (_c *BLSSigner_PublicKey_Call) Return(_a0 [48]byte) *BLSSigner_PublicKey_Call { _c.Call.Return(_a0) return _c } -func (_c *BLSSigner_PublicKey_Call) RunAndReturn(run func() crypto.BLSPubkey) *BLSSigner_PublicKey_Call { +func (_c *BLSSigner_PublicKey_Call) RunAndReturn(run func() [48]byte) *BLSSigner_PublicKey_Call { _c.Call.Return(run) return _c } // Sign provides a mock function with given fields: _a0 -func (_m *BLSSigner) Sign(_a0 []byte) (crypto.BLSSignature, error) { +func (_m *BLSSigner) Sign(_a0 []byte) ([96]byte, error) { ret := _m.Called(_a0) if len(ret) == 0 { panic("no return value specified for Sign") } - var r0 crypto.BLSSignature + var r0 [96]byte var r1 error - if rf, ok := ret.Get(0).(func([]byte) (crypto.BLSSignature, error)); ok { + if rf, ok := ret.Get(0).(func([]byte) ([96]byte, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func([]byte) crypto.BLSSignature); ok { + if rf, ok := ret.Get(0).(func([]byte) [96]byte); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(crypto.BLSSignature) + r0 = ret.Get(0).([96]byte) } } @@ -115,18 +112,18 @@ func (_c *BLSSigner_Sign_Call) Run(run func(_a0 []byte)) *BLSSigner_Sign_Call { return _c } -func (_c *BLSSigner_Sign_Call) Return(_a0 crypto.BLSSignature, _a1 error) *BLSSigner_Sign_Call { +func (_c *BLSSigner_Sign_Call) Return(_a0 [96]byte, _a1 error) *BLSSigner_Sign_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *BLSSigner_Sign_Call) RunAndReturn(run func([]byte) (crypto.BLSSignature, error)) *BLSSigner_Sign_Call { +func (_c *BLSSigner_Sign_Call) RunAndReturn(run func([]byte) ([96]byte, error)) *BLSSigner_Sign_Call { _c.Call.Return(run) return _c } // VerifySignature provides a mock function with given fields: pubKey, msg, signature -func (_m *BLSSigner) VerifySignature(pubKey crypto.BLSPubkey, msg []byte, signature crypto.BLSSignature) error { +func (_m *BLSSigner) VerifySignature(pubKey [48]byte, msg []byte, signature [96]byte) error { ret := _m.Called(pubKey, msg, signature) if len(ret) == 0 { @@ -134,7 +131,7 @@ func (_m *BLSSigner) VerifySignature(pubKey crypto.BLSPubkey, msg []byte, signat } var r0 error - if rf, ok := ret.Get(0).(func(crypto.BLSPubkey, []byte, crypto.BLSSignature) error); ok { + if rf, ok := ret.Get(0).(func([48]byte, []byte, [96]byte) error); ok { r0 = rf(pubKey, msg, signature) } else { r0 = ret.Error(0) @@ -149,16 +146,16 @@ type BLSSigner_VerifySignature_Call struct { } // VerifySignature is a helper method to define mock.On call -// - pubKey crypto.BLSPubkey +// - pubKey [48]byte // - msg []byte -// - signature crypto.BLSSignature +// - signature [96]byte func (_e *BLSSigner_Expecter) VerifySignature(pubKey interface{}, msg interface{}, signature interface{}) *BLSSigner_VerifySignature_Call { return &BLSSigner_VerifySignature_Call{Call: _e.mock.On("VerifySignature", pubKey, msg, signature)} } -func (_c *BLSSigner_VerifySignature_Call) Run(run func(pubKey crypto.BLSPubkey, msg []byte, signature crypto.BLSSignature)) *BLSSigner_VerifySignature_Call { +func (_c *BLSSigner_VerifySignature_Call) Run(run func(pubKey [48]byte, msg []byte, signature [96]byte)) *BLSSigner_VerifySignature_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(crypto.BLSPubkey), args[1].([]byte), args[2].(crypto.BLSSignature)) + run(args[0].([48]byte), args[1].([]byte), args[2].([96]byte)) }) return _c } @@ -168,7 +165,7 @@ func (_c *BLSSigner_VerifySignature_Call) Return(_a0 error) *BLSSigner_VerifySig return _c } -func (_c *BLSSigner_VerifySignature_Call) RunAndReturn(run func(crypto.BLSPubkey, []byte, crypto.BLSSignature) error) *BLSSigner_VerifySignature_Call { +func (_c *BLSSigner_VerifySignature_Call) RunAndReturn(run func([48]byte, []byte, [96]byte) error) *BLSSigner_VerifySignature_Call { _c.Call.Return(run) return _c } diff --git a/mod/state-transition/pkg/core/mocks/execution_engine.mock.go b/mod/state-transition/pkg/core/mocks/execution_engine.mock.go index c0ddbae4ab..0c53e3687d 100644 --- a/mod/state-transition/pkg/core/mocks/execution_engine.mock.go +++ b/mod/state-transition/pkg/core/mocks/execution_engine.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks @@ -12,11 +12,11 @@ import ( ) // ExecutionEngine is an autogenerated mock type for the ExecutionEngine type -type ExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals] struct { +type ExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals] struct { mock.Mock } -type ExecutionEngine_Expecter[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals] struct { +type ExecutionEngine_Expecter[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *ExecutionEngine[ExecutionPayloadT, ExecutionPayloadHeaderT, Withdrawal } // ExecutionEngine_VerifyAndNotifyNewPayload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VerifyAndNotifyNewPayload' -type ExecutionEngine_VerifyAndNotifyNewPayload_Call[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals] struct { +type ExecutionEngine_VerifyAndNotifyNewPayload_Call[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals] struct { *mock.Call } @@ -73,7 +73,7 @@ func (_c *ExecutionEngine_VerifyAndNotifyNewPayload_Call[ExecutionPayloadT, Exec // NewExecutionEngine creates a new instance of ExecutionEngine. 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 NewExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals](t interface { +func NewExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals](t interface { mock.TestingT Cleanup(func()) }) *ExecutionEngine[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT] { diff --git a/mod/storage/pkg/interfaces/mocks/db.mock.go b/mod/storage/pkg/interfaces/mocks/db.mock.go index f9cdef39a7..956c2182d4 100644 --- a/mod/storage/pkg/interfaces/mocks/db.mock.go +++ b/mod/storage/pkg/interfaces/mocks/db.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/storage/pkg/pruner/mocks/beacon_block.mock.go b/mod/storage/pkg/pruner/mocks/beacon_block.mock.go index ba68c5bf2d..3f6fa20bc2 100644 --- a/mod/storage/pkg/pruner/mocks/beacon_block.mock.go +++ b/mod/storage/pkg/pruner/mocks/beacon_block.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/storage/pkg/pruner/mocks/block_event.mock.go b/mod/storage/pkg/pruner/mocks/block_event.mock.go index 5d2d1891ca..0297db3ce3 100644 --- a/mod/storage/pkg/pruner/mocks/block_event.mock.go +++ b/mod/storage/pkg/pruner/mocks/block_event.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/storage/pkg/pruner/mocks/prunable.mock.go b/mod/storage/pkg/pruner/mocks/prunable.mock.go index 0b84e1e0b4..894d56ac32 100644 --- a/mod/storage/pkg/pruner/mocks/prunable.mock.go +++ b/mod/storage/pkg/pruner/mocks/prunable.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks diff --git a/mod/storage/pkg/pruner/mocks/pruner.mock.go b/mod/storage/pkg/pruner/mocks/pruner.mock.go index 77e354f31e..6d5b0672c4 100644 --- a/mod/storage/pkg/pruner/mocks/pruner.mock.go +++ b/mod/storage/pkg/pruner/mocks/pruner.mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.48.0. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package mocks From 674a84281ac724a121d6b4b4735f9ead47eedde5 Mon Sep 17 00:00:00 2001 From: aBear Date: Mon, 25 Nov 2024 20:56:18 +0100 Subject: [PATCH 16/17] fixed merge --- .../mocks/built_execution_payload_env.mock.go | 14 ++-- .../backend/mocks/availability_store.mock.go | 10 +-- .../backend/mocks/beacon_block_header.mock.go | 26 +++---- .../backend/mocks/beacon_state.mock.go | 72 ++++++++++--------- .../backend/mocks/block_store.mock.go | 12 ++-- .../backend/mocks/deposit_store.mock.go | 12 ++-- mod/node-api/backend/mocks/node.mock.go | 8 +-- .../backend/mocks/state_processor.mock.go | 8 +-- .../backend/mocks/storage_backend.mock.go | 14 ++-- mod/node-api/backend/mocks/withdrawal.mock.go | 8 +-- .../pkg/crypto/mocks/bls_signer.mock.go | 45 ++++++------ .../pkg/core/mocks/execution_engine.mock.go | 8 +-- 12 files changed, 121 insertions(+), 116 deletions(-) diff --git a/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go b/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go index 3b1b6b73f3..2eb2e63c66 100644 --- a/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go +++ b/mod/engine-primitives/pkg/engine-primitives/mocks/built_execution_payload_env.mock.go @@ -10,11 +10,11 @@ import ( ) // BuiltExecutionPayloadEnv is an autogenerated mock type for the BuiltExecutionPayloadEnv type -type BuiltExecutionPayloadEnv[ExecutionPayloadT interface{}] struct { +type BuiltExecutionPayloadEnv[ExecutionPayloadT any] struct { mock.Mock } -type BuiltExecutionPayloadEnv_Expecter[ExecutionPayloadT interface{}] struct { +type BuiltExecutionPayloadEnv_Expecter[ExecutionPayloadT any] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) GetBlobsBundle() enginepr } // BuiltExecutionPayloadEnv_GetBlobsBundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlobsBundle' -type BuiltExecutionPayloadEnv_GetBlobsBundle_Call[ExecutionPayloadT interface{}] struct { +type BuiltExecutionPayloadEnv_GetBlobsBundle_Call[ExecutionPayloadT any] struct { *mock.Call } @@ -90,7 +90,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) GetExecutionPayload() Exe } // BuiltExecutionPayloadEnv_GetExecutionPayload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExecutionPayload' -type BuiltExecutionPayloadEnv_GetExecutionPayload_Call[ExecutionPayloadT interface{}] struct { +type BuiltExecutionPayloadEnv_GetExecutionPayload_Call[ExecutionPayloadT any] struct { *mock.Call } @@ -137,7 +137,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) GetValue() *uint256.Int { } // BuiltExecutionPayloadEnv_GetValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValue' -type BuiltExecutionPayloadEnv_GetValue_Call[ExecutionPayloadT interface{}] struct { +type BuiltExecutionPayloadEnv_GetValue_Call[ExecutionPayloadT any] struct { *mock.Call } @@ -182,7 +182,7 @@ func (_m *BuiltExecutionPayloadEnv[ExecutionPayloadT]) ShouldOverrideBuilder() b } // BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShouldOverrideBuilder' -type BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call[ExecutionPayloadT interface{}] struct { +type BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call[ExecutionPayloadT any] struct { *mock.Call } @@ -210,7 +210,7 @@ func (_c *BuiltExecutionPayloadEnv_ShouldOverrideBuilder_Call[ExecutionPayloadT] // NewBuiltExecutionPayloadEnv creates a new instance of BuiltExecutionPayloadEnv. 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 NewBuiltExecutionPayloadEnv[ExecutionPayloadT interface{}](t interface { +func NewBuiltExecutionPayloadEnv[ExecutionPayloadT any](t interface { mock.TestingT Cleanup(func()) }) *BuiltExecutionPayloadEnv[ExecutionPayloadT] { diff --git a/mod/node-api/backend/mocks/availability_store.mock.go b/mod/node-api/backend/mocks/availability_store.mock.go index dce9967a8a..26ab51f6ca 100644 --- a/mod/node-api/backend/mocks/availability_store.mock.go +++ b/mod/node-api/backend/mocks/availability_store.mock.go @@ -10,11 +10,11 @@ import ( ) // AvailabilityStore is an autogenerated mock type for the AvailabilityStore type -type AvailabilityStore[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { +type AvailabilityStore[BeaconBlockBodyT any, BlobSidecarsT any] struct { mock.Mock } -type AvailabilityStore_Expecter[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { +type AvailabilityStore_Expecter[BeaconBlockBodyT any, BlobSidecarsT any] struct { mock *mock.Mock } @@ -41,7 +41,7 @@ func (_m *AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT]) IsDataAvailable(_a } // AvailabilityStore_IsDataAvailable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDataAvailable' -type AvailabilityStore_IsDataAvailable_Call[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { +type AvailabilityStore_IsDataAvailable_Call[BeaconBlockBodyT any, BlobSidecarsT any] struct { *mock.Call } @@ -89,7 +89,7 @@ func (_m *AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT]) Persist(_a0 math.U } // AvailabilityStore_Persist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Persist' -type AvailabilityStore_Persist_Call[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}] struct { +type AvailabilityStore_Persist_Call[BeaconBlockBodyT any, BlobSidecarsT any] struct { *mock.Call } @@ -119,7 +119,7 @@ func (_c *AvailabilityStore_Persist_Call[BeaconBlockBodyT, BlobSidecarsT]) RunAn // NewAvailabilityStore creates a new instance of AvailabilityStore. 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 NewAvailabilityStore[BeaconBlockBodyT interface{}, BlobSidecarsT interface{}](t interface { +func NewAvailabilityStore[BeaconBlockBodyT any, BlobSidecarsT any](t interface { mock.TestingT Cleanup(func()) }) *AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT] { diff --git a/mod/node-api/backend/mocks/beacon_block_header.mock.go b/mod/node-api/backend/mocks/beacon_block_header.mock.go index f62b151595..db5cfc4192 100644 --- a/mod/node-api/backend/mocks/beacon_block_header.mock.go +++ b/mod/node-api/backend/mocks/beacon_block_header.mock.go @@ -10,11 +10,11 @@ import ( ) // BeaconBlockHeader is an autogenerated mock type for the BeaconBlockHeader type -type BeaconBlockHeader[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader[BeaconBlockHeaderT any] struct { mock.Mock } -type BeaconBlockHeader_Expecter[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_Expecter[BeaconBlockHeaderT any] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetBodyRoot() common.Root { } // BeaconBlockHeader_GetBodyRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBodyRoot' -type BeaconBlockHeader_GetBodyRoot_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_GetBodyRoot_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -90,7 +90,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetParentBlockRoot() common.Roo } // BeaconBlockHeader_GetParentBlockRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParentBlockRoot' -type BeaconBlockHeader_GetParentBlockRoot_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_GetParentBlockRoot_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -135,7 +135,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetProposerIndex() math.U64 { } // BeaconBlockHeader_GetProposerIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProposerIndex' -type BeaconBlockHeader_GetProposerIndex_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_GetProposerIndex_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -180,7 +180,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetSlot() math.U64 { } // BeaconBlockHeader_GetSlot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlot' -type BeaconBlockHeader_GetSlot_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_GetSlot_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -227,7 +227,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) GetStateRoot() common.Root { } // BeaconBlockHeader_GetStateRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStateRoot' -type BeaconBlockHeader_GetStateRoot_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_GetStateRoot_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -274,7 +274,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) HashTreeRoot() common.Root { } // BeaconBlockHeader_HashTreeRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HashTreeRoot' -type BeaconBlockHeader_HashTreeRoot_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_HashTreeRoot_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -331,7 +331,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) MarshalSSZ() ([]byte, error) { } // BeaconBlockHeader_MarshalSSZ_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarshalSSZ' -type BeaconBlockHeader_MarshalSSZ_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_MarshalSSZ_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -378,7 +378,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) New(slot math.U64, proposerInde } // BeaconBlockHeader_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New' -type BeaconBlockHeader_New_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_New_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -415,7 +415,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) SetStateRoot(_a0 common.Root) { } // BeaconBlockHeader_SetStateRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStateRoot' -type BeaconBlockHeader_SetStateRoot_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_SetStateRoot_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -461,7 +461,7 @@ func (_m *BeaconBlockHeader[BeaconBlockHeaderT]) UnmarshalSSZ(_a0 []byte) error } // BeaconBlockHeader_UnmarshalSSZ_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnmarshalSSZ' -type BeaconBlockHeader_UnmarshalSSZ_Call[BeaconBlockHeaderT interface{}] struct { +type BeaconBlockHeader_UnmarshalSSZ_Call[BeaconBlockHeaderT any] struct { *mock.Call } @@ -490,7 +490,7 @@ func (_c *BeaconBlockHeader_UnmarshalSSZ_Call[BeaconBlockHeaderT]) RunAndReturn( // NewBeaconBlockHeader creates a new instance of BeaconBlockHeader. 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 NewBeaconBlockHeader[BeaconBlockHeaderT interface{}](t interface { +func NewBeaconBlockHeader[BeaconBlockHeaderT any](t interface { mock.TestingT Cleanup(func()) }) *BeaconBlockHeader[BeaconBlockHeaderT] { diff --git a/mod/node-api/backend/mocks/beacon_state.mock.go b/mod/node-api/backend/mocks/beacon_state.mock.go index a783c6fd6e..ef3004fd8d 100644 --- a/mod/node-api/backend/mocks/beacon_state.mock.go +++ b/mod/node-api/backend/mocks/beacon_state.mock.go @@ -6,17 +6,19 @@ import ( bytes "github.com/berachain/beacon-kit/mod/primitives/pkg/bytes" common "github.com/berachain/beacon-kit/mod/primitives/pkg/common" + crypto "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" + math "github.com/berachain/beacon-kit/mod/primitives/pkg/math" mock "github.com/stretchr/testify/mock" ) // BeaconState is an autogenerated mock type for the BeaconState type -type BeaconState[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { mock.Mock } -type BeaconState_Expecter[BeaconBlockHeaderT interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_Expecter[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { mock *mock.Mock } @@ -55,7 +57,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ExpectedWithdrawals_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -110,7 +112,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetBalance_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -168,7 +170,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetBlockRootAtIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -226,7 +228,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetEth1Data_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -281,7 +283,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetEth1DepositIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -338,7 +340,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetFork_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -395,7 +397,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetGenesisValidatorsRoot_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -452,7 +454,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetLatestBlockHeader_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -509,7 +511,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetLatestExecutionPayloadHeader_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -564,7 +566,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetNextWithdrawalIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -619,7 +621,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetNextWithdrawalValidatorIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -676,7 +678,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetRandaoMixAtIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -732,7 +734,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetSlashingAtIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -788,7 +790,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetSlot_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -843,7 +845,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetTotalActiveBalances_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -899,7 +901,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetTotalSlashing_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -954,7 +956,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetTotalValidators_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1011,7 +1013,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetValidators_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1068,7 +1070,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_GetValidatorsByEffectiveBalance_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1113,7 +1115,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_SetSlot_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1171,7 +1173,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_StateRootAtIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1229,7 +1231,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ValidatorByIndex_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1285,7 +1287,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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ValidatorIndexByCometBFTAddress_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } @@ -1313,7 +1315,7 @@ func (_c *BeaconState_ValidatorIndexByCometBFTAddress_Call[BeaconBlockHeaderT, E } // ValidatorIndexByPubkey provides a mock function with given fields: _a0 -func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) ValidatorIndexByPubkey(_a0 [48]byte) (math.U64, error) { +func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) ValidatorIndexByPubkey(_a0 crypto.BLSPubkey) (math.U64, error) { ret := _m.Called(_a0) if len(ret) == 0 { @@ -1322,16 +1324,16 @@ func (_m *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, Fo var r0 math.U64 var r1 error - if rf, ok := ret.Get(0).(func([48]byte) (math.U64, error)); ok { + if rf, ok := ret.Get(0).(func(crypto.BLSPubkey) (math.U64, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func([48]byte) math.U64); ok { + if rf, ok := ret.Get(0).(func(crypto.BLSPubkey) math.U64); ok { r0 = rf(_a0) } else { r0 = ret.Get(0).(math.U64) } - if rf, ok := ret.Get(1).(func([48]byte) error); ok { + if rf, ok := ret.Get(1).(func(crypto.BLSPubkey) error); ok { r1 = rf(_a0) } else { r1 = ret.Error(1) @@ -1341,19 +1343,19 @@ 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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}] struct { +type BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any] struct { *mock.Call } // ValidatorIndexByPubkey is a helper method to define mock.On call -// - _a0 [48]byte +// - _a0 crypto.BLSPubkey func (_e *BeaconState_Expecter[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) ValidatorIndexByPubkey(_a0 interface{}) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { return &BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]{Call: _e.mock.On("ValidatorIndexByPubkey", _a0)} } -func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) Run(run func(_a0 [48]byte)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { +func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) Run(run func(_a0 crypto.BLSPubkey)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([48]byte)) + run(args[0].(crypto.BLSPubkey)) }) return _c } @@ -1363,14 +1365,14 @@ func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, return _c } -func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) RunAndReturn(run func([48]byte) (math.U64, error)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { +func (_c *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT]) RunAndReturn(run func(crypto.BLSPubkey) (math.U64, error)) *BeaconState_ValidatorIndexByPubkey_Call[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { _c.Call.Return(run) return _c } // 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 interface{}, Eth1DataT interface{}, ExecutionPayloadHeaderT interface{}, ForkT interface{}, ValidatorT interface{}, ValidatorsT interface{}, WithdrawalT interface{}](t interface { +func NewBeaconState[BeaconBlockHeaderT any, Eth1DataT any, ExecutionPayloadHeaderT any, ForkT any, ValidatorT any, ValidatorsT any, WithdrawalT any](t interface { mock.TestingT Cleanup(func()) }) *BeaconState[BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, ValidatorsT, WithdrawalT] { diff --git a/mod/node-api/backend/mocks/block_store.mock.go b/mod/node-api/backend/mocks/block_store.mock.go index 6035973164..c5bc5b8467 100644 --- a/mod/node-api/backend/mocks/block_store.mock.go +++ b/mod/node-api/backend/mocks/block_store.mock.go @@ -10,11 +10,11 @@ import ( ) // BlockStore is an autogenerated mock type for the BlockStore type -type BlockStore[BeaconBlockT interface{}] struct { +type BlockStore[BeaconBlockT any] struct { mock.Mock } -type BlockStore_Expecter[BeaconBlockT interface{}] struct { +type BlockStore_Expecter[BeaconBlockT any] struct { mock *mock.Mock } @@ -51,7 +51,7 @@ func (_m *BlockStore[BeaconBlockT]) GetParentSlotByTimestamp(timestamp math.U64) } // BlockStore_GetParentSlotByTimestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParentSlotByTimestamp' -type BlockStore_GetParentSlotByTimestamp_Call[BeaconBlockT interface{}] struct { +type BlockStore_GetParentSlotByTimestamp_Call[BeaconBlockT any] struct { *mock.Call } @@ -107,7 +107,7 @@ func (_m *BlockStore[BeaconBlockT]) GetSlotByBlockRoot(root common.Root) (math.U } // BlockStore_GetSlotByBlockRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotByBlockRoot' -type BlockStore_GetSlotByBlockRoot_Call[BeaconBlockT interface{}] struct { +type BlockStore_GetSlotByBlockRoot_Call[BeaconBlockT any] struct { *mock.Call } @@ -163,7 +163,7 @@ func (_m *BlockStore[BeaconBlockT]) GetSlotByStateRoot(root common.Root) (math.U } // BlockStore_GetSlotByStateRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotByStateRoot' -type BlockStore_GetSlotByStateRoot_Call[BeaconBlockT interface{}] struct { +type BlockStore_GetSlotByStateRoot_Call[BeaconBlockT any] struct { *mock.Call } @@ -192,7 +192,7 @@ func (_c *BlockStore_GetSlotByStateRoot_Call[BeaconBlockT]) RunAndReturn(run fun // NewBlockStore creates a new instance of BlockStore. 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 NewBlockStore[BeaconBlockT interface{}](t interface { +func NewBlockStore[BeaconBlockT any](t interface { mock.TestingT Cleanup(func()) }) *BlockStore[BeaconBlockT] { diff --git a/mod/node-api/backend/mocks/deposit_store.mock.go b/mod/node-api/backend/mocks/deposit_store.mock.go index 9ab8b9c40b..a226184c72 100644 --- a/mod/node-api/backend/mocks/deposit_store.mock.go +++ b/mod/node-api/backend/mocks/deposit_store.mock.go @@ -5,11 +5,11 @@ package mocks import mock "github.com/stretchr/testify/mock" // DepositStore is an autogenerated mock type for the DepositStore type -type DepositStore[DepositT interface{}] struct { +type DepositStore[DepositT any] struct { mock.Mock } -type DepositStore_Expecter[DepositT interface{}] struct { +type DepositStore_Expecter[DepositT any] struct { mock *mock.Mock } @@ -36,7 +36,7 @@ func (_m *DepositStore[DepositT]) EnqueueDeposits(deposits []DepositT) error { } // DepositStore_EnqueueDeposits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnqueueDeposits' -type DepositStore_EnqueueDeposits_Call[DepositT interface{}] struct { +type DepositStore_EnqueueDeposits_Call[DepositT any] struct { *mock.Call } @@ -94,7 +94,7 @@ func (_m *DepositStore[DepositT]) GetDepositsByIndex(startIndex uint64, numView } // DepositStore_GetDepositsByIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDepositsByIndex' -type DepositStore_GetDepositsByIndex_Call[DepositT interface{}] struct { +type DepositStore_GetDepositsByIndex_Call[DepositT any] struct { *mock.Call } @@ -141,7 +141,7 @@ func (_m *DepositStore[DepositT]) Prune(start uint64, end uint64) error { } // DepositStore_Prune_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prune' -type DepositStore_Prune_Call[DepositT interface{}] struct { +type DepositStore_Prune_Call[DepositT any] struct { *mock.Call } @@ -171,7 +171,7 @@ func (_c *DepositStore_Prune_Call[DepositT]) RunAndReturn(run func(uint64, uint6 // NewDepositStore creates a new instance of DepositStore. 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 NewDepositStore[DepositT interface{}](t interface { +func NewDepositStore[DepositT any](t interface { mock.TestingT Cleanup(func()) }) *DepositStore[DepositT] { diff --git a/mod/node-api/backend/mocks/node.mock.go b/mod/node-api/backend/mocks/node.mock.go index 5ac750d029..45a53055be 100644 --- a/mod/node-api/backend/mocks/node.mock.go +++ b/mod/node-api/backend/mocks/node.mock.go @@ -5,11 +5,11 @@ package mocks import mock "github.com/stretchr/testify/mock" // Node is an autogenerated mock type for the Node type -type Node[ContextT interface{}] struct { +type Node[ContextT any] struct { mock.Mock } -type Node_Expecter[ContextT interface{}] struct { +type Node_Expecter[ContextT any] struct { mock *mock.Mock } @@ -48,7 +48,7 @@ func (_m *Node[ContextT]) CreateQueryContext(height int64, prove bool) (ContextT } // Node_CreateQueryContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateQueryContext' -type Node_CreateQueryContext_Call[ContextT interface{}] struct { +type Node_CreateQueryContext_Call[ContextT any] struct { *mock.Call } @@ -78,7 +78,7 @@ func (_c *Node_CreateQueryContext_Call[ContextT]) RunAndReturn(run func(int64, b // NewNode creates a new instance of Node. 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 NewNode[ContextT interface{}](t interface { +func NewNode[ContextT any](t interface { mock.TestingT Cleanup(func()) }) *Node[ContextT] { diff --git a/mod/node-api/backend/mocks/state_processor.mock.go b/mod/node-api/backend/mocks/state_processor.mock.go index bb70ffd086..0314009602 100644 --- a/mod/node-api/backend/mocks/state_processor.mock.go +++ b/mod/node-api/backend/mocks/state_processor.mock.go @@ -10,11 +10,11 @@ import ( ) // StateProcessor is an autogenerated mock type for the StateProcessor type -type StateProcessor[BeaconStateT interface{}] struct { +type StateProcessor[BeaconStateT any] struct { mock.Mock } -type StateProcessor_Expecter[BeaconStateT interface{}] struct { +type StateProcessor_Expecter[BeaconStateT any] struct { mock *mock.Mock } @@ -53,7 +53,7 @@ func (_m *StateProcessor[BeaconStateT]) ProcessSlots(_a0 BeaconStateT, _a1 math. } // StateProcessor_ProcessSlots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessSlots' -type StateProcessor_ProcessSlots_Call[BeaconStateT interface{}] struct { +type StateProcessor_ProcessSlots_Call[BeaconStateT any] struct { *mock.Call } @@ -83,7 +83,7 @@ func (_c *StateProcessor_ProcessSlots_Call[BeaconStateT]) RunAndReturn(run func( // NewStateProcessor creates a new instance of StateProcessor. 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 NewStateProcessor[BeaconStateT interface{}](t interface { +func NewStateProcessor[BeaconStateT any](t interface { mock.TestingT Cleanup(func()) }) *StateProcessor[BeaconStateT] { diff --git a/mod/node-api/backend/mocks/storage_backend.mock.go b/mod/node-api/backend/mocks/storage_backend.mock.go index ff93a1dfbb..2992bb6e90 100644 --- a/mod/node-api/backend/mocks/storage_backend.mock.go +++ b/mod/node-api/backend/mocks/storage_backend.mock.go @@ -9,11 +9,11 @@ import ( ) // StorageBackend is an autogenerated mock type for the StorageBackend type -type StorageBackend[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { +type StorageBackend[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { mock.Mock } -type StorageBackend_Expecter[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { +type StorageBackend_Expecter[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { mock *mock.Mock } @@ -42,7 +42,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_AvailabilityStore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AvailabilityStore' -type StorageBackend_AvailabilityStore_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { +type StorageBackend_AvailabilityStore_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { *mock.Call } @@ -89,7 +89,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_BlockStore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockStore' -type StorageBackend_BlockStore_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { +type StorageBackend_BlockStore_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { *mock.Call } @@ -136,7 +136,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_DepositStore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DepositStore' -type StorageBackend_DepositStore_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { +type StorageBackend_DepositStore_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { *mock.Call } @@ -183,7 +183,7 @@ func (_m *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositS } // StorageBackend_StateFromContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StateFromContext' -type StorageBackend_StateFromContext_Call[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}] struct { +type StorageBackend_StateFromContext_Call[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any] struct { *mock.Call } @@ -212,7 +212,7 @@ func (_c *StorageBackend_StateFromContext_Call[AvailabilityStoreT, BeaconStateT, // NewStorageBackend creates a new instance of StorageBackend. 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 NewStorageBackend[AvailabilityStoreT interface{}, BeaconStateT interface{}, BlockStoreT interface{}, DepositStoreT interface{}](t interface { +func NewStorageBackend[AvailabilityStoreT any, BeaconStateT any, BlockStoreT any, DepositStoreT any](t interface { mock.TestingT Cleanup(func()) }) *StorageBackend[AvailabilityStoreT, BeaconStateT, BlockStoreT, DepositStoreT] { diff --git a/mod/node-api/backend/mocks/withdrawal.mock.go b/mod/node-api/backend/mocks/withdrawal.mock.go index 5370de0b45..d0ef6cff94 100644 --- a/mod/node-api/backend/mocks/withdrawal.mock.go +++ b/mod/node-api/backend/mocks/withdrawal.mock.go @@ -10,11 +10,11 @@ import ( ) // Withdrawal is an autogenerated mock type for the Withdrawal type -type Withdrawal[T interface{}] struct { +type Withdrawal[T any] struct { mock.Mock } -type Withdrawal_Expecter[T interface{}] struct { +type Withdrawal_Expecter[T any] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *Withdrawal[T]) New(index math.U64, validator math.U64, address common. } // Withdrawal_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New' -type Withdrawal_New_Call[T interface{}] struct { +type Withdrawal_New_Call[T any] struct { *mock.Call } @@ -75,7 +75,7 @@ func (_c *Withdrawal_New_Call[T]) RunAndReturn(run func(math.U64, math.U64, comm // NewWithdrawal creates a new instance of Withdrawal. 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 NewWithdrawal[T interface{}](t interface { +func NewWithdrawal[T any](t interface { mock.TestingT Cleanup(func()) }) *Withdrawal[T] { diff --git a/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go b/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go index 359ea77810..fad1b08842 100644 --- a/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go +++ b/mod/primitives/pkg/crypto/mocks/bls_signer.mock.go @@ -2,7 +2,10 @@ package mocks -import mock "github.com/stretchr/testify/mock" +import ( + crypto "github.com/berachain/beacon-kit/mod/primitives/pkg/crypto" + mock "github.com/stretchr/testify/mock" +) // BLSSigner is an autogenerated mock type for the BLSSigner type type BLSSigner struct { @@ -18,19 +21,19 @@ func (_m *BLSSigner) EXPECT() *BLSSigner_Expecter { } // PublicKey provides a mock function with given fields: -func (_m *BLSSigner) PublicKey() [48]byte { +func (_m *BLSSigner) PublicKey() crypto.BLSPubkey { ret := _m.Called() if len(ret) == 0 { panic("no return value specified for PublicKey") } - var r0 [48]byte - if rf, ok := ret.Get(0).(func() [48]byte); ok { + var r0 crypto.BLSPubkey + if rf, ok := ret.Get(0).(func() crypto.BLSPubkey); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([48]byte) + r0 = ret.Get(0).(crypto.BLSPubkey) } } @@ -54,34 +57,34 @@ func (_c *BLSSigner_PublicKey_Call) Run(run func()) *BLSSigner_PublicKey_Call { return _c } -func (_c *BLSSigner_PublicKey_Call) Return(_a0 [48]byte) *BLSSigner_PublicKey_Call { +func (_c *BLSSigner_PublicKey_Call) Return(_a0 crypto.BLSPubkey) *BLSSigner_PublicKey_Call { _c.Call.Return(_a0) return _c } -func (_c *BLSSigner_PublicKey_Call) RunAndReturn(run func() [48]byte) *BLSSigner_PublicKey_Call { +func (_c *BLSSigner_PublicKey_Call) RunAndReturn(run func() crypto.BLSPubkey) *BLSSigner_PublicKey_Call { _c.Call.Return(run) return _c } // Sign provides a mock function with given fields: _a0 -func (_m *BLSSigner) Sign(_a0 []byte) ([96]byte, error) { +func (_m *BLSSigner) Sign(_a0 []byte) (crypto.BLSSignature, error) { ret := _m.Called(_a0) if len(ret) == 0 { panic("no return value specified for Sign") } - var r0 [96]byte + var r0 crypto.BLSSignature var r1 error - if rf, ok := ret.Get(0).(func([]byte) ([96]byte, error)); ok { + if rf, ok := ret.Get(0).(func([]byte) (crypto.BLSSignature, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func([]byte) [96]byte); ok { + if rf, ok := ret.Get(0).(func([]byte) crypto.BLSSignature); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([96]byte) + r0 = ret.Get(0).(crypto.BLSSignature) } } @@ -112,18 +115,18 @@ func (_c *BLSSigner_Sign_Call) Run(run func(_a0 []byte)) *BLSSigner_Sign_Call { return _c } -func (_c *BLSSigner_Sign_Call) Return(_a0 [96]byte, _a1 error) *BLSSigner_Sign_Call { +func (_c *BLSSigner_Sign_Call) Return(_a0 crypto.BLSSignature, _a1 error) *BLSSigner_Sign_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *BLSSigner_Sign_Call) RunAndReturn(run func([]byte) ([96]byte, error)) *BLSSigner_Sign_Call { +func (_c *BLSSigner_Sign_Call) RunAndReturn(run func([]byte) (crypto.BLSSignature, error)) *BLSSigner_Sign_Call { _c.Call.Return(run) return _c } // VerifySignature provides a mock function with given fields: pubKey, msg, signature -func (_m *BLSSigner) VerifySignature(pubKey [48]byte, msg []byte, signature [96]byte) error { +func (_m *BLSSigner) VerifySignature(pubKey crypto.BLSPubkey, msg []byte, signature crypto.BLSSignature) error { ret := _m.Called(pubKey, msg, signature) if len(ret) == 0 { @@ -131,7 +134,7 @@ func (_m *BLSSigner) VerifySignature(pubKey [48]byte, msg []byte, signature [96] } var r0 error - if rf, ok := ret.Get(0).(func([48]byte, []byte, [96]byte) error); ok { + if rf, ok := ret.Get(0).(func(crypto.BLSPubkey, []byte, crypto.BLSSignature) error); ok { r0 = rf(pubKey, msg, signature) } else { r0 = ret.Error(0) @@ -146,16 +149,16 @@ type BLSSigner_VerifySignature_Call struct { } // VerifySignature is a helper method to define mock.On call -// - pubKey [48]byte +// - pubKey crypto.BLSPubkey // - msg []byte -// - signature [96]byte +// - signature crypto.BLSSignature func (_e *BLSSigner_Expecter) VerifySignature(pubKey interface{}, msg interface{}, signature interface{}) *BLSSigner_VerifySignature_Call { return &BLSSigner_VerifySignature_Call{Call: _e.mock.On("VerifySignature", pubKey, msg, signature)} } -func (_c *BLSSigner_VerifySignature_Call) Run(run func(pubKey [48]byte, msg []byte, signature [96]byte)) *BLSSigner_VerifySignature_Call { +func (_c *BLSSigner_VerifySignature_Call) Run(run func(pubKey crypto.BLSPubkey, msg []byte, signature crypto.BLSSignature)) *BLSSigner_VerifySignature_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([48]byte), args[1].([]byte), args[2].([96]byte)) + run(args[0].(crypto.BLSPubkey), args[1].([]byte), args[2].(crypto.BLSSignature)) }) return _c } @@ -165,7 +168,7 @@ func (_c *BLSSigner_VerifySignature_Call) Return(_a0 error) *BLSSigner_VerifySig return _c } -func (_c *BLSSigner_VerifySignature_Call) RunAndReturn(run func([48]byte, []byte, [96]byte) error) *BLSSigner_VerifySignature_Call { +func (_c *BLSSigner_VerifySignature_Call) RunAndReturn(run func(crypto.BLSPubkey, []byte, crypto.BLSSignature) error) *BLSSigner_VerifySignature_Call { _c.Call.Return(run) return _c } diff --git a/mod/state-transition/pkg/core/mocks/execution_engine.mock.go b/mod/state-transition/pkg/core/mocks/execution_engine.mock.go index 0c53e3687d..8bf5537e0c 100644 --- a/mod/state-transition/pkg/core/mocks/execution_engine.mock.go +++ b/mod/state-transition/pkg/core/mocks/execution_engine.mock.go @@ -12,11 +12,11 @@ import ( ) // ExecutionEngine is an autogenerated mock type for the ExecutionEngine type -type ExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals] struct { +type ExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals] struct { mock.Mock } -type ExecutionEngine_Expecter[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals] struct { +type ExecutionEngine_Expecter[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals] struct { mock *mock.Mock } @@ -43,7 +43,7 @@ func (_m *ExecutionEngine[ExecutionPayloadT, ExecutionPayloadHeaderT, Withdrawal } // ExecutionEngine_VerifyAndNotifyNewPayload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VerifyAndNotifyNewPayload' -type ExecutionEngine_VerifyAndNotifyNewPayload_Call[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals] struct { +type ExecutionEngine_VerifyAndNotifyNewPayload_Call[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals] struct { *mock.Call } @@ -73,7 +73,7 @@ func (_c *ExecutionEngine_VerifyAndNotifyNewPayload_Call[ExecutionPayloadT, Exec // NewExecutionEngine creates a new instance of ExecutionEngine. 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 NewExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT interface{}, WithdrawalsT core.Withdrawals](t interface { +func NewExecutionEngine[ExecutionPayloadT core.ExecutionPayload[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT], ExecutionPayloadHeaderT any, WithdrawalsT core.Withdrawals](t interface { mock.TestingT Cleanup(func()) }) *ExecutionEngine[ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalsT] { From 2cfd6a0c84a14bf0c5a726bda10eb06136cbc077 Mon Sep 17 00:00:00 2001 From: aBear Date: Wed, 27 Nov 2024 12:10:37 +0100 Subject: [PATCH 17/17] fix merge --- mod/state-transition/pkg/core/deposits_validation.go | 2 ++ mod/state-transition/pkg/core/state_processor_genesis.go | 4 ++++ mod/state-transition/pkg/core/state_processor_staking.go | 7 +++---- .../pkg/core/state_processor_staking_test.go | 5 +++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mod/state-transition/pkg/core/deposits_validation.go b/mod/state-transition/pkg/core/deposits_validation.go index 87fdeeff2f..bd28ada64b 100644 --- a/mod/state-transition/pkg/core/deposits_validation.go +++ b/mod/state-transition/pkg/core/deposits_validation.go @@ -48,6 +48,8 @@ func (sp *StateProcessor[ return nil default: + // TODO: improve error handling by distinguishing + // ErrNotFound from other kind of errors if _, err := st.GetEth1DepositIndex(); err == nil { // there should not be Eth1DepositIndex stored before // genesis first deposit diff --git a/mod/state-transition/pkg/core/state_processor_genesis.go b/mod/state-transition/pkg/core/state_processor_genesis.go index 70dfcac85c..78faca5f88 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis.go +++ b/mod/state-transition/pkg/core/state_processor_genesis.go @@ -42,6 +42,10 @@ func (sp *StateProcessor[ execPayloadHeader ExecutionPayloadHeaderT, genesisVersion common.Version, ) (transition.ValidatorUpdates, error) { + if err := st.SetSlot(0); err != nil { + return nil, err + } + var fork ForkT fork = fork.New( genesisVersion, diff --git a/mod/state-transition/pkg/core/state_processor_staking.go b/mod/state-transition/pkg/core/state_processor_staking.go index aa8d527ce9..bbb9e968ca 100644 --- a/mod/state-transition/pkg/core/state_processor_staking.go +++ b/mod/state-transition/pkg/core/state_processor_staking.go @@ -43,10 +43,10 @@ func (sp *StateProcessor[ // Verify that outstanding deposits are processed // up to the maximum number of deposits - // TODO we should assert here that + // Unlike Eth 2.0 specs we don't check that // len(body.deposits) == min(MAX_DEPOSITS, // state.eth1_data.deposit_count - state.eth1_deposit_index) - // Until we fix eth1Data we do a partial check + // Instead we directly compare block deposits with store ones. deposits := blk.GetBody().GetDeposits() if uint64(len(deposits)) > sp.cs.MaxDepositsPerBlock() { return errors.Wrapf( @@ -54,7 +54,6 @@ func (sp *StateProcessor[ sp.cs.MaxDepositsPerBlock(), len(deposits), ) } - if err := sp.validateNonGenesisDeposits(st, deposits); err != nil { return err } @@ -91,7 +90,7 @@ func (sp *StateProcessor[ if err != nil { // If the validator does not exist, we add the validator. // TODO: improve error handling by distinguishing - // validator not found from other kind of errors + // ErrNotFound from other kind of errors return sp.createValidator(st, dep) } diff --git a/mod/state-transition/pkg/core/state_processor_staking_test.go b/mod/state-transition/pkg/core/state_processor_staking_test.go index b8dcfc124a..910ccd3733 100644 --- a/mod/state-transition/pkg/core/state_processor_staking_test.go +++ b/mod/state-transition/pkg/core/state_processor_staking_test.go @@ -338,6 +338,11 @@ func TestTransitionCreateValidator(t *testing.T) { }, ) + // make sure included deposit is already available in deposit store + require.NoError(t, depositStore.EnqueueDeposits( + []*types.Deposit{blkDeposit}), + ) + // run the test updatedVals, err := sp.Transition(ctx, beaconState, blk1) require.NoError(t, err)