diff --git a/cl/abstract/beacon_state.go b/cl/abstract/beacon_state.go index d022340b15f..0a52dcf39ab 100644 --- a/cl/abstract/beacon_state.go +++ b/cl/abstract/beacon_state.go @@ -24,6 +24,7 @@ import ( "github.com/erigontech/erigon/cl/cltypes/solid" ) +//go:generate mockgen -typed=true -destination=./mock_services/beacon_state_mock.go -package=mock_services . BeaconState type BeaconState interface { BeaconStateBasic BeaconStateExtension @@ -58,6 +59,14 @@ type BeaconStateExtension interface { PreviousStateRoot() common.Hash SetPreviousStateRoot(root common.Hash) GetValidatorActivationChurnLimit() uint64 + GetPendingPartialWithdrawals() *solid.ListSSZ[*solid.PendingPartialWithdrawal] + GetDepositBalanceToConsume() uint64 + GetPendingDeposits() *solid.ListSSZ[*solid.PendingDeposit] + GetDepositRequestsStartIndex() uint64 + GetPendingConsolidations() *solid.ListSSZ[*solid.PendingConsolidation] + GetEarlistConsolidationEpoch() uint64 + ComputeExitEpochAndUpdateChurn(exitBalance uint64) uint64 + GetConsolidationBalanceToConsume() uint64 } type BeaconStateBasic interface { @@ -122,7 +131,14 @@ type BeaconStateMutator interface { SetValidatorInactivityScore(index int, score uint64) error SetCurrentEpochParticipationFlags(flags []cltypes.ParticipationFlags) SetPreviousEpochParticipationFlags(flags []cltypes.ParticipationFlags) - SetPreviousEpochAttestations(attestations *solid.ListSSZ[*solid.PendingAttestation]) // temporarily skip this mock + SetPreviousEpochAttestations(attestations *solid.ListSSZ[*solid.PendingAttestation]) + SetPendingPartialWithdrawals(*solid.ListSSZ[*solid.PendingPartialWithdrawal]) + SetPendingDeposits(*solid.ListSSZ[*solid.PendingDeposit]) + SetDepositBalanceToConsume(uint64) + SetPendingConsolidations(consolidations *solid.ListSSZ[*solid.PendingConsolidation]) + SetDepositRequestsStartIndex(uint64) + SetConsolidationBalanceToConsume(uint64) + SetEarlistConsolidationEpoch(uint64) AddEth1DataVote(vote *cltypes.Eth1Data) AddValidator(validator solid.Validator, balance uint64) @@ -136,6 +152,9 @@ type BeaconStateMutator interface { AddPreviousEpochAttestation(attestation *solid.PendingAttestation) AppendValidator(in solid.Validator) + AppendPendingDeposit(deposit *solid.PendingDeposit) + AppendPendingPartialWithdrawal(withdrawal *solid.PendingPartialWithdrawal) + AppendPendingConsolidation(consolidation *solid.PendingConsolidation) ResetEth1DataVotes() ResetEpochParticipation() diff --git a/cl/abstract/mock_services/beacon_state_mock.go b/cl/abstract/mock_services/beacon_state_mock.go new file mode 100644 index 00000000000..5c24d55c24a --- /dev/null +++ b/cl/abstract/mock_services/beacon_state_mock.go @@ -0,0 +1,6071 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/erigontech/erigon/cl/abstract (interfaces: BeaconState) +// +// Generated by this command: +// +// mockgen -typed=true -destination=./mock_services/beacon_state_mock.go -package=mock_services . BeaconState +// + +// Package mock_services is a generated GoMock package. +package mock_services + +import ( + reflect "reflect" + + common "github.com/erigontech/erigon-lib/common" + clonable "github.com/erigontech/erigon-lib/types/clonable" + clparams "github.com/erigontech/erigon/cl/clparams" + cltypes "github.com/erigontech/erigon/cl/cltypes" + solid "github.com/erigontech/erigon/cl/cltypes/solid" + gomock "go.uber.org/mock/gomock" +) + +// MockBeaconState is a mock of BeaconState interface. +type MockBeaconState struct { + ctrl *gomock.Controller + recorder *MockBeaconStateMockRecorder + isgomock struct{} +} + +// MockBeaconStateMockRecorder is the mock recorder for MockBeaconState. +type MockBeaconStateMockRecorder struct { + mock *MockBeaconState +} + +// NewMockBeaconState creates a new mock instance. +func NewMockBeaconState(ctrl *gomock.Controller) *MockBeaconState { + mock := &MockBeaconState{ctrl: ctrl} + mock.recorder = &MockBeaconStateMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBeaconState) EXPECT() *MockBeaconStateMockRecorder { + return m.recorder +} + +// AddCurrentEpochAtteastation mocks base method. +func (m *MockBeaconState) AddCurrentEpochAtteastation(attestation *solid.PendingAttestation) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddCurrentEpochAtteastation", attestation) +} + +// AddCurrentEpochAtteastation indicates an expected call of AddCurrentEpochAtteastation. +func (mr *MockBeaconStateMockRecorder) AddCurrentEpochAtteastation(attestation any) *MockBeaconStateAddCurrentEpochAtteastationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddCurrentEpochAtteastation", reflect.TypeOf((*MockBeaconState)(nil).AddCurrentEpochAtteastation), attestation) + return &MockBeaconStateAddCurrentEpochAtteastationCall{Call: call} +} + +// MockBeaconStateAddCurrentEpochAtteastationCall wrap *gomock.Call +type MockBeaconStateAddCurrentEpochAtteastationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddCurrentEpochAtteastationCall) Return() *MockBeaconStateAddCurrentEpochAtteastationCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddCurrentEpochAtteastationCall) Do(f func(*solid.PendingAttestation)) *MockBeaconStateAddCurrentEpochAtteastationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddCurrentEpochAtteastationCall) DoAndReturn(f func(*solid.PendingAttestation)) *MockBeaconStateAddCurrentEpochAtteastationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddCurrentEpochParticipationFlags mocks base method. +func (m *MockBeaconState) AddCurrentEpochParticipationFlags(flags cltypes.ParticipationFlags) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddCurrentEpochParticipationFlags", flags) +} + +// AddCurrentEpochParticipationFlags indicates an expected call of AddCurrentEpochParticipationFlags. +func (mr *MockBeaconStateMockRecorder) AddCurrentEpochParticipationFlags(flags any) *MockBeaconStateAddCurrentEpochParticipationFlagsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddCurrentEpochParticipationFlags", reflect.TypeOf((*MockBeaconState)(nil).AddCurrentEpochParticipationFlags), flags) + return &MockBeaconStateAddCurrentEpochParticipationFlagsCall{Call: call} +} + +// MockBeaconStateAddCurrentEpochParticipationFlagsCall wrap *gomock.Call +type MockBeaconStateAddCurrentEpochParticipationFlagsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddCurrentEpochParticipationFlagsCall) Return() *MockBeaconStateAddCurrentEpochParticipationFlagsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddCurrentEpochParticipationFlagsCall) Do(f func(cltypes.ParticipationFlags)) *MockBeaconStateAddCurrentEpochParticipationFlagsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddCurrentEpochParticipationFlagsCall) DoAndReturn(f func(cltypes.ParticipationFlags)) *MockBeaconStateAddCurrentEpochParticipationFlagsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddEth1DataVote mocks base method. +func (m *MockBeaconState) AddEth1DataVote(vote *cltypes.Eth1Data) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddEth1DataVote", vote) +} + +// AddEth1DataVote indicates an expected call of AddEth1DataVote. +func (mr *MockBeaconStateMockRecorder) AddEth1DataVote(vote any) *MockBeaconStateAddEth1DataVoteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEth1DataVote", reflect.TypeOf((*MockBeaconState)(nil).AddEth1DataVote), vote) + return &MockBeaconStateAddEth1DataVoteCall{Call: call} +} + +// MockBeaconStateAddEth1DataVoteCall wrap *gomock.Call +type MockBeaconStateAddEth1DataVoteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddEth1DataVoteCall) Return() *MockBeaconStateAddEth1DataVoteCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddEth1DataVoteCall) Do(f func(*cltypes.Eth1Data)) *MockBeaconStateAddEth1DataVoteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddEth1DataVoteCall) DoAndReturn(f func(*cltypes.Eth1Data)) *MockBeaconStateAddEth1DataVoteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddHistoricalRoot mocks base method. +func (m *MockBeaconState) AddHistoricalRoot(root common.Hash) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddHistoricalRoot", root) +} + +// AddHistoricalRoot indicates an expected call of AddHistoricalRoot. +func (mr *MockBeaconStateMockRecorder) AddHistoricalRoot(root any) *MockBeaconStateAddHistoricalRootCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddHistoricalRoot", reflect.TypeOf((*MockBeaconState)(nil).AddHistoricalRoot), root) + return &MockBeaconStateAddHistoricalRootCall{Call: call} +} + +// MockBeaconStateAddHistoricalRootCall wrap *gomock.Call +type MockBeaconStateAddHistoricalRootCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddHistoricalRootCall) Return() *MockBeaconStateAddHistoricalRootCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddHistoricalRootCall) Do(f func(common.Hash)) *MockBeaconStateAddHistoricalRootCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddHistoricalRootCall) DoAndReturn(f func(common.Hash)) *MockBeaconStateAddHistoricalRootCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddHistoricalSummary mocks base method. +func (m *MockBeaconState) AddHistoricalSummary(summary *cltypes.HistoricalSummary) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddHistoricalSummary", summary) +} + +// AddHistoricalSummary indicates an expected call of AddHistoricalSummary. +func (mr *MockBeaconStateMockRecorder) AddHistoricalSummary(summary any) *MockBeaconStateAddHistoricalSummaryCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddHistoricalSummary", reflect.TypeOf((*MockBeaconState)(nil).AddHistoricalSummary), summary) + return &MockBeaconStateAddHistoricalSummaryCall{Call: call} +} + +// MockBeaconStateAddHistoricalSummaryCall wrap *gomock.Call +type MockBeaconStateAddHistoricalSummaryCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddHistoricalSummaryCall) Return() *MockBeaconStateAddHistoricalSummaryCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddHistoricalSummaryCall) Do(f func(*cltypes.HistoricalSummary)) *MockBeaconStateAddHistoricalSummaryCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddHistoricalSummaryCall) DoAndReturn(f func(*cltypes.HistoricalSummary)) *MockBeaconStateAddHistoricalSummaryCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddInactivityScore mocks base method. +func (m *MockBeaconState) AddInactivityScore(score uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddInactivityScore", score) +} + +// AddInactivityScore indicates an expected call of AddInactivityScore. +func (mr *MockBeaconStateMockRecorder) AddInactivityScore(score any) *MockBeaconStateAddInactivityScoreCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddInactivityScore", reflect.TypeOf((*MockBeaconState)(nil).AddInactivityScore), score) + return &MockBeaconStateAddInactivityScoreCall{Call: call} +} + +// MockBeaconStateAddInactivityScoreCall wrap *gomock.Call +type MockBeaconStateAddInactivityScoreCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddInactivityScoreCall) Return() *MockBeaconStateAddInactivityScoreCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddInactivityScoreCall) Do(f func(uint64)) *MockBeaconStateAddInactivityScoreCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddInactivityScoreCall) DoAndReturn(f func(uint64)) *MockBeaconStateAddInactivityScoreCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddPreviousEpochAttestation mocks base method. +func (m *MockBeaconState) AddPreviousEpochAttestation(attestation *solid.PendingAttestation) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddPreviousEpochAttestation", attestation) +} + +// AddPreviousEpochAttestation indicates an expected call of AddPreviousEpochAttestation. +func (mr *MockBeaconStateMockRecorder) AddPreviousEpochAttestation(attestation any) *MockBeaconStateAddPreviousEpochAttestationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPreviousEpochAttestation", reflect.TypeOf((*MockBeaconState)(nil).AddPreviousEpochAttestation), attestation) + return &MockBeaconStateAddPreviousEpochAttestationCall{Call: call} +} + +// MockBeaconStateAddPreviousEpochAttestationCall wrap *gomock.Call +type MockBeaconStateAddPreviousEpochAttestationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddPreviousEpochAttestationCall) Return() *MockBeaconStateAddPreviousEpochAttestationCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddPreviousEpochAttestationCall) Do(f func(*solid.PendingAttestation)) *MockBeaconStateAddPreviousEpochAttestationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddPreviousEpochAttestationCall) DoAndReturn(f func(*solid.PendingAttestation)) *MockBeaconStateAddPreviousEpochAttestationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddPreviousEpochParticipationAt mocks base method. +func (m *MockBeaconState) AddPreviousEpochParticipationAt(index int, delta byte) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddPreviousEpochParticipationAt", index, delta) +} + +// AddPreviousEpochParticipationAt indicates an expected call of AddPreviousEpochParticipationAt. +func (mr *MockBeaconStateMockRecorder) AddPreviousEpochParticipationAt(index, delta any) *MockBeaconStateAddPreviousEpochParticipationAtCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPreviousEpochParticipationAt", reflect.TypeOf((*MockBeaconState)(nil).AddPreviousEpochParticipationAt), index, delta) + return &MockBeaconStateAddPreviousEpochParticipationAtCall{Call: call} +} + +// MockBeaconStateAddPreviousEpochParticipationAtCall wrap *gomock.Call +type MockBeaconStateAddPreviousEpochParticipationAtCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddPreviousEpochParticipationAtCall) Return() *MockBeaconStateAddPreviousEpochParticipationAtCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddPreviousEpochParticipationAtCall) Do(f func(int, byte)) *MockBeaconStateAddPreviousEpochParticipationAtCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddPreviousEpochParticipationAtCall) DoAndReturn(f func(int, byte)) *MockBeaconStateAddPreviousEpochParticipationAtCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddPreviousEpochParticipationFlags mocks base method. +func (m *MockBeaconState) AddPreviousEpochParticipationFlags(flags cltypes.ParticipationFlags) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddPreviousEpochParticipationFlags", flags) +} + +// AddPreviousEpochParticipationFlags indicates an expected call of AddPreviousEpochParticipationFlags. +func (mr *MockBeaconStateMockRecorder) AddPreviousEpochParticipationFlags(flags any) *MockBeaconStateAddPreviousEpochParticipationFlagsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPreviousEpochParticipationFlags", reflect.TypeOf((*MockBeaconState)(nil).AddPreviousEpochParticipationFlags), flags) + return &MockBeaconStateAddPreviousEpochParticipationFlagsCall{Call: call} +} + +// MockBeaconStateAddPreviousEpochParticipationFlagsCall wrap *gomock.Call +type MockBeaconStateAddPreviousEpochParticipationFlagsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddPreviousEpochParticipationFlagsCall) Return() *MockBeaconStateAddPreviousEpochParticipationFlagsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddPreviousEpochParticipationFlagsCall) Do(f func(cltypes.ParticipationFlags)) *MockBeaconStateAddPreviousEpochParticipationFlagsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddPreviousEpochParticipationFlagsCall) DoAndReturn(f func(cltypes.ParticipationFlags)) *MockBeaconStateAddPreviousEpochParticipationFlagsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AddValidator mocks base method. +func (m *MockBeaconState) AddValidator(validator solid.Validator, balance uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddValidator", validator, balance) +} + +// AddValidator indicates an expected call of AddValidator. +func (mr *MockBeaconStateMockRecorder) AddValidator(validator, balance any) *MockBeaconStateAddValidatorCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddValidator", reflect.TypeOf((*MockBeaconState)(nil).AddValidator), validator, balance) + return &MockBeaconStateAddValidatorCall{Call: call} +} + +// MockBeaconStateAddValidatorCall wrap *gomock.Call +type MockBeaconStateAddValidatorCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAddValidatorCall) Return() *MockBeaconStateAddValidatorCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAddValidatorCall) Do(f func(solid.Validator, uint64)) *MockBeaconStateAddValidatorCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAddValidatorCall) DoAndReturn(f func(solid.Validator, uint64)) *MockBeaconStateAddValidatorCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AppendPendingConsolidation mocks base method. +func (m *MockBeaconState) AppendPendingConsolidation(consolidation *solid.PendingConsolidation) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendPendingConsolidation", consolidation) +} + +// AppendPendingConsolidation indicates an expected call of AppendPendingConsolidation. +func (mr *MockBeaconStateMockRecorder) AppendPendingConsolidation(consolidation any) *MockBeaconStateAppendPendingConsolidationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendPendingConsolidation", reflect.TypeOf((*MockBeaconState)(nil).AppendPendingConsolidation), consolidation) + return &MockBeaconStateAppendPendingConsolidationCall{Call: call} +} + +// MockBeaconStateAppendPendingConsolidationCall wrap *gomock.Call +type MockBeaconStateAppendPendingConsolidationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAppendPendingConsolidationCall) Return() *MockBeaconStateAppendPendingConsolidationCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAppendPendingConsolidationCall) Do(f func(*solid.PendingConsolidation)) *MockBeaconStateAppendPendingConsolidationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAppendPendingConsolidationCall) DoAndReturn(f func(*solid.PendingConsolidation)) *MockBeaconStateAppendPendingConsolidationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AppendPendingDeposit mocks base method. +func (m *MockBeaconState) AppendPendingDeposit(deposit *solid.PendingDeposit) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendPendingDeposit", deposit) +} + +// AppendPendingDeposit indicates an expected call of AppendPendingDeposit. +func (mr *MockBeaconStateMockRecorder) AppendPendingDeposit(deposit any) *MockBeaconStateAppendPendingDepositCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendPendingDeposit", reflect.TypeOf((*MockBeaconState)(nil).AppendPendingDeposit), deposit) + return &MockBeaconStateAppendPendingDepositCall{Call: call} +} + +// MockBeaconStateAppendPendingDepositCall wrap *gomock.Call +type MockBeaconStateAppendPendingDepositCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAppendPendingDepositCall) Return() *MockBeaconStateAppendPendingDepositCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAppendPendingDepositCall) Do(f func(*solid.PendingDeposit)) *MockBeaconStateAppendPendingDepositCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAppendPendingDepositCall) DoAndReturn(f func(*solid.PendingDeposit)) *MockBeaconStateAppendPendingDepositCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AppendPendingPartialWithdrawal mocks base method. +func (m *MockBeaconState) AppendPendingPartialWithdrawal(withdrawal *solid.PendingPartialWithdrawal) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendPendingPartialWithdrawal", withdrawal) +} + +// AppendPendingPartialWithdrawal indicates an expected call of AppendPendingPartialWithdrawal. +func (mr *MockBeaconStateMockRecorder) AppendPendingPartialWithdrawal(withdrawal any) *MockBeaconStateAppendPendingPartialWithdrawalCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendPendingPartialWithdrawal", reflect.TypeOf((*MockBeaconState)(nil).AppendPendingPartialWithdrawal), withdrawal) + return &MockBeaconStateAppendPendingPartialWithdrawalCall{Call: call} +} + +// MockBeaconStateAppendPendingPartialWithdrawalCall wrap *gomock.Call +type MockBeaconStateAppendPendingPartialWithdrawalCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAppendPendingPartialWithdrawalCall) Return() *MockBeaconStateAppendPendingPartialWithdrawalCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAppendPendingPartialWithdrawalCall) Do(f func(*solid.PendingPartialWithdrawal)) *MockBeaconStateAppendPendingPartialWithdrawalCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAppendPendingPartialWithdrawalCall) DoAndReturn(f func(*solid.PendingPartialWithdrawal)) *MockBeaconStateAppendPendingPartialWithdrawalCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AppendValidator mocks base method. +func (m *MockBeaconState) AppendValidator(in solid.Validator) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendValidator", in) +} + +// AppendValidator indicates an expected call of AppendValidator. +func (mr *MockBeaconStateMockRecorder) AppendValidator(in any) *MockBeaconStateAppendValidatorCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendValidator", reflect.TypeOf((*MockBeaconState)(nil).AppendValidator), in) + return &MockBeaconStateAppendValidatorCall{Call: call} +} + +// MockBeaconStateAppendValidatorCall wrap *gomock.Call +type MockBeaconStateAppendValidatorCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateAppendValidatorCall) Return() *MockBeaconStateAppendValidatorCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateAppendValidatorCall) Do(f func(solid.Validator)) *MockBeaconStateAppendValidatorCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateAppendValidatorCall) DoAndReturn(f func(solid.Validator)) *MockBeaconStateAppendValidatorCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BaseReward mocks base method. +func (m *MockBeaconState) BaseReward(index uint64) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BaseReward", index) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BaseReward indicates an expected call of BaseReward. +func (mr *MockBeaconStateMockRecorder) BaseReward(index any) *MockBeaconStateBaseRewardCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BaseReward", reflect.TypeOf((*MockBeaconState)(nil).BaseReward), index) + return &MockBeaconStateBaseRewardCall{Call: call} +} + +// MockBeaconStateBaseRewardCall wrap *gomock.Call +type MockBeaconStateBaseRewardCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateBaseRewardCall) Return(arg0 uint64, arg1 error) *MockBeaconStateBaseRewardCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateBaseRewardCall) Do(f func(uint64) (uint64, error)) *MockBeaconStateBaseRewardCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateBaseRewardCall) DoAndReturn(f func(uint64) (uint64, error)) *MockBeaconStateBaseRewardCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BaseRewardPerIncrement mocks base method. +func (m *MockBeaconState) BaseRewardPerIncrement() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BaseRewardPerIncrement") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// BaseRewardPerIncrement indicates an expected call of BaseRewardPerIncrement. +func (mr *MockBeaconStateMockRecorder) BaseRewardPerIncrement() *MockBeaconStateBaseRewardPerIncrementCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BaseRewardPerIncrement", reflect.TypeOf((*MockBeaconState)(nil).BaseRewardPerIncrement)) + return &MockBeaconStateBaseRewardPerIncrementCall{Call: call} +} + +// MockBeaconStateBaseRewardPerIncrementCall wrap *gomock.Call +type MockBeaconStateBaseRewardPerIncrementCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateBaseRewardPerIncrementCall) Return(arg0 uint64) *MockBeaconStateBaseRewardPerIncrementCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateBaseRewardPerIncrementCall) Do(f func() uint64) *MockBeaconStateBaseRewardPerIncrementCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateBaseRewardPerIncrementCall) DoAndReturn(f func() uint64) *MockBeaconStateBaseRewardPerIncrementCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BeaconConfig mocks base method. +func (m *MockBeaconState) BeaconConfig() *clparams.BeaconChainConfig { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BeaconConfig") + ret0, _ := ret[0].(*clparams.BeaconChainConfig) + return ret0 +} + +// BeaconConfig indicates an expected call of BeaconConfig. +func (mr *MockBeaconStateMockRecorder) BeaconConfig() *MockBeaconStateBeaconConfigCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeaconConfig", reflect.TypeOf((*MockBeaconState)(nil).BeaconConfig)) + return &MockBeaconStateBeaconConfigCall{Call: call} +} + +// MockBeaconStateBeaconConfigCall wrap *gomock.Call +type MockBeaconStateBeaconConfigCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateBeaconConfigCall) Return(arg0 *clparams.BeaconChainConfig) *MockBeaconStateBeaconConfigCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateBeaconConfigCall) Do(f func() *clparams.BeaconChainConfig) *MockBeaconStateBeaconConfigCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateBeaconConfigCall) DoAndReturn(f func() *clparams.BeaconChainConfig) *MockBeaconStateBeaconConfigCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BlockRoot mocks base method. +func (m *MockBeaconState) BlockRoot() ([32]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlockRoot") + ret0, _ := ret[0].([32]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BlockRoot indicates an expected call of BlockRoot. +func (mr *MockBeaconStateMockRecorder) BlockRoot() *MockBeaconStateBlockRootCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockRoot", reflect.TypeOf((*MockBeaconState)(nil).BlockRoot)) + return &MockBeaconStateBlockRootCall{Call: call} +} + +// MockBeaconStateBlockRootCall wrap *gomock.Call +type MockBeaconStateBlockRootCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateBlockRootCall) Return(arg0 [32]byte, arg1 error) *MockBeaconStateBlockRootCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateBlockRootCall) Do(f func() ([32]byte, error)) *MockBeaconStateBlockRootCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateBlockRootCall) DoAndReturn(f func() ([32]byte, error)) *MockBeaconStateBlockRootCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BlockRoots mocks base method. +func (m *MockBeaconState) BlockRoots() solid.HashVectorSSZ { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlockRoots") + ret0, _ := ret[0].(solid.HashVectorSSZ) + return ret0 +} + +// BlockRoots indicates an expected call of BlockRoots. +func (mr *MockBeaconStateMockRecorder) BlockRoots() *MockBeaconStateBlockRootsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockRoots", reflect.TypeOf((*MockBeaconState)(nil).BlockRoots)) + return &MockBeaconStateBlockRootsCall{Call: call} +} + +// MockBeaconStateBlockRootsCall wrap *gomock.Call +type MockBeaconStateBlockRootsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateBlockRootsCall) Return(arg0 solid.HashVectorSSZ) *MockBeaconStateBlockRootsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateBlockRootsCall) Do(f func() solid.HashVectorSSZ) *MockBeaconStateBlockRootsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateBlockRootsCall) DoAndReturn(f func() solid.HashVectorSSZ) *MockBeaconStateBlockRootsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Clone mocks base method. +func (m *MockBeaconState) Clone() clonable.Clonable { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Clone") + ret0, _ := ret[0].(clonable.Clonable) + return ret0 +} + +// Clone indicates an expected call of Clone. +func (mr *MockBeaconStateMockRecorder) Clone() *MockBeaconStateCloneCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clone", reflect.TypeOf((*MockBeaconState)(nil).Clone)) + return &MockBeaconStateCloneCall{Call: call} +} + +// MockBeaconStateCloneCall wrap *gomock.Call +type MockBeaconStateCloneCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateCloneCall) Return(arg0 clonable.Clonable) *MockBeaconStateCloneCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateCloneCall) Do(f func() clonable.Clonable) *MockBeaconStateCloneCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateCloneCall) DoAndReturn(f func() clonable.Clonable) *MockBeaconStateCloneCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CommitteeCount mocks base method. +func (m *MockBeaconState) CommitteeCount(epoch uint64) uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitteeCount", epoch) + ret0, _ := ret[0].(uint64) + return ret0 +} + +// CommitteeCount indicates an expected call of CommitteeCount. +func (mr *MockBeaconStateMockRecorder) CommitteeCount(epoch any) *MockBeaconStateCommitteeCountCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitteeCount", reflect.TypeOf((*MockBeaconState)(nil).CommitteeCount), epoch) + return &MockBeaconStateCommitteeCountCall{Call: call} +} + +// MockBeaconStateCommitteeCountCall wrap *gomock.Call +type MockBeaconStateCommitteeCountCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateCommitteeCountCall) Return(arg0 uint64) *MockBeaconStateCommitteeCountCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateCommitteeCountCall) Do(f func(uint64) uint64) *MockBeaconStateCommitteeCountCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateCommitteeCountCall) DoAndReturn(f func(uint64) uint64) *MockBeaconStateCommitteeCountCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ComputeCommittee mocks base method. +func (m *MockBeaconState) ComputeCommittee(indicies []uint64, slot, index, count uint64) ([]uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ComputeCommittee", indicies, slot, index, count) + ret0, _ := ret[0].([]uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ComputeCommittee indicates an expected call of ComputeCommittee. +func (mr *MockBeaconStateMockRecorder) ComputeCommittee(indicies, slot, index, count any) *MockBeaconStateComputeCommitteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComputeCommittee", reflect.TypeOf((*MockBeaconState)(nil).ComputeCommittee), indicies, slot, index, count) + return &MockBeaconStateComputeCommitteeCall{Call: call} +} + +// MockBeaconStateComputeCommitteeCall wrap *gomock.Call +type MockBeaconStateComputeCommitteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateComputeCommitteeCall) Return(arg0 []uint64, arg1 error) *MockBeaconStateComputeCommitteeCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateComputeCommitteeCall) Do(f func([]uint64, uint64, uint64, uint64) ([]uint64, error)) *MockBeaconStateComputeCommitteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateComputeCommitteeCall) DoAndReturn(f func([]uint64, uint64, uint64, uint64) ([]uint64, error)) *MockBeaconStateComputeCommitteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ComputeExitEpochAndUpdateChurn mocks base method. +func (m *MockBeaconState) ComputeExitEpochAndUpdateChurn(exitBalance uint64) uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ComputeExitEpochAndUpdateChurn", exitBalance) + ret0, _ := ret[0].(uint64) + return ret0 +} + +// ComputeExitEpochAndUpdateChurn indicates an expected call of ComputeExitEpochAndUpdateChurn. +func (mr *MockBeaconStateMockRecorder) ComputeExitEpochAndUpdateChurn(exitBalance any) *MockBeaconStateComputeExitEpochAndUpdateChurnCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComputeExitEpochAndUpdateChurn", reflect.TypeOf((*MockBeaconState)(nil).ComputeExitEpochAndUpdateChurn), exitBalance) + return &MockBeaconStateComputeExitEpochAndUpdateChurnCall{Call: call} +} + +// MockBeaconStateComputeExitEpochAndUpdateChurnCall wrap *gomock.Call +type MockBeaconStateComputeExitEpochAndUpdateChurnCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateComputeExitEpochAndUpdateChurnCall) Return(arg0 uint64) *MockBeaconStateComputeExitEpochAndUpdateChurnCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateComputeExitEpochAndUpdateChurnCall) Do(f func(uint64) uint64) *MockBeaconStateComputeExitEpochAndUpdateChurnCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateComputeExitEpochAndUpdateChurnCall) DoAndReturn(f func(uint64) uint64) *MockBeaconStateComputeExitEpochAndUpdateChurnCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ComputeNextSyncCommittee mocks base method. +func (m *MockBeaconState) ComputeNextSyncCommittee() (*solid.SyncCommittee, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ComputeNextSyncCommittee") + ret0, _ := ret[0].(*solid.SyncCommittee) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ComputeNextSyncCommittee indicates an expected call of ComputeNextSyncCommittee. +func (mr *MockBeaconStateMockRecorder) ComputeNextSyncCommittee() *MockBeaconStateComputeNextSyncCommitteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComputeNextSyncCommittee", reflect.TypeOf((*MockBeaconState)(nil).ComputeNextSyncCommittee)) + return &MockBeaconStateComputeNextSyncCommitteeCall{Call: call} +} + +// MockBeaconStateComputeNextSyncCommitteeCall wrap *gomock.Call +type MockBeaconStateComputeNextSyncCommitteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateComputeNextSyncCommitteeCall) Return(arg0 *solid.SyncCommittee, arg1 error) *MockBeaconStateComputeNextSyncCommitteeCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateComputeNextSyncCommitteeCall) Do(f func() (*solid.SyncCommittee, error)) *MockBeaconStateComputeNextSyncCommitteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateComputeNextSyncCommitteeCall) DoAndReturn(f func() (*solid.SyncCommittee, error)) *MockBeaconStateComputeNextSyncCommitteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CurrentEpochAttestations mocks base method. +func (m *MockBeaconState) CurrentEpochAttestations() *solid.ListSSZ[*solid.PendingAttestation] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrentEpochAttestations") + ret0, _ := ret[0].(*solid.ListSSZ[*solid.PendingAttestation]) + return ret0 +} + +// CurrentEpochAttestations indicates an expected call of CurrentEpochAttestations. +func (mr *MockBeaconStateMockRecorder) CurrentEpochAttestations() *MockBeaconStateCurrentEpochAttestationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentEpochAttestations", reflect.TypeOf((*MockBeaconState)(nil).CurrentEpochAttestations)) + return &MockBeaconStateCurrentEpochAttestationsCall{Call: call} +} + +// MockBeaconStateCurrentEpochAttestationsCall wrap *gomock.Call +type MockBeaconStateCurrentEpochAttestationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateCurrentEpochAttestationsCall) Return(arg0 *solid.ListSSZ[*solid.PendingAttestation]) *MockBeaconStateCurrentEpochAttestationsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateCurrentEpochAttestationsCall) Do(f func() *solid.ListSSZ[*solid.PendingAttestation]) *MockBeaconStateCurrentEpochAttestationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateCurrentEpochAttestationsCall) DoAndReturn(f func() *solid.ListSSZ[*solid.PendingAttestation]) *MockBeaconStateCurrentEpochAttestationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CurrentEpochAttestationsLength mocks base method. +func (m *MockBeaconState) CurrentEpochAttestationsLength() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrentEpochAttestationsLength") + ret0, _ := ret[0].(int) + return ret0 +} + +// CurrentEpochAttestationsLength indicates an expected call of CurrentEpochAttestationsLength. +func (mr *MockBeaconStateMockRecorder) CurrentEpochAttestationsLength() *MockBeaconStateCurrentEpochAttestationsLengthCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentEpochAttestationsLength", reflect.TypeOf((*MockBeaconState)(nil).CurrentEpochAttestationsLength)) + return &MockBeaconStateCurrentEpochAttestationsLengthCall{Call: call} +} + +// MockBeaconStateCurrentEpochAttestationsLengthCall wrap *gomock.Call +type MockBeaconStateCurrentEpochAttestationsLengthCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateCurrentEpochAttestationsLengthCall) Return(arg0 int) *MockBeaconStateCurrentEpochAttestationsLengthCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateCurrentEpochAttestationsLengthCall) Do(f func() int) *MockBeaconStateCurrentEpochAttestationsLengthCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateCurrentEpochAttestationsLengthCall) DoAndReturn(f func() int) *MockBeaconStateCurrentEpochAttestationsLengthCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CurrentJustifiedCheckpoint mocks base method. +func (m *MockBeaconState) CurrentJustifiedCheckpoint() solid.Checkpoint { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrentJustifiedCheckpoint") + ret0, _ := ret[0].(solid.Checkpoint) + return ret0 +} + +// CurrentJustifiedCheckpoint indicates an expected call of CurrentJustifiedCheckpoint. +func (mr *MockBeaconStateMockRecorder) CurrentJustifiedCheckpoint() *MockBeaconStateCurrentJustifiedCheckpointCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentJustifiedCheckpoint", reflect.TypeOf((*MockBeaconState)(nil).CurrentJustifiedCheckpoint)) + return &MockBeaconStateCurrentJustifiedCheckpointCall{Call: call} +} + +// MockBeaconStateCurrentJustifiedCheckpointCall wrap *gomock.Call +type MockBeaconStateCurrentJustifiedCheckpointCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateCurrentJustifiedCheckpointCall) Return(arg0 solid.Checkpoint) *MockBeaconStateCurrentJustifiedCheckpointCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateCurrentJustifiedCheckpointCall) Do(f func() solid.Checkpoint) *MockBeaconStateCurrentJustifiedCheckpointCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateCurrentJustifiedCheckpointCall) DoAndReturn(f func() solid.Checkpoint) *MockBeaconStateCurrentJustifiedCheckpointCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CurrentSyncCommittee mocks base method. +func (m *MockBeaconState) CurrentSyncCommittee() *solid.SyncCommittee { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrentSyncCommittee") + ret0, _ := ret[0].(*solid.SyncCommittee) + return ret0 +} + +// CurrentSyncCommittee indicates an expected call of CurrentSyncCommittee. +func (mr *MockBeaconStateMockRecorder) CurrentSyncCommittee() *MockBeaconStateCurrentSyncCommitteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentSyncCommittee", reflect.TypeOf((*MockBeaconState)(nil).CurrentSyncCommittee)) + return &MockBeaconStateCurrentSyncCommitteeCall{Call: call} +} + +// MockBeaconStateCurrentSyncCommitteeCall wrap *gomock.Call +type MockBeaconStateCurrentSyncCommitteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateCurrentSyncCommitteeCall) Return(arg0 *solid.SyncCommittee) *MockBeaconStateCurrentSyncCommitteeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateCurrentSyncCommitteeCall) Do(f func() *solid.SyncCommittee) *MockBeaconStateCurrentSyncCommitteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateCurrentSyncCommitteeCall) DoAndReturn(f func() *solid.SyncCommittee) *MockBeaconStateCurrentSyncCommitteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// DebugPrint mocks base method. +func (m *MockBeaconState) DebugPrint(prefix string) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "DebugPrint", prefix) +} + +// DebugPrint indicates an expected call of DebugPrint. +func (mr *MockBeaconStateMockRecorder) DebugPrint(prefix any) *MockBeaconStateDebugPrintCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DebugPrint", reflect.TypeOf((*MockBeaconState)(nil).DebugPrint), prefix) + return &MockBeaconStateDebugPrintCall{Call: call} +} + +// MockBeaconStateDebugPrintCall wrap *gomock.Call +type MockBeaconStateDebugPrintCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateDebugPrintCall) Return() *MockBeaconStateDebugPrintCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateDebugPrintCall) Do(f func(string)) *MockBeaconStateDebugPrintCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateDebugPrintCall) DoAndReturn(f func(string)) *MockBeaconStateDebugPrintCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// DecodeSSZ mocks base method. +func (m *MockBeaconState) DecodeSSZ(buf []byte, version int) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DecodeSSZ", buf, version) + ret0, _ := ret[0].(error) + return ret0 +} + +// DecodeSSZ indicates an expected call of DecodeSSZ. +func (mr *MockBeaconStateMockRecorder) DecodeSSZ(buf, version any) *MockBeaconStateDecodeSSZCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DecodeSSZ", reflect.TypeOf((*MockBeaconState)(nil).DecodeSSZ), buf, version) + return &MockBeaconStateDecodeSSZCall{Call: call} +} + +// MockBeaconStateDecodeSSZCall wrap *gomock.Call +type MockBeaconStateDecodeSSZCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateDecodeSSZCall) Return(arg0 error) *MockBeaconStateDecodeSSZCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateDecodeSSZCall) Do(f func([]byte, int) error) *MockBeaconStateDecodeSSZCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateDecodeSSZCall) DoAndReturn(f func([]byte, int) error) *MockBeaconStateDecodeSSZCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// EncodeSSZ mocks base method. +func (m *MockBeaconState) EncodeSSZ(buf []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EncodeSSZ", buf) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EncodeSSZ indicates an expected call of EncodeSSZ. +func (mr *MockBeaconStateMockRecorder) EncodeSSZ(buf any) *MockBeaconStateEncodeSSZCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EncodeSSZ", reflect.TypeOf((*MockBeaconState)(nil).EncodeSSZ), buf) + return &MockBeaconStateEncodeSSZCall{Call: call} +} + +// MockBeaconStateEncodeSSZCall wrap *gomock.Call +type MockBeaconStateEncodeSSZCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEncodeSSZCall) Return(arg0 []byte, arg1 error) *MockBeaconStateEncodeSSZCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEncodeSSZCall) Do(f func([]byte) ([]byte, error)) *MockBeaconStateEncodeSSZCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEncodeSSZCall) DoAndReturn(f func([]byte) ([]byte, error)) *MockBeaconStateEncodeSSZCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// EncodingSizeSSZ mocks base method. +func (m *MockBeaconState) EncodingSizeSSZ() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EncodingSizeSSZ") + ret0, _ := ret[0].(int) + return ret0 +} + +// EncodingSizeSSZ indicates an expected call of EncodingSizeSSZ. +func (mr *MockBeaconStateMockRecorder) EncodingSizeSSZ() *MockBeaconStateEncodingSizeSSZCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EncodingSizeSSZ", reflect.TypeOf((*MockBeaconState)(nil).EncodingSizeSSZ)) + return &MockBeaconStateEncodingSizeSSZCall{Call: call} +} + +// MockBeaconStateEncodingSizeSSZCall wrap *gomock.Call +type MockBeaconStateEncodingSizeSSZCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEncodingSizeSSZCall) Return(size int) *MockBeaconStateEncodingSizeSSZCall { + c.Call = c.Call.Return(size) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEncodingSizeSSZCall) Do(f func() int) *MockBeaconStateEncodingSizeSSZCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEncodingSizeSSZCall) DoAndReturn(f func() int) *MockBeaconStateEncodingSizeSSZCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// EpochParticipation mocks base method. +func (m *MockBeaconState) EpochParticipation(currentEpoch bool) *solid.ParticipationBitList { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EpochParticipation", currentEpoch) + ret0, _ := ret[0].(*solid.ParticipationBitList) + return ret0 +} + +// EpochParticipation indicates an expected call of EpochParticipation. +func (mr *MockBeaconStateMockRecorder) EpochParticipation(currentEpoch any) *MockBeaconStateEpochParticipationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EpochParticipation", reflect.TypeOf((*MockBeaconState)(nil).EpochParticipation), currentEpoch) + return &MockBeaconStateEpochParticipationCall{Call: call} +} + +// MockBeaconStateEpochParticipationCall wrap *gomock.Call +type MockBeaconStateEpochParticipationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEpochParticipationCall) Return(arg0 *solid.ParticipationBitList) *MockBeaconStateEpochParticipationCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEpochParticipationCall) Do(f func(bool) *solid.ParticipationBitList) *MockBeaconStateEpochParticipationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEpochParticipationCall) DoAndReturn(f func(bool) *solid.ParticipationBitList) *MockBeaconStateEpochParticipationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// EpochParticipationForValidatorIndex mocks base method. +func (m *MockBeaconState) EpochParticipationForValidatorIndex(isCurrentEpoch bool, index int) cltypes.ParticipationFlags { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EpochParticipationForValidatorIndex", isCurrentEpoch, index) + ret0, _ := ret[0].(cltypes.ParticipationFlags) + return ret0 +} + +// EpochParticipationForValidatorIndex indicates an expected call of EpochParticipationForValidatorIndex. +func (mr *MockBeaconStateMockRecorder) EpochParticipationForValidatorIndex(isCurrentEpoch, index any) *MockBeaconStateEpochParticipationForValidatorIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EpochParticipationForValidatorIndex", reflect.TypeOf((*MockBeaconState)(nil).EpochParticipationForValidatorIndex), isCurrentEpoch, index) + return &MockBeaconStateEpochParticipationForValidatorIndexCall{Call: call} +} + +// MockBeaconStateEpochParticipationForValidatorIndexCall wrap *gomock.Call +type MockBeaconStateEpochParticipationForValidatorIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEpochParticipationForValidatorIndexCall) Return(arg0 cltypes.ParticipationFlags) *MockBeaconStateEpochParticipationForValidatorIndexCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEpochParticipationForValidatorIndexCall) Do(f func(bool, int) cltypes.ParticipationFlags) *MockBeaconStateEpochParticipationForValidatorIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEpochParticipationForValidatorIndexCall) DoAndReturn(f func(bool, int) cltypes.ParticipationFlags) *MockBeaconStateEpochParticipationForValidatorIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Eth1Data mocks base method. +func (m *MockBeaconState) Eth1Data() *cltypes.Eth1Data { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Eth1Data") + ret0, _ := ret[0].(*cltypes.Eth1Data) + return ret0 +} + +// Eth1Data indicates an expected call of Eth1Data. +func (mr *MockBeaconStateMockRecorder) Eth1Data() *MockBeaconStateEth1DataCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eth1Data", reflect.TypeOf((*MockBeaconState)(nil).Eth1Data)) + return &MockBeaconStateEth1DataCall{Call: call} +} + +// MockBeaconStateEth1DataCall wrap *gomock.Call +type MockBeaconStateEth1DataCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEth1DataCall) Return(arg0 *cltypes.Eth1Data) *MockBeaconStateEth1DataCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEth1DataCall) Do(f func() *cltypes.Eth1Data) *MockBeaconStateEth1DataCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEth1DataCall) DoAndReturn(f func() *cltypes.Eth1Data) *MockBeaconStateEth1DataCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Eth1DataVotes mocks base method. +func (m *MockBeaconState) Eth1DataVotes() *solid.ListSSZ[*cltypes.Eth1Data] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Eth1DataVotes") + ret0, _ := ret[0].(*solid.ListSSZ[*cltypes.Eth1Data]) + return ret0 +} + +// Eth1DataVotes indicates an expected call of Eth1DataVotes. +func (mr *MockBeaconStateMockRecorder) Eth1DataVotes() *MockBeaconStateEth1DataVotesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eth1DataVotes", reflect.TypeOf((*MockBeaconState)(nil).Eth1DataVotes)) + return &MockBeaconStateEth1DataVotesCall{Call: call} +} + +// MockBeaconStateEth1DataVotesCall wrap *gomock.Call +type MockBeaconStateEth1DataVotesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEth1DataVotesCall) Return(arg0 *solid.ListSSZ[*cltypes.Eth1Data]) *MockBeaconStateEth1DataVotesCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEth1DataVotesCall) Do(f func() *solid.ListSSZ[*cltypes.Eth1Data]) *MockBeaconStateEth1DataVotesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEth1DataVotesCall) DoAndReturn(f func() *solid.ListSSZ[*cltypes.Eth1Data]) *MockBeaconStateEth1DataVotesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Eth1DepositIndex mocks base method. +func (m *MockBeaconState) Eth1DepositIndex() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Eth1DepositIndex") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// Eth1DepositIndex indicates an expected call of Eth1DepositIndex. +func (mr *MockBeaconStateMockRecorder) Eth1DepositIndex() *MockBeaconStateEth1DepositIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eth1DepositIndex", reflect.TypeOf((*MockBeaconState)(nil).Eth1DepositIndex)) + return &MockBeaconStateEth1DepositIndexCall{Call: call} +} + +// MockBeaconStateEth1DepositIndexCall wrap *gomock.Call +type MockBeaconStateEth1DepositIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateEth1DepositIndexCall) Return(arg0 uint64) *MockBeaconStateEth1DepositIndexCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateEth1DepositIndexCall) Do(f func() uint64) *MockBeaconStateEth1DepositIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateEth1DepositIndexCall) DoAndReturn(f func() uint64) *MockBeaconStateEth1DepositIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// FinalizedCheckpoint mocks base method. +func (m *MockBeaconState) FinalizedCheckpoint() solid.Checkpoint { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FinalizedCheckpoint") + ret0, _ := ret[0].(solid.Checkpoint) + return ret0 +} + +// FinalizedCheckpoint indicates an expected call of FinalizedCheckpoint. +func (mr *MockBeaconStateMockRecorder) FinalizedCheckpoint() *MockBeaconStateFinalizedCheckpointCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizedCheckpoint", reflect.TypeOf((*MockBeaconState)(nil).FinalizedCheckpoint)) + return &MockBeaconStateFinalizedCheckpointCall{Call: call} +} + +// MockBeaconStateFinalizedCheckpointCall wrap *gomock.Call +type MockBeaconStateFinalizedCheckpointCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateFinalizedCheckpointCall) Return(arg0 solid.Checkpoint) *MockBeaconStateFinalizedCheckpointCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateFinalizedCheckpointCall) Do(f func() solid.Checkpoint) *MockBeaconStateFinalizedCheckpointCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateFinalizedCheckpointCall) DoAndReturn(f func() solid.Checkpoint) *MockBeaconStateFinalizedCheckpointCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ForEachBalance mocks base method. +func (m *MockBeaconState) ForEachBalance(fn func(uint64, int, int) bool) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ForEachBalance", fn) +} + +// ForEachBalance indicates an expected call of ForEachBalance. +func (mr *MockBeaconStateMockRecorder) ForEachBalance(fn any) *MockBeaconStateForEachBalanceCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForEachBalance", reflect.TypeOf((*MockBeaconState)(nil).ForEachBalance), fn) + return &MockBeaconStateForEachBalanceCall{Call: call} +} + +// MockBeaconStateForEachBalanceCall wrap *gomock.Call +type MockBeaconStateForEachBalanceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateForEachBalanceCall) Return() *MockBeaconStateForEachBalanceCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateForEachBalanceCall) Do(f func(func(uint64, int, int) bool)) *MockBeaconStateForEachBalanceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateForEachBalanceCall) DoAndReturn(f func(func(uint64, int, int) bool)) *MockBeaconStateForEachBalanceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ForEachSlashingSegment mocks base method. +func (m *MockBeaconState) ForEachSlashingSegment(fn func(int, uint64, int) bool) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ForEachSlashingSegment", fn) +} + +// ForEachSlashingSegment indicates an expected call of ForEachSlashingSegment. +func (mr *MockBeaconStateMockRecorder) ForEachSlashingSegment(fn any) *MockBeaconStateForEachSlashingSegmentCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForEachSlashingSegment", reflect.TypeOf((*MockBeaconState)(nil).ForEachSlashingSegment), fn) + return &MockBeaconStateForEachSlashingSegmentCall{Call: call} +} + +// MockBeaconStateForEachSlashingSegmentCall wrap *gomock.Call +type MockBeaconStateForEachSlashingSegmentCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateForEachSlashingSegmentCall) Return() *MockBeaconStateForEachSlashingSegmentCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateForEachSlashingSegmentCall) Do(f func(func(int, uint64, int) bool)) *MockBeaconStateForEachSlashingSegmentCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateForEachSlashingSegmentCall) DoAndReturn(f func(func(int, uint64, int) bool)) *MockBeaconStateForEachSlashingSegmentCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ForEachValidator mocks base method. +func (m *MockBeaconState) ForEachValidator(fn func(solid.Validator, int, int) bool) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ForEachValidator", fn) +} + +// ForEachValidator indicates an expected call of ForEachValidator. +func (mr *MockBeaconStateMockRecorder) ForEachValidator(fn any) *MockBeaconStateForEachValidatorCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForEachValidator", reflect.TypeOf((*MockBeaconState)(nil).ForEachValidator), fn) + return &MockBeaconStateForEachValidatorCall{Call: call} +} + +// MockBeaconStateForEachValidatorCall wrap *gomock.Call +type MockBeaconStateForEachValidatorCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateForEachValidatorCall) Return() *MockBeaconStateForEachValidatorCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateForEachValidatorCall) Do(f func(func(solid.Validator, int, int) bool)) *MockBeaconStateForEachValidatorCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateForEachValidatorCall) DoAndReturn(f func(func(solid.Validator, int, int) bool)) *MockBeaconStateForEachValidatorCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Fork mocks base method. +func (m *MockBeaconState) Fork() *cltypes.Fork { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Fork") + ret0, _ := ret[0].(*cltypes.Fork) + return ret0 +} + +// Fork indicates an expected call of Fork. +func (mr *MockBeaconStateMockRecorder) Fork() *MockBeaconStateForkCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Fork", reflect.TypeOf((*MockBeaconState)(nil).Fork)) + return &MockBeaconStateForkCall{Call: call} +} + +// MockBeaconStateForkCall wrap *gomock.Call +type MockBeaconStateForkCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateForkCall) Return(arg0 *cltypes.Fork) *MockBeaconStateForkCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateForkCall) Do(f func() *cltypes.Fork) *MockBeaconStateForkCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateForkCall) DoAndReturn(f func() *cltypes.Fork) *MockBeaconStateForkCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GenesisTime mocks base method. +func (m *MockBeaconState) GenesisTime() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenesisTime") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GenesisTime indicates an expected call of GenesisTime. +func (mr *MockBeaconStateMockRecorder) GenesisTime() *MockBeaconStateGenesisTimeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenesisTime", reflect.TypeOf((*MockBeaconState)(nil).GenesisTime)) + return &MockBeaconStateGenesisTimeCall{Call: call} +} + +// MockBeaconStateGenesisTimeCall wrap *gomock.Call +type MockBeaconStateGenesisTimeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGenesisTimeCall) Return(arg0 uint64) *MockBeaconStateGenesisTimeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGenesisTimeCall) Do(f func() uint64) *MockBeaconStateGenesisTimeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGenesisTimeCall) DoAndReturn(f func() uint64) *MockBeaconStateGenesisTimeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GenesisValidatorsRoot mocks base method. +func (m *MockBeaconState) GenesisValidatorsRoot() common.Hash { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenesisValidatorsRoot") + ret0, _ := ret[0].(common.Hash) + return ret0 +} + +// GenesisValidatorsRoot indicates an expected call of GenesisValidatorsRoot. +func (mr *MockBeaconStateMockRecorder) GenesisValidatorsRoot() *MockBeaconStateGenesisValidatorsRootCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenesisValidatorsRoot", reflect.TypeOf((*MockBeaconState)(nil).GenesisValidatorsRoot)) + return &MockBeaconStateGenesisValidatorsRootCall{Call: call} +} + +// MockBeaconStateGenesisValidatorsRootCall wrap *gomock.Call +type MockBeaconStateGenesisValidatorsRootCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGenesisValidatorsRootCall) Return(arg0 common.Hash) *MockBeaconStateGenesisValidatorsRootCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGenesisValidatorsRootCall) Do(f func() common.Hash) *MockBeaconStateGenesisValidatorsRootCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGenesisValidatorsRootCall) DoAndReturn(f func() common.Hash) *MockBeaconStateGenesisValidatorsRootCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetActiveValidatorsIndices mocks base method. +func (m *MockBeaconState) GetActiveValidatorsIndices(epoch uint64) []uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetActiveValidatorsIndices", epoch) + ret0, _ := ret[0].([]uint64) + return ret0 +} + +// GetActiveValidatorsIndices indicates an expected call of GetActiveValidatorsIndices. +func (mr *MockBeaconStateMockRecorder) GetActiveValidatorsIndices(epoch any) *MockBeaconStateGetActiveValidatorsIndicesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActiveValidatorsIndices", reflect.TypeOf((*MockBeaconState)(nil).GetActiveValidatorsIndices), epoch) + return &MockBeaconStateGetActiveValidatorsIndicesCall{Call: call} +} + +// MockBeaconStateGetActiveValidatorsIndicesCall wrap *gomock.Call +type MockBeaconStateGetActiveValidatorsIndicesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetActiveValidatorsIndicesCall) Return(indicies []uint64) *MockBeaconStateGetActiveValidatorsIndicesCall { + c.Call = c.Call.Return(indicies) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetActiveValidatorsIndicesCall) Do(f func(uint64) []uint64) *MockBeaconStateGetActiveValidatorsIndicesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetActiveValidatorsIndicesCall) DoAndReturn(f func(uint64) []uint64) *MockBeaconStateGetActiveValidatorsIndicesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetAttestationParticipationFlagIndicies mocks base method. +func (m *MockBeaconState) GetAttestationParticipationFlagIndicies(data *solid.AttestationData, inclusionDelay uint64, skipAssert bool) ([]uint8, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAttestationParticipationFlagIndicies", data, inclusionDelay, skipAssert) + ret0, _ := ret[0].([]uint8) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAttestationParticipationFlagIndicies indicates an expected call of GetAttestationParticipationFlagIndicies. +func (mr *MockBeaconStateMockRecorder) GetAttestationParticipationFlagIndicies(data, inclusionDelay, skipAssert any) *MockBeaconStateGetAttestationParticipationFlagIndiciesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttestationParticipationFlagIndicies", reflect.TypeOf((*MockBeaconState)(nil).GetAttestationParticipationFlagIndicies), data, inclusionDelay, skipAssert) + return &MockBeaconStateGetAttestationParticipationFlagIndiciesCall{Call: call} +} + +// MockBeaconStateGetAttestationParticipationFlagIndiciesCall wrap *gomock.Call +type MockBeaconStateGetAttestationParticipationFlagIndiciesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetAttestationParticipationFlagIndiciesCall) Return(arg0 []uint8, arg1 error) *MockBeaconStateGetAttestationParticipationFlagIndiciesCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetAttestationParticipationFlagIndiciesCall) Do(f func(*solid.AttestationData, uint64, bool) ([]uint8, error)) *MockBeaconStateGetAttestationParticipationFlagIndiciesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetAttestationParticipationFlagIndiciesCall) DoAndReturn(f func(*solid.AttestationData, uint64, bool) ([]uint8, error)) *MockBeaconStateGetAttestationParticipationFlagIndiciesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetAttestingIndicies mocks base method. +func (m *MockBeaconState) GetAttestingIndicies(attestation *solid.Attestation, checkBitsLength bool) ([]uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAttestingIndicies", attestation, checkBitsLength) + ret0, _ := ret[0].([]uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAttestingIndicies indicates an expected call of GetAttestingIndicies. +func (mr *MockBeaconStateMockRecorder) GetAttestingIndicies(attestation, checkBitsLength any) *MockBeaconStateGetAttestingIndiciesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttestingIndicies", reflect.TypeOf((*MockBeaconState)(nil).GetAttestingIndicies), attestation, checkBitsLength) + return &MockBeaconStateGetAttestingIndiciesCall{Call: call} +} + +// MockBeaconStateGetAttestingIndiciesCall wrap *gomock.Call +type MockBeaconStateGetAttestingIndiciesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetAttestingIndiciesCall) Return(arg0 []uint64, arg1 error) *MockBeaconStateGetAttestingIndiciesCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetAttestingIndiciesCall) Do(f func(*solid.Attestation, bool) ([]uint64, error)) *MockBeaconStateGetAttestingIndiciesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetAttestingIndiciesCall) DoAndReturn(f func(*solid.Attestation, bool) ([]uint64, error)) *MockBeaconStateGetAttestingIndiciesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetBeaconCommitee mocks base method. +func (m *MockBeaconState) GetBeaconCommitee(slot, committeeIndex uint64) ([]uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBeaconCommitee", slot, committeeIndex) + ret0, _ := ret[0].([]uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBeaconCommitee indicates an expected call of GetBeaconCommitee. +func (mr *MockBeaconStateMockRecorder) GetBeaconCommitee(slot, committeeIndex any) *MockBeaconStateGetBeaconCommiteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBeaconCommitee", reflect.TypeOf((*MockBeaconState)(nil).GetBeaconCommitee), slot, committeeIndex) + return &MockBeaconStateGetBeaconCommiteeCall{Call: call} +} + +// MockBeaconStateGetBeaconCommiteeCall wrap *gomock.Call +type MockBeaconStateGetBeaconCommiteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetBeaconCommiteeCall) Return(arg0 []uint64, arg1 error) *MockBeaconStateGetBeaconCommiteeCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetBeaconCommiteeCall) Do(f func(uint64, uint64) ([]uint64, error)) *MockBeaconStateGetBeaconCommiteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetBeaconCommiteeCall) DoAndReturn(f func(uint64, uint64) ([]uint64, error)) *MockBeaconStateGetBeaconCommiteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetBeaconProposerIndex mocks base method. +func (m *MockBeaconState) GetBeaconProposerIndex() (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBeaconProposerIndex") + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBeaconProposerIndex indicates an expected call of GetBeaconProposerIndex. +func (mr *MockBeaconStateMockRecorder) GetBeaconProposerIndex() *MockBeaconStateGetBeaconProposerIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBeaconProposerIndex", reflect.TypeOf((*MockBeaconState)(nil).GetBeaconProposerIndex)) + return &MockBeaconStateGetBeaconProposerIndexCall{Call: call} +} + +// MockBeaconStateGetBeaconProposerIndexCall wrap *gomock.Call +type MockBeaconStateGetBeaconProposerIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetBeaconProposerIndexCall) Return(arg0 uint64, arg1 error) *MockBeaconStateGetBeaconProposerIndexCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetBeaconProposerIndexCall) Do(f func() (uint64, error)) *MockBeaconStateGetBeaconProposerIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetBeaconProposerIndexCall) DoAndReturn(f func() (uint64, error)) *MockBeaconStateGetBeaconProposerIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetBlockRootAtSlot mocks base method. +func (m *MockBeaconState) GetBlockRootAtSlot(slot uint64) (common.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBlockRootAtSlot", slot) + ret0, _ := ret[0].(common.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBlockRootAtSlot indicates an expected call of GetBlockRootAtSlot. +func (mr *MockBeaconStateMockRecorder) GetBlockRootAtSlot(slot any) *MockBeaconStateGetBlockRootAtSlotCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockRootAtSlot", reflect.TypeOf((*MockBeaconState)(nil).GetBlockRootAtSlot), slot) + return &MockBeaconStateGetBlockRootAtSlotCall{Call: call} +} + +// MockBeaconStateGetBlockRootAtSlotCall wrap *gomock.Call +type MockBeaconStateGetBlockRootAtSlotCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetBlockRootAtSlotCall) Return(arg0 common.Hash, arg1 error) *MockBeaconStateGetBlockRootAtSlotCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetBlockRootAtSlotCall) Do(f func(uint64) (common.Hash, error)) *MockBeaconStateGetBlockRootAtSlotCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetBlockRootAtSlotCall) DoAndReturn(f func(uint64) (common.Hash, error)) *MockBeaconStateGetBlockRootAtSlotCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetConsolidationBalanceToConsume mocks base method. +func (m *MockBeaconState) GetConsolidationBalanceToConsume() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetConsolidationBalanceToConsume") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetConsolidationBalanceToConsume indicates an expected call of GetConsolidationBalanceToConsume. +func (mr *MockBeaconStateMockRecorder) GetConsolidationBalanceToConsume() *MockBeaconStateGetConsolidationBalanceToConsumeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConsolidationBalanceToConsume", reflect.TypeOf((*MockBeaconState)(nil).GetConsolidationBalanceToConsume)) + return &MockBeaconStateGetConsolidationBalanceToConsumeCall{Call: call} +} + +// MockBeaconStateGetConsolidationBalanceToConsumeCall wrap *gomock.Call +type MockBeaconStateGetConsolidationBalanceToConsumeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetConsolidationBalanceToConsumeCall) Return(arg0 uint64) *MockBeaconStateGetConsolidationBalanceToConsumeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetConsolidationBalanceToConsumeCall) Do(f func() uint64) *MockBeaconStateGetConsolidationBalanceToConsumeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetConsolidationBalanceToConsumeCall) DoAndReturn(f func() uint64) *MockBeaconStateGetConsolidationBalanceToConsumeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetDepositBalanceToConsume mocks base method. +func (m *MockBeaconState) GetDepositBalanceToConsume() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDepositBalanceToConsume") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetDepositBalanceToConsume indicates an expected call of GetDepositBalanceToConsume. +func (mr *MockBeaconStateMockRecorder) GetDepositBalanceToConsume() *MockBeaconStateGetDepositBalanceToConsumeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDepositBalanceToConsume", reflect.TypeOf((*MockBeaconState)(nil).GetDepositBalanceToConsume)) + return &MockBeaconStateGetDepositBalanceToConsumeCall{Call: call} +} + +// MockBeaconStateGetDepositBalanceToConsumeCall wrap *gomock.Call +type MockBeaconStateGetDepositBalanceToConsumeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetDepositBalanceToConsumeCall) Return(arg0 uint64) *MockBeaconStateGetDepositBalanceToConsumeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetDepositBalanceToConsumeCall) Do(f func() uint64) *MockBeaconStateGetDepositBalanceToConsumeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetDepositBalanceToConsumeCall) DoAndReturn(f func() uint64) *MockBeaconStateGetDepositBalanceToConsumeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetDepositRequestsStartIndex mocks base method. +func (m *MockBeaconState) GetDepositRequestsStartIndex() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDepositRequestsStartIndex") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetDepositRequestsStartIndex indicates an expected call of GetDepositRequestsStartIndex. +func (mr *MockBeaconStateMockRecorder) GetDepositRequestsStartIndex() *MockBeaconStateGetDepositRequestsStartIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDepositRequestsStartIndex", reflect.TypeOf((*MockBeaconState)(nil).GetDepositRequestsStartIndex)) + return &MockBeaconStateGetDepositRequestsStartIndexCall{Call: call} +} + +// MockBeaconStateGetDepositRequestsStartIndexCall wrap *gomock.Call +type MockBeaconStateGetDepositRequestsStartIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetDepositRequestsStartIndexCall) Return(arg0 uint64) *MockBeaconStateGetDepositRequestsStartIndexCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetDepositRequestsStartIndexCall) Do(f func() uint64) *MockBeaconStateGetDepositRequestsStartIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetDepositRequestsStartIndexCall) DoAndReturn(f func() uint64) *MockBeaconStateGetDepositRequestsStartIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetDomain mocks base method. +func (m *MockBeaconState) GetDomain(domainType [4]byte, epoch uint64) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDomain", domainType, epoch) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDomain indicates an expected call of GetDomain. +func (mr *MockBeaconStateMockRecorder) GetDomain(domainType, epoch any) *MockBeaconStateGetDomainCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDomain", reflect.TypeOf((*MockBeaconState)(nil).GetDomain), domainType, epoch) + return &MockBeaconStateGetDomainCall{Call: call} +} + +// MockBeaconStateGetDomainCall wrap *gomock.Call +type MockBeaconStateGetDomainCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetDomainCall) Return(arg0 []byte, arg1 error) *MockBeaconStateGetDomainCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetDomainCall) Do(f func([4]byte, uint64) ([]byte, error)) *MockBeaconStateGetDomainCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetDomainCall) DoAndReturn(f func([4]byte, uint64) ([]byte, error)) *MockBeaconStateGetDomainCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetEarlistConsolidationEpoch mocks base method. +func (m *MockBeaconState) GetEarlistConsolidationEpoch() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetEarlistConsolidationEpoch") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetEarlistConsolidationEpoch indicates an expected call of GetEarlistConsolidationEpoch. +func (mr *MockBeaconStateMockRecorder) GetEarlistConsolidationEpoch() *MockBeaconStateGetEarlistConsolidationEpochCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEarlistConsolidationEpoch", reflect.TypeOf((*MockBeaconState)(nil).GetEarlistConsolidationEpoch)) + return &MockBeaconStateGetEarlistConsolidationEpochCall{Call: call} +} + +// MockBeaconStateGetEarlistConsolidationEpochCall wrap *gomock.Call +type MockBeaconStateGetEarlistConsolidationEpochCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetEarlistConsolidationEpochCall) Return(arg0 uint64) *MockBeaconStateGetEarlistConsolidationEpochCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetEarlistConsolidationEpochCall) Do(f func() uint64) *MockBeaconStateGetEarlistConsolidationEpochCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetEarlistConsolidationEpochCall) DoAndReturn(f func() uint64) *MockBeaconStateGetEarlistConsolidationEpochCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetPendingConsolidations mocks base method. +func (m *MockBeaconState) GetPendingConsolidations() *solid.ListSSZ[*solid.PendingConsolidation] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPendingConsolidations") + ret0, _ := ret[0].(*solid.ListSSZ[*solid.PendingConsolidation]) + return ret0 +} + +// GetPendingConsolidations indicates an expected call of GetPendingConsolidations. +func (mr *MockBeaconStateMockRecorder) GetPendingConsolidations() *MockBeaconStateGetPendingConsolidationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPendingConsolidations", reflect.TypeOf((*MockBeaconState)(nil).GetPendingConsolidations)) + return &MockBeaconStateGetPendingConsolidationsCall{Call: call} +} + +// MockBeaconStateGetPendingConsolidationsCall wrap *gomock.Call +type MockBeaconStateGetPendingConsolidationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetPendingConsolidationsCall) Return(arg0 *solid.ListSSZ[*solid.PendingConsolidation]) *MockBeaconStateGetPendingConsolidationsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetPendingConsolidationsCall) Do(f func() *solid.ListSSZ[*solid.PendingConsolidation]) *MockBeaconStateGetPendingConsolidationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetPendingConsolidationsCall) DoAndReturn(f func() *solid.ListSSZ[*solid.PendingConsolidation]) *MockBeaconStateGetPendingConsolidationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetPendingDeposits mocks base method. +func (m *MockBeaconState) GetPendingDeposits() *solid.ListSSZ[*solid.PendingDeposit] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPendingDeposits") + ret0, _ := ret[0].(*solid.ListSSZ[*solid.PendingDeposit]) + return ret0 +} + +// GetPendingDeposits indicates an expected call of GetPendingDeposits. +func (mr *MockBeaconStateMockRecorder) GetPendingDeposits() *MockBeaconStateGetPendingDepositsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPendingDeposits", reflect.TypeOf((*MockBeaconState)(nil).GetPendingDeposits)) + return &MockBeaconStateGetPendingDepositsCall{Call: call} +} + +// MockBeaconStateGetPendingDepositsCall wrap *gomock.Call +type MockBeaconStateGetPendingDepositsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetPendingDepositsCall) Return(arg0 *solid.ListSSZ[*solid.PendingDeposit]) *MockBeaconStateGetPendingDepositsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetPendingDepositsCall) Do(f func() *solid.ListSSZ[*solid.PendingDeposit]) *MockBeaconStateGetPendingDepositsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetPendingDepositsCall) DoAndReturn(f func() *solid.ListSSZ[*solid.PendingDeposit]) *MockBeaconStateGetPendingDepositsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetPendingPartialWithdrawals mocks base method. +func (m *MockBeaconState) GetPendingPartialWithdrawals() *solid.ListSSZ[*solid.PendingPartialWithdrawal] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPendingPartialWithdrawals") + ret0, _ := ret[0].(*solid.ListSSZ[*solid.PendingPartialWithdrawal]) + return ret0 +} + +// GetPendingPartialWithdrawals indicates an expected call of GetPendingPartialWithdrawals. +func (mr *MockBeaconStateMockRecorder) GetPendingPartialWithdrawals() *MockBeaconStateGetPendingPartialWithdrawalsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPendingPartialWithdrawals", reflect.TypeOf((*MockBeaconState)(nil).GetPendingPartialWithdrawals)) + return &MockBeaconStateGetPendingPartialWithdrawalsCall{Call: call} +} + +// MockBeaconStateGetPendingPartialWithdrawalsCall wrap *gomock.Call +type MockBeaconStateGetPendingPartialWithdrawalsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetPendingPartialWithdrawalsCall) Return(arg0 *solid.ListSSZ[*solid.PendingPartialWithdrawal]) *MockBeaconStateGetPendingPartialWithdrawalsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetPendingPartialWithdrawalsCall) Do(f func() *solid.ListSSZ[*solid.PendingPartialWithdrawal]) *MockBeaconStateGetPendingPartialWithdrawalsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetPendingPartialWithdrawalsCall) DoAndReturn(f func() *solid.ListSSZ[*solid.PendingPartialWithdrawal]) *MockBeaconStateGetPendingPartialWithdrawalsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetRandaoMix mocks base method. +func (m *MockBeaconState) GetRandaoMix(index int) [32]byte { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRandaoMix", index) + ret0, _ := ret[0].([32]byte) + return ret0 +} + +// GetRandaoMix indicates an expected call of GetRandaoMix. +func (mr *MockBeaconStateMockRecorder) GetRandaoMix(index any) *MockBeaconStateGetRandaoMixCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRandaoMix", reflect.TypeOf((*MockBeaconState)(nil).GetRandaoMix), index) + return &MockBeaconStateGetRandaoMixCall{Call: call} +} + +// MockBeaconStateGetRandaoMixCall wrap *gomock.Call +type MockBeaconStateGetRandaoMixCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetRandaoMixCall) Return(arg0 [32]byte) *MockBeaconStateGetRandaoMixCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetRandaoMixCall) Do(f func(int) [32]byte) *MockBeaconStateGetRandaoMixCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetRandaoMixCall) DoAndReturn(f func(int) [32]byte) *MockBeaconStateGetRandaoMixCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetRandaoMixes mocks base method. +func (m *MockBeaconState) GetRandaoMixes(epoch uint64) [32]byte { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRandaoMixes", epoch) + ret0, _ := ret[0].([32]byte) + return ret0 +} + +// GetRandaoMixes indicates an expected call of GetRandaoMixes. +func (mr *MockBeaconStateMockRecorder) GetRandaoMixes(epoch any) *MockBeaconStateGetRandaoMixesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRandaoMixes", reflect.TypeOf((*MockBeaconState)(nil).GetRandaoMixes), epoch) + return &MockBeaconStateGetRandaoMixesCall{Call: call} +} + +// MockBeaconStateGetRandaoMixesCall wrap *gomock.Call +type MockBeaconStateGetRandaoMixesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetRandaoMixesCall) Return(arg0 [32]byte) *MockBeaconStateGetRandaoMixesCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetRandaoMixesCall) Do(f func(uint64) [32]byte) *MockBeaconStateGetRandaoMixesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetRandaoMixesCall) DoAndReturn(f func(uint64) [32]byte) *MockBeaconStateGetRandaoMixesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetTotalActiveBalance mocks base method. +func (m *MockBeaconState) GetTotalActiveBalance() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTotalActiveBalance") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetTotalActiveBalance indicates an expected call of GetTotalActiveBalance. +func (mr *MockBeaconStateMockRecorder) GetTotalActiveBalance() *MockBeaconStateGetTotalActiveBalanceCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTotalActiveBalance", reflect.TypeOf((*MockBeaconState)(nil).GetTotalActiveBalance)) + return &MockBeaconStateGetTotalActiveBalanceCall{Call: call} +} + +// MockBeaconStateGetTotalActiveBalanceCall wrap *gomock.Call +type MockBeaconStateGetTotalActiveBalanceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetTotalActiveBalanceCall) Return(arg0 uint64) *MockBeaconStateGetTotalActiveBalanceCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetTotalActiveBalanceCall) Do(f func() uint64) *MockBeaconStateGetTotalActiveBalanceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetTotalActiveBalanceCall) DoAndReturn(f func() uint64) *MockBeaconStateGetTotalActiveBalanceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetValidatorActivationChurnLimit mocks base method. +func (m *MockBeaconState) GetValidatorActivationChurnLimit() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidatorActivationChurnLimit") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetValidatorActivationChurnLimit indicates an expected call of GetValidatorActivationChurnLimit. +func (mr *MockBeaconStateMockRecorder) GetValidatorActivationChurnLimit() *MockBeaconStateGetValidatorActivationChurnLimitCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorActivationChurnLimit", reflect.TypeOf((*MockBeaconState)(nil).GetValidatorActivationChurnLimit)) + return &MockBeaconStateGetValidatorActivationChurnLimitCall{Call: call} +} + +// MockBeaconStateGetValidatorActivationChurnLimitCall wrap *gomock.Call +type MockBeaconStateGetValidatorActivationChurnLimitCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetValidatorActivationChurnLimitCall) Return(arg0 uint64) *MockBeaconStateGetValidatorActivationChurnLimitCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetValidatorActivationChurnLimitCall) Do(f func() uint64) *MockBeaconStateGetValidatorActivationChurnLimitCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetValidatorActivationChurnLimitCall) DoAndReturn(f func() uint64) *MockBeaconStateGetValidatorActivationChurnLimitCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetValidatorChurnLimit mocks base method. +func (m *MockBeaconState) GetValidatorChurnLimit() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidatorChurnLimit") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetValidatorChurnLimit indicates an expected call of GetValidatorChurnLimit. +func (mr *MockBeaconStateMockRecorder) GetValidatorChurnLimit() *MockBeaconStateGetValidatorChurnLimitCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorChurnLimit", reflect.TypeOf((*MockBeaconState)(nil).GetValidatorChurnLimit)) + return &MockBeaconStateGetValidatorChurnLimitCall{Call: call} +} + +// MockBeaconStateGetValidatorChurnLimitCall wrap *gomock.Call +type MockBeaconStateGetValidatorChurnLimitCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateGetValidatorChurnLimitCall) Return(arg0 uint64) *MockBeaconStateGetValidatorChurnLimitCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateGetValidatorChurnLimitCall) Do(f func() uint64) *MockBeaconStateGetValidatorChurnLimitCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateGetValidatorChurnLimitCall) DoAndReturn(f func() uint64) *MockBeaconStateGetValidatorChurnLimitCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// HashSSZ mocks base method. +func (m *MockBeaconState) HashSSZ() ([32]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HashSSZ") + ret0, _ := ret[0].([32]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HashSSZ indicates an expected call of HashSSZ. +func (mr *MockBeaconStateMockRecorder) HashSSZ() *MockBeaconStateHashSSZCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HashSSZ", reflect.TypeOf((*MockBeaconState)(nil).HashSSZ)) + return &MockBeaconStateHashSSZCall{Call: call} +} + +// MockBeaconStateHashSSZCall wrap *gomock.Call +type MockBeaconStateHashSSZCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateHashSSZCall) Return(out [32]byte, err error) *MockBeaconStateHashSSZCall { + c.Call = c.Call.Return(out, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateHashSSZCall) Do(f func() ([32]byte, error)) *MockBeaconStateHashSSZCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateHashSSZCall) DoAndReturn(f func() ([32]byte, error)) *MockBeaconStateHashSSZCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// InitiateValidatorExit mocks base method. +func (m *MockBeaconState) InitiateValidatorExit(index uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InitiateValidatorExit", index) + ret0, _ := ret[0].(error) + return ret0 +} + +// InitiateValidatorExit indicates an expected call of InitiateValidatorExit. +func (mr *MockBeaconStateMockRecorder) InitiateValidatorExit(index any) *MockBeaconStateInitiateValidatorExitCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitiateValidatorExit", reflect.TypeOf((*MockBeaconState)(nil).InitiateValidatorExit), index) + return &MockBeaconStateInitiateValidatorExitCall{Call: call} +} + +// MockBeaconStateInitiateValidatorExitCall wrap *gomock.Call +type MockBeaconStateInitiateValidatorExitCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateInitiateValidatorExitCall) Return(arg0 error) *MockBeaconStateInitiateValidatorExitCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateInitiateValidatorExitCall) Do(f func(uint64) error) *MockBeaconStateInitiateValidatorExitCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateInitiateValidatorExitCall) DoAndReturn(f func(uint64) error) *MockBeaconStateInitiateValidatorExitCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// JustificationBits mocks base method. +func (m *MockBeaconState) JustificationBits() cltypes.JustificationBits { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "JustificationBits") + ret0, _ := ret[0].(cltypes.JustificationBits) + return ret0 +} + +// JustificationBits indicates an expected call of JustificationBits. +func (mr *MockBeaconStateMockRecorder) JustificationBits() *MockBeaconStateJustificationBitsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "JustificationBits", reflect.TypeOf((*MockBeaconState)(nil).JustificationBits)) + return &MockBeaconStateJustificationBitsCall{Call: call} +} + +// MockBeaconStateJustificationBitsCall wrap *gomock.Call +type MockBeaconStateJustificationBitsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateJustificationBitsCall) Return(arg0 cltypes.JustificationBits) *MockBeaconStateJustificationBitsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateJustificationBitsCall) Do(f func() cltypes.JustificationBits) *MockBeaconStateJustificationBitsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateJustificationBitsCall) DoAndReturn(f func() cltypes.JustificationBits) *MockBeaconStateJustificationBitsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// LatestBlockHeader mocks base method. +func (m *MockBeaconState) LatestBlockHeader() cltypes.BeaconBlockHeader { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "LatestBlockHeader") + ret0, _ := ret[0].(cltypes.BeaconBlockHeader) + return ret0 +} + +// LatestBlockHeader indicates an expected call of LatestBlockHeader. +func (mr *MockBeaconStateMockRecorder) LatestBlockHeader() *MockBeaconStateLatestBlockHeaderCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LatestBlockHeader", reflect.TypeOf((*MockBeaconState)(nil).LatestBlockHeader)) + return &MockBeaconStateLatestBlockHeaderCall{Call: call} +} + +// MockBeaconStateLatestBlockHeaderCall wrap *gomock.Call +type MockBeaconStateLatestBlockHeaderCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateLatestBlockHeaderCall) Return(arg0 cltypes.BeaconBlockHeader) *MockBeaconStateLatestBlockHeaderCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateLatestBlockHeaderCall) Do(f func() cltypes.BeaconBlockHeader) *MockBeaconStateLatestBlockHeaderCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateLatestBlockHeaderCall) DoAndReturn(f func() cltypes.BeaconBlockHeader) *MockBeaconStateLatestBlockHeaderCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// LatestExecutionPayloadHeader mocks base method. +func (m *MockBeaconState) LatestExecutionPayloadHeader() *cltypes.Eth1Header { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "LatestExecutionPayloadHeader") + ret0, _ := ret[0].(*cltypes.Eth1Header) + return ret0 +} + +// LatestExecutionPayloadHeader indicates an expected call of LatestExecutionPayloadHeader. +func (mr *MockBeaconStateMockRecorder) LatestExecutionPayloadHeader() *MockBeaconStateLatestExecutionPayloadHeaderCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LatestExecutionPayloadHeader", reflect.TypeOf((*MockBeaconState)(nil).LatestExecutionPayloadHeader)) + return &MockBeaconStateLatestExecutionPayloadHeaderCall{Call: call} +} + +// MockBeaconStateLatestExecutionPayloadHeaderCall wrap *gomock.Call +type MockBeaconStateLatestExecutionPayloadHeaderCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateLatestExecutionPayloadHeaderCall) Return(arg0 *cltypes.Eth1Header) *MockBeaconStateLatestExecutionPayloadHeaderCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateLatestExecutionPayloadHeaderCall) Do(f func() *cltypes.Eth1Header) *MockBeaconStateLatestExecutionPayloadHeaderCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateLatestExecutionPayloadHeaderCall) DoAndReturn(f func() *cltypes.Eth1Header) *MockBeaconStateLatestExecutionPayloadHeaderCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// NextSyncCommittee mocks base method. +func (m *MockBeaconState) NextSyncCommittee() *solid.SyncCommittee { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NextSyncCommittee") + ret0, _ := ret[0].(*solid.SyncCommittee) + return ret0 +} + +// NextSyncCommittee indicates an expected call of NextSyncCommittee. +func (mr *MockBeaconStateMockRecorder) NextSyncCommittee() *MockBeaconStateNextSyncCommitteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextSyncCommittee", reflect.TypeOf((*MockBeaconState)(nil).NextSyncCommittee)) + return &MockBeaconStateNextSyncCommitteeCall{Call: call} +} + +// MockBeaconStateNextSyncCommitteeCall wrap *gomock.Call +type MockBeaconStateNextSyncCommitteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateNextSyncCommitteeCall) Return(arg0 *solid.SyncCommittee) *MockBeaconStateNextSyncCommitteeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateNextSyncCommitteeCall) Do(f func() *solid.SyncCommittee) *MockBeaconStateNextSyncCommitteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateNextSyncCommitteeCall) DoAndReturn(f func() *solid.SyncCommittee) *MockBeaconStateNextSyncCommitteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// NextWithdrawalIndex mocks base method. +func (m *MockBeaconState) NextWithdrawalIndex() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NextWithdrawalIndex") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// NextWithdrawalIndex indicates an expected call of NextWithdrawalIndex. +func (mr *MockBeaconStateMockRecorder) NextWithdrawalIndex() *MockBeaconStateNextWithdrawalIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextWithdrawalIndex", reflect.TypeOf((*MockBeaconState)(nil).NextWithdrawalIndex)) + return &MockBeaconStateNextWithdrawalIndexCall{Call: call} +} + +// MockBeaconStateNextWithdrawalIndexCall wrap *gomock.Call +type MockBeaconStateNextWithdrawalIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateNextWithdrawalIndexCall) Return(arg0 uint64) *MockBeaconStateNextWithdrawalIndexCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateNextWithdrawalIndexCall) Do(f func() uint64) *MockBeaconStateNextWithdrawalIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateNextWithdrawalIndexCall) DoAndReturn(f func() uint64) *MockBeaconStateNextWithdrawalIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// NextWithdrawalValidatorIndex mocks base method. +func (m *MockBeaconState) NextWithdrawalValidatorIndex() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NextWithdrawalValidatorIndex") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// NextWithdrawalValidatorIndex indicates an expected call of NextWithdrawalValidatorIndex. +func (mr *MockBeaconStateMockRecorder) NextWithdrawalValidatorIndex() *MockBeaconStateNextWithdrawalValidatorIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextWithdrawalValidatorIndex", reflect.TypeOf((*MockBeaconState)(nil).NextWithdrawalValidatorIndex)) + return &MockBeaconStateNextWithdrawalValidatorIndexCall{Call: call} +} + +// MockBeaconStateNextWithdrawalValidatorIndexCall wrap *gomock.Call +type MockBeaconStateNextWithdrawalValidatorIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateNextWithdrawalValidatorIndexCall) Return(arg0 uint64) *MockBeaconStateNextWithdrawalValidatorIndexCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateNextWithdrawalValidatorIndexCall) Do(f func() uint64) *MockBeaconStateNextWithdrawalValidatorIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateNextWithdrawalValidatorIndexCall) DoAndReturn(f func() uint64) *MockBeaconStateNextWithdrawalValidatorIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PreviousEpochAttestations mocks base method. +func (m *MockBeaconState) PreviousEpochAttestations() *solid.ListSSZ[*solid.PendingAttestation] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreviousEpochAttestations") + ret0, _ := ret[0].(*solid.ListSSZ[*solid.PendingAttestation]) + return ret0 +} + +// PreviousEpochAttestations indicates an expected call of PreviousEpochAttestations. +func (mr *MockBeaconStateMockRecorder) PreviousEpochAttestations() *MockBeaconStatePreviousEpochAttestationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreviousEpochAttestations", reflect.TypeOf((*MockBeaconState)(nil).PreviousEpochAttestations)) + return &MockBeaconStatePreviousEpochAttestationsCall{Call: call} +} + +// MockBeaconStatePreviousEpochAttestationsCall wrap *gomock.Call +type MockBeaconStatePreviousEpochAttestationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStatePreviousEpochAttestationsCall) Return(arg0 *solid.ListSSZ[*solid.PendingAttestation]) *MockBeaconStatePreviousEpochAttestationsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStatePreviousEpochAttestationsCall) Do(f func() *solid.ListSSZ[*solid.PendingAttestation]) *MockBeaconStatePreviousEpochAttestationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStatePreviousEpochAttestationsCall) DoAndReturn(f func() *solid.ListSSZ[*solid.PendingAttestation]) *MockBeaconStatePreviousEpochAttestationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PreviousEpochAttestationsLength mocks base method. +func (m *MockBeaconState) PreviousEpochAttestationsLength() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreviousEpochAttestationsLength") + ret0, _ := ret[0].(int) + return ret0 +} + +// PreviousEpochAttestationsLength indicates an expected call of PreviousEpochAttestationsLength. +func (mr *MockBeaconStateMockRecorder) PreviousEpochAttestationsLength() *MockBeaconStatePreviousEpochAttestationsLengthCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreviousEpochAttestationsLength", reflect.TypeOf((*MockBeaconState)(nil).PreviousEpochAttestationsLength)) + return &MockBeaconStatePreviousEpochAttestationsLengthCall{Call: call} +} + +// MockBeaconStatePreviousEpochAttestationsLengthCall wrap *gomock.Call +type MockBeaconStatePreviousEpochAttestationsLengthCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStatePreviousEpochAttestationsLengthCall) Return(arg0 int) *MockBeaconStatePreviousEpochAttestationsLengthCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStatePreviousEpochAttestationsLengthCall) Do(f func() int) *MockBeaconStatePreviousEpochAttestationsLengthCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStatePreviousEpochAttestationsLengthCall) DoAndReturn(f func() int) *MockBeaconStatePreviousEpochAttestationsLengthCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PreviousEpochParticipation mocks base method. +func (m *MockBeaconState) PreviousEpochParticipation() *solid.ParticipationBitList { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreviousEpochParticipation") + ret0, _ := ret[0].(*solid.ParticipationBitList) + return ret0 +} + +// PreviousEpochParticipation indicates an expected call of PreviousEpochParticipation. +func (mr *MockBeaconStateMockRecorder) PreviousEpochParticipation() *MockBeaconStatePreviousEpochParticipationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreviousEpochParticipation", reflect.TypeOf((*MockBeaconState)(nil).PreviousEpochParticipation)) + return &MockBeaconStatePreviousEpochParticipationCall{Call: call} +} + +// MockBeaconStatePreviousEpochParticipationCall wrap *gomock.Call +type MockBeaconStatePreviousEpochParticipationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStatePreviousEpochParticipationCall) Return(arg0 *solid.ParticipationBitList) *MockBeaconStatePreviousEpochParticipationCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStatePreviousEpochParticipationCall) Do(f func() *solid.ParticipationBitList) *MockBeaconStatePreviousEpochParticipationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStatePreviousEpochParticipationCall) DoAndReturn(f func() *solid.ParticipationBitList) *MockBeaconStatePreviousEpochParticipationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PreviousJustifiedCheckpoint mocks base method. +func (m *MockBeaconState) PreviousJustifiedCheckpoint() solid.Checkpoint { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreviousJustifiedCheckpoint") + ret0, _ := ret[0].(solid.Checkpoint) + return ret0 +} + +// PreviousJustifiedCheckpoint indicates an expected call of PreviousJustifiedCheckpoint. +func (mr *MockBeaconStateMockRecorder) PreviousJustifiedCheckpoint() *MockBeaconStatePreviousJustifiedCheckpointCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreviousJustifiedCheckpoint", reflect.TypeOf((*MockBeaconState)(nil).PreviousJustifiedCheckpoint)) + return &MockBeaconStatePreviousJustifiedCheckpointCall{Call: call} +} + +// MockBeaconStatePreviousJustifiedCheckpointCall wrap *gomock.Call +type MockBeaconStatePreviousJustifiedCheckpointCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStatePreviousJustifiedCheckpointCall) Return(arg0 solid.Checkpoint) *MockBeaconStatePreviousJustifiedCheckpointCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStatePreviousJustifiedCheckpointCall) Do(f func() solid.Checkpoint) *MockBeaconStatePreviousJustifiedCheckpointCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStatePreviousJustifiedCheckpointCall) DoAndReturn(f func() solid.Checkpoint) *MockBeaconStatePreviousJustifiedCheckpointCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PreviousSlot mocks base method. +func (m *MockBeaconState) PreviousSlot() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreviousSlot") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// PreviousSlot indicates an expected call of PreviousSlot. +func (mr *MockBeaconStateMockRecorder) PreviousSlot() *MockBeaconStatePreviousSlotCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreviousSlot", reflect.TypeOf((*MockBeaconState)(nil).PreviousSlot)) + return &MockBeaconStatePreviousSlotCall{Call: call} +} + +// MockBeaconStatePreviousSlotCall wrap *gomock.Call +type MockBeaconStatePreviousSlotCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStatePreviousSlotCall) Return(arg0 uint64) *MockBeaconStatePreviousSlotCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStatePreviousSlotCall) Do(f func() uint64) *MockBeaconStatePreviousSlotCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStatePreviousSlotCall) DoAndReturn(f func() uint64) *MockBeaconStatePreviousSlotCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PreviousStateRoot mocks base method. +func (m *MockBeaconState) PreviousStateRoot() common.Hash { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreviousStateRoot") + ret0, _ := ret[0].(common.Hash) + return ret0 +} + +// PreviousStateRoot indicates an expected call of PreviousStateRoot. +func (mr *MockBeaconStateMockRecorder) PreviousStateRoot() *MockBeaconStatePreviousStateRootCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreviousStateRoot", reflect.TypeOf((*MockBeaconState)(nil).PreviousStateRoot)) + return &MockBeaconStatePreviousStateRootCall{Call: call} +} + +// MockBeaconStatePreviousStateRootCall wrap *gomock.Call +type MockBeaconStatePreviousStateRootCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStatePreviousStateRootCall) Return(arg0 common.Hash) *MockBeaconStatePreviousStateRootCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStatePreviousStateRootCall) Do(f func() common.Hash) *MockBeaconStatePreviousStateRootCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStatePreviousStateRootCall) DoAndReturn(f func() common.Hash) *MockBeaconStatePreviousStateRootCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RandaoMixes mocks base method. +func (m *MockBeaconState) RandaoMixes() solid.HashVectorSSZ { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RandaoMixes") + ret0, _ := ret[0].(solid.HashVectorSSZ) + return ret0 +} + +// RandaoMixes indicates an expected call of RandaoMixes. +func (mr *MockBeaconStateMockRecorder) RandaoMixes() *MockBeaconStateRandaoMixesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RandaoMixes", reflect.TypeOf((*MockBeaconState)(nil).RandaoMixes)) + return &MockBeaconStateRandaoMixesCall{Call: call} +} + +// MockBeaconStateRandaoMixesCall wrap *gomock.Call +type MockBeaconStateRandaoMixesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateRandaoMixesCall) Return(arg0 solid.HashVectorSSZ) *MockBeaconStateRandaoMixesCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateRandaoMixesCall) Do(f func() solid.HashVectorSSZ) *MockBeaconStateRandaoMixesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateRandaoMixesCall) DoAndReturn(f func() solid.HashVectorSSZ) *MockBeaconStateRandaoMixesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ResetCurrentEpochAttestations mocks base method. +func (m *MockBeaconState) ResetCurrentEpochAttestations() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ResetCurrentEpochAttestations") +} + +// ResetCurrentEpochAttestations indicates an expected call of ResetCurrentEpochAttestations. +func (mr *MockBeaconStateMockRecorder) ResetCurrentEpochAttestations() *MockBeaconStateResetCurrentEpochAttestationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetCurrentEpochAttestations", reflect.TypeOf((*MockBeaconState)(nil).ResetCurrentEpochAttestations)) + return &MockBeaconStateResetCurrentEpochAttestationsCall{Call: call} +} + +// MockBeaconStateResetCurrentEpochAttestationsCall wrap *gomock.Call +type MockBeaconStateResetCurrentEpochAttestationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateResetCurrentEpochAttestationsCall) Return() *MockBeaconStateResetCurrentEpochAttestationsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateResetCurrentEpochAttestationsCall) Do(f func()) *MockBeaconStateResetCurrentEpochAttestationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateResetCurrentEpochAttestationsCall) DoAndReturn(f func()) *MockBeaconStateResetCurrentEpochAttestationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ResetEpochParticipation mocks base method. +func (m *MockBeaconState) ResetEpochParticipation() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ResetEpochParticipation") +} + +// ResetEpochParticipation indicates an expected call of ResetEpochParticipation. +func (mr *MockBeaconStateMockRecorder) ResetEpochParticipation() *MockBeaconStateResetEpochParticipationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetEpochParticipation", reflect.TypeOf((*MockBeaconState)(nil).ResetEpochParticipation)) + return &MockBeaconStateResetEpochParticipationCall{Call: call} +} + +// MockBeaconStateResetEpochParticipationCall wrap *gomock.Call +type MockBeaconStateResetEpochParticipationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateResetEpochParticipationCall) Return() *MockBeaconStateResetEpochParticipationCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateResetEpochParticipationCall) Do(f func()) *MockBeaconStateResetEpochParticipationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateResetEpochParticipationCall) DoAndReturn(f func()) *MockBeaconStateResetEpochParticipationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ResetEth1DataVotes mocks base method. +func (m *MockBeaconState) ResetEth1DataVotes() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ResetEth1DataVotes") +} + +// ResetEth1DataVotes indicates an expected call of ResetEth1DataVotes. +func (mr *MockBeaconStateMockRecorder) ResetEth1DataVotes() *MockBeaconStateResetEth1DataVotesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetEth1DataVotes", reflect.TypeOf((*MockBeaconState)(nil).ResetEth1DataVotes)) + return &MockBeaconStateResetEth1DataVotesCall{Call: call} +} + +// MockBeaconStateResetEth1DataVotesCall wrap *gomock.Call +type MockBeaconStateResetEth1DataVotesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateResetEth1DataVotesCall) Return() *MockBeaconStateResetEth1DataVotesCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateResetEth1DataVotesCall) Do(f func()) *MockBeaconStateResetEth1DataVotesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateResetEth1DataVotesCall) DoAndReturn(f func()) *MockBeaconStateResetEth1DataVotesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ResetHistoricalSummaries mocks base method. +func (m *MockBeaconState) ResetHistoricalSummaries() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ResetHistoricalSummaries") +} + +// ResetHistoricalSummaries indicates an expected call of ResetHistoricalSummaries. +func (mr *MockBeaconStateMockRecorder) ResetHistoricalSummaries() *MockBeaconStateResetHistoricalSummariesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetHistoricalSummaries", reflect.TypeOf((*MockBeaconState)(nil).ResetHistoricalSummaries)) + return &MockBeaconStateResetHistoricalSummariesCall{Call: call} +} + +// MockBeaconStateResetHistoricalSummariesCall wrap *gomock.Call +type MockBeaconStateResetHistoricalSummariesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateResetHistoricalSummariesCall) Return() *MockBeaconStateResetHistoricalSummariesCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateResetHistoricalSummariesCall) Do(f func()) *MockBeaconStateResetHistoricalSummariesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateResetHistoricalSummariesCall) DoAndReturn(f func()) *MockBeaconStateResetHistoricalSummariesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ResetPreviousEpochAttestations mocks base method. +func (m *MockBeaconState) ResetPreviousEpochAttestations() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ResetPreviousEpochAttestations") +} + +// ResetPreviousEpochAttestations indicates an expected call of ResetPreviousEpochAttestations. +func (mr *MockBeaconStateMockRecorder) ResetPreviousEpochAttestations() *MockBeaconStateResetPreviousEpochAttestationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetPreviousEpochAttestations", reflect.TypeOf((*MockBeaconState)(nil).ResetPreviousEpochAttestations)) + return &MockBeaconStateResetPreviousEpochAttestationsCall{Call: call} +} + +// MockBeaconStateResetPreviousEpochAttestationsCall wrap *gomock.Call +type MockBeaconStateResetPreviousEpochAttestationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateResetPreviousEpochAttestationsCall) Return() *MockBeaconStateResetPreviousEpochAttestationsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateResetPreviousEpochAttestationsCall) Do(f func()) *MockBeaconStateResetPreviousEpochAttestationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateResetPreviousEpochAttestationsCall) DoAndReturn(f func()) *MockBeaconStateResetPreviousEpochAttestationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetActivationEligibilityEpochForValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetActivationEligibilityEpochForValidatorAtIndex(index int, epoch uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetActivationEligibilityEpochForValidatorAtIndex", index, epoch) +} + +// SetActivationEligibilityEpochForValidatorAtIndex indicates an expected call of SetActivationEligibilityEpochForValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetActivationEligibilityEpochForValidatorAtIndex(index, epoch any) *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetActivationEligibilityEpochForValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetActivationEligibilityEpochForValidatorAtIndex), index, epoch) + return &MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall) Return() *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall) Do(f func(int, uint64)) *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall) DoAndReturn(f func(int, uint64)) *MockBeaconStateSetActivationEligibilityEpochForValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetActivationEpochForValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetActivationEpochForValidatorAtIndex(index int, epoch uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetActivationEpochForValidatorAtIndex", index, epoch) +} + +// SetActivationEpochForValidatorAtIndex indicates an expected call of SetActivationEpochForValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetActivationEpochForValidatorAtIndex(index, epoch any) *MockBeaconStateSetActivationEpochForValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetActivationEpochForValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetActivationEpochForValidatorAtIndex), index, epoch) + return &MockBeaconStateSetActivationEpochForValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetActivationEpochForValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetActivationEpochForValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetActivationEpochForValidatorAtIndexCall) Return() *MockBeaconStateSetActivationEpochForValidatorAtIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetActivationEpochForValidatorAtIndexCall) Do(f func(int, uint64)) *MockBeaconStateSetActivationEpochForValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetActivationEpochForValidatorAtIndexCall) DoAndReturn(f func(int, uint64)) *MockBeaconStateSetActivationEpochForValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetBlockRootAt mocks base method. +func (m *MockBeaconState) SetBlockRootAt(index int, root common.Hash) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetBlockRootAt", index, root) +} + +// SetBlockRootAt indicates an expected call of SetBlockRootAt. +func (mr *MockBeaconStateMockRecorder) SetBlockRootAt(index, root any) *MockBeaconStateSetBlockRootAtCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBlockRootAt", reflect.TypeOf((*MockBeaconState)(nil).SetBlockRootAt), index, root) + return &MockBeaconStateSetBlockRootAtCall{Call: call} +} + +// MockBeaconStateSetBlockRootAtCall wrap *gomock.Call +type MockBeaconStateSetBlockRootAtCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetBlockRootAtCall) Return() *MockBeaconStateSetBlockRootAtCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetBlockRootAtCall) Do(f func(int, common.Hash)) *MockBeaconStateSetBlockRootAtCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetBlockRootAtCall) DoAndReturn(f func(int, common.Hash)) *MockBeaconStateSetBlockRootAtCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetConsolidationBalanceToConsume mocks base method. +func (m *MockBeaconState) SetConsolidationBalanceToConsume(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetConsolidationBalanceToConsume", arg0) +} + +// SetConsolidationBalanceToConsume indicates an expected call of SetConsolidationBalanceToConsume. +func (mr *MockBeaconStateMockRecorder) SetConsolidationBalanceToConsume(arg0 any) *MockBeaconStateSetConsolidationBalanceToConsumeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetConsolidationBalanceToConsume", reflect.TypeOf((*MockBeaconState)(nil).SetConsolidationBalanceToConsume), arg0) + return &MockBeaconStateSetConsolidationBalanceToConsumeCall{Call: call} +} + +// MockBeaconStateSetConsolidationBalanceToConsumeCall wrap *gomock.Call +type MockBeaconStateSetConsolidationBalanceToConsumeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetConsolidationBalanceToConsumeCall) Return() *MockBeaconStateSetConsolidationBalanceToConsumeCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetConsolidationBalanceToConsumeCall) Do(f func(uint64)) *MockBeaconStateSetConsolidationBalanceToConsumeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetConsolidationBalanceToConsumeCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetConsolidationBalanceToConsumeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetCurrentEpochParticipationFlags mocks base method. +func (m *MockBeaconState) SetCurrentEpochParticipationFlags(flags []cltypes.ParticipationFlags) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetCurrentEpochParticipationFlags", flags) +} + +// SetCurrentEpochParticipationFlags indicates an expected call of SetCurrentEpochParticipationFlags. +func (mr *MockBeaconStateMockRecorder) SetCurrentEpochParticipationFlags(flags any) *MockBeaconStateSetCurrentEpochParticipationFlagsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCurrentEpochParticipationFlags", reflect.TypeOf((*MockBeaconState)(nil).SetCurrentEpochParticipationFlags), flags) + return &MockBeaconStateSetCurrentEpochParticipationFlagsCall{Call: call} +} + +// MockBeaconStateSetCurrentEpochParticipationFlagsCall wrap *gomock.Call +type MockBeaconStateSetCurrentEpochParticipationFlagsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetCurrentEpochParticipationFlagsCall) Return() *MockBeaconStateSetCurrentEpochParticipationFlagsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetCurrentEpochParticipationFlagsCall) Do(f func([]cltypes.ParticipationFlags)) *MockBeaconStateSetCurrentEpochParticipationFlagsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetCurrentEpochParticipationFlagsCall) DoAndReturn(f func([]cltypes.ParticipationFlags)) *MockBeaconStateSetCurrentEpochParticipationFlagsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetCurrentJustifiedCheckpoint mocks base method. +func (m *MockBeaconState) SetCurrentJustifiedCheckpoint(currentJustifiedCheckpoint solid.Checkpoint) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetCurrentJustifiedCheckpoint", currentJustifiedCheckpoint) +} + +// SetCurrentJustifiedCheckpoint indicates an expected call of SetCurrentJustifiedCheckpoint. +func (mr *MockBeaconStateMockRecorder) SetCurrentJustifiedCheckpoint(currentJustifiedCheckpoint any) *MockBeaconStateSetCurrentJustifiedCheckpointCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCurrentJustifiedCheckpoint", reflect.TypeOf((*MockBeaconState)(nil).SetCurrentJustifiedCheckpoint), currentJustifiedCheckpoint) + return &MockBeaconStateSetCurrentJustifiedCheckpointCall{Call: call} +} + +// MockBeaconStateSetCurrentJustifiedCheckpointCall wrap *gomock.Call +type MockBeaconStateSetCurrentJustifiedCheckpointCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetCurrentJustifiedCheckpointCall) Return() *MockBeaconStateSetCurrentJustifiedCheckpointCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetCurrentJustifiedCheckpointCall) Do(f func(solid.Checkpoint)) *MockBeaconStateSetCurrentJustifiedCheckpointCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetCurrentJustifiedCheckpointCall) DoAndReturn(f func(solid.Checkpoint)) *MockBeaconStateSetCurrentJustifiedCheckpointCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetCurrentSyncCommittee mocks base method. +func (m *MockBeaconState) SetCurrentSyncCommittee(currentSyncCommittee *solid.SyncCommittee) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetCurrentSyncCommittee", currentSyncCommittee) +} + +// SetCurrentSyncCommittee indicates an expected call of SetCurrentSyncCommittee. +func (mr *MockBeaconStateMockRecorder) SetCurrentSyncCommittee(currentSyncCommittee any) *MockBeaconStateSetCurrentSyncCommitteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCurrentSyncCommittee", reflect.TypeOf((*MockBeaconState)(nil).SetCurrentSyncCommittee), currentSyncCommittee) + return &MockBeaconStateSetCurrentSyncCommitteeCall{Call: call} +} + +// MockBeaconStateSetCurrentSyncCommitteeCall wrap *gomock.Call +type MockBeaconStateSetCurrentSyncCommitteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetCurrentSyncCommitteeCall) Return() *MockBeaconStateSetCurrentSyncCommitteeCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetCurrentSyncCommitteeCall) Do(f func(*solid.SyncCommittee)) *MockBeaconStateSetCurrentSyncCommitteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetCurrentSyncCommitteeCall) DoAndReturn(f func(*solid.SyncCommittee)) *MockBeaconStateSetCurrentSyncCommitteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetDepositBalanceToConsume mocks base method. +func (m *MockBeaconState) SetDepositBalanceToConsume(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetDepositBalanceToConsume", arg0) +} + +// SetDepositBalanceToConsume indicates an expected call of SetDepositBalanceToConsume. +func (mr *MockBeaconStateMockRecorder) SetDepositBalanceToConsume(arg0 any) *MockBeaconStateSetDepositBalanceToConsumeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDepositBalanceToConsume", reflect.TypeOf((*MockBeaconState)(nil).SetDepositBalanceToConsume), arg0) + return &MockBeaconStateSetDepositBalanceToConsumeCall{Call: call} +} + +// MockBeaconStateSetDepositBalanceToConsumeCall wrap *gomock.Call +type MockBeaconStateSetDepositBalanceToConsumeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetDepositBalanceToConsumeCall) Return() *MockBeaconStateSetDepositBalanceToConsumeCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetDepositBalanceToConsumeCall) Do(f func(uint64)) *MockBeaconStateSetDepositBalanceToConsumeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetDepositBalanceToConsumeCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetDepositBalanceToConsumeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetDepositRequestsStartIndex mocks base method. +func (m *MockBeaconState) SetDepositRequestsStartIndex(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetDepositRequestsStartIndex", arg0) +} + +// SetDepositRequestsStartIndex indicates an expected call of SetDepositRequestsStartIndex. +func (mr *MockBeaconStateMockRecorder) SetDepositRequestsStartIndex(arg0 any) *MockBeaconStateSetDepositRequestsStartIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDepositRequestsStartIndex", reflect.TypeOf((*MockBeaconState)(nil).SetDepositRequestsStartIndex), arg0) + return &MockBeaconStateSetDepositRequestsStartIndexCall{Call: call} +} + +// MockBeaconStateSetDepositRequestsStartIndexCall wrap *gomock.Call +type MockBeaconStateSetDepositRequestsStartIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetDepositRequestsStartIndexCall) Return() *MockBeaconStateSetDepositRequestsStartIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetDepositRequestsStartIndexCall) Do(f func(uint64)) *MockBeaconStateSetDepositRequestsStartIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetDepositRequestsStartIndexCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetDepositRequestsStartIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetEarlistConsolidationEpoch mocks base method. +func (m *MockBeaconState) SetEarlistConsolidationEpoch(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetEarlistConsolidationEpoch", arg0) +} + +// SetEarlistConsolidationEpoch indicates an expected call of SetEarlistConsolidationEpoch. +func (mr *MockBeaconStateMockRecorder) SetEarlistConsolidationEpoch(arg0 any) *MockBeaconStateSetEarlistConsolidationEpochCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEarlistConsolidationEpoch", reflect.TypeOf((*MockBeaconState)(nil).SetEarlistConsolidationEpoch), arg0) + return &MockBeaconStateSetEarlistConsolidationEpochCall{Call: call} +} + +// MockBeaconStateSetEarlistConsolidationEpochCall wrap *gomock.Call +type MockBeaconStateSetEarlistConsolidationEpochCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetEarlistConsolidationEpochCall) Return() *MockBeaconStateSetEarlistConsolidationEpochCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetEarlistConsolidationEpochCall) Do(f func(uint64)) *MockBeaconStateSetEarlistConsolidationEpochCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetEarlistConsolidationEpochCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetEarlistConsolidationEpochCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetEffectiveBalanceForValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetEffectiveBalanceForValidatorAtIndex(index int, balance uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetEffectiveBalanceForValidatorAtIndex", index, balance) +} + +// SetEffectiveBalanceForValidatorAtIndex indicates an expected call of SetEffectiveBalanceForValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetEffectiveBalanceForValidatorAtIndex(index, balance any) *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEffectiveBalanceForValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetEffectiveBalanceForValidatorAtIndex), index, balance) + return &MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall) Return() *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall) Do(f func(int, uint64)) *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall) DoAndReturn(f func(int, uint64)) *MockBeaconStateSetEffectiveBalanceForValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetEpochParticipationForValidatorIndex mocks base method. +func (m *MockBeaconState) SetEpochParticipationForValidatorIndex(isCurrentEpoch bool, index int, flags cltypes.ParticipationFlags) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetEpochParticipationForValidatorIndex", isCurrentEpoch, index, flags) +} + +// SetEpochParticipationForValidatorIndex indicates an expected call of SetEpochParticipationForValidatorIndex. +func (mr *MockBeaconStateMockRecorder) SetEpochParticipationForValidatorIndex(isCurrentEpoch, index, flags any) *MockBeaconStateSetEpochParticipationForValidatorIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEpochParticipationForValidatorIndex", reflect.TypeOf((*MockBeaconState)(nil).SetEpochParticipationForValidatorIndex), isCurrentEpoch, index, flags) + return &MockBeaconStateSetEpochParticipationForValidatorIndexCall{Call: call} +} + +// MockBeaconStateSetEpochParticipationForValidatorIndexCall wrap *gomock.Call +type MockBeaconStateSetEpochParticipationForValidatorIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetEpochParticipationForValidatorIndexCall) Return() *MockBeaconStateSetEpochParticipationForValidatorIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetEpochParticipationForValidatorIndexCall) Do(f func(bool, int, cltypes.ParticipationFlags)) *MockBeaconStateSetEpochParticipationForValidatorIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetEpochParticipationForValidatorIndexCall) DoAndReturn(f func(bool, int, cltypes.ParticipationFlags)) *MockBeaconStateSetEpochParticipationForValidatorIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetEth1Data mocks base method. +func (m *MockBeaconState) SetEth1Data(eth1Data *cltypes.Eth1Data) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetEth1Data", eth1Data) +} + +// SetEth1Data indicates an expected call of SetEth1Data. +func (mr *MockBeaconStateMockRecorder) SetEth1Data(eth1Data any) *MockBeaconStateSetEth1DataCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEth1Data", reflect.TypeOf((*MockBeaconState)(nil).SetEth1Data), eth1Data) + return &MockBeaconStateSetEth1DataCall{Call: call} +} + +// MockBeaconStateSetEth1DataCall wrap *gomock.Call +type MockBeaconStateSetEth1DataCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetEth1DataCall) Return() *MockBeaconStateSetEth1DataCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetEth1DataCall) Do(f func(*cltypes.Eth1Data)) *MockBeaconStateSetEth1DataCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetEth1DataCall) DoAndReturn(f func(*cltypes.Eth1Data)) *MockBeaconStateSetEth1DataCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetEth1DepositIndex mocks base method. +func (m *MockBeaconState) SetEth1DepositIndex(eth1DepositIndex uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetEth1DepositIndex", eth1DepositIndex) +} + +// SetEth1DepositIndex indicates an expected call of SetEth1DepositIndex. +func (mr *MockBeaconStateMockRecorder) SetEth1DepositIndex(eth1DepositIndex any) *MockBeaconStateSetEth1DepositIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEth1DepositIndex", reflect.TypeOf((*MockBeaconState)(nil).SetEth1DepositIndex), eth1DepositIndex) + return &MockBeaconStateSetEth1DepositIndexCall{Call: call} +} + +// MockBeaconStateSetEth1DepositIndexCall wrap *gomock.Call +type MockBeaconStateSetEth1DepositIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetEth1DepositIndexCall) Return() *MockBeaconStateSetEth1DepositIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetEth1DepositIndexCall) Do(f func(uint64)) *MockBeaconStateSetEth1DepositIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetEth1DepositIndexCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetEth1DepositIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetExitEpochForValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetExitEpochForValidatorAtIndex(index int, epoch uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetExitEpochForValidatorAtIndex", index, epoch) +} + +// SetExitEpochForValidatorAtIndex indicates an expected call of SetExitEpochForValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetExitEpochForValidatorAtIndex(index, epoch any) *MockBeaconStateSetExitEpochForValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetExitEpochForValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetExitEpochForValidatorAtIndex), index, epoch) + return &MockBeaconStateSetExitEpochForValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetExitEpochForValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetExitEpochForValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetExitEpochForValidatorAtIndexCall) Return() *MockBeaconStateSetExitEpochForValidatorAtIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetExitEpochForValidatorAtIndexCall) Do(f func(int, uint64)) *MockBeaconStateSetExitEpochForValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetExitEpochForValidatorAtIndexCall) DoAndReturn(f func(int, uint64)) *MockBeaconStateSetExitEpochForValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetFinalizedCheckpoint mocks base method. +func (m *MockBeaconState) SetFinalizedCheckpoint(finalizedCheckpoint solid.Checkpoint) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetFinalizedCheckpoint", finalizedCheckpoint) +} + +// SetFinalizedCheckpoint indicates an expected call of SetFinalizedCheckpoint. +func (mr *MockBeaconStateMockRecorder) SetFinalizedCheckpoint(finalizedCheckpoint any) *MockBeaconStateSetFinalizedCheckpointCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFinalizedCheckpoint", reflect.TypeOf((*MockBeaconState)(nil).SetFinalizedCheckpoint), finalizedCheckpoint) + return &MockBeaconStateSetFinalizedCheckpointCall{Call: call} +} + +// MockBeaconStateSetFinalizedCheckpointCall wrap *gomock.Call +type MockBeaconStateSetFinalizedCheckpointCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetFinalizedCheckpointCall) Return() *MockBeaconStateSetFinalizedCheckpointCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetFinalizedCheckpointCall) Do(f func(solid.Checkpoint)) *MockBeaconStateSetFinalizedCheckpointCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetFinalizedCheckpointCall) DoAndReturn(f func(solid.Checkpoint)) *MockBeaconStateSetFinalizedCheckpointCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetFork mocks base method. +func (m *MockBeaconState) SetFork(fork *cltypes.Fork) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetFork", fork) +} + +// SetFork indicates an expected call of SetFork. +func (mr *MockBeaconStateMockRecorder) SetFork(fork any) *MockBeaconStateSetForkCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFork", reflect.TypeOf((*MockBeaconState)(nil).SetFork), fork) + return &MockBeaconStateSetForkCall{Call: call} +} + +// MockBeaconStateSetForkCall wrap *gomock.Call +type MockBeaconStateSetForkCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetForkCall) Return() *MockBeaconStateSetForkCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetForkCall) Do(f func(*cltypes.Fork)) *MockBeaconStateSetForkCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetForkCall) DoAndReturn(f func(*cltypes.Fork)) *MockBeaconStateSetForkCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetInactivityScores mocks base method. +func (m *MockBeaconState) SetInactivityScores(scores []uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetInactivityScores", scores) +} + +// SetInactivityScores indicates an expected call of SetInactivityScores. +func (mr *MockBeaconStateMockRecorder) SetInactivityScores(scores any) *MockBeaconStateSetInactivityScoresCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetInactivityScores", reflect.TypeOf((*MockBeaconState)(nil).SetInactivityScores), scores) + return &MockBeaconStateSetInactivityScoresCall{Call: call} +} + +// MockBeaconStateSetInactivityScoresCall wrap *gomock.Call +type MockBeaconStateSetInactivityScoresCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetInactivityScoresCall) Return() *MockBeaconStateSetInactivityScoresCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetInactivityScoresCall) Do(f func([]uint64)) *MockBeaconStateSetInactivityScoresCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetInactivityScoresCall) DoAndReturn(f func([]uint64)) *MockBeaconStateSetInactivityScoresCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetJustificationBits mocks base method. +func (m *MockBeaconState) SetJustificationBits(justificationBits cltypes.JustificationBits) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetJustificationBits", justificationBits) +} + +// SetJustificationBits indicates an expected call of SetJustificationBits. +func (mr *MockBeaconStateMockRecorder) SetJustificationBits(justificationBits any) *MockBeaconStateSetJustificationBitsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetJustificationBits", reflect.TypeOf((*MockBeaconState)(nil).SetJustificationBits), justificationBits) + return &MockBeaconStateSetJustificationBitsCall{Call: call} +} + +// MockBeaconStateSetJustificationBitsCall wrap *gomock.Call +type MockBeaconStateSetJustificationBitsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetJustificationBitsCall) Return() *MockBeaconStateSetJustificationBitsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetJustificationBitsCall) Do(f func(cltypes.JustificationBits)) *MockBeaconStateSetJustificationBitsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetJustificationBitsCall) DoAndReturn(f func(cltypes.JustificationBits)) *MockBeaconStateSetJustificationBitsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetLatestBlockHeader mocks base method. +func (m *MockBeaconState) SetLatestBlockHeader(header *cltypes.BeaconBlockHeader) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetLatestBlockHeader", header) +} + +// SetLatestBlockHeader indicates an expected call of SetLatestBlockHeader. +func (mr *MockBeaconStateMockRecorder) SetLatestBlockHeader(header any) *MockBeaconStateSetLatestBlockHeaderCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLatestBlockHeader", reflect.TypeOf((*MockBeaconState)(nil).SetLatestBlockHeader), header) + return &MockBeaconStateSetLatestBlockHeaderCall{Call: call} +} + +// MockBeaconStateSetLatestBlockHeaderCall wrap *gomock.Call +type MockBeaconStateSetLatestBlockHeaderCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetLatestBlockHeaderCall) Return() *MockBeaconStateSetLatestBlockHeaderCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetLatestBlockHeaderCall) Do(f func(*cltypes.BeaconBlockHeader)) *MockBeaconStateSetLatestBlockHeaderCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetLatestBlockHeaderCall) DoAndReturn(f func(*cltypes.BeaconBlockHeader)) *MockBeaconStateSetLatestBlockHeaderCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetLatestExecutionPayloadHeader mocks base method. +func (m *MockBeaconState) SetLatestExecutionPayloadHeader(header *cltypes.Eth1Header) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetLatestExecutionPayloadHeader", header) +} + +// SetLatestExecutionPayloadHeader indicates an expected call of SetLatestExecutionPayloadHeader. +func (mr *MockBeaconStateMockRecorder) SetLatestExecutionPayloadHeader(header any) *MockBeaconStateSetLatestExecutionPayloadHeaderCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLatestExecutionPayloadHeader", reflect.TypeOf((*MockBeaconState)(nil).SetLatestExecutionPayloadHeader), header) + return &MockBeaconStateSetLatestExecutionPayloadHeaderCall{Call: call} +} + +// MockBeaconStateSetLatestExecutionPayloadHeaderCall wrap *gomock.Call +type MockBeaconStateSetLatestExecutionPayloadHeaderCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetLatestExecutionPayloadHeaderCall) Return() *MockBeaconStateSetLatestExecutionPayloadHeaderCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetLatestExecutionPayloadHeaderCall) Do(f func(*cltypes.Eth1Header)) *MockBeaconStateSetLatestExecutionPayloadHeaderCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetLatestExecutionPayloadHeaderCall) DoAndReturn(f func(*cltypes.Eth1Header)) *MockBeaconStateSetLatestExecutionPayloadHeaderCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetNextSyncCommittee mocks base method. +func (m *MockBeaconState) SetNextSyncCommittee(nextSyncCommittee *solid.SyncCommittee) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetNextSyncCommittee", nextSyncCommittee) +} + +// SetNextSyncCommittee indicates an expected call of SetNextSyncCommittee. +func (mr *MockBeaconStateMockRecorder) SetNextSyncCommittee(nextSyncCommittee any) *MockBeaconStateSetNextSyncCommitteeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetNextSyncCommittee", reflect.TypeOf((*MockBeaconState)(nil).SetNextSyncCommittee), nextSyncCommittee) + return &MockBeaconStateSetNextSyncCommitteeCall{Call: call} +} + +// MockBeaconStateSetNextSyncCommitteeCall wrap *gomock.Call +type MockBeaconStateSetNextSyncCommitteeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetNextSyncCommitteeCall) Return() *MockBeaconStateSetNextSyncCommitteeCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetNextSyncCommitteeCall) Do(f func(*solid.SyncCommittee)) *MockBeaconStateSetNextSyncCommitteeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetNextSyncCommitteeCall) DoAndReturn(f func(*solid.SyncCommittee)) *MockBeaconStateSetNextSyncCommitteeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetNextWithdrawalIndex mocks base method. +func (m *MockBeaconState) SetNextWithdrawalIndex(index uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetNextWithdrawalIndex", index) +} + +// SetNextWithdrawalIndex indicates an expected call of SetNextWithdrawalIndex. +func (mr *MockBeaconStateMockRecorder) SetNextWithdrawalIndex(index any) *MockBeaconStateSetNextWithdrawalIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetNextWithdrawalIndex", reflect.TypeOf((*MockBeaconState)(nil).SetNextWithdrawalIndex), index) + return &MockBeaconStateSetNextWithdrawalIndexCall{Call: call} +} + +// MockBeaconStateSetNextWithdrawalIndexCall wrap *gomock.Call +type MockBeaconStateSetNextWithdrawalIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetNextWithdrawalIndexCall) Return() *MockBeaconStateSetNextWithdrawalIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetNextWithdrawalIndexCall) Do(f func(uint64)) *MockBeaconStateSetNextWithdrawalIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetNextWithdrawalIndexCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetNextWithdrawalIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetNextWithdrawalValidatorIndex mocks base method. +func (m *MockBeaconState) SetNextWithdrawalValidatorIndex(index uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetNextWithdrawalValidatorIndex", index) +} + +// SetNextWithdrawalValidatorIndex indicates an expected call of SetNextWithdrawalValidatorIndex. +func (mr *MockBeaconStateMockRecorder) SetNextWithdrawalValidatorIndex(index any) *MockBeaconStateSetNextWithdrawalValidatorIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetNextWithdrawalValidatorIndex", reflect.TypeOf((*MockBeaconState)(nil).SetNextWithdrawalValidatorIndex), index) + return &MockBeaconStateSetNextWithdrawalValidatorIndexCall{Call: call} +} + +// MockBeaconStateSetNextWithdrawalValidatorIndexCall wrap *gomock.Call +type MockBeaconStateSetNextWithdrawalValidatorIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetNextWithdrawalValidatorIndexCall) Return() *MockBeaconStateSetNextWithdrawalValidatorIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetNextWithdrawalValidatorIndexCall) Do(f func(uint64)) *MockBeaconStateSetNextWithdrawalValidatorIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetNextWithdrawalValidatorIndexCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetNextWithdrawalValidatorIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPendingConsolidations mocks base method. +func (m *MockBeaconState) SetPendingConsolidations(consolidations *solid.ListSSZ[*solid.PendingConsolidation]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPendingConsolidations", consolidations) +} + +// SetPendingConsolidations indicates an expected call of SetPendingConsolidations. +func (mr *MockBeaconStateMockRecorder) SetPendingConsolidations(consolidations any) *MockBeaconStateSetPendingConsolidationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPendingConsolidations", reflect.TypeOf((*MockBeaconState)(nil).SetPendingConsolidations), consolidations) + return &MockBeaconStateSetPendingConsolidationsCall{Call: call} +} + +// MockBeaconStateSetPendingConsolidationsCall wrap *gomock.Call +type MockBeaconStateSetPendingConsolidationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPendingConsolidationsCall) Return() *MockBeaconStateSetPendingConsolidationsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPendingConsolidationsCall) Do(f func(*solid.ListSSZ[*solid.PendingConsolidation])) *MockBeaconStateSetPendingConsolidationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPendingConsolidationsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingConsolidation])) *MockBeaconStateSetPendingConsolidationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPendingDeposits mocks base method. +func (m *MockBeaconState) SetPendingDeposits(arg0 *solid.ListSSZ[*solid.PendingDeposit]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPendingDeposits", arg0) +} + +// SetPendingDeposits indicates an expected call of SetPendingDeposits. +func (mr *MockBeaconStateMockRecorder) SetPendingDeposits(arg0 any) *MockBeaconStateSetPendingDepositsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPendingDeposits", reflect.TypeOf((*MockBeaconState)(nil).SetPendingDeposits), arg0) + return &MockBeaconStateSetPendingDepositsCall{Call: call} +} + +// MockBeaconStateSetPendingDepositsCall wrap *gomock.Call +type MockBeaconStateSetPendingDepositsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPendingDepositsCall) Return() *MockBeaconStateSetPendingDepositsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPendingDepositsCall) Do(f func(*solid.ListSSZ[*solid.PendingDeposit])) *MockBeaconStateSetPendingDepositsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPendingDepositsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingDeposit])) *MockBeaconStateSetPendingDepositsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPendingPartialWithdrawals mocks base method. +func (m *MockBeaconState) SetPendingPartialWithdrawals(arg0 *solid.ListSSZ[*solid.PendingPartialWithdrawal]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPendingPartialWithdrawals", arg0) +} + +// SetPendingPartialWithdrawals indicates an expected call of SetPendingPartialWithdrawals. +func (mr *MockBeaconStateMockRecorder) SetPendingPartialWithdrawals(arg0 any) *MockBeaconStateSetPendingPartialWithdrawalsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPendingPartialWithdrawals", reflect.TypeOf((*MockBeaconState)(nil).SetPendingPartialWithdrawals), arg0) + return &MockBeaconStateSetPendingPartialWithdrawalsCall{Call: call} +} + +// MockBeaconStateSetPendingPartialWithdrawalsCall wrap *gomock.Call +type MockBeaconStateSetPendingPartialWithdrawalsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPendingPartialWithdrawalsCall) Return() *MockBeaconStateSetPendingPartialWithdrawalsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPendingPartialWithdrawalsCall) Do(f func(*solid.ListSSZ[*solid.PendingPartialWithdrawal])) *MockBeaconStateSetPendingPartialWithdrawalsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPendingPartialWithdrawalsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingPartialWithdrawal])) *MockBeaconStateSetPendingPartialWithdrawalsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPreviousEpochAttestations mocks base method. +func (m *MockBeaconState) SetPreviousEpochAttestations(attestations *solid.ListSSZ[*solid.PendingAttestation]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPreviousEpochAttestations", attestations) +} + +// SetPreviousEpochAttestations indicates an expected call of SetPreviousEpochAttestations. +func (mr *MockBeaconStateMockRecorder) SetPreviousEpochAttestations(attestations any) *MockBeaconStateSetPreviousEpochAttestationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreviousEpochAttestations", reflect.TypeOf((*MockBeaconState)(nil).SetPreviousEpochAttestations), attestations) + return &MockBeaconStateSetPreviousEpochAttestationsCall{Call: call} +} + +// MockBeaconStateSetPreviousEpochAttestationsCall wrap *gomock.Call +type MockBeaconStateSetPreviousEpochAttestationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPreviousEpochAttestationsCall) Return() *MockBeaconStateSetPreviousEpochAttestationsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPreviousEpochAttestationsCall) Do(f func(*solid.ListSSZ[*solid.PendingAttestation])) *MockBeaconStateSetPreviousEpochAttestationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPreviousEpochAttestationsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingAttestation])) *MockBeaconStateSetPreviousEpochAttestationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPreviousEpochParticipationFlags mocks base method. +func (m *MockBeaconState) SetPreviousEpochParticipationFlags(flags []cltypes.ParticipationFlags) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPreviousEpochParticipationFlags", flags) +} + +// SetPreviousEpochParticipationFlags indicates an expected call of SetPreviousEpochParticipationFlags. +func (mr *MockBeaconStateMockRecorder) SetPreviousEpochParticipationFlags(flags any) *MockBeaconStateSetPreviousEpochParticipationFlagsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreviousEpochParticipationFlags", reflect.TypeOf((*MockBeaconState)(nil).SetPreviousEpochParticipationFlags), flags) + return &MockBeaconStateSetPreviousEpochParticipationFlagsCall{Call: call} +} + +// MockBeaconStateSetPreviousEpochParticipationFlagsCall wrap *gomock.Call +type MockBeaconStateSetPreviousEpochParticipationFlagsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPreviousEpochParticipationFlagsCall) Return() *MockBeaconStateSetPreviousEpochParticipationFlagsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPreviousEpochParticipationFlagsCall) Do(f func([]cltypes.ParticipationFlags)) *MockBeaconStateSetPreviousEpochParticipationFlagsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPreviousEpochParticipationFlagsCall) DoAndReturn(f func([]cltypes.ParticipationFlags)) *MockBeaconStateSetPreviousEpochParticipationFlagsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPreviousJustifiedCheckpoint mocks base method. +func (m *MockBeaconState) SetPreviousJustifiedCheckpoint(previousJustifiedCheckpoint solid.Checkpoint) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPreviousJustifiedCheckpoint", previousJustifiedCheckpoint) +} + +// SetPreviousJustifiedCheckpoint indicates an expected call of SetPreviousJustifiedCheckpoint. +func (mr *MockBeaconStateMockRecorder) SetPreviousJustifiedCheckpoint(previousJustifiedCheckpoint any) *MockBeaconStateSetPreviousJustifiedCheckpointCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreviousJustifiedCheckpoint", reflect.TypeOf((*MockBeaconState)(nil).SetPreviousJustifiedCheckpoint), previousJustifiedCheckpoint) + return &MockBeaconStateSetPreviousJustifiedCheckpointCall{Call: call} +} + +// MockBeaconStateSetPreviousJustifiedCheckpointCall wrap *gomock.Call +type MockBeaconStateSetPreviousJustifiedCheckpointCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPreviousJustifiedCheckpointCall) Return() *MockBeaconStateSetPreviousJustifiedCheckpointCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPreviousJustifiedCheckpointCall) Do(f func(solid.Checkpoint)) *MockBeaconStateSetPreviousJustifiedCheckpointCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPreviousJustifiedCheckpointCall) DoAndReturn(f func(solid.Checkpoint)) *MockBeaconStateSetPreviousJustifiedCheckpointCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPreviousStateRoot mocks base method. +func (m *MockBeaconState) SetPreviousStateRoot(root common.Hash) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPreviousStateRoot", root) +} + +// SetPreviousStateRoot indicates an expected call of SetPreviousStateRoot. +func (mr *MockBeaconStateMockRecorder) SetPreviousStateRoot(root any) *MockBeaconStateSetPreviousStateRootCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreviousStateRoot", reflect.TypeOf((*MockBeaconState)(nil).SetPreviousStateRoot), root) + return &MockBeaconStateSetPreviousStateRootCall{Call: call} +} + +// MockBeaconStateSetPreviousStateRootCall wrap *gomock.Call +type MockBeaconStateSetPreviousStateRootCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetPreviousStateRootCall) Return() *MockBeaconStateSetPreviousStateRootCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetPreviousStateRootCall) Do(f func(common.Hash)) *MockBeaconStateSetPreviousStateRootCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetPreviousStateRootCall) DoAndReturn(f func(common.Hash)) *MockBeaconStateSetPreviousStateRootCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetRandaoMixAt mocks base method. +func (m *MockBeaconState) SetRandaoMixAt(index int, mix common.Hash) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetRandaoMixAt", index, mix) +} + +// SetRandaoMixAt indicates an expected call of SetRandaoMixAt. +func (mr *MockBeaconStateMockRecorder) SetRandaoMixAt(index, mix any) *MockBeaconStateSetRandaoMixAtCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetRandaoMixAt", reflect.TypeOf((*MockBeaconState)(nil).SetRandaoMixAt), index, mix) + return &MockBeaconStateSetRandaoMixAtCall{Call: call} +} + +// MockBeaconStateSetRandaoMixAtCall wrap *gomock.Call +type MockBeaconStateSetRandaoMixAtCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetRandaoMixAtCall) Return() *MockBeaconStateSetRandaoMixAtCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetRandaoMixAtCall) Do(f func(int, common.Hash)) *MockBeaconStateSetRandaoMixAtCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetRandaoMixAtCall) DoAndReturn(f func(int, common.Hash)) *MockBeaconStateSetRandaoMixAtCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetSlashingSegmentAt mocks base method. +func (m *MockBeaconState) SetSlashingSegmentAt(index int, segment uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetSlashingSegmentAt", index, segment) +} + +// SetSlashingSegmentAt indicates an expected call of SetSlashingSegmentAt. +func (mr *MockBeaconStateMockRecorder) SetSlashingSegmentAt(index, segment any) *MockBeaconStateSetSlashingSegmentAtCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSlashingSegmentAt", reflect.TypeOf((*MockBeaconState)(nil).SetSlashingSegmentAt), index, segment) + return &MockBeaconStateSetSlashingSegmentAtCall{Call: call} +} + +// MockBeaconStateSetSlashingSegmentAtCall wrap *gomock.Call +type MockBeaconStateSetSlashingSegmentAtCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetSlashingSegmentAtCall) Return() *MockBeaconStateSetSlashingSegmentAtCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetSlashingSegmentAtCall) Do(f func(int, uint64)) *MockBeaconStateSetSlashingSegmentAtCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetSlashingSegmentAtCall) DoAndReturn(f func(int, uint64)) *MockBeaconStateSetSlashingSegmentAtCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetSlot mocks base method. +func (m *MockBeaconState) SetSlot(slot uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetSlot", slot) +} + +// SetSlot indicates an expected call of SetSlot. +func (mr *MockBeaconStateMockRecorder) SetSlot(slot any) *MockBeaconStateSetSlotCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSlot", reflect.TypeOf((*MockBeaconState)(nil).SetSlot), slot) + return &MockBeaconStateSetSlotCall{Call: call} +} + +// MockBeaconStateSetSlotCall wrap *gomock.Call +type MockBeaconStateSetSlotCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetSlotCall) Return() *MockBeaconStateSetSlotCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetSlotCall) Do(f func(uint64)) *MockBeaconStateSetSlotCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetSlotCall) DoAndReturn(f func(uint64)) *MockBeaconStateSetSlotCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetStateRootAt mocks base method. +func (m *MockBeaconState) SetStateRootAt(index int, root common.Hash) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetStateRootAt", index, root) +} + +// SetStateRootAt indicates an expected call of SetStateRootAt. +func (mr *MockBeaconStateMockRecorder) SetStateRootAt(index, root any) *MockBeaconStateSetStateRootAtCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStateRootAt", reflect.TypeOf((*MockBeaconState)(nil).SetStateRootAt), index, root) + return &MockBeaconStateSetStateRootAtCall{Call: call} +} + +// MockBeaconStateSetStateRootAtCall wrap *gomock.Call +type MockBeaconStateSetStateRootAtCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetStateRootAtCall) Return() *MockBeaconStateSetStateRootAtCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetStateRootAtCall) Do(f func(int, common.Hash)) *MockBeaconStateSetStateRootAtCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetStateRootAtCall) DoAndReturn(f func(int, common.Hash)) *MockBeaconStateSetStateRootAtCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetValidatorAtIndex(index int, validator solid.Validator) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetValidatorAtIndex", index, validator) +} + +// SetValidatorAtIndex indicates an expected call of SetValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetValidatorAtIndex(index, validator any) *MockBeaconStateSetValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorAtIndex), index, validator) + return &MockBeaconStateSetValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorAtIndexCall) Return() *MockBeaconStateSetValidatorAtIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorAtIndexCall) Do(f func(int, solid.Validator)) *MockBeaconStateSetValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorAtIndexCall) DoAndReturn(f func(int, solid.Validator)) *MockBeaconStateSetValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorBalance mocks base method. +func (m *MockBeaconState) SetValidatorBalance(index int, balance uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorBalance", index, balance) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorBalance indicates an expected call of SetValidatorBalance. +func (mr *MockBeaconStateMockRecorder) SetValidatorBalance(index, balance any) *MockBeaconStateSetValidatorBalanceCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorBalance", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorBalance), index, balance) + return &MockBeaconStateSetValidatorBalanceCall{Call: call} +} + +// MockBeaconStateSetValidatorBalanceCall wrap *gomock.Call +type MockBeaconStateSetValidatorBalanceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorBalanceCall) Return(arg0 error) *MockBeaconStateSetValidatorBalanceCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorBalanceCall) Do(f func(int, uint64) error) *MockBeaconStateSetValidatorBalanceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorBalanceCall) DoAndReturn(f func(int, uint64) error) *MockBeaconStateSetValidatorBalanceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorInactivityScore mocks base method. +func (m *MockBeaconState) SetValidatorInactivityScore(index int, score uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorInactivityScore", index, score) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorInactivityScore indicates an expected call of SetValidatorInactivityScore. +func (mr *MockBeaconStateMockRecorder) SetValidatorInactivityScore(index, score any) *MockBeaconStateSetValidatorInactivityScoreCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorInactivityScore", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorInactivityScore), index, score) + return &MockBeaconStateSetValidatorInactivityScoreCall{Call: call} +} + +// MockBeaconStateSetValidatorInactivityScoreCall wrap *gomock.Call +type MockBeaconStateSetValidatorInactivityScoreCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorInactivityScoreCall) Return(arg0 error) *MockBeaconStateSetValidatorInactivityScoreCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorInactivityScoreCall) Do(f func(int, uint64) error) *MockBeaconStateSetValidatorInactivityScoreCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorInactivityScoreCall) DoAndReturn(f func(int, uint64) error) *MockBeaconStateSetValidatorInactivityScoreCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorIsCurrentMatchingHeadAttester mocks base method. +func (m *MockBeaconState) SetValidatorIsCurrentMatchingHeadAttester(index int, value bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorIsCurrentMatchingHeadAttester", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorIsCurrentMatchingHeadAttester indicates an expected call of SetValidatorIsCurrentMatchingHeadAttester. +func (mr *MockBeaconStateMockRecorder) SetValidatorIsCurrentMatchingHeadAttester(index, value any) *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorIsCurrentMatchingHeadAttester", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorIsCurrentMatchingHeadAttester), index, value) + return &MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall{Call: call} +} + +// MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall wrap *gomock.Call +type MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall) Return(arg0 error) *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorIsCurrentMatchingHeadAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorIsCurrentMatchingSourceAttester mocks base method. +func (m *MockBeaconState) SetValidatorIsCurrentMatchingSourceAttester(index int, value bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorIsCurrentMatchingSourceAttester", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorIsCurrentMatchingSourceAttester indicates an expected call of SetValidatorIsCurrentMatchingSourceAttester. +func (mr *MockBeaconStateMockRecorder) SetValidatorIsCurrentMatchingSourceAttester(index, value any) *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorIsCurrentMatchingSourceAttester", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorIsCurrentMatchingSourceAttester), index, value) + return &MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall{Call: call} +} + +// MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall wrap *gomock.Call +type MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall) Return(arg0 error) *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorIsCurrentMatchingSourceAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorIsCurrentMatchingTargetAttester mocks base method. +func (m *MockBeaconState) SetValidatorIsCurrentMatchingTargetAttester(index int, value bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorIsCurrentMatchingTargetAttester", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorIsCurrentMatchingTargetAttester indicates an expected call of SetValidatorIsCurrentMatchingTargetAttester. +func (mr *MockBeaconStateMockRecorder) SetValidatorIsCurrentMatchingTargetAttester(index, value any) *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorIsCurrentMatchingTargetAttester", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorIsCurrentMatchingTargetAttester), index, value) + return &MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall{Call: call} +} + +// MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall wrap *gomock.Call +type MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall) Return(arg0 error) *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorIsCurrentMatchingTargetAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorIsPreviousMatchingHeadAttester mocks base method. +func (m *MockBeaconState) SetValidatorIsPreviousMatchingHeadAttester(index int, value bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorIsPreviousMatchingHeadAttester", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorIsPreviousMatchingHeadAttester indicates an expected call of SetValidatorIsPreviousMatchingHeadAttester. +func (mr *MockBeaconStateMockRecorder) SetValidatorIsPreviousMatchingHeadAttester(index, value any) *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorIsPreviousMatchingHeadAttester", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorIsPreviousMatchingHeadAttester), index, value) + return &MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall{Call: call} +} + +// MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall wrap *gomock.Call +type MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall) Return(arg0 error) *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorIsPreviousMatchingHeadAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorIsPreviousMatchingSourceAttester mocks base method. +func (m *MockBeaconState) SetValidatorIsPreviousMatchingSourceAttester(index int, value bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorIsPreviousMatchingSourceAttester", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorIsPreviousMatchingSourceAttester indicates an expected call of SetValidatorIsPreviousMatchingSourceAttester. +func (mr *MockBeaconStateMockRecorder) SetValidatorIsPreviousMatchingSourceAttester(index, value any) *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorIsPreviousMatchingSourceAttester", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorIsPreviousMatchingSourceAttester), index, value) + return &MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall{Call: call} +} + +// MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall wrap *gomock.Call +type MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall) Return(arg0 error) *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorIsPreviousMatchingSourceAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorIsPreviousMatchingTargetAttester mocks base method. +func (m *MockBeaconState) SetValidatorIsPreviousMatchingTargetAttester(index int, value bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorIsPreviousMatchingTargetAttester", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorIsPreviousMatchingTargetAttester indicates an expected call of SetValidatorIsPreviousMatchingTargetAttester. +func (mr *MockBeaconStateMockRecorder) SetValidatorIsPreviousMatchingTargetAttester(index, value any) *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorIsPreviousMatchingTargetAttester", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorIsPreviousMatchingTargetAttester), index, value) + return &MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall{Call: call} +} + +// MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall wrap *gomock.Call +type MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall) Return(arg0 error) *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorIsPreviousMatchingTargetAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorMinCurrentInclusionDelayAttestation mocks base method. +func (m *MockBeaconState) SetValidatorMinCurrentInclusionDelayAttestation(index int, value *solid.PendingAttestation) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorMinCurrentInclusionDelayAttestation", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorMinCurrentInclusionDelayAttestation indicates an expected call of SetValidatorMinCurrentInclusionDelayAttestation. +func (mr *MockBeaconStateMockRecorder) SetValidatorMinCurrentInclusionDelayAttestation(index, value any) *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorMinCurrentInclusionDelayAttestation", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorMinCurrentInclusionDelayAttestation), index, value) + return &MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall{Call: call} +} + +// MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall wrap *gomock.Call +type MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall) Return(arg0 error) *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall) Do(f func(int, *solid.PendingAttestation) error) *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall) DoAndReturn(f func(int, *solid.PendingAttestation) error) *MockBeaconStateSetValidatorMinCurrentInclusionDelayAttestationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorMinPreviousInclusionDelayAttestation mocks base method. +func (m *MockBeaconState) SetValidatorMinPreviousInclusionDelayAttestation(index int, value *solid.PendingAttestation) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorMinPreviousInclusionDelayAttestation", index, value) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorMinPreviousInclusionDelayAttestation indicates an expected call of SetValidatorMinPreviousInclusionDelayAttestation. +func (mr *MockBeaconStateMockRecorder) SetValidatorMinPreviousInclusionDelayAttestation(index, value any) *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorMinPreviousInclusionDelayAttestation", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorMinPreviousInclusionDelayAttestation), index, value) + return &MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall{Call: call} +} + +// MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall wrap *gomock.Call +type MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall) Return(arg0 error) *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall) Do(f func(int, *solid.PendingAttestation) error) *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall) DoAndReturn(f func(int, *solid.PendingAttestation) error) *MockBeaconStateSetValidatorMinPreviousInclusionDelayAttestationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetValidatorSlashed mocks base method. +func (m *MockBeaconState) SetValidatorSlashed(index int, slashed bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetValidatorSlashed", index, slashed) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetValidatorSlashed indicates an expected call of SetValidatorSlashed. +func (mr *MockBeaconStateMockRecorder) SetValidatorSlashed(index, slashed any) *MockBeaconStateSetValidatorSlashedCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetValidatorSlashed", reflect.TypeOf((*MockBeaconState)(nil).SetValidatorSlashed), index, slashed) + return &MockBeaconStateSetValidatorSlashedCall{Call: call} +} + +// MockBeaconStateSetValidatorSlashedCall wrap *gomock.Call +type MockBeaconStateSetValidatorSlashedCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetValidatorSlashedCall) Return(arg0 error) *MockBeaconStateSetValidatorSlashedCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetValidatorSlashedCall) Do(f func(int, bool) error) *MockBeaconStateSetValidatorSlashedCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetValidatorSlashedCall) DoAndReturn(f func(int, bool) error) *MockBeaconStateSetValidatorSlashedCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetVersion mocks base method. +func (m *MockBeaconState) SetVersion(version clparams.StateVersion) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetVersion", version) +} + +// SetVersion indicates an expected call of SetVersion. +func (mr *MockBeaconStateMockRecorder) SetVersion(version any) *MockBeaconStateSetVersionCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetVersion", reflect.TypeOf((*MockBeaconState)(nil).SetVersion), version) + return &MockBeaconStateSetVersionCall{Call: call} +} + +// MockBeaconStateSetVersionCall wrap *gomock.Call +type MockBeaconStateSetVersionCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetVersionCall) Return() *MockBeaconStateSetVersionCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetVersionCall) Do(f func(clparams.StateVersion)) *MockBeaconStateSetVersionCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetVersionCall) DoAndReturn(f func(clparams.StateVersion)) *MockBeaconStateSetVersionCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetWithdrawableEpochForValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetWithdrawableEpochForValidatorAtIndex(index int, epoch uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetWithdrawableEpochForValidatorAtIndex", index, epoch) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetWithdrawableEpochForValidatorAtIndex indicates an expected call of SetWithdrawableEpochForValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetWithdrawableEpochForValidatorAtIndex(index, epoch any) *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWithdrawableEpochForValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetWithdrawableEpochForValidatorAtIndex), index, epoch) + return &MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall) Return(arg0 error) *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall) Do(f func(int, uint64) error) *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall) DoAndReturn(f func(int, uint64) error) *MockBeaconStateSetWithdrawableEpochForValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetWithdrawalCredentialForValidatorAtIndex mocks base method. +func (m *MockBeaconState) SetWithdrawalCredentialForValidatorAtIndex(index int, creds common.Hash) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetWithdrawalCredentialForValidatorAtIndex", index, creds) +} + +// SetWithdrawalCredentialForValidatorAtIndex indicates an expected call of SetWithdrawalCredentialForValidatorAtIndex. +func (mr *MockBeaconStateMockRecorder) SetWithdrawalCredentialForValidatorAtIndex(index, creds any) *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWithdrawalCredentialForValidatorAtIndex", reflect.TypeOf((*MockBeaconState)(nil).SetWithdrawalCredentialForValidatorAtIndex), index, creds) + return &MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall{Call: call} +} + +// MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall wrap *gomock.Call +type MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall) Return() *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall) Do(f func(int, common.Hash)) *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall) DoAndReturn(f func(int, common.Hash)) *MockBeaconStateSetWithdrawalCredentialForValidatorAtIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SlashValidator mocks base method. +func (m *MockBeaconState) SlashValidator(slashedInd uint64, whistleblowerInd *uint64) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SlashValidator", slashedInd, whistleblowerInd) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SlashValidator indicates an expected call of SlashValidator. +func (mr *MockBeaconStateMockRecorder) SlashValidator(slashedInd, whistleblowerInd any) *MockBeaconStateSlashValidatorCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashValidator", reflect.TypeOf((*MockBeaconState)(nil).SlashValidator), slashedInd, whistleblowerInd) + return &MockBeaconStateSlashValidatorCall{Call: call} +} + +// MockBeaconStateSlashValidatorCall wrap *gomock.Call +type MockBeaconStateSlashValidatorCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSlashValidatorCall) Return(arg0 uint64, arg1 error) *MockBeaconStateSlashValidatorCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSlashValidatorCall) Do(f func(uint64, *uint64) (uint64, error)) *MockBeaconStateSlashValidatorCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSlashValidatorCall) DoAndReturn(f func(uint64, *uint64) (uint64, error)) *MockBeaconStateSlashValidatorCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SlashingSegmentAt mocks base method. +func (m *MockBeaconState) SlashingSegmentAt(pos int) uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SlashingSegmentAt", pos) + ret0, _ := ret[0].(uint64) + return ret0 +} + +// SlashingSegmentAt indicates an expected call of SlashingSegmentAt. +func (mr *MockBeaconStateMockRecorder) SlashingSegmentAt(pos any) *MockBeaconStateSlashingSegmentAtCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashingSegmentAt", reflect.TypeOf((*MockBeaconState)(nil).SlashingSegmentAt), pos) + return &MockBeaconStateSlashingSegmentAtCall{Call: call} +} + +// MockBeaconStateSlashingSegmentAtCall wrap *gomock.Call +type MockBeaconStateSlashingSegmentAtCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSlashingSegmentAtCall) Return(arg0 uint64) *MockBeaconStateSlashingSegmentAtCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSlashingSegmentAtCall) Do(f func(int) uint64) *MockBeaconStateSlashingSegmentAtCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSlashingSegmentAtCall) DoAndReturn(f func(int) uint64) *MockBeaconStateSlashingSegmentAtCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Slot mocks base method. +func (m *MockBeaconState) Slot() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Slot") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// Slot indicates an expected call of Slot. +func (mr *MockBeaconStateMockRecorder) Slot() *MockBeaconStateSlotCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Slot", reflect.TypeOf((*MockBeaconState)(nil).Slot)) + return &MockBeaconStateSlotCall{Call: call} +} + +// MockBeaconStateSlotCall wrap *gomock.Call +type MockBeaconStateSlotCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSlotCall) Return(arg0 uint64) *MockBeaconStateSlotCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSlotCall) Do(f func() uint64) *MockBeaconStateSlotCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSlotCall) DoAndReturn(f func() uint64) *MockBeaconStateSlotCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// StateRoots mocks base method. +func (m *MockBeaconState) StateRoots() solid.HashVectorSSZ { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StateRoots") + ret0, _ := ret[0].(solid.HashVectorSSZ) + return ret0 +} + +// StateRoots indicates an expected call of StateRoots. +func (mr *MockBeaconStateMockRecorder) StateRoots() *MockBeaconStateStateRootsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateRoots", reflect.TypeOf((*MockBeaconState)(nil).StateRoots)) + return &MockBeaconStateStateRootsCall{Call: call} +} + +// MockBeaconStateStateRootsCall wrap *gomock.Call +type MockBeaconStateStateRootsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateStateRootsCall) Return(arg0 solid.HashVectorSSZ) *MockBeaconStateStateRootsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateStateRootsCall) Do(f func() solid.HashVectorSSZ) *MockBeaconStateStateRootsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateStateRootsCall) DoAndReturn(f func() solid.HashVectorSSZ) *MockBeaconStateStateRootsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SyncRewards mocks base method. +func (m *MockBeaconState) SyncRewards() (uint64, uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SyncRewards") + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(uint64) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// SyncRewards indicates an expected call of SyncRewards. +func (mr *MockBeaconStateMockRecorder) SyncRewards() *MockBeaconStateSyncRewardsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncRewards", reflect.TypeOf((*MockBeaconState)(nil).SyncRewards)) + return &MockBeaconStateSyncRewardsCall{Call: call} +} + +// MockBeaconStateSyncRewardsCall wrap *gomock.Call +type MockBeaconStateSyncRewardsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateSyncRewardsCall) Return(proposerReward, participantReward uint64, err error) *MockBeaconStateSyncRewardsCall { + c.Call = c.Call.Return(proposerReward, participantReward, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateSyncRewardsCall) Do(f func() (uint64, uint64, error)) *MockBeaconStateSyncRewardsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateSyncRewardsCall) DoAndReturn(f func() (uint64, uint64, error)) *MockBeaconStateSyncRewardsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpgradeToAltair mocks base method. +func (m *MockBeaconState) UpgradeToAltair() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpgradeToAltair") + ret0, _ := ret[0].(error) + return ret0 +} + +// UpgradeToAltair indicates an expected call of UpgradeToAltair. +func (mr *MockBeaconStateMockRecorder) UpgradeToAltair() *MockBeaconStateUpgradeToAltairCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpgradeToAltair", reflect.TypeOf((*MockBeaconState)(nil).UpgradeToAltair)) + return &MockBeaconStateUpgradeToAltairCall{Call: call} +} + +// MockBeaconStateUpgradeToAltairCall wrap *gomock.Call +type MockBeaconStateUpgradeToAltairCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateUpgradeToAltairCall) Return(arg0 error) *MockBeaconStateUpgradeToAltairCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateUpgradeToAltairCall) Do(f func() error) *MockBeaconStateUpgradeToAltairCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateUpgradeToAltairCall) DoAndReturn(f func() error) *MockBeaconStateUpgradeToAltairCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpgradeToBellatrix mocks base method. +func (m *MockBeaconState) UpgradeToBellatrix() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpgradeToBellatrix") + ret0, _ := ret[0].(error) + return ret0 +} + +// UpgradeToBellatrix indicates an expected call of UpgradeToBellatrix. +func (mr *MockBeaconStateMockRecorder) UpgradeToBellatrix() *MockBeaconStateUpgradeToBellatrixCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpgradeToBellatrix", reflect.TypeOf((*MockBeaconState)(nil).UpgradeToBellatrix)) + return &MockBeaconStateUpgradeToBellatrixCall{Call: call} +} + +// MockBeaconStateUpgradeToBellatrixCall wrap *gomock.Call +type MockBeaconStateUpgradeToBellatrixCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateUpgradeToBellatrixCall) Return(arg0 error) *MockBeaconStateUpgradeToBellatrixCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateUpgradeToBellatrixCall) Do(f func() error) *MockBeaconStateUpgradeToBellatrixCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateUpgradeToBellatrixCall) DoAndReturn(f func() error) *MockBeaconStateUpgradeToBellatrixCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpgradeToCapella mocks base method. +func (m *MockBeaconState) UpgradeToCapella() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpgradeToCapella") + ret0, _ := ret[0].(error) + return ret0 +} + +// UpgradeToCapella indicates an expected call of UpgradeToCapella. +func (mr *MockBeaconStateMockRecorder) UpgradeToCapella() *MockBeaconStateUpgradeToCapellaCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpgradeToCapella", reflect.TypeOf((*MockBeaconState)(nil).UpgradeToCapella)) + return &MockBeaconStateUpgradeToCapellaCall{Call: call} +} + +// MockBeaconStateUpgradeToCapellaCall wrap *gomock.Call +type MockBeaconStateUpgradeToCapellaCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateUpgradeToCapellaCall) Return(arg0 error) *MockBeaconStateUpgradeToCapellaCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateUpgradeToCapellaCall) Do(f func() error) *MockBeaconStateUpgradeToCapellaCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateUpgradeToCapellaCall) DoAndReturn(f func() error) *MockBeaconStateUpgradeToCapellaCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpgradeToDeneb mocks base method. +func (m *MockBeaconState) UpgradeToDeneb() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpgradeToDeneb") + ret0, _ := ret[0].(error) + return ret0 +} + +// UpgradeToDeneb indicates an expected call of UpgradeToDeneb. +func (mr *MockBeaconStateMockRecorder) UpgradeToDeneb() *MockBeaconStateUpgradeToDenebCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpgradeToDeneb", reflect.TypeOf((*MockBeaconState)(nil).UpgradeToDeneb)) + return &MockBeaconStateUpgradeToDenebCall{Call: call} +} + +// MockBeaconStateUpgradeToDenebCall wrap *gomock.Call +type MockBeaconStateUpgradeToDenebCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateUpgradeToDenebCall) Return(arg0 error) *MockBeaconStateUpgradeToDenebCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateUpgradeToDenebCall) Do(f func() error) *MockBeaconStateUpgradeToDenebCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateUpgradeToDenebCall) DoAndReturn(f func() error) *MockBeaconStateUpgradeToDenebCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpgradeToElectra mocks base method. +func (m *MockBeaconState) UpgradeToElectra() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpgradeToElectra") + ret0, _ := ret[0].(error) + return ret0 +} + +// UpgradeToElectra indicates an expected call of UpgradeToElectra. +func (mr *MockBeaconStateMockRecorder) UpgradeToElectra() *MockBeaconStateUpgradeToElectraCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpgradeToElectra", reflect.TypeOf((*MockBeaconState)(nil).UpgradeToElectra)) + return &MockBeaconStateUpgradeToElectraCall{Call: call} +} + +// MockBeaconStateUpgradeToElectraCall wrap *gomock.Call +type MockBeaconStateUpgradeToElectraCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateUpgradeToElectraCall) Return(arg0 error) *MockBeaconStateUpgradeToElectraCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateUpgradeToElectraCall) Do(f func() error) *MockBeaconStateUpgradeToElectraCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateUpgradeToElectraCall) DoAndReturn(f func() error) *MockBeaconStateUpgradeToElectraCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorBalance mocks base method. +func (m *MockBeaconState) ValidatorBalance(index int) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorBalance", index) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorBalance indicates an expected call of ValidatorBalance. +func (mr *MockBeaconStateMockRecorder) ValidatorBalance(index any) *MockBeaconStateValidatorBalanceCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorBalance", reflect.TypeOf((*MockBeaconState)(nil).ValidatorBalance), index) + return &MockBeaconStateValidatorBalanceCall{Call: call} +} + +// MockBeaconStateValidatorBalanceCall wrap *gomock.Call +type MockBeaconStateValidatorBalanceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorBalanceCall) Return(arg0 uint64, arg1 error) *MockBeaconStateValidatorBalanceCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorBalanceCall) Do(f func(int) (uint64, error)) *MockBeaconStateValidatorBalanceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorBalanceCall) DoAndReturn(f func(int) (uint64, error)) *MockBeaconStateValidatorBalanceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorEffectiveBalance mocks base method. +func (m *MockBeaconState) ValidatorEffectiveBalance(index int) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorEffectiveBalance", index) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorEffectiveBalance indicates an expected call of ValidatorEffectiveBalance. +func (mr *MockBeaconStateMockRecorder) ValidatorEffectiveBalance(index any) *MockBeaconStateValidatorEffectiveBalanceCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorEffectiveBalance", reflect.TypeOf((*MockBeaconState)(nil).ValidatorEffectiveBalance), index) + return &MockBeaconStateValidatorEffectiveBalanceCall{Call: call} +} + +// MockBeaconStateValidatorEffectiveBalanceCall wrap *gomock.Call +type MockBeaconStateValidatorEffectiveBalanceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorEffectiveBalanceCall) Return(arg0 uint64, arg1 error) *MockBeaconStateValidatorEffectiveBalanceCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorEffectiveBalanceCall) Do(f func(int) (uint64, error)) *MockBeaconStateValidatorEffectiveBalanceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorEffectiveBalanceCall) DoAndReturn(f func(int) (uint64, error)) *MockBeaconStateValidatorEffectiveBalanceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorExitEpoch mocks base method. +func (m *MockBeaconState) ValidatorExitEpoch(index int) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorExitEpoch", index) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorExitEpoch indicates an expected call of ValidatorExitEpoch. +func (mr *MockBeaconStateMockRecorder) ValidatorExitEpoch(index any) *MockBeaconStateValidatorExitEpochCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorExitEpoch", reflect.TypeOf((*MockBeaconState)(nil).ValidatorExitEpoch), index) + return &MockBeaconStateValidatorExitEpochCall{Call: call} +} + +// MockBeaconStateValidatorExitEpochCall wrap *gomock.Call +type MockBeaconStateValidatorExitEpochCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorExitEpochCall) Return(arg0 uint64, arg1 error) *MockBeaconStateValidatorExitEpochCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorExitEpochCall) Do(f func(int) (uint64, error)) *MockBeaconStateValidatorExitEpochCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorExitEpochCall) DoAndReturn(f func(int) (uint64, error)) *MockBeaconStateValidatorExitEpochCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorForValidatorIndex mocks base method. +func (m *MockBeaconState) ValidatorForValidatorIndex(index int) (solid.Validator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorForValidatorIndex", index) + ret0, _ := ret[0].(solid.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorForValidatorIndex indicates an expected call of ValidatorForValidatorIndex. +func (mr *MockBeaconStateMockRecorder) ValidatorForValidatorIndex(index any) *MockBeaconStateValidatorForValidatorIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorForValidatorIndex", reflect.TypeOf((*MockBeaconState)(nil).ValidatorForValidatorIndex), index) + return &MockBeaconStateValidatorForValidatorIndexCall{Call: call} +} + +// MockBeaconStateValidatorForValidatorIndexCall wrap *gomock.Call +type MockBeaconStateValidatorForValidatorIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorForValidatorIndexCall) Return(arg0 solid.Validator, arg1 error) *MockBeaconStateValidatorForValidatorIndexCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorForValidatorIndexCall) Do(f func(int) (solid.Validator, error)) *MockBeaconStateValidatorForValidatorIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorForValidatorIndexCall) DoAndReturn(f func(int) (solid.Validator, error)) *MockBeaconStateValidatorForValidatorIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorInactivityScore mocks base method. +func (m *MockBeaconState) ValidatorInactivityScore(index int) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorInactivityScore", index) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorInactivityScore indicates an expected call of ValidatorInactivityScore. +func (mr *MockBeaconStateMockRecorder) ValidatorInactivityScore(index any) *MockBeaconStateValidatorInactivityScoreCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorInactivityScore", reflect.TypeOf((*MockBeaconState)(nil).ValidatorInactivityScore), index) + return &MockBeaconStateValidatorInactivityScoreCall{Call: call} +} + +// MockBeaconStateValidatorInactivityScoreCall wrap *gomock.Call +type MockBeaconStateValidatorInactivityScoreCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorInactivityScoreCall) Return(arg0 uint64, arg1 error) *MockBeaconStateValidatorInactivityScoreCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorInactivityScoreCall) Do(f func(int) (uint64, error)) *MockBeaconStateValidatorInactivityScoreCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorInactivityScoreCall) DoAndReturn(f func(int) (uint64, error)) *MockBeaconStateValidatorInactivityScoreCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIndexByPubkey mocks base method. +func (m *MockBeaconState) ValidatorIndexByPubkey(key [48]byte) (uint64, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIndexByPubkey", key) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// ValidatorIndexByPubkey indicates an expected call of ValidatorIndexByPubkey. +func (mr *MockBeaconStateMockRecorder) ValidatorIndexByPubkey(key any) *MockBeaconStateValidatorIndexByPubkeyCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIndexByPubkey", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIndexByPubkey), key) + return &MockBeaconStateValidatorIndexByPubkeyCall{Call: call} +} + +// MockBeaconStateValidatorIndexByPubkeyCall wrap *gomock.Call +type MockBeaconStateValidatorIndexByPubkeyCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIndexByPubkeyCall) Return(arg0 uint64, arg1 bool) *MockBeaconStateValidatorIndexByPubkeyCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIndexByPubkeyCall) Do(f func([48]byte) (uint64, bool)) *MockBeaconStateValidatorIndexByPubkeyCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIndexByPubkeyCall) DoAndReturn(f func([48]byte) (uint64, bool)) *MockBeaconStateValidatorIndexByPubkeyCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIsCurrentMatchingHeadAttester mocks base method. +func (m *MockBeaconState) ValidatorIsCurrentMatchingHeadAttester(idx int) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIsCurrentMatchingHeadAttester", idx) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIsCurrentMatchingHeadAttester indicates an expected call of ValidatorIsCurrentMatchingHeadAttester. +func (mr *MockBeaconStateMockRecorder) ValidatorIsCurrentMatchingHeadAttester(idx any) *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIsCurrentMatchingHeadAttester", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIsCurrentMatchingHeadAttester), idx) + return &MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall{Call: call} +} + +// MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall wrap *gomock.Call +type MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall) Return(arg0 bool, arg1 error) *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall) Do(f func(int) (bool, error)) *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall) DoAndReturn(f func(int) (bool, error)) *MockBeaconStateValidatorIsCurrentMatchingHeadAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIsCurrentMatchingSourceAttester mocks base method. +func (m *MockBeaconState) ValidatorIsCurrentMatchingSourceAttester(idx int) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIsCurrentMatchingSourceAttester", idx) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIsCurrentMatchingSourceAttester indicates an expected call of ValidatorIsCurrentMatchingSourceAttester. +func (mr *MockBeaconStateMockRecorder) ValidatorIsCurrentMatchingSourceAttester(idx any) *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIsCurrentMatchingSourceAttester", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIsCurrentMatchingSourceAttester), idx) + return &MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall{Call: call} +} + +// MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall wrap *gomock.Call +type MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall) Return(arg0 bool, arg1 error) *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall) Do(f func(int) (bool, error)) *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall) DoAndReturn(f func(int) (bool, error)) *MockBeaconStateValidatorIsCurrentMatchingSourceAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIsCurrentMatchingTargetAttester mocks base method. +func (m *MockBeaconState) ValidatorIsCurrentMatchingTargetAttester(idx int) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIsCurrentMatchingTargetAttester", idx) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIsCurrentMatchingTargetAttester indicates an expected call of ValidatorIsCurrentMatchingTargetAttester. +func (mr *MockBeaconStateMockRecorder) ValidatorIsCurrentMatchingTargetAttester(idx any) *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIsCurrentMatchingTargetAttester", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIsCurrentMatchingTargetAttester), idx) + return &MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall{Call: call} +} + +// MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall wrap *gomock.Call +type MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall) Return(arg0 bool, arg1 error) *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall) Do(f func(int) (bool, error)) *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall) DoAndReturn(f func(int) (bool, error)) *MockBeaconStateValidatorIsCurrentMatchingTargetAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIsPreviousMatchingHeadAttester mocks base method. +func (m *MockBeaconState) ValidatorIsPreviousMatchingHeadAttester(idx int) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIsPreviousMatchingHeadAttester", idx) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIsPreviousMatchingHeadAttester indicates an expected call of ValidatorIsPreviousMatchingHeadAttester. +func (mr *MockBeaconStateMockRecorder) ValidatorIsPreviousMatchingHeadAttester(idx any) *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIsPreviousMatchingHeadAttester", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIsPreviousMatchingHeadAttester), idx) + return &MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall{Call: call} +} + +// MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall wrap *gomock.Call +type MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall) Return(arg0 bool, arg1 error) *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall) Do(f func(int) (bool, error)) *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall) DoAndReturn(f func(int) (bool, error)) *MockBeaconStateValidatorIsPreviousMatchingHeadAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIsPreviousMatchingSourceAttester mocks base method. +func (m *MockBeaconState) ValidatorIsPreviousMatchingSourceAttester(idx int) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIsPreviousMatchingSourceAttester", idx) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIsPreviousMatchingSourceAttester indicates an expected call of ValidatorIsPreviousMatchingSourceAttester. +func (mr *MockBeaconStateMockRecorder) ValidatorIsPreviousMatchingSourceAttester(idx any) *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIsPreviousMatchingSourceAttester", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIsPreviousMatchingSourceAttester), idx) + return &MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall{Call: call} +} + +// MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall wrap *gomock.Call +type MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall) Return(arg0 bool, arg1 error) *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall) Do(f func(int) (bool, error)) *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall) DoAndReturn(f func(int) (bool, error)) *MockBeaconStateValidatorIsPreviousMatchingSourceAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorIsPreviousMatchingTargetAttester mocks base method. +func (m *MockBeaconState) ValidatorIsPreviousMatchingTargetAttester(idx int) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIsPreviousMatchingTargetAttester", idx) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIsPreviousMatchingTargetAttester indicates an expected call of ValidatorIsPreviousMatchingTargetAttester. +func (mr *MockBeaconStateMockRecorder) ValidatorIsPreviousMatchingTargetAttester(idx any) *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIsPreviousMatchingTargetAttester", reflect.TypeOf((*MockBeaconState)(nil).ValidatorIsPreviousMatchingTargetAttester), idx) + return &MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall{Call: call} +} + +// MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall wrap *gomock.Call +type MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall) Return(arg0 bool, arg1 error) *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall) Do(f func(int) (bool, error)) *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall) DoAndReturn(f func(int) (bool, error)) *MockBeaconStateValidatorIsPreviousMatchingTargetAttesterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorLength mocks base method. +func (m *MockBeaconState) ValidatorLength() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorLength") + ret0, _ := ret[0].(int) + return ret0 +} + +// ValidatorLength indicates an expected call of ValidatorLength. +func (mr *MockBeaconStateMockRecorder) ValidatorLength() *MockBeaconStateValidatorLengthCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorLength", reflect.TypeOf((*MockBeaconState)(nil).ValidatorLength)) + return &MockBeaconStateValidatorLengthCall{Call: call} +} + +// MockBeaconStateValidatorLengthCall wrap *gomock.Call +type MockBeaconStateValidatorLengthCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorLengthCall) Return(arg0 int) *MockBeaconStateValidatorLengthCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorLengthCall) Do(f func() int) *MockBeaconStateValidatorLengthCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorLengthCall) DoAndReturn(f func() int) *MockBeaconStateValidatorLengthCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorMinCurrentInclusionDelayAttestation mocks base method. +func (m *MockBeaconState) ValidatorMinCurrentInclusionDelayAttestation(index int) (*solid.PendingAttestation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorMinCurrentInclusionDelayAttestation", index) + ret0, _ := ret[0].(*solid.PendingAttestation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorMinCurrentInclusionDelayAttestation indicates an expected call of ValidatorMinCurrentInclusionDelayAttestation. +func (mr *MockBeaconStateMockRecorder) ValidatorMinCurrentInclusionDelayAttestation(index any) *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorMinCurrentInclusionDelayAttestation", reflect.TypeOf((*MockBeaconState)(nil).ValidatorMinCurrentInclusionDelayAttestation), index) + return &MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall{Call: call} +} + +// MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall wrap *gomock.Call +type MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall) Return(arg0 *solid.PendingAttestation, arg1 error) *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall) Do(f func(int) (*solid.PendingAttestation, error)) *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall) DoAndReturn(f func(int) (*solid.PendingAttestation, error)) *MockBeaconStateValidatorMinCurrentInclusionDelayAttestationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorMinPreviousInclusionDelayAttestation mocks base method. +func (m *MockBeaconState) ValidatorMinPreviousInclusionDelayAttestation(index int) (*solid.PendingAttestation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorMinPreviousInclusionDelayAttestation", index) + ret0, _ := ret[0].(*solid.PendingAttestation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorMinPreviousInclusionDelayAttestation indicates an expected call of ValidatorMinPreviousInclusionDelayAttestation. +func (mr *MockBeaconStateMockRecorder) ValidatorMinPreviousInclusionDelayAttestation(index any) *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorMinPreviousInclusionDelayAttestation", reflect.TypeOf((*MockBeaconState)(nil).ValidatorMinPreviousInclusionDelayAttestation), index) + return &MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall{Call: call} +} + +// MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall wrap *gomock.Call +type MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall) Return(arg0 *solid.PendingAttestation, arg1 error) *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall) Do(f func(int) (*solid.PendingAttestation, error)) *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall) DoAndReturn(f func(int) (*solid.PendingAttestation, error)) *MockBeaconStateValidatorMinPreviousInclusionDelayAttestationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorSet mocks base method. +func (m *MockBeaconState) ValidatorSet() *solid.ValidatorSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorSet") + ret0, _ := ret[0].(*solid.ValidatorSet) + return ret0 +} + +// ValidatorSet indicates an expected call of ValidatorSet. +func (mr *MockBeaconStateMockRecorder) ValidatorSet() *MockBeaconStateValidatorSetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorSet", reflect.TypeOf((*MockBeaconState)(nil).ValidatorSet)) + return &MockBeaconStateValidatorSetCall{Call: call} +} + +// MockBeaconStateValidatorSetCall wrap *gomock.Call +type MockBeaconStateValidatorSetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorSetCall) Return(arg0 *solid.ValidatorSet) *MockBeaconStateValidatorSetCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorSetCall) Do(f func() *solid.ValidatorSet) *MockBeaconStateValidatorSetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorSetCall) DoAndReturn(f func() *solid.ValidatorSet) *MockBeaconStateValidatorSetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ValidatorWithdrawableEpoch mocks base method. +func (m *MockBeaconState) ValidatorWithdrawableEpoch(index int) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorWithdrawableEpoch", index) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorWithdrawableEpoch indicates an expected call of ValidatorWithdrawableEpoch. +func (mr *MockBeaconStateMockRecorder) ValidatorWithdrawableEpoch(index any) *MockBeaconStateValidatorWithdrawableEpochCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorWithdrawableEpoch", reflect.TypeOf((*MockBeaconState)(nil).ValidatorWithdrawableEpoch), index) + return &MockBeaconStateValidatorWithdrawableEpochCall{Call: call} +} + +// MockBeaconStateValidatorWithdrawableEpochCall wrap *gomock.Call +type MockBeaconStateValidatorWithdrawableEpochCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateValidatorWithdrawableEpochCall) Return(arg0 uint64, arg1 error) *MockBeaconStateValidatorWithdrawableEpochCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateValidatorWithdrawableEpochCall) Do(f func(int) (uint64, error)) *MockBeaconStateValidatorWithdrawableEpochCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateValidatorWithdrawableEpochCall) DoAndReturn(f func(int) (uint64, error)) *MockBeaconStateValidatorWithdrawableEpochCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Version mocks base method. +func (m *MockBeaconState) Version() clparams.StateVersion { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Version") + ret0, _ := ret[0].(clparams.StateVersion) + return ret0 +} + +// Version indicates an expected call of Version. +func (mr *MockBeaconStateMockRecorder) Version() *MockBeaconStateVersionCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockBeaconState)(nil).Version)) + return &MockBeaconStateVersionCall{Call: call} +} + +// MockBeaconStateVersionCall wrap *gomock.Call +type MockBeaconStateVersionCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateVersionCall) Return(arg0 clparams.StateVersion) *MockBeaconStateVersionCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateVersionCall) Do(f func() clparams.StateVersion) *MockBeaconStateVersionCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateVersionCall) DoAndReturn(f func() clparams.StateVersion) *MockBeaconStateVersionCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/cl/abstract/mock_services/beacon_state_mutator_mock.go b/cl/abstract/mock_services/beacon_state_mutator_mock.go index 55813af63fd..d5d11f9e79a 100644 --- a/cl/abstract/mock_services/beacon_state_mutator_mock.go +++ b/cl/abstract/mock_services/beacon_state_mutator_mock.go @@ -403,6 +403,114 @@ func (c *MockBeaconStateMutatorAddValidatorCall) DoAndReturn(f func(solid.Valida return c } +// AppendPendingConsolidation mocks base method. +func (m *MockBeaconStateMutator) AppendPendingConsolidation(consolidation *solid.PendingConsolidation) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendPendingConsolidation", consolidation) +} + +// AppendPendingConsolidation indicates an expected call of AppendPendingConsolidation. +func (mr *MockBeaconStateMutatorMockRecorder) AppendPendingConsolidation(consolidation any) *MockBeaconStateMutatorAppendPendingConsolidationCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendPendingConsolidation", reflect.TypeOf((*MockBeaconStateMutator)(nil).AppendPendingConsolidation), consolidation) + return &MockBeaconStateMutatorAppendPendingConsolidationCall{Call: call} +} + +// MockBeaconStateMutatorAppendPendingConsolidationCall wrap *gomock.Call +type MockBeaconStateMutatorAppendPendingConsolidationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorAppendPendingConsolidationCall) Return() *MockBeaconStateMutatorAppendPendingConsolidationCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorAppendPendingConsolidationCall) Do(f func(*solid.PendingConsolidation)) *MockBeaconStateMutatorAppendPendingConsolidationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorAppendPendingConsolidationCall) DoAndReturn(f func(*solid.PendingConsolidation)) *MockBeaconStateMutatorAppendPendingConsolidationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AppendPendingDeposit mocks base method. +func (m *MockBeaconStateMutator) AppendPendingDeposit(deposit *solid.PendingDeposit) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendPendingDeposit", deposit) +} + +// AppendPendingDeposit indicates an expected call of AppendPendingDeposit. +func (mr *MockBeaconStateMutatorMockRecorder) AppendPendingDeposit(deposit any) *MockBeaconStateMutatorAppendPendingDepositCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendPendingDeposit", reflect.TypeOf((*MockBeaconStateMutator)(nil).AppendPendingDeposit), deposit) + return &MockBeaconStateMutatorAppendPendingDepositCall{Call: call} +} + +// MockBeaconStateMutatorAppendPendingDepositCall wrap *gomock.Call +type MockBeaconStateMutatorAppendPendingDepositCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorAppendPendingDepositCall) Return() *MockBeaconStateMutatorAppendPendingDepositCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorAppendPendingDepositCall) Do(f func(*solid.PendingDeposit)) *MockBeaconStateMutatorAppendPendingDepositCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorAppendPendingDepositCall) DoAndReturn(f func(*solid.PendingDeposit)) *MockBeaconStateMutatorAppendPendingDepositCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// AppendPendingPartialWithdrawal mocks base method. +func (m *MockBeaconStateMutator) AppendPendingPartialWithdrawal(withdrawal *solid.PendingPartialWithdrawal) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AppendPendingPartialWithdrawal", withdrawal) +} + +// AppendPendingPartialWithdrawal indicates an expected call of AppendPendingPartialWithdrawal. +func (mr *MockBeaconStateMutatorMockRecorder) AppendPendingPartialWithdrawal(withdrawal any) *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendPendingPartialWithdrawal", reflect.TypeOf((*MockBeaconStateMutator)(nil).AppendPendingPartialWithdrawal), withdrawal) + return &MockBeaconStateMutatorAppendPendingPartialWithdrawalCall{Call: call} +} + +// MockBeaconStateMutatorAppendPendingPartialWithdrawalCall wrap *gomock.Call +type MockBeaconStateMutatorAppendPendingPartialWithdrawalCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall) Return() *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall) Do(f func(*solid.PendingPartialWithdrawal)) *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall) DoAndReturn(f func(*solid.PendingPartialWithdrawal)) *MockBeaconStateMutatorAppendPendingPartialWithdrawalCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + // AppendValidator mocks base method. func (m *MockBeaconStateMutator) AppendValidator(in solid.Validator) { m.ctrl.T.Helper() @@ -727,6 +835,42 @@ func (c *MockBeaconStateMutatorSetBlockRootAtCall) DoAndReturn(f func(int, commo return c } +// SetConsolidationBalanceToConsume mocks base method. +func (m *MockBeaconStateMutator) SetConsolidationBalanceToConsume(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetConsolidationBalanceToConsume", arg0) +} + +// SetConsolidationBalanceToConsume indicates an expected call of SetConsolidationBalanceToConsume. +func (mr *MockBeaconStateMutatorMockRecorder) SetConsolidationBalanceToConsume(arg0 any) *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetConsolidationBalanceToConsume", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetConsolidationBalanceToConsume), arg0) + return &MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall{Call: call} +} + +// MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall wrap *gomock.Call +type MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall) Return() *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall) Do(f func(uint64)) *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall) DoAndReturn(f func(uint64)) *MockBeaconStateMutatorSetConsolidationBalanceToConsumeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + // SetCurrentEpochParticipationFlags mocks base method. func (m *MockBeaconStateMutator) SetCurrentEpochParticipationFlags(flags []cltypes.ParticipationFlags) { m.ctrl.T.Helper() @@ -835,6 +979,114 @@ func (c *MockBeaconStateMutatorSetCurrentSyncCommitteeCall) DoAndReturn(f func(* return c } +// SetDepositBalanceToConsume mocks base method. +func (m *MockBeaconStateMutator) SetDepositBalanceToConsume(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetDepositBalanceToConsume", arg0) +} + +// SetDepositBalanceToConsume indicates an expected call of SetDepositBalanceToConsume. +func (mr *MockBeaconStateMutatorMockRecorder) SetDepositBalanceToConsume(arg0 any) *MockBeaconStateMutatorSetDepositBalanceToConsumeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDepositBalanceToConsume", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetDepositBalanceToConsume), arg0) + return &MockBeaconStateMutatorSetDepositBalanceToConsumeCall{Call: call} +} + +// MockBeaconStateMutatorSetDepositBalanceToConsumeCall wrap *gomock.Call +type MockBeaconStateMutatorSetDepositBalanceToConsumeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetDepositBalanceToConsumeCall) Return() *MockBeaconStateMutatorSetDepositBalanceToConsumeCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetDepositBalanceToConsumeCall) Do(f func(uint64)) *MockBeaconStateMutatorSetDepositBalanceToConsumeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetDepositBalanceToConsumeCall) DoAndReturn(f func(uint64)) *MockBeaconStateMutatorSetDepositBalanceToConsumeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetDepositRequestsStartIndex mocks base method. +func (m *MockBeaconStateMutator) SetDepositRequestsStartIndex(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetDepositRequestsStartIndex", arg0) +} + +// SetDepositRequestsStartIndex indicates an expected call of SetDepositRequestsStartIndex. +func (mr *MockBeaconStateMutatorMockRecorder) SetDepositRequestsStartIndex(arg0 any) *MockBeaconStateMutatorSetDepositRequestsStartIndexCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDepositRequestsStartIndex", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetDepositRequestsStartIndex), arg0) + return &MockBeaconStateMutatorSetDepositRequestsStartIndexCall{Call: call} +} + +// MockBeaconStateMutatorSetDepositRequestsStartIndexCall wrap *gomock.Call +type MockBeaconStateMutatorSetDepositRequestsStartIndexCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetDepositRequestsStartIndexCall) Return() *MockBeaconStateMutatorSetDepositRequestsStartIndexCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetDepositRequestsStartIndexCall) Do(f func(uint64)) *MockBeaconStateMutatorSetDepositRequestsStartIndexCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetDepositRequestsStartIndexCall) DoAndReturn(f func(uint64)) *MockBeaconStateMutatorSetDepositRequestsStartIndexCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetEarlistConsolidationEpoch mocks base method. +func (m *MockBeaconStateMutator) SetEarlistConsolidationEpoch(arg0 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetEarlistConsolidationEpoch", arg0) +} + +// SetEarlistConsolidationEpoch indicates an expected call of SetEarlistConsolidationEpoch. +func (mr *MockBeaconStateMutatorMockRecorder) SetEarlistConsolidationEpoch(arg0 any) *MockBeaconStateMutatorSetEarlistConsolidationEpochCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEarlistConsolidationEpoch", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetEarlistConsolidationEpoch), arg0) + return &MockBeaconStateMutatorSetEarlistConsolidationEpochCall{Call: call} +} + +// MockBeaconStateMutatorSetEarlistConsolidationEpochCall wrap *gomock.Call +type MockBeaconStateMutatorSetEarlistConsolidationEpochCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetEarlistConsolidationEpochCall) Return() *MockBeaconStateMutatorSetEarlistConsolidationEpochCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetEarlistConsolidationEpochCall) Do(f func(uint64)) *MockBeaconStateMutatorSetEarlistConsolidationEpochCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetEarlistConsolidationEpochCall) DoAndReturn(f func(uint64)) *MockBeaconStateMutatorSetEarlistConsolidationEpochCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + // SetEffectiveBalanceForValidatorAtIndex mocks base method. func (m *MockBeaconStateMutator) SetEffectiveBalanceForValidatorAtIndex(index int, balance uint64) { m.ctrl.T.Helper() @@ -1339,6 +1591,114 @@ func (c *MockBeaconStateMutatorSetNextWithdrawalValidatorIndexCall) DoAndReturn( return c } +// SetPendingConsolidations mocks base method. +func (m *MockBeaconStateMutator) SetPendingConsolidations(consolidations *solid.ListSSZ[*solid.PendingConsolidation]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPendingConsolidations", consolidations) +} + +// SetPendingConsolidations indicates an expected call of SetPendingConsolidations. +func (mr *MockBeaconStateMutatorMockRecorder) SetPendingConsolidations(consolidations any) *MockBeaconStateMutatorSetPendingConsolidationsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPendingConsolidations", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetPendingConsolidations), consolidations) + return &MockBeaconStateMutatorSetPendingConsolidationsCall{Call: call} +} + +// MockBeaconStateMutatorSetPendingConsolidationsCall wrap *gomock.Call +type MockBeaconStateMutatorSetPendingConsolidationsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetPendingConsolidationsCall) Return() *MockBeaconStateMutatorSetPendingConsolidationsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetPendingConsolidationsCall) Do(f func(*solid.ListSSZ[*solid.PendingConsolidation])) *MockBeaconStateMutatorSetPendingConsolidationsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetPendingConsolidationsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingConsolidation])) *MockBeaconStateMutatorSetPendingConsolidationsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPendingDeposits mocks base method. +func (m *MockBeaconStateMutator) SetPendingDeposits(arg0 *solid.ListSSZ[*solid.PendingDeposit]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPendingDeposits", arg0) +} + +// SetPendingDeposits indicates an expected call of SetPendingDeposits. +func (mr *MockBeaconStateMutatorMockRecorder) SetPendingDeposits(arg0 any) *MockBeaconStateMutatorSetPendingDepositsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPendingDeposits", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetPendingDeposits), arg0) + return &MockBeaconStateMutatorSetPendingDepositsCall{Call: call} +} + +// MockBeaconStateMutatorSetPendingDepositsCall wrap *gomock.Call +type MockBeaconStateMutatorSetPendingDepositsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetPendingDepositsCall) Return() *MockBeaconStateMutatorSetPendingDepositsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetPendingDepositsCall) Do(f func(*solid.ListSSZ[*solid.PendingDeposit])) *MockBeaconStateMutatorSetPendingDepositsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetPendingDepositsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingDeposit])) *MockBeaconStateMutatorSetPendingDepositsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// SetPendingPartialWithdrawals mocks base method. +func (m *MockBeaconStateMutator) SetPendingPartialWithdrawals(arg0 *solid.ListSSZ[*solid.PendingPartialWithdrawal]) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetPendingPartialWithdrawals", arg0) +} + +// SetPendingPartialWithdrawals indicates an expected call of SetPendingPartialWithdrawals. +func (mr *MockBeaconStateMutatorMockRecorder) SetPendingPartialWithdrawals(arg0 any) *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPendingPartialWithdrawals", reflect.TypeOf((*MockBeaconStateMutator)(nil).SetPendingPartialWithdrawals), arg0) + return &MockBeaconStateMutatorSetPendingPartialWithdrawalsCall{Call: call} +} + +// MockBeaconStateMutatorSetPendingPartialWithdrawalsCall wrap *gomock.Call +type MockBeaconStateMutatorSetPendingPartialWithdrawalsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall) Return() *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall { + c.Call = c.Call.Return() + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall) Do(f func(*solid.ListSSZ[*solid.PendingPartialWithdrawal])) *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall) DoAndReturn(f func(*solid.ListSSZ[*solid.PendingPartialWithdrawal])) *MockBeaconStateMutatorSetPendingPartialWithdrawalsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + // SetPreviousEpochAttestations mocks base method. func (m *MockBeaconStateMutator) SetPreviousEpochAttestations(attestations *solid.ListSSZ[*solid.PendingAttestation]) { m.ctrl.T.Helper() diff --git a/cl/aggregation/mock_services/aggregation_pool_mock.go b/cl/aggregation/mock_services/aggregation_pool_mock.go index 15e3404fdc3..7946cc7d9ec 100644 --- a/cl/aggregation/mock_services/aggregation_pool_mock.go +++ b/cl/aggregation/mock_services/aggregation_pool_mock.go @@ -21,7 +21,6 @@ import ( type MockAggregationPool struct { ctrl *gomock.Controller recorder *MockAggregationPoolMockRecorder - isgomock struct{} } // MockAggregationPoolMockRecorder is the mock recorder for MockAggregationPool. @@ -42,17 +41,17 @@ func (m *MockAggregationPool) EXPECT() *MockAggregationPoolMockRecorder { } // AddAttestation mocks base method. -func (m *MockAggregationPool) AddAttestation(att *solid.Attestation) error { +func (m *MockAggregationPool) AddAttestation(arg0 *solid.Attestation) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddAttestation", att) + ret := m.ctrl.Call(m, "AddAttestation", arg0) ret0, _ := ret[0].(error) return ret0 } // AddAttestation indicates an expected call of AddAttestation. -func (mr *MockAggregationPoolMockRecorder) AddAttestation(att any) *MockAggregationPoolAddAttestationCall { +func (mr *MockAggregationPoolMockRecorder) AddAttestation(arg0 any) *MockAggregationPoolAddAttestationCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAttestation", reflect.TypeOf((*MockAggregationPool)(nil).AddAttestation), att) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAttestation", reflect.TypeOf((*MockAggregationPool)(nil).AddAttestation), arg0) return &MockAggregationPoolAddAttestationCall{Call: call} } @@ -80,17 +79,17 @@ func (c *MockAggregationPoolAddAttestationCall) DoAndReturn(f func(*solid.Attest } // GetAggregatationByRoot mocks base method. -func (m *MockAggregationPool) GetAggregatationByRoot(root common.Hash) *solid.Attestation { +func (m *MockAggregationPool) GetAggregatationByRoot(arg0 common.Hash) *solid.Attestation { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAggregatationByRoot", root) + ret := m.ctrl.Call(m, "GetAggregatationByRoot", arg0) ret0, _ := ret[0].(*solid.Attestation) return ret0 } // GetAggregatationByRoot indicates an expected call of GetAggregatationByRoot. -func (mr *MockAggregationPoolMockRecorder) GetAggregatationByRoot(root any) *MockAggregationPoolGetAggregatationByRootCall { +func (mr *MockAggregationPoolMockRecorder) GetAggregatationByRoot(arg0 any) *MockAggregationPoolGetAggregatationByRootCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAggregatationByRoot", reflect.TypeOf((*MockAggregationPool)(nil).GetAggregatationByRoot), root) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAggregatationByRoot", reflect.TypeOf((*MockAggregationPool)(nil).GetAggregatationByRoot), arg0) return &MockAggregationPoolGetAggregatationByRootCall{Call: call} } diff --git a/cl/beacon/handler/block_production.go b/cl/beacon/handler/block_production.go index bf96b718e58..36fe8428653 100644 --- a/cl/beacon/handler/block_production.go +++ b/cl/beacon/handler/block_production.go @@ -598,7 +598,7 @@ func (a *ApiHandler) produceBeaconBody( secsDiff := (targetSlot - baseBlock.Slot) * a.beaconChainCfg.SecondsPerSlot feeRecipient, _ := a.validatorParams.GetFeeRecipient(proposerIndex) var withdrawals []*types.Withdrawal - clWithdrawals := state.ExpectedWithdrawals( + clWithdrawals, _ := state.ExpectedWithdrawals( baseState, targetSlot/a.beaconChainCfg.SlotsPerEpoch, ) @@ -1030,11 +1030,9 @@ func (a *ApiHandler) parseRequestBeaconBlock( version clparams.StateVersion, r *http.Request, ) (*cltypes.DenebSignedBeaconBlock, error) { - var block *cltypes.DenebSignedBeaconBlock - if version.AfterOrEqual(clparams.ElectraVersion) { - block = cltypes.NewElectraSignedBeaconBlock(a.beaconChainCfg) - } else { - block = cltypes.NewDenebSignedBeaconBlock(a.beaconChainCfg) + block := cltypes.NewDenebSignedBeaconBlock(a.beaconChainCfg, version) + if block == nil { + return nil, errors.New("failed to create block") } // check content type switch r.Header.Get("Content-Type") { diff --git a/cl/beacon/handler/builder.go b/cl/beacon/handler/builder.go index 46102a9ffce..61ef9945c48 100644 --- a/cl/beacon/handler/builder.go +++ b/cl/beacon/handler/builder.go @@ -70,7 +70,7 @@ func (a *ApiHandler) GetEth1V1BuilderStatesExpectedWithdrawals(w http.ResponseWr var expectedWithdrawals []*cltypes.Withdrawal if err := a.syncedData.ViewHeadState(func(headState *state.CachingBeaconState) error { - expectedWithdrawals = state.ExpectedWithdrawals(headState, state.Epoch(headState)) + expectedWithdrawals, _ = state.ExpectedWithdrawals(headState, state.Epoch(headState)) return nil }); err != nil { return nil, err diff --git a/cl/beacon/handler/pool.go b/cl/beacon/handler/pool.go index 264446e9947..ce8e793fdeb 100644 --- a/cl/beacon/handler/pool.go +++ b/cl/beacon/handler/pool.go @@ -71,7 +71,7 @@ func (a *ApiHandler) GetEthV1BeaconPoolAttestations(w http.ResponseWriter, r *ht attVersion := a.beaconChainCfg.GetCurrentStateVersion(a.ethClock.GetEpochAtSlot(atts[i].Data.Slot)) cIndex := atts[i].Data.CommitteeIndex if attVersion.AfterOrEqual(clparams.ElectraVersion) { - index, err := atts[i].ElectraSingleCommitteeIndex() + index, err := atts[i].GetCommitteeIndexFromBits() if err != nil { log.Warn("[Beacon REST] failed to get committee bits", "err", err) continue @@ -109,7 +109,7 @@ func (a *ApiHandler) PostEthV1BeaconPoolAttestations(w http.ResponseWriter, r *h ) if attClVersion.AfterOrEqual(clparams.ElectraVersion) { - index, err := attestation.ElectraSingleCommitteeIndex() + index, err := attestation.GetCommitteeIndexFromBits() if err != nil { failures = append(failures, poolingFailure{ Index: i, diff --git a/cl/clparams/config.go b/cl/clparams/config.go index 217eec3ad51..09a3a7553cf 100644 --- a/cl/clparams/config.go +++ b/cl/clparams/config.go @@ -389,10 +389,12 @@ type BeaconChainConfig struct { MinEpochsForBlobsSidecarsRequest uint64 `yaml:"MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUEST" spec:"true" json:"MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUEST,string"` // MinEpochsForBlobsSidecarsRequest defines the minimum number of epochs to wait before requesting blobs sidecars. // Gwei value constants. - MinDepositAmount uint64 `yaml:"MIN_DEPOSIT_AMOUNT" spec:"true" json:"MIN_DEPOSIT_AMOUNT,string"` // MinDepositAmount is the minimum amount of Gwei a validator can send to the deposit contract at once (lower amounts will be reverted). - MaxEffectiveBalance uint64 `yaml:"MAX_EFFECTIVE_BALANCE" spec:"true" json:"MAX_EFFECTIVE_BALANCE,string"` // MaxEffectiveBalance is the maximal amount of Gwei that is effective for staking. - EjectionBalance uint64 `yaml:"EJECTION_BALANCE" spec:"true" json:"EJECTION_BALANCE,string"` // EjectionBalance is the minimal GWei a validator needs to have before ejected. - EffectiveBalanceIncrement uint64 `yaml:"EFFECTIVE_BALANCE_INCREMENT" spec:"true" json:"EFFECTIVE_BALANCE_INCREMENT,string"` // EffectiveBalanceIncrement is used for converting the high balance into the low balance for validators. + MinDepositAmount uint64 `yaml:"MIN_DEPOSIT_AMOUNT" spec:"true" json:"MIN_DEPOSIT_AMOUNT,string"` // MinDepositAmount is the minimum amount of Gwei a validator can send to the deposit contract at once (lower amounts will be reverted). + MaxEffectiveBalance uint64 `yaml:"MAX_EFFECTIVE_BALANCE" spec:"true" json:"MAX_EFFECTIVE_BALANCE,string"` // MaxEffectiveBalance is the maximal amount of Gwei that is effective for staking. + MaxEffectiveBalanceElectra uint64 `yaml:"MAX_EFFECTIVE_BALANCE_ELECTRA" spec:"true" json:"MAX_EFFECTIVE_BALANCE_ELECTRA,string"` // MaxEffectiveBalanceElectra is the maximal amount of Gwei that is effective for staking in Electra. + MinActivationBalance uint64 `yaml:"MIN_ACTIVATION_BALANCE" spec:"true" json:"MIN_ACTIVATION_BALANCE,string"` // MinActivationBalance is the minimal GWei a validator needs to have before activated. + EjectionBalance uint64 `yaml:"EJECTION_BALANCE" spec:"true" json:"EJECTION_BALANCE,string"` // EjectionBalance is the minimal GWei a validator needs to have before ejected. + EffectiveBalanceIncrement uint64 `yaml:"EFFECTIVE_BALANCE_INCREMENT" spec:"true" json:"EFFECTIVE_BALANCE_INCREMENT,string"` // EffectiveBalanceIncrement is used for converting the high balance into the low balance for validators. // Initial value constants. BLSWithdrawalPrefixByte ConfigByte `yaml:"BLS_WITHDRAWAL_PREFIX" spec:"true" json:"BLS_WITHDRAWAL_PREFIX"` // BLSWithdrawalPrefixByte is used for BLS withdrawal and it's the first byte. @@ -554,8 +556,25 @@ type BeaconChainConfig struct { TargetNumberOfPeers uint64 `yaml:"TARGET_NUMBER_OF_PEERS" spec:"true" json:"TARGET_NUMBER_OF_PEERS,string"` // TargetNumberOfPeers defines the target number of peers. // Electra - MinPerEpochChurnLimitElectra uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA" spec:"true" json:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA,string"` // MinPerEpochChurnLimitElectra defines the minimum per epoch churn limit for Electra. - MaxPerEpochActivationExitChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT" spec:"true" json:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT,string"` // MaxPerEpochActivationExitChurnLimit defines the maximum per epoch activation exit churn limit for Electra. + MinPerEpochChurnLimitElectra uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA" spec:"true" json:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA,string"` // MinPerEpochChurnLimitElectra defines the minimum per epoch churn limit for Electra. + MaxPerEpochActivationExitChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT" spec:"true" json:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT,string"` // MaxPerEpochActivationExitChurnLimit defines the maximum per epoch activation exit churn limit for Electra. + MaxDepositRequestsPerPayload uint64 `yaml:"MAX_DEPOSIT_REQUESTS_PER_PAYLOAD" spec:"true" json:"MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,string"` // MaxDepositRequestsPerPayload defines the maximum number of deposit requests in a block. + MaxWithdrawalRequestsPerPayload uint64 `yaml:"MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD" spec:"true" json:"MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,string"` // MaxWithdrawalRequestsPerPayload defines the maximum number of withdrawal requests in a block. + MaxConsolidationRequestsPerPayload uint64 `yaml:"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD" spec:"true" json:"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,string"` // MaxConsolidationRequestsPerPayload defines the maximum number of consolidation requests in a block. + MinSlashingPenaltyQuotientElectra uint64 `yaml:"MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA" spec:"true" json:"MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA,string"` // MinSlashingPenaltyQuotientElectra for slashing penalties post Electra hard fork. + WhistleBlowerRewardQuotientElectra uint64 `yaml:"WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA" spec:"true" json:"WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA,string"` // WhistleBlowerRewardQuotientElectra is used to calculate whistle blower reward post Electra hard fork. + MaxPendingPartialsPerWithdrawalsSweep uint64 `yaml:"MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP" spec:"true" json:"MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP,string"` // MaxPendingPartialsPerWithdrawalsSweep bounds the size of the sweep searching for pending partials per slot. + MaxPendingDepositsPerEpoch uint64 `yaml:"MAX_PENDING_DEPOSITS_PER_EPOCH" spec:"true" json:"MAX_PENDING_DEPOSITS_PER_EPOCH,string"` // MaxPendingDepositsPerEpoch defines the maximum number of pending deposits per epoch. + PendingDepositLimit uint64 `yaml:"PENDING_DEPOSIT_LIMIT" spec:"true" json:"PENDING_DEPOSIT_LIMIT,string"` // PendingDepositLimit defines the maximum number of pending deposits. + PendingPartialWithdrawalsLimit uint64 `yaml:"PENDING_PARTIAL_WITHDRAWALS_LIMIT" spec:"true" json:"PENDING_PARTIAL_WITHDRAWALS_LIMIT,string"` // PendingPartialWithdrawalsLimit defines the maximum number of pending partial withdrawals. + PendingConsolidationsLimit uint64 `yaml:"PENDING_CONSOLIDATIONS_LIMIT" spec:"true" json:"PENDING_CONSOLIDATIONS_LIMIT,string"` // PendingConsolidationsLimit defines the maximum number of pending consolidations. + // Constants for the Electra fork. + UnsetDepositRequestsStartIndex uint64 `yaml:"UNSET_DEPOSIT_REQUESTS_START_INDEX" spec:"true" json:"UNSET_DEPOSIT_REQUESTS_START_INDEX,string"` // UnsetDepositRequestsStartIndex defines the start index for unset deposit requests. + FullExitRequestAmount uint64 `yaml:"FULL_EXIT_REQUEST_AMOUNT" spec:"true" json:"FULL_EXIT_REQUEST_AMOUNT,string"` // FullExitRequestAmount defines the amount for a full exit request. + CompoundingWithdrawalPrefix byte `yaml:"COMPOUNDING_WITHDRAWAL_PREFIX" spec:"true" json:"COMPOUNDING_WITHDRAWAL_PREFIX"` // CompoundingWithdrawalPrefix is the prefix for compounding withdrawals. + DepositRequestType byte `yaml:"DEPOSIT_REQUEST_TYPE" spec:"true" json:"DEPOSIT_REQUEST_TYPE"` // DepositRequestType is the type for deposit requests. + WithdrawalRequestType byte `yaml:"WITHDRAWAL_REQUEST_TYPE" spec:"true" json:"WITHDRAWAL_REQUEST_TYPE"` // WithdrawalRequestType is the type for withdrawal requests. + ConsolidationRequestType byte `yaml:"CONSOLIDATION_REQUEST_TYPE" spec:"true" json:"CONSOLIDATION_REQUEST_TYPE"` // ConsolidationRequestType is the type for consolidation requests. } func (b *BeaconChainConfig) RoundSlotToEpoch(slot uint64) uint64 { @@ -637,10 +656,12 @@ var MainnetBeaconConfig BeaconChainConfig = BeaconChainConfig{ MinEpochsForBlobsSidecarsRequest: 4096, // Gwei value constants. - MinDepositAmount: 1 * 1e9, - MaxEffectiveBalance: 32 * 1e9, - EjectionBalance: 16 * 1e9, - EffectiveBalanceIncrement: 1 * 1e9, + MinDepositAmount: 1 * 1e9, + MaxEffectiveBalance: 32 * 1e9, + MinActivationBalance: 32 * 1e9, + MaxEffectiveBalanceElectra: 2048 * 1e9, + EjectionBalance: 16 * 1e9, + EffectiveBalanceIncrement: 1 * 1e9, // Initial value constants. BLSWithdrawalPrefixByte: ConfigByte(0), @@ -740,8 +761,8 @@ var MainnetBeaconConfig BeaconChainConfig = BeaconChainConfig{ CapellaForkEpoch: 194048, DenebForkVersion: 0x04000000, DenebForkEpoch: 269568, - // ElectraForkVersion: Not Set, - ElectraForkEpoch: math.MaxUint64, + ElectraForkVersion: 0x05000000, + ElectraForkEpoch: math.MaxUint64, // New values introduced in Altair hard fork 1. // Participation flag indices. @@ -802,8 +823,26 @@ var MainnetBeaconConfig BeaconChainConfig = BeaconChainConfig{ CustodyRequirement: 1, TargetNumberOfPeers: 70, - MinPerEpochChurnLimitElectra: 128000000000, - MaxPerEpochActivationExitChurnLimit: 256000000000, + // Electra + MinPerEpochChurnLimitElectra: 128000000000, + MaxPerEpochActivationExitChurnLimit: 256000000000, + MaxDepositRequestsPerPayload: 8192, + MaxWithdrawalRequestsPerPayload: 16, + MaxConsolidationRequestsPerPayload: 1, + MinSlashingPenaltyQuotientElectra: 4096, + WhistleBlowerRewardQuotientElectra: 4096, + MaxPendingPartialsPerWithdrawalsSweep: 8, + MaxPendingDepositsPerEpoch: 16, + PendingDepositLimit: 1 << 27, + PendingPartialWithdrawalsLimit: 1 << 27, + PendingConsolidationsLimit: 1 << 18, + // Electra constants. + UnsetDepositRequestsStartIndex: ^uint64(0), // 2**64 - 1 + FullExitRequestAmount: 0, + CompoundingWithdrawalPrefix: 0x02, + DepositRequestType: 0x00, + WithdrawalRequestType: 0x01, + ConsolidationRequestType: 0x02, } func mainnetConfig() BeaconChainConfig { @@ -973,6 +1012,28 @@ func (b *BeaconChainConfig) GetMinSlashingPenaltyQuotient(version StateVersion) return b.MinSlashingPenaltyQuotientBellatrix case DenebVersion: return b.MinSlashingPenaltyQuotientBellatrix + case ElectraVersion: + return b.MinSlashingPenaltyQuotientElectra + default: + panic("not implemented") + } +} + +func (b *BeaconChainConfig) GetWhistleBlowerRewardQuotient(version StateVersion) uint64 { + if version == ElectraVersion { + return b.WhistleBlowerRewardQuotientElectra + } + return b.WhistleBlowerRewardQuotient +} + +func (b *BeaconChainConfig) GetProportionalSlashingMultiplier(version StateVersion) uint64 { + switch version { + case Phase0Version: + return b.ProportionalSlashingMultiplier + case AltairVersion: + return b.ProportionalSlashingMultiplierAltair + case BellatrixVersion, CapellaVersion, DenebVersion, ElectraVersion: + return b.ProportionalSlashingMultiplierBellatrix default: panic("not implemented") } @@ -990,6 +1051,8 @@ func (b *BeaconChainConfig) GetPenaltyQuotient(version StateVersion) uint64 { return b.InactivityPenaltyQuotientBellatrix case DenebVersion: return b.InactivityPenaltyQuotientBellatrix + case ElectraVersion: + return b.InactivityPenaltyQuotientBellatrix default: panic("not implemented") } @@ -1024,6 +1087,17 @@ func (b *BeaconChainConfig) CurrentEpochAttestationsLength() uint64 { return b.SlotsPerEpoch * b.MaxAttestations } +func (b *BeaconChainConfig) MaxEffectiveBalanceForVersion(version StateVersion) uint64 { + switch version { + case Phase0Version, AltairVersion, BellatrixVersion, CapellaVersion, DenebVersion: + return b.MaxEffectiveBalance + case ElectraVersion: + return b.MaxEffectiveBalanceElectra + default: + panic("invalid version") + } +} + func (b *BeaconChainConfig) GetForkVersionByVersion(v StateVersion) uint32 { switch v { case Phase0Version: diff --git a/cl/cltypes/beacon_block.go b/cl/cltypes/beacon_block.go index 0917f75498f..7182541978c 100644 --- a/cl/cltypes/beacon_block.go +++ b/cl/cltypes/beacon_block.go @@ -22,6 +22,8 @@ import ( "fmt" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/hexutility" + "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/types/clonable" "github.com/erigontech/erigon-lib/types/ssz" @@ -62,12 +64,14 @@ var ( // Definition of SignedBeaconBlock type SignedBeaconBlock struct { - Signature libcommon.Bytes96 `json:"signature"` Block *BeaconBlock `json:"message"` + Signature libcommon.Bytes96 `json:"signature"` } func NewSignedBeaconBlock(beaconCfg *clparams.BeaconChainConfig, version clparams.StateVersion) *SignedBeaconBlock { - return &SignedBeaconBlock{Block: NewBeaconBlock(beaconCfg, version)} + return &SignedBeaconBlock{ + Block: NewBeaconBlock(beaconCfg, version), + } } func (b *SignedBeaconBlock) Blinded() (*SignedBlindedBeaconBlock, error) { @@ -228,19 +232,24 @@ type BeaconBody struct { // The commitments for beacon chain blobs // With a max of 4 per block BlobKzgCommitments *solid.ListSSZ[*KZGCommitment] `json:"blob_kzg_commitments,omitempty"` + ExecutionRequests *ExecutionRequests `json:"execution_requests,omitempty"` + // The version of the beacon chain - Version clparams.StateVersion `json:"-"` - beaconCfg *clparams.BeaconChainConfig + Version clparams.StateVersion `json:"-"` + beaconCfg *clparams.BeaconChainConfig `json:"-"` } func NewBeaconBody(beaconCfg *clparams.BeaconChainConfig, version clparams.StateVersion) *BeaconBody { var ( - maxAttSlashing = MaxAttesterSlashings - maxAttestation = MaxAttestations + executionRequests *ExecutionRequests + maxAttSlashing = MaxAttesterSlashings + maxAttestation = MaxAttestations ) if version.AfterOrEqual(clparams.ElectraVersion) { + // upgrade to electra maxAttSlashing = MaxAttesterSlashingsElectra maxAttestation = MaxAttestationsElectra + executionRequests = NewExecutionRequests(beaconCfg) } return &BeaconBody{ @@ -251,15 +260,21 @@ func NewBeaconBody(beaconCfg *clparams.BeaconChainConfig, version clparams.State Attestations: solid.NewDynamicListSSZ[*solid.Attestation](maxAttestation), Deposits: solid.NewStaticListSSZ[*Deposit](MaxDeposits, 1240), VoluntaryExits: solid.NewStaticListSSZ[*SignedVoluntaryExit](MaxVoluntaryExits, 112), - ExecutionPayload: NewEth1Block(clparams.Phase0Version, beaconCfg), + ExecutionPayload: NewEth1Block(version, beaconCfg), ExecutionChanges: solid.NewStaticListSSZ[*SignedBLSToExecutionChange](MaxExecutionChanges, 172), BlobKzgCommitments: solid.NewStaticListSSZ[*KZGCommitment](MaxBlobsCommittmentsPerBlock, 48), + ExecutionRequests: executionRequests, Version: version, } } func (b *BeaconBody) SetVersion(version clparams.StateVersion) { b.Version = version b.ExecutionPayload.SetVersion(version) + if version.AfterOrEqual(clparams.ElectraVersion) { + b.AttesterSlashings = solid.NewDynamicListSSZ[*AttesterSlashing](MaxAttesterSlashingsElectra) + b.Attestations = solid.NewDynamicListSSZ[*solid.Attestation](MaxAttestationsElectra) + b.ExecutionRequests = NewExecutionRequests(b.beaconCfg) + } } func (b *BeaconBody) EncodeSSZ(dst []byte) ([]byte, error) { @@ -322,6 +337,11 @@ func (b *BeaconBody) EncodingSizeSSZ() (size int) { if b.Version >= clparams.DenebVersion { size += b.BlobKzgCommitments.EncodingSizeSSZ() } + if b.Version >= clparams.ElectraVersion { + if b.ExecutionRequests != nil { + size += b.ExecutionRequests.EncodingSizeSSZ() + } + } return } @@ -334,7 +354,6 @@ func (b *BeaconBody) DecodeSSZ(buf []byte, version int) error { } b.ExecutionPayload = NewEth1Block(b.Version, b.beaconCfg) - err := ssz2.UnmarshalSSZ(buf, version, b.getSchema(false)...) return err } @@ -357,6 +376,7 @@ func (b *BeaconBody) Blinded() (*BlindedBeaconBody, error) { ExecutionPayload: header, ExecutionChanges: b.ExecutionChanges, BlobKzgCommitments: b.BlobKzgCommitments, + ExecutionRequests: b.ExecutionRequests, Version: b.Version, beaconCfg: b.beaconCfg, }, nil @@ -380,6 +400,9 @@ func (b *BeaconBody) getSchema(storage bool) []interface{} { if b.Version >= clparams.DenebVersion { s = append(s, b.BlobKzgCommitments) } + if b.Version >= clparams.ElectraVersion { + s = append(s, b.ExecutionRequests) + } return s } @@ -425,6 +448,7 @@ func (b *BeaconBody) UnmarshalJSON(buf []byte) error { ExecutionPayload *Eth1Block `json:"execution_payload,omitempty"` ExecutionChanges *solid.ListSSZ[*SignedBLSToExecutionChange] `json:"bls_to_execution_changes,omitempty"` BlobKzgCommitments *solid.ListSSZ[*KZGCommitment] `json:"blob_kzg_commitments,omitempty"` + ExecutionRequests *ExecutionRequests `json:"execution_requests,omitempty"` } tmp.ProposerSlashings = solid.NewStaticListSSZ[*ProposerSlashing](MaxProposerSlashings, 416) tmp.AttesterSlashings = solid.NewDynamicListSSZ[*AttesterSlashing](maxAttSlashing) @@ -433,11 +457,18 @@ func (b *BeaconBody) UnmarshalJSON(buf []byte) error { tmp.VoluntaryExits = solid.NewStaticListSSZ[*SignedVoluntaryExit](MaxVoluntaryExits, 112) tmp.ExecutionChanges = solid.NewStaticListSSZ[*SignedBLSToExecutionChange](MaxExecutionChanges, 172) tmp.BlobKzgCommitments = solid.NewStaticListSSZ[*KZGCommitment](MaxBlobsCommittmentsPerBlock, 48) + tmp.ExecutionRequests = NewExecutionRequests(b.beaconCfg) tmp.ExecutionPayload = NewEth1Block(b.Version, b.beaconCfg) if err := json.Unmarshal(buf, &tmp); err != nil { return err } + tmp.AttesterSlashings.Range(func(_ int, value *AttesterSlashing, _ int) bool { + // Trick to set version + value.SetVersion(b.Version) + return true + }) + b.RandaoReveal = tmp.RandaoReveal b.Eth1Data = tmp.Eth1Data b.Graffiti = tmp.Graffiti @@ -450,6 +481,9 @@ func (b *BeaconBody) UnmarshalJSON(buf []byte) error { b.ExecutionPayload = tmp.ExecutionPayload b.ExecutionChanges = tmp.ExecutionChanges b.BlobKzgCommitments = tmp.BlobKzgCommitments + if b.Version >= clparams.ElectraVersion { + b.ExecutionRequests = tmp.ExecutionRequests + } return nil } @@ -497,6 +531,34 @@ func (b *BeaconBody) GetExecutionChanges() *solid.ListSSZ[*SignedBLSToExecutionC return b.ExecutionChanges } +func (b *BeaconBody) GetExecutionRequests() *ExecutionRequests { + return b.ExecutionRequests +} + +func (b *BeaconBody) GetExecutionRequestsList() []hexutility.Bytes { + ret := []hexutility.Bytes{} + r := b.ExecutionRequests + for requestType, requests := range map[byte]ssz.EncodableSSZ{ + b.beaconCfg.DepositRequestType: r.Deposits, + b.beaconCfg.WithdrawalRequestType: r.Withdrawals, + b.beaconCfg.ConsolidationRequestType: r.Consolidations, + } { + if requests != nil { + ssz, err := r.Deposits.EncodeSSZ(nil) + if err != nil { + log.Warn("Error encoding deposits", "err", err) + return nil + } + if len(ssz) == 0 { + continue + } + // type + ssz + ret = append(ret, append(hexutility.Bytes{requestType}, ssz...)) + } + } + return ret +} + type DenebBeaconBlock struct { Block *BeaconBlock `json:"block"` KZGProofs *solid.ListSSZ[*KZGProof] `json:"kzg_proofs"` @@ -560,20 +622,14 @@ type DenebSignedBeaconBlock struct { Blobs *solid.ListSSZ[*Blob] `json:"blobs"` } -func NewDenebSignedBeaconBlock(beaconCfg *clparams.BeaconChainConfig) *DenebSignedBeaconBlock { - maxBlobsPerBlock := int(beaconCfg.MaxBlobsPerBlock) - b := &DenebSignedBeaconBlock{ - SignedBlock: NewSignedBeaconBlock(beaconCfg, clparams.DenebVersion), - KZGProofs: solid.NewStaticListSSZ[*KZGProof](maxBlobsPerBlock, BYTES_KZG_PROOF), - Blobs: solid.NewStaticListSSZ[*Blob](maxBlobsPerBlock, int(BYTES_PER_BLOB)), +func NewDenebSignedBeaconBlock(beaconCfg *clparams.BeaconChainConfig, version clparams.StateVersion) *DenebSignedBeaconBlock { + if version < clparams.DenebVersion { + log.Warn("DenebSignedBeaconBlock: version is not after DenebVersion") + return nil } - return b -} - -func NewElectraSignedBeaconBlock(beaconCfg *clparams.BeaconChainConfig) *DenebSignedBeaconBlock { maxBlobsPerBlock := int(beaconCfg.MaxBlobsPerBlock) b := &DenebSignedBeaconBlock{ - SignedBlock: NewSignedBeaconBlock(beaconCfg, clparams.ElectraVersion), + SignedBlock: NewSignedBeaconBlock(beaconCfg, version), KZGProofs: solid.NewStaticListSSZ[*KZGProof](maxBlobsPerBlock, BYTES_KZG_PROOF), Blobs: solid.NewStaticListSSZ[*Blob](maxBlobsPerBlock, int(BYTES_PER_BLOB)), } diff --git a/cl/cltypes/beacon_block_blinded.go b/cl/cltypes/beacon_block_blinded.go index b9ce927557f..a3df5f05441 100644 --- a/cl/cltypes/beacon_block_blinded.go +++ b/cl/cltypes/beacon_block_blinded.go @@ -224,6 +224,8 @@ type BlindedBeaconBody struct { // The commitments for beacon chain blobs // With a max of 4 per block BlobKzgCommitments *solid.ListSSZ[*KZGCommitment] `json:"blob_kzg_commitments"` + ExecutionRequests *ExecutionRequests `json:"execution_requests,omitempty"` + // The version of the beacon chain Version clparams.StateVersion `json:"-"` beaconCfg *clparams.BeaconChainConfig @@ -231,12 +233,14 @@ type BlindedBeaconBody struct { func NewBlindedBeaconBody(beaconCfg *clparams.BeaconChainConfig, version clparams.StateVersion) *BlindedBeaconBody { var ( - maxAttSlashing = MaxAttesterSlashings - maxAttestation = MaxAttestations + maxAttSlashing = MaxAttesterSlashings + maxAttestation = MaxAttestations + executionRequests *ExecutionRequests ) if version.AfterOrEqual(clparams.ElectraVersion) { maxAttSlashing = MaxAttesterSlashingsElectra maxAttestation = MaxAttestationsElectra + executionRequests = NewExecutionRequests(beaconCfg) } return &BlindedBeaconBody{ @@ -252,6 +256,7 @@ func NewBlindedBeaconBody(beaconCfg *clparams.BeaconChainConfig, version clparam ExecutionPayload: NewEth1Header(version), ExecutionChanges: solid.NewStaticListSSZ[*SignedBLSToExecutionChange](MaxExecutionChanges, 172), BlobKzgCommitments: solid.NewStaticListSSZ[*KZGCommitment](MaxBlobsCommittmentsPerBlock, 48), + ExecutionRequests: executionRequests, Version: 0, beaconCfg: beaconCfg, } @@ -328,7 +333,11 @@ func (b *BlindedBeaconBody) EncodingSizeSSZ() (size int) { if b.Version >= clparams.DenebVersion { size += b.ExecutionChanges.EncodingSizeSSZ() } - + if b.Version >= clparams.ElectraVersion { + if b.ExecutionRequests != nil { + size += b.ExecutionRequests.EncodingSizeSSZ() + } + } return } @@ -363,6 +372,9 @@ func (b *BlindedBeaconBody) getSchema(storage bool) []interface{} { if b.Version >= clparams.DenebVersion { s = append(s, b.BlobKzgCommitments) } + if b.Version >= clparams.ElectraVersion { + s = append(s, b.ExecutionRequests) + } return s } @@ -413,6 +425,7 @@ func (b *BlindedBeaconBody) Full(txs *solid.TransactionsSSZ, withdrawals *solid. ExecutionPayload: executionPayload, ExecutionChanges: b.ExecutionChanges, BlobKzgCommitments: b.BlobKzgCommitments, + ExecutionRequests: b.ExecutionRequests, Version: b.Version, beaconCfg: b.beaconCfg, } @@ -472,3 +485,7 @@ func (b *BlindedBeaconBody) GetBlobKzgCommitments() *solid.ListSSZ[*KZGCommitmen func (b *BlindedBeaconBody) GetExecutionChanges() *solid.ListSSZ[*SignedBLSToExecutionChange] { return b.ExecutionChanges } + +func (b *BlindedBeaconBody) GetExecutionRequests() *ExecutionRequests { + return b.ExecutionRequests +} diff --git a/cl/cltypes/beacon_block_interface.go b/cl/cltypes/beacon_block_interface.go index 4d5bf1e5d78..6f84c857492 100644 --- a/cl/cltypes/beacon_block_interface.go +++ b/cl/cltypes/beacon_block_interface.go @@ -28,4 +28,5 @@ type GenericBeaconBody interface { GetVoluntaryExits() *solid.ListSSZ[*SignedVoluntaryExit] GetBlobKzgCommitments() *solid.ListSSZ[*KZGCommitment] GetExecutionChanges() *solid.ListSSZ[*SignedBLSToExecutionChange] + GetExecutionRequests() *ExecutionRequests } diff --git a/cl/cltypes/clone.go b/cl/cltypes/clone.go index 8cc68ba6ca5..d261b74ff47 100644 --- a/cl/cltypes/clone.go +++ b/cl/cltypes/clone.go @@ -18,6 +18,7 @@ package cltypes import ( "github.com/erigontech/erigon-lib/types/clonable" + "github.com/erigontech/erigon/cl/cltypes/solid" ) func (s *SignedBeaconBlock) Clone() clonable.Clonable { @@ -26,8 +27,19 @@ func (s *SignedBeaconBlock) Clone() clonable.Clonable { return other } -func (*IndexedAttestation) Clone() clonable.Clonable { - return &IndexedAttestation{} +func (i *IndexedAttestation) Clone() clonable.Clonable { + /* + var attestingIndices *solid.RawUint64List + + if i.AttestingIndices != nil { + attestingIndices = solid.NewRawUint64List(i.AttestingIndices.Cap(), []uint64{}) + } + + */ + return &IndexedAttestation{ + //AttestingIndices: attestingIndices, + Data: &solid.AttestationData{}, + } } func (b *BeaconBody) Clone() clonable.Clonable { diff --git a/cl/cltypes/execution_requests.go b/cl/cltypes/execution_requests.go new file mode 100644 index 00000000000..c3195a7217d --- /dev/null +++ b/cl/cltypes/execution_requests.go @@ -0,0 +1,82 @@ +package cltypes + +import ( + "encoding/json" + + "github.com/erigontech/erigon-lib/types/clonable" + "github.com/erigontech/erigon/cl/clparams" + "github.com/erigontech/erigon/cl/cltypes/solid" + "github.com/erigontech/erigon/cl/merkle_tree" + ssz2 "github.com/erigontech/erigon/cl/ssz" +) + +var ( + _ solid.EncodableHashableSSZ = (*ExecutionRequests)(nil) + _ ssz2.SizedObjectSSZ = (*ExecutionRequests)(nil) +) + +// class ExecutionRequests(Container): +// +// deposits: List[DepositRequest, MAX_DEPOSIT_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP6110] +// withdrawals: List[WithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7002:EIP7251] +// consolidations: List[ConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7251] +type ExecutionRequests struct { + Deposits *solid.ListSSZ[*solid.DepositRequest] `json:"deposits"` + Withdrawals *solid.ListSSZ[*solid.WithdrawalRequest] `json:"withdrawals"` + Consolidations *solid.ListSSZ[*solid.ConsolidationRequest] `json:"consolidations"` + + cfg *clparams.BeaconChainConfig +} + +func NewExecutionRequests(cfg *clparams.BeaconChainConfig) *ExecutionRequests { + return &ExecutionRequests{ + Deposits: solid.NewStaticListSSZ[*solid.DepositRequest](int(cfg.MaxDepositRequestsPerPayload), solid.SizeDepositRequest), + Withdrawals: solid.NewStaticListSSZ[*solid.WithdrawalRequest](int(cfg.MaxWithdrawalRequestsPerPayload), solid.SizeWithdrawalRequest), + Consolidations: solid.NewStaticListSSZ[*solid.ConsolidationRequest](int(cfg.MaxConsolidationRequestsPerPayload), solid.SizeConsolidationRequest), + cfg: cfg, + } +} + +func (e *ExecutionRequests) EncodingSizeSSZ() int { + return e.Deposits.EncodingSizeSSZ() + e.Withdrawals.EncodingSizeSSZ() + e.Consolidations.EncodingSizeSSZ() +} + +func (e *ExecutionRequests) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, e.Deposits, e.Withdrawals, e.Consolidations) +} + +func (e *ExecutionRequests) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, e.Deposits, e.Withdrawals, e.Consolidations) +} + +func (e *ExecutionRequests) Clone() clonable.Clonable { + return NewExecutionRequests(e.cfg) +} + +func (e *ExecutionRequests) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(e.Deposits, e.Withdrawals, e.Consolidations) +} + +func (e *ExecutionRequests) Static() bool { + return false +} + +func (e *ExecutionRequests) UnmarshalJSON(b []byte) error { + c := struct { + Deposits *solid.ListSSZ[*solid.DepositRequest] `json:"deposits"` + Withdrawals *solid.ListSSZ[*solid.WithdrawalRequest] `json:"withdrawals"` + Consolidations *solid.ListSSZ[*solid.ConsolidationRequest] `json:"consolidations"` + }{ + Deposits: solid.NewStaticListSSZ[*solid.DepositRequest](int(e.cfg.MaxDepositRequestsPerPayload), solid.SizeDepositRequest), + Withdrawals: solid.NewStaticListSSZ[*solid.WithdrawalRequest](int(e.cfg.MaxWithdrawalRequestsPerPayload), solid.SizeWithdrawalRequest), + Consolidations: solid.NewStaticListSSZ[*solid.ConsolidationRequest](int(e.cfg.MaxConsolidationRequestsPerPayload), solid.SizeConsolidationRequest), + } + if err := json.Unmarshal(b, &c); err != nil { + return err + } + + e.Deposits = c.Deposits + e.Withdrawals = c.Withdrawals + e.Consolidations = c.Consolidations + return nil +} diff --git a/cl/cltypes/indexed_attestation.go b/cl/cltypes/indexed_attestation.go index 01fd50afb64..45ba2284d19 100644 --- a/cl/cltypes/indexed_attestation.go +++ b/cl/cltypes/indexed_attestation.go @@ -18,6 +18,7 @@ package cltypes import ( "encoding/json" + "strconv" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/clparams" @@ -48,27 +49,44 @@ func NewIndexedAttestation(version clparams.StateVersion) *IndexedAttestation { attLimit = attestingIndicesLimit } return &IndexedAttestation{ - AttestingIndices: solid.NewRawUint64List(attLimit, nil), + AttestingIndices: solid.NewRawUint64List(attLimit, []uint64{}), Data: &solid.AttestationData{}, } } +func (i *IndexedAttestation) SetVersion(v clparams.StateVersion) { + if v >= clparams.ElectraVersion { + i.AttestingIndices.SetCap(attestingIndicesLimitElectra) + } else { + i.AttestingIndices.SetCap(attestingIndicesLimit) + } +} + func (i *IndexedAttestation) Static() bool { return false } func (i *IndexedAttestation) UnmarshalJSON(buf []byte) error { var tmp struct { - AttestingIndices *solid.RawUint64List `json:"attesting_indices"` + AttestingIndices []string `json:"attesting_indices"` Data *solid.AttestationData `json:"data"` Signature libcommon.Bytes96 `json:"signature"` } - tmp.AttestingIndices = solid.NewRawUint64List(2048, nil) tmp.Data = &solid.AttestationData{} if err := json.Unmarshal(buf, &tmp); err != nil { return err } - i.AttestingIndices = tmp.AttestingIndices + + if i.AttestingIndices == nil { + i.AttestingIndices = solid.NewRawUint64List(attestingIndicesLimit, nil) + } + for _, index := range tmp.AttestingIndices { + v, err := strconv.ParseUint(index, 10, 64) + if err != nil { + return err + } + i.AttestingIndices.Append(v) + } i.Data = tmp.Data i.Signature = tmp.Signature return nil @@ -81,7 +99,11 @@ func (i *IndexedAttestation) EncodeSSZ(buf []byte) (dst []byte, err error) { // DecodeSSZ ssz unmarshals the IndexedAttestation object func (i *IndexedAttestation) DecodeSSZ(buf []byte, version int) error { i.Data = &solid.AttestationData{} - i.AttestingIndices = solid.NewRawUint64List(2048, nil) + if version >= int(clparams.ElectraVersion) { + i.AttestingIndices = solid.NewRawUint64List(attestingIndicesLimitElectra, nil) + } else { + i.AttestingIndices = solid.NewRawUint64List(attestingIndicesLimit, nil) + } return ssz2.UnmarshalSSZ(buf, version, i.AttestingIndices, i.Data, i.Signature[:]) } diff --git a/cl/cltypes/light_client.go b/cl/cltypes/light_client.go index bcde90715ec..864679f54e3 100644 --- a/cl/cltypes/light_client.go +++ b/cl/cltypes/light_client.go @@ -25,10 +25,20 @@ import ( ) const ( + // FINALIZED_ROOT_GINDEX get_generalized_index(altair.BeaconState, 'finalized_checkpoint', 'root') (= 105) + // CURRENT_SYNC_COMMITTEE_GINDEX get_generalized_index(altair.BeaconState, 'current_sync_committee') (= 54) + // NEXT_SYNC_COMMITTEE_GINDEX get_generalized_index(altair.BeaconState, 'next_sync_committee') (= 55) ExecutionBranchSize = 4 SyncCommitteeBranchSize = 5 CurrentSyncCommitteeBranchSize = 5 FinalizedBranchSize = 6 + + // FINALIZED_ROOT_GINDEX_ELECTRA get_generalized_index(BeaconState, 'finalized_checkpoint', 'root') (= 169) + // CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA get_generalized_index(BeaconState, 'current_sync_committee') (= 86) + // NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA get_generalized_index(BeaconState, 'next_sync_committee') (= 87) + SyncCommitteeBranchSizeElectra = 6 + CurrentSyncCommitteeBranchSizeElectra = 6 + FinalizedBranchSizeElectra = 7 ) type LightClientHeader struct { @@ -118,9 +128,9 @@ func NewLightClientUpdate(version clparams.StateVersion) *LightClientUpdate { return &LightClientUpdate{ AttestedHeader: NewLightClientHeader(version), NextSyncCommittee: &solid.SyncCommittee{}, - NextSyncCommitteeBranch: solid.NewHashVector(CurrentSyncCommitteeBranchSize), + NextSyncCommitteeBranch: solid.NewHashVector(getCurrentSyncCommitteeBranchSize(version)), FinalizedHeader: NewLightClientHeader(version), - FinalityBranch: solid.NewHashVector(FinalizedBranchSize), + FinalityBranch: solid.NewHashVector(getFinalizedBranchSize(version)), SyncAggregate: &SyncAggregate{}, } } @@ -132,9 +142,9 @@ func (l *LightClientUpdate) EncodeSSZ(buf []byte) ([]byte, error) { func (l *LightClientUpdate) DecodeSSZ(buf []byte, version int) error { l.AttestedHeader = NewLightClientHeader(clparams.StateVersion(version)) l.NextSyncCommittee = &solid.SyncCommittee{} - l.NextSyncCommitteeBranch = solid.NewHashVector(CurrentSyncCommitteeBranchSize) + l.NextSyncCommitteeBranch = solid.NewHashVector(getCurrentSyncCommitteeBranchSize(clparams.StateVersion(version))) l.FinalizedHeader = NewLightClientHeader(clparams.StateVersion(version)) - l.FinalityBranch = solid.NewHashVector(FinalizedBranchSize) + l.FinalityBranch = solid.NewHashVector(getFinalizedBranchSize(clparams.StateVersion(version))) l.SyncAggregate = &SyncAggregate{} return ssz2.UnmarshalSSZ(buf, version, l.AttestedHeader, l.NextSyncCommittee, l.NextSyncCommitteeBranch, l.FinalizedHeader, l.FinalityBranch, l.SyncAggregate, &l.SignatureSlot) } @@ -178,7 +188,7 @@ func NewLightClientBootstrap(version clparams.StateVersion) *LightClientBootstra return &LightClientBootstrap{ Header: NewLightClientHeader(version), CurrentSyncCommittee: &solid.SyncCommittee{}, - CurrentSyncCommitteeBranch: solid.NewHashVector(CurrentSyncCommitteeBranchSize), + CurrentSyncCommitteeBranch: solid.NewHashVector(getCurrentSyncCommitteeBranchSize(version)), } } @@ -189,7 +199,7 @@ func (l *LightClientBootstrap) EncodeSSZ(buf []byte) ([]byte, error) { func (l *LightClientBootstrap) DecodeSSZ(buf []byte, version int) error { l.Header = NewLightClientHeader(clparams.StateVersion(version)) l.CurrentSyncCommittee = &solid.SyncCommittee{} - l.CurrentSyncCommitteeBranch = solid.NewHashVector(CurrentSyncCommitteeBranchSize) + l.CurrentSyncCommitteeBranch = solid.NewHashVector(getCurrentSyncCommitteeBranchSize(clparams.StateVersion(version))) return ssz2.UnmarshalSSZ(buf, version, l.Header, l.CurrentSyncCommittee, l.CurrentSyncCommitteeBranch) } @@ -227,7 +237,7 @@ func NewLightClientFinalityUpdate(version clparams.StateVersion) *LightClientFin return &LightClientFinalityUpdate{ AttestedHeader: NewLightClientHeader(version), FinalizedHeader: NewLightClientHeader(version), - FinalityBranch: solid.NewHashVector(FinalizedBranchSize), + FinalityBranch: solid.NewHashVector(getFinalizedBranchSize(version)), SyncAggregate: &SyncAggregate{}, } } @@ -239,7 +249,7 @@ func (l *LightClientFinalityUpdate) EncodeSSZ(buf []byte) ([]byte, error) { func (l *LightClientFinalityUpdate) DecodeSSZ(buf []byte, version int) error { l.AttestedHeader = NewLightClientHeader(clparams.StateVersion(version)) l.FinalizedHeader = NewLightClientHeader(clparams.StateVersion(version)) - l.FinalityBranch = solid.NewHashVector(FinalizedBranchSize) + l.FinalityBranch = solid.NewHashVector(getFinalizedBranchSize(clparams.StateVersion(version))) l.SyncAggregate = &SyncAggregate{} return ssz2.UnmarshalSSZ(buf, version, l.AttestedHeader, l.FinalizedHeader, l.FinalityBranch, l.SyncAggregate, &l.SignatureSlot) } @@ -315,3 +325,24 @@ func (l *LightClientOptimisticUpdate) Clone() clonable.Clonable { } return NewLightClientOptimisticUpdate(v) } + +func getCurrentSyncCommitteeBranchSize(version clparams.StateVersion) int { + if version >= clparams.ElectraVersion { + return CurrentSyncCommitteeBranchSizeElectra + } + return CurrentSyncCommitteeBranchSize +} + +func getFinalizedBranchSize(version clparams.StateVersion) int { + if version >= clparams.ElectraVersion { + return FinalizedBranchSizeElectra + } + return FinalizedBranchSize +} + +func getSyncCommitteeBranchSize(version clparams.StateVersion) int { + if version >= clparams.ElectraVersion { + return SyncCommitteeBranchSizeElectra + } + return SyncCommitteeBranchSize +} diff --git a/cl/cltypes/slashings.go b/cl/cltypes/slashings.go index 26f8a05c9af..8f1adc3be21 100644 --- a/cl/cltypes/slashings.go +++ b/cl/cltypes/slashings.go @@ -57,13 +57,18 @@ func NewAttesterSlashing(version clparams.StateVersion) *AttesterSlashing { } } +func (a *AttesterSlashing) SetVersion(v clparams.StateVersion) { + a.Attestation_1.SetVersion(v) + a.Attestation_2.SetVersion(v) +} + func (a *AttesterSlashing) EncodeSSZ(dst []byte) ([]byte, error) { return ssz2.MarshalSSZ(dst, a.Attestation_1, a.Attestation_2) } func (a *AttesterSlashing) DecodeSSZ(buf []byte, version int) error { - a.Attestation_1 = new(IndexedAttestation) - a.Attestation_2 = new(IndexedAttestation) + a.Attestation_1 = NewIndexedAttestation(clparams.StateVersion(version)) + a.Attestation_2 = NewIndexedAttestation(clparams.StateVersion(version)) return ssz2.UnmarshalSSZ(buf, version, a.Attestation_1, a.Attestation_2) } diff --git a/cl/cltypes/solid/attestation.go b/cl/cltypes/solid/attestation.go index b63a9f9be0b..3bcb7147fd7 100644 --- a/cl/cltypes/solid/attestation.go +++ b/cl/cltypes/solid/attestation.go @@ -45,7 +45,7 @@ type Attestation struct { CommitteeBits *BitVector `json:"committee_bits,omitempty"` // Electra EIP-7549 } -func (a *Attestation) ElectraSingleCommitteeIndex() (uint64, error) { +func (a *Attestation) GetCommitteeIndexFromBits() (uint64, error) { bits := a.CommitteeBits.GetOnIndices() if len(bits) == 0 { return 0, errors.New("no committee bits set in electra attestation") @@ -72,9 +72,9 @@ func (a *Attestation) Copy() *Attestation { func (a *Attestation) EncodingSizeSSZ() (size int) { if a.CommitteeBits != nil { // Electra case - return 4 + AttestationDataSize + length.Bytes96 + 4 + - a.AggregationBits.EncodingSizeSSZ() + - a.CommitteeBits.EncodingSizeSSZ() + return 4 + AttestationDataSize + length.Bytes96 + + a.CommitteeBits.EncodingSizeSSZ() + + a.AggregationBits.EncodingSizeSSZ() } // Deneb case size = AttestationDataSize + length.Bytes96 @@ -150,6 +150,7 @@ func (a *Attestation) UnmarshalJSON(data []byte) error { a.Data = temp.Data a.Signature = temp.Signature a.CommitteeBits = temp.CommitteeBits + return nil } // Deneb case @@ -164,3 +165,54 @@ func (a *Attestation) UnmarshalJSON(data []byte) error { a.Signature = temp.Signature return nil } + +// class SingleAttestation(Container): +// +// committee_index: CommitteeIndex +// attester_index: ValidatorIndex +// data: AttestationData +// signature: BLSSignature +type SingleAttestation struct { + CommitteeIndex uint64 `json:"committee_index"` + AttesterIndex uint64 `json:"attester_index"` + Data *AttestationData `json:"data"` + Signature libcommon.Bytes96 `json:"signature"` +} + +func (s *SingleAttestation) EncodeSSZ(dst []byte) ([]byte, error) { + return ssz2.MarshalSSZ(dst, &s.CommitteeIndex, &s.AttesterIndex, s.Data, s.Signature[:]) +} + +func (s *SingleAttestation) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, &s.CommitteeIndex, &s.AttesterIndex, s.Data, s.Signature[:]) +} + +func (s *SingleAttestation) EncodingSizeSSZ() (size int) { + return 8 + 8 + AttestationDataSize + length.Bytes96 +} + +func (s *SingleAttestation) HashSSZ() (o [32]byte, err error) { + return merkle_tree.HashTreeRoot(&s.CommitteeIndex, &s.AttesterIndex, s.Data, s.Signature[:]) +} + +func (s *SingleAttestation) Clone() clonable.Clonable { + return &SingleAttestation{ + Data: &AttestationData{}, + } +} + +func (s *SingleAttestation) Static() bool { + return true +} + +func (s *SingleAttestation) ToAttestation(memberIndexInCommittee int) *Attestation { + committeeBits := NewBitVector(maxCommitteesPerSlot) + aggregationBits := NewBitList(0, aggregationBitsSizeElectra) + aggregationBits.SetOnBit(maxValidatorsPerCommittee*int(s.CommitteeIndex) + memberIndexInCommittee) + return &Attestation{ + AggregationBits: aggregationBits, + Data: s.Data, + Signature: s.Signature, + CommitteeBits: committeeBits, + } +} diff --git a/cl/cltypes/solid/bitlist.go b/cl/cltypes/solid/bitlist.go index 2eb712d19a1..33d10ee4f44 100644 --- a/cl/cltypes/solid/bitlist.go +++ b/cl/cltypes/solid/bitlist.go @@ -128,6 +128,50 @@ func (u *BitList) Set(index int, v byte) { u.u[index] = v } +func (u *BitList) removeMsb() { + for i := len(u.u) - 1; i >= 0; i-- { + if u.u[i] != 0 { + // find last bit, make a mask and clear it + u.u[i] &= ^(1 << uint(bits.Len8(u.u[i])-1)) + break + } + } +} + +func (u *BitList) addMsb() { + for i := len(u.u) - 1; i >= 0; i-- { + if u.u[i] != 0 { + msb := bits.Len8(u.u[i]) + if msb == 7 { + if i == len(u.u)-1 { + u.u = append(u.u, 0) + } + u.u[i+1] |= 1 + } else { + u.u[i] |= 1 << uint(msb+1) + } + break + } + } +} + +func (u *BitList) SetOnBit(bitIndex int) { + if bitIndex >= u.c { + return + } + // remove the last on bit if necessary + u.removeMsb() + // expand the bitlist if necessary + for len(u.u)*8 <= bitIndex { + u.u = append(u.u, 0) + } + // set the bit + u.u[bitIndex/8] |= 1 << uint(bitIndex%8) + // set last bit + u.addMsb() + u.l = len(u.u) +} + // Length gives us the length of the bitlist, just like a roll call tells us how many Rangers there are. func (u *BitList) Length() int { return u.l diff --git a/cl/cltypes/solid/bitvector.go b/cl/cltypes/solid/bitvector.go index 3271642298f..d30e180d456 100644 --- a/cl/cltypes/solid/bitvector.go +++ b/cl/cltypes/solid/bitvector.go @@ -42,7 +42,7 @@ func (b *BitVector) BitCap() int { } func (b *BitVector) Static() bool { - return false + return true } func (b *BitVector) GetBitAt(i int) bool { @@ -117,27 +117,26 @@ func (b *BitVector) EncodingSizeSSZ() int { } func (b *BitVector) DecodeSSZ(buf []byte, _ int) error { - b.bitLen = len(buf) * 8 - b.container = make([]byte, len(buf)) + b.bitLen = b.bitCap // bitCap must be set before decoding by NewBitVector + b.container = make([]byte, b.EncodingSizeSSZ()) copy(b.container, buf) return nil } func (b *BitVector) EncodeSSZ(dst []byte) ([]byte, error) { // allocate enough space - if cap(dst) < b.EncodingSizeSSZ() { - dst = make([]byte, 0, b.EncodingSizeSSZ()) - } - dst = append(dst, b.container...) - // pad with zeros - for i := len(b.container); i < (b.bitCap+7)/8; i++ { - dst = append(dst, 0) + if len(dst) < b.EncodingSizeSSZ() { + dst = append(dst, make([]byte, b.EncodingSizeSSZ()-len(dst))...) } + copy(dst, b.container) return dst, nil } func (b *BitVector) HashSSZ() ([32]byte, error) { - return merkle_tree.BitvectorRootWithLimit(b.container, uint64(b.bitCap)) + // zero padding + buf := make([]byte, b.EncodingSizeSSZ()) + copy(buf, b.container) + return merkle_tree.BitvectorRootWithLimit(buf, uint64(b.bitCap)) } func (b *BitVector) MarshalJSON() ([]byte, error) { @@ -151,6 +150,7 @@ func (b *BitVector) UnmarshalJSON(data []byte) error { } b.container = hex b.bitLen = len(hex) * 8 + b.bitCap = b.bitLen return nil } diff --git a/cl/cltypes/solid/consolidation.go b/cl/cltypes/solid/consolidation.go new file mode 100644 index 00000000000..cce6b32c9c7 --- /dev/null +++ b/cl/cltypes/solid/consolidation.go @@ -0,0 +1,86 @@ +package solid + +import ( + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/length" + "github.com/erigontech/erigon-lib/types/clonable" + "github.com/erigontech/erigon/cl/clparams" + "github.com/erigontech/erigon/cl/merkle_tree" + ssz2 "github.com/erigontech/erigon/cl/ssz" +) + +var ( + _ EncodableHashableSSZ = (*ConsolidationRequest)(nil) + _ ssz2.SizedObjectSSZ = (*ConsolidationRequest)(nil) + + _ EncodableHashableSSZ = (*PendingConsolidation)(nil) + _ ssz2.SizedObjectSSZ = (*PendingConsolidation)(nil) +) + +const ( + SizeConsolidationRequest = length.Addr + length.Bytes48 + length.Bytes48 + SizePendingConsolidation = 8 + 8 +) + +type ConsolidationRequest struct { + SourceAddress common.Address `json:"source_address"` + SourcePubKey common.Bytes48 `json:"source_pubkey"` // BLS public key + TargetPubKey common.Bytes48 `json:"target_pubkey"` // BLS public key +} + +func (p *ConsolidationRequest) EncodingSizeSSZ() int { + return SizeConsolidationRequest +} + +func (p *ConsolidationRequest) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, p.SourceAddress[:], p.SourcePubKey[:], p.TargetPubKey[:]) +} + +func (p *ConsolidationRequest) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, p.SourceAddress[:], p.SourcePubKey[:], p.TargetPubKey[:]) +} + +func (p *ConsolidationRequest) Clone() clonable.Clonable { + return &ConsolidationRequest{} +} + +func (p *ConsolidationRequest) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(p.SourceAddress[:], p.SourcePubKey[:], p.TargetPubKey[:]) +} + +func (p *ConsolidationRequest) Static() bool { + return true +} + +type PendingConsolidation struct { + SourceIndex uint64 // validator index + TargetIndex uint64 // validator index +} + +func (p *PendingConsolidation) EncodingSizeSSZ() int { + return 16 +} + +func (p *PendingConsolidation) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, &p.SourceIndex, &p.TargetIndex) +} + +func (p *PendingConsolidation) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, &p.SourceIndex, &p.TargetIndex) +} + +func (p *PendingConsolidation) Clone() clonable.Clonable { + return &PendingConsolidation{} +} + +func (p *PendingConsolidation) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(&p.SourceIndex, &p.TargetIndex) +} + +func (p *PendingConsolidation) Static() bool { + return true +} + +func NewPendingConsolidationList(cfg *clparams.BeaconChainConfig) *ListSSZ[*PendingConsolidation] { + return NewStaticListSSZ[*PendingConsolidation](int(cfg.PendingConsolidationsLimit), SizePendingConsolidation) +} diff --git a/cl/cltypes/solid/deposits.go b/cl/cltypes/solid/deposits.go new file mode 100644 index 00000000000..d4867ccc38c --- /dev/null +++ b/cl/cltypes/solid/deposits.go @@ -0,0 +1,91 @@ +package solid + +import ( + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/length" + "github.com/erigontech/erigon-lib/types/clonable" + "github.com/erigontech/erigon/cl/clparams" + "github.com/erigontech/erigon/cl/merkle_tree" + ssz2 "github.com/erigontech/erigon/cl/ssz" +) + +var ( + _ EncodableHashableSSZ = (*DepositRequest)(nil) + _ ssz2.SizedObjectSSZ = (*DepositRequest)(nil) + + _ EncodableHashableSSZ = (*PendingDeposit)(nil) + _ ssz2.SizedObjectSSZ = (*PendingDeposit)(nil) +) + +const ( + SizeDepositRequest = length.Bytes48 + length.Hash + 8 + length.Bytes96 + 8 + SizePendingDeposit = length.Bytes48 + length.Hash + 8 + length.Bytes96 + 8 +) + +type DepositRequest struct { + PubKey common.Bytes48 `json:"pubkey"` // BLS public key + WithdrawalCredentials common.Hash `json:"withdrawal_credentials"` + Amount uint64 `json:"amount"` // Gwei + Signature common.Bytes96 `json:"signature"` // BLS signature + Index uint64 `json:"index"` // validator index +} + +func (p *DepositRequest) EncodingSizeSSZ() int { + return SizeDepositRequest +} + +func (p *DepositRequest) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, p.PubKey[:], p.WithdrawalCredentials[:], &p.Amount, p.Signature[:], &p.Index) +} + +func (p *DepositRequest) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, p.PubKey[:], p.WithdrawalCredentials[:], &p.Amount, p.Signature[:], &p.Index) +} + +func (p *DepositRequest) Clone() clonable.Clonable { + return &DepositRequest{} +} + +func (p *DepositRequest) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(p.PubKey[:], p.WithdrawalCredentials[:], &p.Amount, p.Signature[:], &p.Index) +} + +func (p *DepositRequest) Static() bool { + return true +} + +type PendingDeposit struct { + PubKey common.Bytes48 // BLS public key + WithdrawalCredentials common.Hash + Amount uint64 // Gwei + Signature common.Bytes96 // BLS signature + Slot uint64 +} + +func (p *PendingDeposit) EncodingSizeSSZ() int { + return SizePendingDeposit +} + +func (p *PendingDeposit) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, p.PubKey[:], p.WithdrawalCredentials[:], &p.Amount, p.Signature[:], &p.Slot) +} + +func (p *PendingDeposit) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, p.PubKey[:], p.WithdrawalCredentials[:], &p.Amount, p.Signature[:], &p.Slot) +} + +func (p *PendingDeposit) Clone() clonable.Clonable { + return &PendingDeposit{} +} + +func (p *PendingDeposit) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(p.PubKey[:], p.WithdrawalCredentials[:], &p.Amount, p.Signature[:], &p.Slot) +} + +func (p *PendingDeposit) Static() bool { + return true +} + +func NewPendingDepositList(cfg *clparams.BeaconChainConfig) *ListSSZ[*PendingDeposit] { + return NewStaticListSSZ[*PendingDeposit](int(cfg.PendingDepositLimit), SizePendingDeposit) +} diff --git a/cl/cltypes/solid/list_ssz.go b/cl/cltypes/solid/list_ssz.go index d82ae7bb687..58135604a85 100644 --- a/cl/cltypes/solid/list_ssz.go +++ b/cl/cltypes/solid/list_ssz.go @@ -25,12 +25,12 @@ import ( "github.com/erigontech/erigon/cl/merkle_tree" ) -type encodableHashableSSZ interface { +type EncodableHashableSSZ interface { ssz.EncodableSSZ ssz.HashableSSZ } -type ListSSZ[T encodableHashableSSZ] struct { +type ListSSZ[T EncodableHashableSSZ] struct { list []T limit int @@ -45,14 +45,14 @@ type ListSSZ[T encodableHashableSSZ] struct { root libcommon.Hash } -func NewDynamicListSSZ[T encodableHashableSSZ](limit int) *ListSSZ[T] { +func NewDynamicListSSZ[T EncodableHashableSSZ](limit int) *ListSSZ[T] { return &ListSSZ[T]{ list: make([]T, 0), limit: limit, } } -func NewStaticListSSZ[T encodableHashableSSZ](limit int, bytesPerElement int) *ListSSZ[T] { +func NewStaticListSSZ[T EncodableHashableSSZ](limit int, bytesPerElement int) *ListSSZ[T] { return &ListSSZ[T]{ list: make([]T, 0), limit: limit, @@ -69,14 +69,14 @@ func (l *ListSSZ[T]) UnmarshalJSON(data []byte) error { return json.Unmarshal(data, &l.list) } -func NewDynamicListSSZFromList[T encodableHashableSSZ](list []T, limit int) *ListSSZ[T] { +func NewDynamicListSSZFromList[T EncodableHashableSSZ](list []T, limit int) *ListSSZ[T] { return &ListSSZ[T]{ list: list, limit: limit, } } -func NewStaticListSSZFromList[T encodableHashableSSZ](list []T, limit int, bytesPerElement int) *ListSSZ[T] { +func NewStaticListSSZFromList[T EncodableHashableSSZ](list []T, limit int, bytesPerElement int) *ListSSZ[T] { return &ListSSZ[T]{ list: list, limit: limit, @@ -172,6 +172,15 @@ func (l *ListSSZ[T]) Truncate(length int) { l.root = libcommon.Hash{} } +func (l *ListSSZ[T]) Cut(length int) { + if length >= len(l.list) { + l.list = make([]T, 0) + } else { + l.list = l.list[length:] + } + l.root = libcommon.Hash{} +} + func (l *ListSSZ[T]) ElementProof(i int) [][32]byte { leaves := make([]interface{}, l.limit) for i := range leaves { @@ -191,3 +200,15 @@ func (l *ListSSZ[T]) ElementProof(i int) [][32]byte { } return append(branch, merkle_tree.Uint64Root(uint64(len(l.list)))) } + +func (l *ListSSZ[T]) ShallowCopy() *ListSSZ[T] { + cpy := &ListSSZ[T]{ + list: make([]T, len(l.list), cap(l.list)), + limit: l.limit, + static: l.static, + bytesPerElement: l.bytesPerElement, + root: libcommon.Hash(libcommon.CopyBytes(l.root[:])), + } + copy(cpy.list, l.list) + return cpy +} diff --git a/cl/cltypes/solid/uint64_raw_list.go b/cl/cltypes/solid/uint64_raw_list.go index c25a7d7a193..6b45febb6e6 100644 --- a/cl/cltypes/solid/uint64_raw_list.go +++ b/cl/cltypes/solid/uint64_raw_list.go @@ -43,6 +43,10 @@ func NewRawUint64List(limit int, u []uint64) *RawUint64List { } } +func (arr *RawUint64List) SetCap(c int) { + arr.c = c +} + func (arr *RawUint64List) Clear() { arr.cachedHash = libcommon.Hash{} arr.u = arr.u[:0] diff --git a/cl/cltypes/solid/validator_set.go b/cl/cltypes/solid/validator_set.go index 1af61dfd9cc..6c439c5d53c 100644 --- a/cl/cltypes/solid/validator_set.go +++ b/cl/cltypes/solid/validator_set.go @@ -21,7 +21,6 @@ import ( "io" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/types/clonable" "github.com/erigontech/erigon-lib/types/ssz" "github.com/erigontech/erigon/cl/merkle_tree" @@ -208,27 +207,12 @@ func (v *ValidatorSet) HashSSZ() ([32]byte, error) { return utils.Sha256(coreRoot[:], lengthRoot[:]), nil } -func computeFlatRootsToBuffer(depth uint8, layerBuffer, output []byte) error { - for i := uint8(0); i < depth; i++ { - // Sequential - if len(layerBuffer)%64 != 0 { - layerBuffer = append(layerBuffer, merkle_tree.ZeroHashes[i][:]...) - } - if err := merkle_tree.HashByteSlice(layerBuffer, layerBuffer); err != nil { - return err - } - layerBuffer = layerBuffer[:len(layerBuffer)/2] - } - - copy(output, layerBuffer[:length.Hash]) - return nil -} - func (v *ValidatorSet) Set(idx int, val Validator) { if idx >= v.l { panic("ValidatorSet -- Set: out of bounds") } copy(v.buffer[idx*validatorSize:(idx*validatorSize)+validatorSize], val) + v.zeroTreeHash(idx) } func (v *ValidatorSet) getPhase0(idx int) *Phase0Data { diff --git a/cl/cltypes/solid/withdrawal.go b/cl/cltypes/solid/withdrawal.go new file mode 100644 index 00000000000..65eb10e9aa1 --- /dev/null +++ b/cl/cltypes/solid/withdrawal.go @@ -0,0 +1,87 @@ +package solid + +import ( + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/length" + "github.com/erigontech/erigon-lib/types/clonable" + "github.com/erigontech/erigon/cl/clparams" + "github.com/erigontech/erigon/cl/merkle_tree" + ssz2 "github.com/erigontech/erigon/cl/ssz" +) + +var ( + _ EncodableHashableSSZ = (*WithdrawalRequest)(nil) + _ ssz2.SizedObjectSSZ = (*WithdrawalRequest)(nil) + + _ EncodableHashableSSZ = (*PendingPartialWithdrawal)(nil) + _ ssz2.SizedObjectSSZ = (*PendingPartialWithdrawal)(nil) +) + +const ( + SizeWithdrawalRequest = length.Addr + length.Bytes48 + 8 + SizePendingPartialWithdrawal = 8 + 8 + 8 +) + +type WithdrawalRequest struct { + SourceAddress common.Address `json:"source_address"` + ValidatorPubKey common.Bytes48 `json:"validator_pubkey"` // BLS public key + Amount uint64 `json:"amount"` // Gwei +} + +func (p *WithdrawalRequest) EncodingSizeSSZ() int { + return SizeWithdrawalRequest +} + +func (p *WithdrawalRequest) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, p.SourceAddress[:], p.ValidatorPubKey[:], &p.Amount) +} + +func (p *WithdrawalRequest) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, p.SourceAddress[:], p.ValidatorPubKey[:], &p.Amount) +} + +func (p *WithdrawalRequest) Clone() clonable.Clonable { + return &WithdrawalRequest{} +} + +func (p *WithdrawalRequest) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(p.SourceAddress[:], p.ValidatorPubKey[:], &p.Amount) +} + +func (p *WithdrawalRequest) Static() bool { + return true +} + +type PendingPartialWithdrawal struct { + Index uint64 // validator index + Amount uint64 // Gwei + WithdrawableEpoch uint64 +} + +func (p *PendingPartialWithdrawal) EncodingSizeSSZ() int { + return SizePendingPartialWithdrawal +} + +func (p *PendingPartialWithdrawal) EncodeSSZ(buf []byte) ([]byte, error) { + return ssz2.MarshalSSZ(buf, &p.Index, &p.Amount, &p.WithdrawableEpoch) +} + +func (p *PendingPartialWithdrawal) DecodeSSZ(buf []byte, version int) error { + return ssz2.UnmarshalSSZ(buf, version, &p.Index, &p.Amount, &p.WithdrawableEpoch) +} + +func (p *PendingPartialWithdrawal) Clone() clonable.Clonable { + return &PendingPartialWithdrawal{} +} + +func (p *PendingPartialWithdrawal) HashSSZ() ([32]byte, error) { + return merkle_tree.HashTreeRoot(&p.Index, &p.Amount, &p.WithdrawableEpoch) +} + +func (p *PendingPartialWithdrawal) Static() bool { + return true +} + +func NewPendingWithdrawalList(cfg *clparams.BeaconChainConfig) *ListSSZ[*PendingPartialWithdrawal] { + return NewStaticListSSZ[*PendingPartialWithdrawal](int(cfg.PendingPartialWithdrawalsLimit), SizePendingPartialWithdrawal) +} diff --git a/cl/monitor/metrics.go b/cl/monitor/metrics.go index b0250f46644..3fac5638337 100644 --- a/cl/monitor/metrics.go +++ b/cl/monitor/metrics.go @@ -40,6 +40,7 @@ var ( ProcessHistoricalRootsUpdateTime = metrics.GetOrCreateGauge("process_historical_roots_update_time") ProcessParticipationFlagUpdatesTime = metrics.GetOrCreateGauge("process_participation_flag_updates_time") ProcessSyncCommitteeUpdateTime = metrics.GetOrCreateGauge("process_sync_committee_update_time") + ProcessPendingDepositsTime = metrics.GetOrCreateGauge("process_pending_deposits_time") // Network metrics gossipTopicsMetricCounterPrefix = "gossip_topics_seen" diff --git a/cl/phase1/core/state/accessors.go b/cl/phase1/core/state/accessors.go index e5245237ccc..99563c98d7c 100644 --- a/cl/phase1/core/state/accessors.go +++ b/cl/phase1/core/state/accessors.go @@ -24,6 +24,7 @@ import ( "github.com/Giulio2002/bls" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/abstract" "github.com/erigontech/erigon/cl/clparams" @@ -224,9 +225,15 @@ func GetUnslashedParticipatingIndices(b abstract.BeaconState, flagIndex int, epo // IsValidatorEligibleForActivationQueue returns whether the validator is eligible to be placed into the activation queue. // Implementation of is_eligible_for_activation_queue. // Specs at: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue +// updated for Electra: https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/beacon-chain.md#modified-is_eligible_for_activation_queue func IsValidatorEligibleForActivationQueue(b abstract.BeaconState, validator solid.Validator) bool { + if b.Version() <= clparams.DenebVersion { + return validator.ActivationEligibilityEpoch() == b.BeaconConfig().FarFutureEpoch && + validator.EffectiveBalance() == b.BeaconConfig().MaxEffectiveBalance + } + // Electra and after return validator.ActivationEligibilityEpoch() == b.BeaconConfig().FarFutureEpoch && - validator.EffectiveBalance() == b.BeaconConfig().MaxEffectiveBalance + validator.EffectiveBalance() >= b.BeaconConfig().MinActivationBalance } // IsValidatorEligibleForActivation returns whether the validator is eligible for activation. @@ -239,6 +246,12 @@ func IsValidatorEligibleForActivation(b abstract.BeaconState, validator solid.Va // IsMergeTransitionComplete returns whether a merge transition is complete by verifying the presence of a valid execution payload header. func IsMergeTransitionComplete(b abstract.BeaconState) bool { + if b.Version() < clparams.BellatrixVersion { + return false + } + if b.Version() > clparams.BellatrixVersion { + return true + } return !b.LatestExecutionPayloadHeader().IsZero() } @@ -248,7 +261,7 @@ func ComputeTimestampAtSlot(b abstract.BeaconState, slot uint64) uint64 { } // ExpectedWithdrawals calculates the expected withdrawals that can be made by validators in the current epoch -func ExpectedWithdrawals(b abstract.BeaconState, currentEpoch uint64) []*cltypes.Withdrawal { +func ExpectedWithdrawals(b abstract.BeaconState, currentEpoch uint64) ([]*cltypes.Withdrawal, uint64) { // Get the current epoch, the next withdrawal index, and the next withdrawal validator index nextWithdrawalIndex := b.NextWithdrawalIndex() nextWithdrawalValidatorIndex := b.NextWithdrawalValidatorIndex() @@ -258,16 +271,64 @@ func ExpectedWithdrawals(b abstract.BeaconState, currentEpoch uint64) []*cltypes maxValidatorsPerWithdrawalsSweep := b.BeaconConfig().MaxValidatorsPerWithdrawalsSweep bound := min(maxValidators, maxValidatorsPerWithdrawalsSweep) withdrawals := make([]*cltypes.Withdrawal, 0, bound) + partialWithdrawalsCount := uint64(0) + + // [New in Electra:EIP7251] Consume pending partial withdrawals + cfg := b.BeaconConfig() + if b.Version().AfterOrEqual(clparams.ElectraVersion) { + b.GetPendingPartialWithdrawals().Range(func(index int, w *solid.PendingPartialWithdrawal, length int) bool { + if w.WithdrawableEpoch > currentEpoch || len(withdrawals) == int(cfg.MaxPendingPartialsPerWithdrawalsSweep) { + return false + } + validatorBalance, err := b.ValidatorBalance(int(w.Index)) + if err != nil { + log.Warn("Failed to get validator balance", "index", w.Index, "error", err) + return false + } + validator := b.ValidatorSet().Get(int(w.Index)) + if validator.ExitEpoch() == cfg.FarFutureEpoch && + validator.EffectiveBalance() >= cfg.MinActivationBalance && + validatorBalance > cfg.MinActivationBalance { + wd := validator.WithdrawalCredentials() + withdrawableBalance := min(validatorBalance-cfg.MinActivationBalance, w.Amount) + withdrawals = append(withdrawals, &cltypes.Withdrawal{ + Index: nextWithdrawalIndex, + Validator: w.Index, + Address: libcommon.BytesToAddress(wd[12:]), + Amount: withdrawableBalance, + }) + nextWithdrawalIndex++ + } + partialWithdrawalsCount++ + return true + }) + } // Loop through the validators to calculate expected withdrawals for validatorCount := uint64(0); validatorCount < bound && len(withdrawals) != int(b.BeaconConfig().MaxWithdrawalsPerPayload); validatorCount++ { // Get the validator and balance for the current validator index // supposedly this operation is safe because we checked the validator length about currentValidator, _ := b.ValidatorForValidatorIndex(int(nextWithdrawalValidatorIndex)) - currentBalance, _ := b.ValidatorBalance(int(nextWithdrawalValidatorIndex)) + currentBalance, err := b.ValidatorBalance(int(nextWithdrawalValidatorIndex)) + if err != nil { + log.Warn("Failed to get validator balance", "index", nextWithdrawalValidatorIndex, "error", err) + } + if b.Version() >= clparams.ElectraVersion { + partiallyWithdrawnBalance := uint64(0) + for _, w := range withdrawals { + if w.Validator == nextWithdrawalValidatorIndex { + partiallyWithdrawnBalance += w.Amount + } + } + if currentBalance <= partiallyWithdrawnBalance { + currentBalance = 0 + } else { + currentBalance -= partiallyWithdrawnBalance + } + } wd := currentValidator.WithdrawalCredentials() // Check if the validator is fully withdrawable - if isFullyWithdrawableValidator(b.BeaconConfig(), currentValidator, currentBalance, currentEpoch) { + if isFullyWithdrawableValidator(b, currentValidator, currentBalance, currentEpoch) { // Add a new withdrawal with the validator's withdrawal credentials and balance newWithdrawal := &cltypes.Withdrawal{ Index: nextWithdrawalIndex, @@ -277,22 +338,25 @@ func ExpectedWithdrawals(b abstract.BeaconState, currentEpoch uint64) []*cltypes } withdrawals = append(withdrawals, newWithdrawal) nextWithdrawalIndex++ - } else if isPartiallyWithdrawableValidator(b.BeaconConfig(), currentValidator, currentBalance) { // Check if the validator is partially withdrawable + } else if isPartiallyWithdrawableValidator(b, currentValidator, currentBalance) { // Check if the validator is partially withdrawable // Add a new withdrawal with the validator's withdrawal credentials and balance minus the maximum effective balance + amount := currentBalance - b.BeaconConfig().MaxEffectiveBalance + if b.Version() >= clparams.ElectraVersion { + amount = currentBalance - getMaxEffectiveBalanceElectra(currentValidator, b.BeaconConfig()) + } newWithdrawal := &cltypes.Withdrawal{ Index: nextWithdrawalIndex, Validator: nextWithdrawalValidatorIndex, Address: libcommon.BytesToAddress(wd[12:]), - Amount: currentBalance - b.BeaconConfig().MaxEffectiveBalance, + Amount: amount, } withdrawals = append(withdrawals, newWithdrawal) nextWithdrawalIndex++ } - // Increment the validator index, looping back to 0 if necessary nextWithdrawalValidatorIndex = (nextWithdrawalValidatorIndex + 1) % maxValidators } // Return the withdrawals slice - return withdrawals + return withdrawals, partialWithdrawalsCount } diff --git a/cl/phase1/core/state/cache.go b/cl/phase1/core/state/cache.go index a3986878753..169c7ec18f3 100644 --- a/cl/phase1/core/state/cache.go +++ b/cl/phase1/core/state/cache.go @@ -27,7 +27,7 @@ import ( "github.com/erigontech/erigon/cl/merkle_tree" "github.com/erigontech/erigon/cl/phase1/core/state/lru" "github.com/erigontech/erigon/cl/phase1/core/state/raw" - shuffling2 "github.com/erigontech/erigon/cl/phase1/core/state/shuffling" + "github.com/erigontech/erigon/cl/phase1/core/state/shuffling" "github.com/erigontech/erigon/cl/utils/threading" "github.com/erigontech/erigon-lib/common" @@ -89,7 +89,7 @@ func (b *CachingBeaconState) _updateProposerIndex() (err error) { beaconConfig.EpochsPerHistoricalVector // Input for the seed hash. mix := b.GetRandaoMix(int(mixPosition)) - input := shuffling2.GetSeed(b.BeaconConfig(), mix, epoch, b.BeaconConfig().DomainBeaconProposer) + input := shuffling.GetSeed(b.BeaconConfig(), mix, epoch, b.BeaconConfig().DomainBeaconProposer) slotByteArray := make([]byte, 8) binary.LittleEndian.PutUint64(slotByteArray, b.Slot()) @@ -105,7 +105,7 @@ func (b *CachingBeaconState) _updateProposerIndex() (err error) { seedArray := [32]byte{} copy(seedArray[:], seed) b.proposerIndex = new(uint64) - *b.proposerIndex, err = shuffling2.ComputeProposerIndex(b.BeaconState, indices, seedArray) + *b.proposerIndex, err = shuffling.ComputeProposerIndex(b.BeaconState, indices, seedArray) return } diff --git a/cl/phase1/core/state/cache_accessors.go b/cl/phase1/core/state/cache_accessors.go index 8b4794e97be..aa7880a8784 100644 --- a/cl/phase1/core/state/cache_accessors.go +++ b/cl/phase1/core/state/cache_accessors.go @@ -29,7 +29,6 @@ import ( "github.com/erigontech/erigon/cl/monitor/shuffling_metrics" "github.com/erigontech/erigon/cl/phase1/core/caches" "github.com/erigontech/erigon/cl/phase1/core/state/shuffling" - shuffling2 "github.com/erigontech/erigon/cl/phase1/core/state/shuffling" "github.com/erigontech/erigon/cl/utils/threading" "github.com/Giulio2002/bls" @@ -145,7 +144,7 @@ func (b *CachingBeaconState) GetBeaconProposerIndexForSlot(slot uint64) (uint64, beaconConfig.EpochsPerHistoricalVector // Input for the seed hash. mix := b.GetRandaoMix(int(mixPosition)) - input := shuffling2.GetSeed(b.BeaconConfig(), mix, epoch, b.BeaconConfig().DomainBeaconProposer) + input := shuffling.GetSeed(b.BeaconConfig(), mix, epoch, b.BeaconConfig().DomainBeaconProposer) slotByteArray := make([]byte, 8) binary.LittleEndian.PutUint64(slotByteArray, slot) @@ -160,7 +159,7 @@ func (b *CachingBeaconState) GetBeaconProposerIndexForSlot(slot uint64) (uint64, // Write the seed to an array. seedArray := [32]byte{} copy(seedArray[:], seed) - return shuffling2.ComputeProposerIndex(b.BeaconState, indices, seedArray) + return shuffling.ComputeProposerIndex(b.BeaconState, indices, seedArray) } // BaseRewardPerIncrement return base rewards for processing sync committee and duties. @@ -326,7 +325,7 @@ func (b *CachingBeaconState) ComputeNextSyncCommittee() (*solid.SyncCommittee, e if err != nil { return nil, err } - if validator.EffectiveBalance()*math.MaxUint8 >= beaconConfig.MaxEffectiveBalance*randomByte { + if validator.EffectiveBalance()*math.MaxUint8 >= beaconConfig.MaxEffectiveBalanceForVersion(b.Version())*randomByte { syncCommitteePubKeys = append(syncCommitteePubKeys, validator.PublicKey()) } i++ @@ -393,6 +392,7 @@ func (b *CachingBeaconState) GetAttestingIndicies( var ( committeeBits = attestation.CommitteeBits aggregationBits = attestation.AggregationBits + aggrBitsLen = aggregationBits.Bits() attesters = []uint64{} ) committeeOffset := 0 @@ -402,7 +402,7 @@ func (b *CachingBeaconState) GetAttestingIndicies( return nil, err } for i, member := range committee { - if i >= aggregationBits.Bits() { + if i >= aggrBitsLen { return nil, errors.New("GetAttestingIndicies: committee is too big") } if aggregationBits.GetBitAt(committeeOffset + i) { @@ -411,6 +411,9 @@ func (b *CachingBeaconState) GetAttestingIndicies( committeeOffset += len(committee) } } + if committeeOffset != aggrBitsLen { + return nil, errors.New("GetAttestingIndicies: aggregation bits length does not match committee length") + } return attesters, nil } diff --git a/cl/phase1/core/state/cache_mutators.go b/cl/phase1/core/state/cache_mutators.go index 351567a4315..c2d3ed9e5e6 100644 --- a/cl/phase1/core/state/cache_mutators.go +++ b/cl/phase1/core/state/cache_mutators.go @@ -77,15 +77,11 @@ func (b *CachingBeaconState) SlashValidator(slashedInd uint64, whistleblowerInd whistleblowerInd = new(uint64) *whistleblowerInd = proposerInd } - whistleBlowerReward := newEffectiveBalance / b.BeaconConfig().WhistleBlowerRewardQuotient + whistleBlowerReward := newEffectiveBalance / b.BeaconConfig().GetWhistleBlowerRewardQuotient(b.Version()) proposerReward := b.getSlashingProposerReward(whistleBlowerReward) if err := IncreaseBalance(b, proposerInd, proposerReward); err != nil { return 0, err } - rewardWhist := whistleBlowerReward - proposerReward - if whistleblowerInd == nil { - proposerReward += rewardWhist - } return proposerReward, IncreaseBalance(b, *whistleblowerInd, whistleBlowerReward-proposerReward) } @@ -98,24 +94,35 @@ func (b *CachingBeaconState) InitiateValidatorExit(index uint64) error { return nil } - currentEpoch := Epoch(b) - exitQueueEpoch := ComputeActivationExitEpoch(b.BeaconConfig(), currentEpoch) - b.ForEachValidator(func(v solid.Validator, idx, total int) bool { - if v.ExitEpoch() != b.BeaconConfig().FarFutureEpoch && v.ExitEpoch() > exitQueueEpoch { - exitQueueEpoch = v.ExitEpoch() + var exitQueueEpoch uint64 + switch { + case b.Version() >= clparams.ElectraVersion: + // electra and after + effectiveBalance, err := b.ValidatorEffectiveBalance(int(index)) + if err != nil { + return err } - return true - }) + exitQueueEpoch = b.ComputeExitEpochAndUpdateChurn(effectiveBalance) + default: + currentEpoch := Epoch(b) + exitQueueEpoch = ComputeActivationExitEpoch(b.BeaconConfig(), currentEpoch) + b.ForEachValidator(func(v solid.Validator, idx, total int) bool { + if v.ExitEpoch() != b.BeaconConfig().FarFutureEpoch && v.ExitEpoch() > exitQueueEpoch { + exitQueueEpoch = v.ExitEpoch() + } + return true + }) - exitQueueChurn := 0 - b.ForEachValidator(func(v solid.Validator, idx, total int) bool { - if v.ExitEpoch() == exitQueueEpoch { - exitQueueChurn += 1 + exitQueueChurn := 0 + b.ForEachValidator(func(v solid.Validator, idx, total int) bool { + if v.ExitEpoch() == exitQueueEpoch { + exitQueueChurn += 1 + } + return true + }) + if exitQueueChurn >= int(b.GetValidatorChurnLimit()) { + exitQueueEpoch += 1 } - return true - }) - if exitQueueChurn >= int(b.GetValidatorChurnLimit()) { - exitQueueEpoch += 1 } var overflow bool @@ -127,3 +134,30 @@ func (b *CachingBeaconState) InitiateValidatorExit(index uint64) error { b.SetWithdrawableEpochForValidatorAtIndex(int(index), newWithdrawableEpoch) return nil } + +// def compute_exit_epoch_and_update_churn(state: BeaconState, exit_balance: Gwei) -> Epoch +func (b *CachingBeaconState) ComputeExitEpochAndUpdateChurn(exitBalance uint64) uint64 { + earliestExitEpoch := max( + b.EarliestExitEpoch(), + ComputeActivationExitEpoch(b.BeaconConfig(), Epoch(b)), + ) + perEpochChurn := GetActivationExitChurnLimit(b) + + var exitBalanceToConsume uint64 + if b.EarliestExitEpoch() < earliestExitEpoch { + exitBalanceToConsume = perEpochChurn + } else { + exitBalanceToConsume = b.ExitBalanceToConsume() + } + if exitBalance > exitBalanceToConsume { + // Exit doesn't fit in the current earliest epoch. + balanceToProcess := exitBalance - exitBalanceToConsume + addtionalEpochs := (balanceToProcess-1)/perEpochChurn + 1 + earliestExitEpoch += addtionalEpochs + exitBalanceToConsume += addtionalEpochs * perEpochChurn + } + // Consume the balance and update state variables. + b.SetExitBalanceToConsume(exitBalanceToConsume - exitBalance) + b.SetEarliestExitEpoch(earliestExitEpoch) + return earliestExitEpoch +} diff --git a/cl/phase1/core/state/raw/copy.go b/cl/phase1/core/state/raw/copy.go index e57ae890029..fe7d03f5ce8 100644 --- a/cl/phase1/core/state/raw/copy.go +++ b/cl/phase1/core/state/raw/copy.go @@ -78,6 +78,19 @@ func (b *BeaconState) CopyInto(dst *BeaconState) error { dst.historicalSummaries.Append(value) return true }) + if b.version >= clparams.ElectraVersion { + // Electra fields + dst.depositRequestsStartIndex = b.depositRequestsStartIndex + dst.depositBalanceToConsume = b.depositBalanceToConsume + dst.exitBalanceToConsume = b.exitBalanceToConsume + dst.earliestExitEpoch = b.earliestExitEpoch + dst.consolidationBalanceToConsume = b.consolidationBalanceToConsume + dst.earliestConsolidationEpoch = b.earliestConsolidationEpoch + dst.pendingDeposits = b.pendingDeposits.ShallowCopy() + dst.pendingPartialWithdrawals = b.pendingPartialWithdrawals.ShallowCopy() + dst.pendingConsolidations = b.pendingConsolidations.ShallowCopy() + } + dst.version = b.version // Now sync internals copy(dst.leaves, b.leaves) diff --git a/cl/phase1/core/state/raw/getters.go b/cl/phase1/core/state/raw/getters.go index 16d5c258cf1..688bb216c91 100644 --- a/cl/phase1/core/state/raw/getters.go +++ b/cl/phase1/core/state/raw/getters.go @@ -347,3 +347,7 @@ func (b *BeaconState) GetDomain(domainType [4]byte, epoch uint64) ([]byte, error func (b *BeaconState) DebugPrint(prefix string) { fmt.Printf("%s: %x\n", prefix, b.currentEpochParticipation) } + +func (b *BeaconState) GetPendingPartialWithdrawals() *solid.ListSSZ[*solid.PendingPartialWithdrawal] { + return b.pendingPartialWithdrawals +} diff --git a/cl/phase1/core/state/raw/hashing.go b/cl/phase1/core/state/raw/hashing.go index a4390593baf..e340b1e3f2a 100644 --- a/cl/phase1/core/state/raw/hashing.go +++ b/cl/phase1/core/state/raw/hashing.go @@ -35,7 +35,11 @@ func (b *BeaconState) HashSSZ() (out [32]byte, err error) { // fmt.Println(i/32, libcommon.BytesToHash(b.leaves[i:i+32])) // } // Pad to 32 of length - err = merkle_tree.MerkleRootFromFlatLeaves(b.leaves, out[:]) + endIndex := StateLeafSize * 32 + if b.Version() <= clparams.DenebVersion { + endIndex = StateLeafSizeDeneb * 32 + } + err = merkle_tree.MerkleRootFromFlatLeaves(b.leaves[:endIndex], out[:]) return } @@ -43,33 +47,55 @@ func (b *BeaconState) CurrentSyncCommitteeBranch() ([][32]byte, error) { if err := b.computeDirtyLeaves(); err != nil { return nil, err } + depth := 5 + leafSize := StateLeafSizeDeneb + if b.Version() >= clparams.ElectraVersion { + depth = 6 + leafSize = StateLeafSize + } + schema := []interface{}{} - for i := 0; i < len(b.leaves); i += 32 { + for i := 0; i < leafSize*32; i += 32 { schema = append(schema, b.leaves[i:i+32]) } - return merkle_tree.MerkleProof(5, 22, schema...) + + return merkle_tree.MerkleProof(depth, 22, schema...) } func (b *BeaconState) NextSyncCommitteeBranch() ([][32]byte, error) { if err := b.computeDirtyLeaves(); err != nil { return nil, err } + depth := 5 + leafSize := StateLeafSizeDeneb + if b.Version() >= clparams.ElectraVersion { + depth = 6 + leafSize = StateLeafSize + } + schema := []interface{}{} - for i := 0; i < len(b.leaves); i += 32 { + for i := 0; i < leafSize*32; i += 32 { schema = append(schema, b.leaves[i:i+32]) } - return merkle_tree.MerkleProof(5, 23, schema...) + return merkle_tree.MerkleProof(depth, 23, schema...) } func (b *BeaconState) FinalityRootBranch() ([][32]byte, error) { if err := b.computeDirtyLeaves(); err != nil { return nil, err } + depth := 5 + leafSize := StateLeafSizeDeneb + if b.Version() >= clparams.ElectraVersion { + depth = 6 + leafSize = StateLeafSize + } + schema := []interface{}{} - for i := 0; i < len(b.leaves); i += 32 { + for i := 0; i < leafSize*32; i += 32 { schema = append(schema, b.leaves[i:i+32]) } - proof, err := merkle_tree.MerkleProof(5, 20, schema...) + proof, err := merkle_tree.MerkleProof(depth, 20, schema...) if err != nil { return nil, err } @@ -156,28 +182,38 @@ func (b *BeaconState) computeDirtyLeaves() error { beaconStateHasher.add(PreviousJustifiedCheckpointLeafIndex, &b.previousJustifiedCheckpoint) beaconStateHasher.add(CurrentJustifiedCheckpointLeafIndex, &b.currentJustifiedCheckpoint) beaconStateHasher.add(FinalizedCheckpointLeafIndex, &b.finalizedCheckpoint) - if b.version == clparams.Phase0Version { - beaconStateHasher.run() - return nil - } - // Altair fields - beaconStateHasher.add(InactivityScoresLeafIndex, b.inactivityScores) - beaconStateHasher.add(CurrentSyncCommitteeLeafIndex, b.currentSyncCommittee) - beaconStateHasher.add(NextSyncCommitteeLeafIndex, b.nextSyncCommittee) - if b.version < clparams.BellatrixVersion { - beaconStateHasher.run() - return nil - } - // Bellatrix fields - beaconStateHasher.add(LatestExecutionPayloadHeaderLeafIndex, b.latestExecutionPayloadHeader) - if b.version < clparams.CapellaVersion { - beaconStateHasher.run() - return nil - } - // Capella fields - beaconStateHasher.add(NextWithdrawalIndexLeafIndex, b.nextWithdrawalIndex) - beaconStateHasher.add(NextWithdrawalValidatorIndexLeafIndex, b.nextWithdrawalValidatorIndex) - beaconStateHasher.add(HistoricalSummariesLeafIndex, b.historicalSummaries) + + if b.version >= clparams.AltairVersion { + // Altair fields + beaconStateHasher.add(InactivityScoresLeafIndex, b.inactivityScores) + beaconStateHasher.add(CurrentSyncCommitteeLeafIndex, b.currentSyncCommittee) + beaconStateHasher.add(NextSyncCommitteeLeafIndex, b.nextSyncCommittee) + } + + if b.version >= clparams.BellatrixVersion { + // Bellatrix fields + beaconStateHasher.add(LatestExecutionPayloadHeaderLeafIndex, b.latestExecutionPayloadHeader) + } + + if b.version >= clparams.CapellaVersion { + // Capella fields + beaconStateHasher.add(NextWithdrawalIndexLeafIndex, b.nextWithdrawalIndex) + beaconStateHasher.add(NextWithdrawalValidatorIndexLeafIndex, b.nextWithdrawalValidatorIndex) + beaconStateHasher.add(HistoricalSummariesLeafIndex, b.historicalSummaries) + } + + if b.version >= clparams.ElectraVersion { + // Electra fields + beaconStateHasher.add(DepositRequestsStartIndexLeafIndex, b.depositRequestsStartIndex) + beaconStateHasher.add(DepositBalanceToConsumeLeafIndex, b.depositBalanceToConsume) + beaconStateHasher.add(ExitBalanceToConsumeLeafIndex, b.exitBalanceToConsume) + beaconStateHasher.add(EarliestExitEpochLeafIndex, b.earliestExitEpoch) + beaconStateHasher.add(ConsolidationBalanceToConsumeLeafIndex, b.consolidationBalanceToConsume) + beaconStateHasher.add(EarliestConsolidationEpochLeafIndex, b.earliestConsolidationEpoch) + beaconStateHasher.add(PendingDepositsLeafIndex, b.pendingDeposits) + beaconStateHasher.add(PendingPartialWithdrawalsLeafIndex, b.pendingPartialWithdrawals) + beaconStateHasher.add(PendingConsolidationsLeafIndex, b.pendingConsolidations) + } beaconStateHasher.run() diff --git a/cl/phase1/core/state/raw/params.go b/cl/phase1/core/state/raw/params.go index e20b5c9ce21..4fe9df948a5 100644 --- a/cl/phase1/core/state/raw/params.go +++ b/cl/phase1/core/state/raw/params.go @@ -51,10 +51,21 @@ const ( NextWithdrawalIndexLeafIndex StateLeafIndex = 25 NextWithdrawalValidatorIndexLeafIndex StateLeafIndex = 26 HistoricalSummariesLeafIndex StateLeafIndex = 27 + // Electra + DepositRequestsStartIndexLeafIndex StateLeafIndex = 28 + DepositBalanceToConsumeLeafIndex StateLeafIndex = 29 + ExitBalanceToConsumeLeafIndex StateLeafIndex = 30 + EarliestExitEpochLeafIndex StateLeafIndex = 31 + ConsolidationBalanceToConsumeLeafIndex StateLeafIndex = 32 + EarliestConsolidationEpochLeafIndex StateLeafIndex = 33 + PendingDepositsLeafIndex StateLeafIndex = 34 + PendingPartialWithdrawalsLeafIndex StateLeafIndex = 35 + PendingConsolidationsLeafIndex StateLeafIndex = 36 ) const ( - StateLeafSize = 28 + StateLeafSizeDeneb = 32 + StateLeafSize = 37 LeafInitValue = 0 LeafCleanValue = 1 diff --git a/cl/phase1/core/state/raw/setters.go b/cl/phase1/core/state/raw/setters.go index a5c47e45eb4..2a0d8119c68 100644 --- a/cl/phase1/core/state/raw/setters.go +++ b/cl/phase1/core/state/raw/setters.go @@ -515,3 +515,62 @@ func (b *BeaconState) SetSlashings(slashings solid.Uint64VectorSSZ) { b.markLeaf(SlashingsLeafIndex) b.slashings = slashings } + +func (b *BeaconState) SetEarliestExitEpoch(epoch uint64) { + b.earliestExitEpoch = epoch + b.markLeaf(EarliestExitEpochLeafIndex) +} + +func (b *BeaconState) SetExitBalanceToConsume(balance uint64) { + b.exitBalanceToConsume = balance + b.markLeaf(ExitBalanceToConsumeLeafIndex) +} + +func (b *BeaconState) SetPendingPartialWithdrawals(pendingWithdrawals *solid.ListSSZ[*solid.PendingPartialWithdrawal]) { + b.pendingPartialWithdrawals = pendingWithdrawals + b.markLeaf(PendingPartialWithdrawalsLeafIndex) +} + +func (b *BeaconState) AppendPendingDeposit(deposit *solid.PendingDeposit) { + b.pendingDeposits.Append(deposit) + b.markLeaf(PendingDepositsLeafIndex) +} + +func (b *BeaconState) AppendPendingPartialWithdrawal(withdrawal *solid.PendingPartialWithdrawal) { + b.pendingPartialWithdrawals.Append(withdrawal) + b.markLeaf(PendingPartialWithdrawalsLeafIndex) +} + +func (b *BeaconState) AppendPendingConsolidation(consolidation *solid.PendingConsolidation) { + b.pendingConsolidations.Append(consolidation) + b.markLeaf(PendingConsolidationsLeafIndex) +} + +func (b *BeaconState) SetPendingDeposits(deposits *solid.ListSSZ[*solid.PendingDeposit]) { + b.pendingDeposits = deposits + b.markLeaf(PendingDepositsLeafIndex) +} + +func (b *BeaconState) SetPendingConsolidations(consolidations *solid.ListSSZ[*solid.PendingConsolidation]) { + b.pendingConsolidations = consolidations + b.markLeaf(PendingConsolidationsLeafIndex) +} + +func (b *BeaconState) SetDepositBalanceToConsume(balance uint64) { + b.depositBalanceToConsume = balance + b.markLeaf(DepositBalanceToConsumeLeafIndex) +} + +func (b *BeaconState) SetDepositRequestsStartIndex(index uint64) { + b.depositRequestsStartIndex = index + b.markLeaf(DepositRequestsStartIndexLeafIndex) +} + +func (b *BeaconState) SetConsolidationBalanceToConsume(balance uint64) { + b.consolidationBalanceToConsume = balance + b.markLeaf(ConsolidationBalanceToConsumeLeafIndex) +} +func (b *BeaconState) SetEarlistConsolidationEpoch(epoch uint64) { + b.earliestConsolidationEpoch = epoch + b.markLeaf(EarliestConsolidationEpochLeafIndex) +} diff --git a/cl/phase1/core/state/raw/ssz.go b/cl/phase1/core/state/raw/ssz.go index c1e1dfff3fd..c7c7f1134b7 100644 --- a/cl/phase1/core/state/raw/ssz.go +++ b/cl/phase1/core/state/raw/ssz.go @@ -19,6 +19,7 @@ package raw import ( "fmt" + "github.com/erigontech/erigon/cl/cltypes/solid" ssz2 "github.com/erigontech/erigon/cl/ssz" "github.com/erigontech/erigon-lib/types/clonable" @@ -55,6 +56,8 @@ func (b *BeaconState) baseOffsetSSZ() uint32 { return 2736653 case clparams.DenebVersion: return 2736653 + case clparams.ElectraVersion: + return 2736653 default: // ????? panic("tf is that") @@ -81,6 +84,11 @@ func (b *BeaconState) getSchema() []interface{} { if b.version >= clparams.CapellaVersion { s = append(s, &b.nextWithdrawalIndex, &b.nextWithdrawalValidatorIndex, b.historicalSummaries) } + if b.version >= clparams.ElectraVersion { + // Electra fields + s = append(s, &b.depositRequestsStartIndex, &b.depositBalanceToConsume, &b.exitBalanceToConsume, &b.earliestExitEpoch, &b.consolidationBalanceToConsume, + &b.earliestConsolidationEpoch, b.pendingDeposits, b.pendingPartialWithdrawals, b.pendingConsolidations) + } return s } @@ -92,6 +100,11 @@ func (b *BeaconState) DecodeSSZ(buf []byte, version int) error { if version >= int(clparams.BellatrixVersion) { b.latestExecutionPayloadHeader = &cltypes.Eth1Header{} } + if version >= int(clparams.ElectraVersion) { + b.pendingDeposits = solid.NewPendingDepositList(b.beaconConfig) + b.pendingPartialWithdrawals = solid.NewPendingWithdrawalList(b.beaconConfig) + b.pendingConsolidations = solid.NewPendingConsolidationList(b.beaconConfig) + } if err := ssz2.UnmarshalSSZ(buf, version, b.getSchema()...); err != nil { return err } @@ -115,6 +128,14 @@ func (b *BeaconState) EncodingSizeSSZ() (size int) { size += b.inactivityScores.Length() * 8 size += b.historicalSummaries.EncodingSizeSSZ() + + if b.version >= clparams.ElectraVersion { + // 6 uint64 fields + size += 6 * 8 + size += b.pendingDeposits.EncodingSizeSSZ() + size += b.pendingPartialWithdrawals.EncodingSizeSSZ() + size += b.pendingConsolidations.EncodingSizeSSZ() + } return } diff --git a/cl/phase1/core/state/raw/state.go b/cl/phase1/core/state/raw/state.go index 3acbd5e2d11..21e719f2ba2 100644 --- a/cl/phase1/core/state/raw/state.go +++ b/cl/phase1/core/state/raw/state.go @@ -72,6 +72,17 @@ type BeaconState struct { previousEpochAttestations *solid.ListSSZ[*solid.PendingAttestation] currentEpochAttestations *solid.ListSSZ[*solid.PendingAttestation] + // Electra + depositRequestsStartIndex uint64 + depositBalanceToConsume uint64 + exitBalanceToConsume uint64 + earliestExitEpoch uint64 + consolidationBalanceToConsume uint64 + earliestConsolidationEpoch uint64 + pendingDeposits *solid.ListSSZ[*solid.PendingDeposit] + pendingPartialWithdrawals *solid.ListSSZ[*solid.PendingPartialWithdrawal] + pendingConsolidations *solid.ListSSZ[*solid.PendingConsolidation] + // leaves for computing hashes leaves []byte // Pre-computed leaves. touchedLeaves []atomic.Uint32 // Maps each leaf to whether they were touched or not. @@ -107,7 +118,10 @@ func New(cfg *clparams.BeaconChainConfig) *BeaconState { stateRoots: solid.NewHashVector(int(cfg.SlotsPerHistoricalRoot)), randaoMixes: solid.NewHashVector(int(cfg.EpochsPerHistoricalVector)), validators: solid.NewValidatorSet(int(cfg.ValidatorRegistryLimit)), - leaves: make([]byte, 32*32), + leaves: make([]byte, StateLeafSize*32), + pendingDeposits: solid.NewPendingDepositList(cfg), + pendingPartialWithdrawals: solid.NewPendingWithdrawalList(cfg), + pendingConsolidations: solid.NewPendingConsolidationList(cfg), } state.init() return state @@ -164,6 +178,17 @@ func (b *BeaconState) MarshalJSON() ([]byte, error) { obj["next_withdrawal_validator_index"] = strconv.FormatInt(int64(b.nextWithdrawalValidatorIndex), 10) obj["historical_summaries"] = b.historicalSummaries } + if b.version >= clparams.ElectraVersion { + obj["deposit_requests_start_index"] = strconv.FormatInt(int64(b.depositRequestsStartIndex), 10) + obj["deposit_balance_to_consume"] = strconv.FormatInt(int64(b.depositBalanceToConsume), 10) + obj["exit_balance_to_consume"] = strconv.FormatInt(int64(b.exitBalanceToConsume), 10) + obj["earliest_exit_epoch"] = strconv.FormatInt(int64(b.earliestExitEpoch), 10) + obj["consolidation_balance_to_consume"] = strconv.FormatInt(int64(b.consolidationBalanceToConsume), 10) + obj["earliest_consolidation_epoch"] = strconv.FormatInt(int64(b.earliestConsolidationEpoch), 10) + obj["pending_deposits"] = b.pendingDeposits + obj["pending_partial_withdrawals"] = b.pendingPartialWithdrawals + obj["pending_consolidations"] = b.pendingConsolidations + } return json.Marshal(obj) } @@ -216,3 +241,43 @@ func (b *BeaconState) HistoricalSummary(index int) *cltypes.HistoricalSummary { func (b *BeaconState) RawSlashings() []byte { return b.slashings.Bytes() } + +func (b *BeaconState) EarliestExitEpoch() uint64 { + return b.earliestExitEpoch +} + +func (b *BeaconState) ExitBalanceToConsume() uint64 { + return b.exitBalanceToConsume +} + +func (b *BeaconState) GetDepositBalanceToConsume() uint64 { + return b.depositBalanceToConsume +} + +func (b *BeaconState) GetPendingDeposits() *solid.ListSSZ[*solid.PendingDeposit] { + return b.pendingDeposits +} + +func (b *BeaconState) GetDepositRequestsStartIndex() uint64 { + return b.depositRequestsStartIndex +} + +func (b *BeaconState) GetPendingConsolidations() *solid.ListSSZ[*solid.PendingConsolidation] { + return b.pendingConsolidations +} + +func (b *BeaconState) GetEarlistConsolidationEpoch() uint64 { + return b.earliestConsolidationEpoch +} + +func (b *BeaconState) GetEarlistExitEpoch() uint64 { + return b.earliestExitEpoch +} + +func (b *BeaconState) GetExitBalanceToConsume() uint64 { + return b.exitBalanceToConsume +} + +func (b *BeaconState) GetConsolidationBalanceToConsume() uint64 { + return b.consolidationBalanceToConsume +} diff --git a/cl/phase1/core/state/shuffling/shuffling.go b/cl/phase1/core/state/shuffling/shuffling.go index 61a6c217ca8..48f73c90fc6 100644 --- a/cl/phase1/core/state/shuffling/shuffling.go +++ b/cl/phase1/core/state/shuffling/shuffling.go @@ -50,7 +50,7 @@ func ComputeProposerIndex(b *raw.BeaconState, indices []uint64, seed [32]byte) ( if err != nil { return 0, err } - if validator.EffectiveBalance()*maxRandomByte >= b.BeaconConfig().MaxEffectiveBalance*randomByte { + if validator.EffectiveBalance()*maxRandomByte >= b.BeaconConfig().MaxEffectiveBalanceForVersion(b.Version())*randomByte { return candidateIndex, nil } i += 1 diff --git a/cl/phase1/core/state/upgrade.go b/cl/phase1/core/state/upgrade.go index eef750ff26b..09768ef0829 100644 --- a/cl/phase1/core/state/upgrade.go +++ b/cl/phase1/core/state/upgrade.go @@ -17,6 +17,9 @@ package state import ( + "sort" + + "github.com/Giulio2002/bls" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/cltypes" @@ -145,13 +148,98 @@ func (b *CachingBeaconState) UpgradeToElectra() error { fork.PreviousVersion = fork.CurrentVersion fork.CurrentVersion = utils.Uint32ToBytes4(uint32(b.BeaconConfig().ElectraForkVersion)) b.SetFork(fork) - // Update the payload header. - //header := b.LatestExecutionPayloadHeader() - // header.Electra() - //b.SetLatestExecutionPayloadHeader(header) - + header := b.LatestExecutionPayloadHeader() + header.SetVersion(clparams.ElectraVersion) + b.SetLatestExecutionPayloadHeader(header) // Update the state root cache b.SetVersion(clparams.ElectraVersion) + + //earliestExitEpoch := ComputeActivationExitEpoch(b.BeaconConfig(), epoch) + earliestExitEpoch := epoch // for Mekong testnet + b.ValidatorSet().Range(func(i int, v solid.Validator, _ int) bool { + if v.ExitEpoch() != b.BeaconConfig().FarFutureEpoch { + if v.ExitEpoch() > earliestExitEpoch { + earliestExitEpoch = v.ExitEpoch() + } + } + return true + }) + earliestExitEpoch += 1 + // New in Electra:EIP6110 + b.SetDepositRequestsStartIndex(b.BeaconConfig().UnsetDepositRequestsStartIndex) + // New in Electra:EIP7251 + b.SetDepositBalanceToConsume(0) + b.SetExitBalanceToConsume(0) + b.SetEarliestExitEpoch(earliestExitEpoch) + b.SetConsolidationBalanceToConsume(0) + b.SetEarlistConsolidationEpoch(ComputeActivationExitEpoch(b.BeaconConfig(), epoch)) + b.SetPendingDeposits(solid.NewPendingDepositList(b.BeaconConfig())) + b.SetPendingPartialWithdrawals(solid.NewPendingWithdrawalList(b.BeaconConfig())) + b.SetPendingConsolidations(solid.NewPendingConsolidationList(b.BeaconConfig())) + // update + newExitBalanceToConsume := GetActivationExitChurnLimit(b) + newConsolidationBalanceToConsume := GetConsolidationChurnLimit(b) + b.SetExitBalanceToConsume(newExitBalanceToConsume) + b.SetConsolidationBalanceToConsume(newConsolidationBalanceToConsume) + + // add validators that are not yet active to pending balance deposits + type tempValidator struct { + validator solid.Validator + index uint64 + } + validators := []tempValidator{} + b.ValidatorSet().Range(func(i int, v solid.Validator, _ int) bool { + if v.ActivationEpoch() == b.BeaconConfig().FarFutureEpoch { + validators = append(validators, tempValidator{ + validator: v, + index: uint64(i), + }) + } + return true + }) + // sort + sort.Slice(validators, func(i, j int) bool { + vi, vj := validators[i].validator, validators[j].validator + if vi.ActivationEligibilityEpoch() == vj.ActivationEligibilityEpoch() { + // If eligibility epochs are equal, compare indices + return validators[i].index < validators[j].index + } + // Otherwise, sort by activationEligibilityEpoch + return vi.ActivationEligibilityEpoch() < vj.ActivationEligibilityEpoch() + }) + + for _, v := range validators { + balance, err := b.ValidatorBalance(int(v.index)) + if err != nil { + return err + } + if err := b.SetValidatorBalance(int(v.index), 0); err != nil { + return err + } + curValidator := v.validator + // Do NOT directly modify the validator in the validator set, because we need to mark validatorSet as dirty in BeaconState + //curValidator.SetEffectiveBalance(0) + //curValidator.SetActivationEligibilityEpoch(b.BeaconConfig().FarFutureEpoch) + b.SetEffectiveBalanceForValidatorAtIndex(int(v.index), 0) + b.SetActivationEligibilityEpochForValidatorAtIndex(int(v.index), b.BeaconConfig().FarFutureEpoch) + // Use bls.G2_POINT_AT_INFINITY as a signature field placeholder + // and GENESIS_SLOT to distinguish from a pending deposit request + b.AppendPendingDeposit(&solid.PendingDeposit{ + PubKey: curValidator.PublicKey(), + WithdrawalCredentials: curValidator.WithdrawalCredentials(), + Amount: balance, + Signature: bls.InfiniteSignature, + Slot: b.BeaconConfig().GenesisSlot, + }) + } + + // Ensure early adopters of compounding credentials go through the activation churn + b.ValidatorSet().Range(func(vindex int, v solid.Validator, _ int) bool { + if HasCompoundingWithdrawalCredential(v, b.BeaconConfig()) { + QueueExcessActiveBalance(b, uint64(vindex), &v) + } + return true + }) return nil } diff --git a/cl/phase1/core/state/upgrade_test.go b/cl/phase1/core/state/upgrade_test.go index 802805af731..1d598b2718b 100644 --- a/cl/phase1/core/state/upgrade_test.go +++ b/cl/phase1/core/state/upgrade_test.go @@ -37,7 +37,7 @@ func TestUpgradeAndExpectedWithdrawals(t *testing.T) { require.NoError(t, s.UpgradeToCapella()) require.NoError(t, s.UpgradeToDeneb()) // now WITHDRAWAAALLLLSSSS - w := ExpectedWithdrawals(s, Epoch(s)) + w, _ := ExpectedWithdrawals(s, Epoch(s)) assert.Empty(t, w) } diff --git a/cl/phase1/core/state/util.go b/cl/phase1/core/state/util.go index cf66b93116e..cae517c1a1c 100644 --- a/cl/phase1/core/state/util.go +++ b/cl/phase1/core/state/util.go @@ -19,6 +19,9 @@ package state import ( "sort" + "github.com/Giulio2002/bls" + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/cl/abstract" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/cltypes" "github.com/erigontech/erigon/cl/cltypes/solid" @@ -49,35 +52,127 @@ func GetIndexedAttestation(attestation *solid.Attestation, attestingIndicies []u } } -func ValidatorFromDeposit(conf *clparams.BeaconChainConfig, deposit *cltypes.Deposit) solid.Validator { - amount := deposit.Data.Amount - effectiveBalance := min(amount-amount%conf.EffectiveBalanceIncrement, conf.MaxEffectiveBalance) +func GetValidatorFromDeposit(s abstract.BeaconState, pubkey [48]byte, withdrawalCredentials common.Hash, amount uint64) solid.Validator { + conf := s.BeaconConfig() validator := solid.NewValidator() - validator.SetPublicKey(deposit.Data.PubKey) - validator.SetWithdrawalCredentials(deposit.Data.WithdrawalCredentials) + validator.SetPublicKey(pubkey) + validator.SetWithdrawalCredentials(withdrawalCredentials) validator.SetActivationEligibilityEpoch(conf.FarFutureEpoch) validator.SetActivationEpoch(conf.FarFutureEpoch) validator.SetExitEpoch(conf.FarFutureEpoch) validator.SetWithdrawableEpoch(conf.FarFutureEpoch) + + // maxEffectiveBalance differs based on the version + maxEffectiveBalance := GetMaxEffectiveBalanceByVersion(validator, conf, s.Version()) + effectiveBalance := min(amount-amount%conf.EffectiveBalanceIncrement, maxEffectiveBalance) validator.SetEffectiveBalance(effectiveBalance) return validator } -// Check whether a validator is fully withdrawable at the given epoch. -func isFullyWithdrawableValidator(conf *clparams.BeaconChainConfig, validator solid.Validator, balance uint64, epoch uint64) bool { +func HasEth1WithdrawalCredential(validator solid.Validator, conf *clparams.BeaconChainConfig) bool { + withdrawalCredentials := validator.WithdrawalCredentials() + return withdrawalCredentials[0] == byte(conf.ETH1AddressWithdrawalPrefixByte) +} + +func HasCompoundingWithdrawalCredential(validator solid.Validator, conf *clparams.BeaconChainConfig) bool { withdrawalCredentials := validator.WithdrawalCredentials() - return withdrawalCredentials[0] == byte(conf.ETH1AddressWithdrawalPrefixByte) && - validator.WithdrawableEpoch() <= epoch && balance > 0 + return withdrawalCredentials[0] == conf.CompoundingWithdrawalPrefix +} + +func HasExecutionWithdrawalCredential(validator solid.Validator, conf *clparams.BeaconChainConfig) bool { + return HasCompoundingWithdrawalCredential(validator, conf) || HasEth1WithdrawalCredential(validator, conf) +} + +// Check whether a validator is fully withdrawable at the given epoch. +func isFullyWithdrawableValidator(b abstract.BeaconState, validator solid.Validator, balance uint64, epoch uint64) bool { + conf := b.BeaconConfig() + if b.Version().BeforeOrEqual(clparams.DenebVersion) { + return HasEth1WithdrawalCredential(validator, conf) && + validator.WithdrawableEpoch() <= epoch && + balance > 0 + } + // electra and after + return HasExecutionWithdrawalCredential(validator, conf) && + validator.WithdrawableEpoch() <= epoch && + balance > 0 +} + +// getMaxEffectiveBalanceElectra is new in electra +func getMaxEffectiveBalanceElectra(v solid.Validator, conf *clparams.BeaconChainConfig) uint64 { + if HasCompoundingWithdrawalCredential(v, conf) { + return conf.MaxEffectiveBalanceElectra + } + return conf.MinActivationBalance +} + +// GetMaxEffectiveBalanceByVersion is a helper function to get the max effective balance based on the state version. +// In Electra, the max effective balance is different based on the withdrawal credential. +func GetMaxEffectiveBalanceByVersion(v solid.Validator, conf *clparams.BeaconChainConfig, version clparams.StateVersion) uint64 { + if version.BeforeOrEqual(clparams.DenebVersion) { + return conf.MaxEffectiveBalance + } + return getMaxEffectiveBalanceElectra(v, conf) } // Check whether a validator is partially withdrawable. -func isPartiallyWithdrawableValidator(conf *clparams.BeaconChainConfig, validator solid.Validator, balance uint64) bool { +func isPartiallyWithdrawableValidator(b abstract.BeaconState, validator solid.Validator, balance uint64) bool { + conf := b.BeaconConfig() withdrawalCredentials := validator.WithdrawalCredentials() - return withdrawalCredentials[0] == byte(conf.ETH1AddressWithdrawalPrefixByte) && - validator.EffectiveBalance() == conf.MaxEffectiveBalance && balance > conf.MaxEffectiveBalance + if b.Version().BeforeOrEqual(clparams.DenebVersion) { + return withdrawalCredentials[0] == byte(conf.ETH1AddressWithdrawalPrefixByte) && + validator.EffectiveBalance() == conf.MaxEffectiveBalance && + balance > conf.MaxEffectiveBalance + } + // electra and after + maxEffectiveBalance := getMaxEffectiveBalanceElectra(validator, conf) + return HasExecutionWithdrawalCredential(validator, conf) && + validator.EffectiveBalance() == maxEffectiveBalance && + balance > maxEffectiveBalance } func ComputeActivationExitEpoch(config *clparams.BeaconChainConfig, epoch uint64) uint64 { return epoch + 1 + config.MaxSeedLookahead } + +func GetActivationExitChurnLimit(s abstract.BeaconState) uint64 { + return min( + s.BeaconConfig().MaxPerEpochActivationExitChurnLimit, + GetBalanceChurnLimit(s), + ) +} + +func GetBalanceChurnLimit(s abstract.BeaconState) uint64 { + churn := max( + s.BeaconConfig().MinPerEpochChurnLimitElectra, + s.GetTotalActiveBalance()/s.BeaconConfig().ChurnLimitQuotient, + ) + return churn - churn%s.BeaconConfig().EffectiveBalanceIncrement +} + +func GetConsolidationChurnLimit(s abstract.BeaconState) uint64 { + return GetBalanceChurnLimit(s) - GetActivationExitChurnLimit(s) +} + +func QueueExcessActiveBalance(s abstract.BeaconState, vindex uint64, validator *solid.Validator) error { + balance, err := s.ValidatorBalance(int(vindex)) + if err != nil { + return err + } + if balance > s.BeaconConfig().MinActivationBalance { + excessBalance := balance - s.BeaconConfig().MinActivationBalance + if err := s.SetValidatorBalance(int(vindex), s.BeaconConfig().MinActivationBalance); err != nil { + return err + } + // Use bls.G2_POINT_AT_INFINITY as a signature field placeholder + // and GENESIS_SLOT to distinguish from a pending deposit request + s.AppendPendingDeposit(&solid.PendingDeposit{ + PubKey: validator.PublicKey(), + WithdrawalCredentials: validator.WithdrawalCredentials(), + Amount: excessBalance, + Signature: bls.InfiniteSignature, + Slot: s.BeaconConfig().GenesisSlot, + }) + } + return nil +} diff --git a/cl/phase1/core/state/utils_test.go b/cl/phase1/core/state/utils_test.go index ad91272559e..d3700d8beb5 100644 --- a/cl/phase1/core/state/utils_test.go +++ b/cl/phase1/core/state/utils_test.go @@ -20,11 +20,12 @@ import ( "math" "testing" + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/cl/abstract/mock_services" "github.com/erigontech/erigon/cl/clparams" - "github.com/erigontech/erigon/cl/cltypes" - "github.com/erigontech/erigon/cl/cltypes/solid" "github.com/erigontech/erigon/cl/utils" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestValidatorSlashing(t *testing.T) { @@ -41,14 +42,14 @@ func TestValidatorSlashing(t *testing.T) { } func TestValidatorFromDeposit(t *testing.T) { - validator := ValidatorFromDeposit(&clparams.MainnetBeaconConfig, &cltypes.Deposit{ - Proof: solid.NewHashList(33), - Data: &cltypes.DepositData{ - PubKey: [48]byte{69}, - Amount: 99999, - }, - }) + ctrl := gomock.NewController(t) + mockBeaconState := mock_services.NewMockBeaconState(ctrl) + mockBeaconState.EXPECT().BeaconConfig().Return(&clparams.MainnetBeaconConfig).AnyTimes() + mockBeaconState.EXPECT().Version().Return(clparams.DenebVersion).Times(1) + + validator := GetValidatorFromDeposit(mockBeaconState, [48]byte{69}, common.Hash{}, uint64(99999)) require.Equal(t, validator.PublicKey(), [48]byte{69}) + ctrl.Finish() } func TestSyncReward(t *testing.T) { diff --git a/cl/phase1/execution_client/execution_client_direct.go b/cl/phase1/execution_client/execution_client_direct.go index de08eb62012..0955c942197 100644 --- a/cl/phase1/execution_client/execution_client_direct.go +++ b/cl/phase1/execution_client/execution_client_direct.go @@ -24,6 +24,7 @@ import ( "math/big" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/hexutility" execution "github.com/erigontech/erigon-lib/gointerfaces/executionproto" "github.com/erigontech/erigon/cl/cltypes" "github.com/erigontech/erigon/core/types" @@ -41,7 +42,13 @@ func NewExecutionClientDirect(chainRW eth1_chain_reader.ChainReaderWriterEth1) ( }, nil } -func (cc *ExecutionClientDirect) NewPayload(ctx context.Context, payload *cltypes.Eth1Block, beaconParentRoot *libcommon.Hash, versionedHashes []libcommon.Hash) (PayloadStatus, error) { +func (cc *ExecutionClientDirect) NewPayload( + ctx context.Context, + payload *cltypes.Eth1Block, + beaconParentRoot *libcommon.Hash, + versionedHashes []libcommon.Hash, + executionRequestsList []hexutility.Bytes, +) (PayloadStatus, error) { if payload == nil { return PayloadStatusValidated, nil } diff --git a/cl/phase1/execution_client/execution_client_rpc.go b/cl/phase1/execution_client/execution_client_rpc.go index 4983e7704ff..486eacf04d9 100644 --- a/cl/phase1/execution_client/execution_client_rpc.go +++ b/cl/phase1/execution_client/execution_client_rpc.go @@ -26,6 +26,7 @@ import ( "time" "github.com/erigontech/erigon-lib/common/hexutil" + "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/log/v3" @@ -70,7 +71,13 @@ func NewExecutionClientRPC(jwtSecret []byte, addr string, port int) (*ExecutionC }, nil } -func (cc *ExecutionClientRpc) NewPayload(ctx context.Context, payload *cltypes.Eth1Block, beaconParentRoot *libcommon.Hash, versionedHashes []libcommon.Hash) (PayloadStatus, error) { +func (cc *ExecutionClientRpc) NewPayload( + ctx context.Context, + payload *cltypes.Eth1Block, + beaconParentRoot *libcommon.Hash, + versionedHashes []libcommon.Hash, + executionRequestsList []hexutility.Bytes, +) (PayloadStatus, error) { if payload == nil { return PayloadStatusValidated, nil } @@ -89,6 +96,8 @@ func (cc *ExecutionClientRpc) NewPayload(ctx context.Context, payload *cltypes.E engineMethod = rpc_helper.EngineNewPayloadV2 case clparams.DenebVersion: engineMethod = rpc_helper.EngineNewPayloadV3 + case clparams.ElectraVersion: + engineMethod = rpc_helper.EngineNewPayloadV4 default: return PayloadStatusNone, errors.New("invalid payload version") } @@ -131,6 +140,9 @@ func (cc *ExecutionClientRpc) NewPayload(ctx context.Context, payload *cltypes.E if versionedHashes != nil { args = append(args, versionedHashes, *beaconParentRoot) } + if executionRequestsList != nil { + args = append(args, executionRequestsList) + } if err := cc.client.CallContext(ctx, &payloadStatus, engineMethod, args...); err != nil { err = fmt.Errorf("execution Client RPC failed to retrieve the NewPayload status response, err: %w", err) return PayloadStatusNone, err diff --git a/cl/phase1/execution_client/execution_engine_mock.go b/cl/phase1/execution_client/execution_engine_mock.go index b30759d5ce9..45913a04f68 100644 --- a/cl/phase1/execution_client/execution_engine_mock.go +++ b/cl/phase1/execution_client/execution_engine_mock.go @@ -15,6 +15,7 @@ import ( reflect "reflect" common "github.com/erigontech/erigon-lib/common" + hexutility "github.com/erigontech/erigon-lib/common/hexutility" cltypes "github.com/erigontech/erigon/cl/cltypes" types "github.com/erigontech/erigon/core/types" engine_types "github.com/erigontech/erigon/turbo/engineapi/engine_types" @@ -473,18 +474,18 @@ func (c *MockExecutionEngineIsCanonicalHashCall) DoAndReturn(f func(context.Cont } // NewPayload mocks base method. -func (m *MockExecutionEngine) NewPayload(ctx context.Context, payload *cltypes.Eth1Block, beaconParentRoot *common.Hash, versionedHashes []common.Hash) (PayloadStatus, error) { +func (m *MockExecutionEngine) NewPayload(ctx context.Context, payload *cltypes.Eth1Block, beaconParentRoot *common.Hash, versionedHashes []common.Hash, executionRequestsList []hexutility.Bytes) (PayloadStatus, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewPayload", ctx, payload, beaconParentRoot, versionedHashes) + ret := m.ctrl.Call(m, "NewPayload", ctx, payload, beaconParentRoot, versionedHashes, executionRequestsList) ret0, _ := ret[0].(PayloadStatus) ret1, _ := ret[1].(error) return ret0, ret1 } // NewPayload indicates an expected call of NewPayload. -func (mr *MockExecutionEngineMockRecorder) NewPayload(ctx, payload, beaconParentRoot, versionedHashes any) *MockExecutionEngineNewPayloadCall { +func (mr *MockExecutionEngineMockRecorder) NewPayload(ctx, payload, beaconParentRoot, versionedHashes, executionRequestsList any) *MockExecutionEngineNewPayloadCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewPayload", reflect.TypeOf((*MockExecutionEngine)(nil).NewPayload), ctx, payload, beaconParentRoot, versionedHashes) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewPayload", reflect.TypeOf((*MockExecutionEngine)(nil).NewPayload), ctx, payload, beaconParentRoot, versionedHashes, executionRequestsList) return &MockExecutionEngineNewPayloadCall{Call: call} } @@ -500,13 +501,13 @@ func (c *MockExecutionEngineNewPayloadCall) Return(arg0 PayloadStatus, arg1 erro } // Do rewrite *gomock.Call.Do -func (c *MockExecutionEngineNewPayloadCall) Do(f func(context.Context, *cltypes.Eth1Block, *common.Hash, []common.Hash) (PayloadStatus, error)) *MockExecutionEngineNewPayloadCall { +func (c *MockExecutionEngineNewPayloadCall) Do(f func(context.Context, *cltypes.Eth1Block, *common.Hash, []common.Hash, []hexutility.Bytes) (PayloadStatus, error)) *MockExecutionEngineNewPayloadCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockExecutionEngineNewPayloadCall) DoAndReturn(f func(context.Context, *cltypes.Eth1Block, *common.Hash, []common.Hash) (PayloadStatus, error)) *MockExecutionEngineNewPayloadCall { +func (c *MockExecutionEngineNewPayloadCall) DoAndReturn(f func(context.Context, *cltypes.Eth1Block, *common.Hash, []common.Hash, []hexutility.Bytes) (PayloadStatus, error)) *MockExecutionEngineNewPayloadCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/cl/phase1/execution_client/interface.go b/cl/phase1/execution_client/interface.go index 4a784f5d988..3d358efdefd 100644 --- a/cl/phase1/execution_client/interface.go +++ b/cl/phase1/execution_client/interface.go @@ -21,6 +21,7 @@ import ( "math/big" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon/cl/cltypes" "github.com/erigontech/erigon/core/types" @@ -34,7 +35,7 @@ var errContextExceeded = "rpc error: code = DeadlineExceeded desc = context dead //go:generate mockgen -typed=true -source=./interface.go -destination=./execution_engine_mock.go -package=execution_client . ExecutionEngine type ExecutionEngine interface { - NewPayload(ctx context.Context, payload *cltypes.Eth1Block, beaconParentRoot *libcommon.Hash, versionedHashes []libcommon.Hash) (PayloadStatus, error) + NewPayload(ctx context.Context, payload *cltypes.Eth1Block, beaconParentRoot *libcommon.Hash, versionedHashes []libcommon.Hash, executionRequestsList []hexutility.Bytes) (PayloadStatus, error) ForkChoiceUpdate(ctx context.Context, finalized libcommon.Hash, head libcommon.Hash, attributes *engine_types.PayloadAttributes) ([]byte, error) SupportInsertion() bool InsertBlocks(ctx context.Context, blocks []*types.Block, wait bool) error diff --git a/cl/phase1/execution_client/rpc_helper/methods.go b/cl/phase1/execution_client/rpc_helper/methods.go index 2371ce0be68..9071b376cf5 100644 --- a/cl/phase1/execution_client/rpc_helper/methods.go +++ b/cl/phase1/execution_client/rpc_helper/methods.go @@ -19,6 +19,7 @@ package rpc_helper const EngineNewPayloadV1 = "engine_newPayloadV1" const EngineNewPayloadV2 = "engine_newPayloadV2" const EngineNewPayloadV3 = "engine_newPayloadV3" +const EngineNewPayloadV4 = "engine_newPayloadV4" const ForkChoiceUpdatedV1 = "engine_forkchoiceUpdatedV1" const ForkChoiceUpdatedV2 = "engine_forkchoiceUpdatedV2" diff --git a/cl/phase1/forkchoice/checkpoint_state.go b/cl/phase1/forkchoice/checkpoint_state.go index 0e96d24e29d..3c302f565d4 100644 --- a/cl/phase1/forkchoice/checkpoint_state.go +++ b/cl/phase1/forkchoice/checkpoint_state.go @@ -123,7 +123,7 @@ func (c *checkpointState) getAttestingIndicies(attestation *solid.Attestation, a cIndex := attestation.Data.CommitteeIndex clversion := c.beaconConfig.GetCurrentStateVersion(epoch) if clversion.AfterOrEqual(clparams.ElectraVersion) { - index, err := attestation.ElectraSingleCommitteeIndex() + index, err := attestation.GetCommitteeIndexFromBits() if err != nil { return nil, err } diff --git a/cl/phase1/forkchoice/on_block.go b/cl/phase1/forkchoice/on_block.go index 8bfec99c7ca..56acb2d307f 100644 --- a/cl/phase1/forkchoice/on_block.go +++ b/cl/phase1/forkchoice/on_block.go @@ -23,6 +23,7 @@ import ( "sort" "time" + "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/common" @@ -106,9 +107,14 @@ func (f *ForkChoiceStore) ProcessBlockExecution(ctx context.Context, block *clty return fmt.Errorf("OnBlock: failed to process kzg commitments: %v", err) } } - timeStartExec := time.Now() - payloadStatus, err := f.engine.NewPayload(ctx, block.Block.Body.ExecutionPayload, &block.Block.ParentRoot, versionedHashes) + var executionRequestsList []hexutility.Bytes = nil + if block.Version() >= clparams.ElectraVersion { + executionRequestsList = block.Block.Body.GetExecutionRequestsList() + } + + timeStartExec := time.Now() + payloadStatus, err := f.engine.NewPayload(ctx, block.Block.Body.ExecutionPayload, &block.Block.ParentRoot, versionedHashes, executionRequestsList) switch payloadStatus { case execution_client.PayloadStatusInvalidated: log.Warn("OnBlock: block is invalid", "block", libcommon.Hash(blockRoot), "err", err) @@ -192,6 +198,11 @@ func (f *ForkChoiceStore) OnBlock(ctx context.Context, block *cltypes.SignedBeac } } + var executionRequestsList []hexutility.Bytes = nil + if block.Version() >= clparams.ElectraVersion { + executionRequestsList = block.Block.Body.GetExecutionRequestsList() + } + isVerifiedExecutionPayload := f.verifiedExecutionPayload.Contains(blockRoot) startEngine := time.Now() if newPayload && f.engine != nil && !isVerifiedExecutionPayload { @@ -201,7 +212,7 @@ func (f *ForkChoiceStore) OnBlock(ctx context.Context, block *cltypes.SignedBeac } } timeStartExec := time.Now() - payloadStatus, err := f.engine.NewPayload(ctx, block.Block.Body.ExecutionPayload, &block.Block.ParentRoot, versionedHashes) + payloadStatus, err := f.engine.NewPayload(ctx, block.Block.Body.ExecutionPayload, &block.Block.ParentRoot, versionedHashes, executionRequestsList) switch payloadStatus { case execution_client.PayloadStatusNotValidated: log.Debug("OnBlock: block is not validated yet", "block", libcommon.Hash(blockRoot)) diff --git a/cl/phase1/network/gossip_manager.go b/cl/phase1/network/gossip_manager.go index 3f4540d18e6..b370de6ff78 100644 --- a/cl/phase1/network/gossip_manager.go +++ b/cl/phase1/network/gossip_manager.go @@ -28,7 +28,6 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/gointerfaces/grpcutil" sentinel "github.com/erigontech/erigon-lib/gointerfaces/sentinelproto" - "github.com/erigontech/erigon-lib/types/ssz" "github.com/erigontech/erigon/cl/beacon/beaconevents" "github.com/erigontech/erigon/cl/beacon/synced_data" "github.com/erigontech/erigon/cl/clparams" @@ -108,22 +107,6 @@ func NewGossipReceiver( } } -func operationsContract[T ssz.EncodableSSZ](ctx context.Context, g *GossipManager, data *sentinel.GossipData, version int, name string, fn func(T, bool) error) error { - var t T - object := t.Clone().(T) - if err := object.DecodeSSZ(common.CopyBytes(data.Data), version); err != nil { - g.sentinel.BanPeer(ctx, data.Peer) - return err - } - if err := fn(object /*test=*/, false); err != nil { - return err - } - if _, err := g.sentinel.PublishGossip(ctx, data); err != nil { - log.Debug("failed to publish gossip", "err", err) - } - return nil -} - func (g *GossipManager) onRecv(ctx context.Context, data *sentinel.GossipData, l log.Ctx) (err error) { // defer func() { // r := recover() @@ -225,7 +208,19 @@ func (g *GossipManager) routeAndProcess(ctx context.Context, data *sentinel.Goss } return g.proposerSlashingService.ProcessMessage(ctx, data.SubnetId, obj) case gossip.TopicNameAttesterSlashing: - return operationsContract[*cltypes.AttesterSlashing](ctx, g, data, int(version), "attester slashing", g.forkChoice.OnAttesterSlashing) + attesterSlashing := cltypes.NewAttesterSlashing(version) + if err := attesterSlashing.DecodeSSZ(data.Data, int(version)); err != nil { + return err + } + g.sentinel.BanPeer(ctx, data.Peer) + if err := g.forkChoice.OnAttesterSlashing(attesterSlashing, false); err != nil { + return err + } + + if _, err := g.sentinel.PublishGossip(ctx, data); err != nil { + log.Debug("failed to publish gossip", "err", err) + } + return nil case gossip.TopicNameBlsToExecutionChange: obj := &cltypes.SignedBLSToExecutionChangeWithGossipData{ GossipData: copyOfSentinelData(data), @@ -267,16 +262,26 @@ func (g *GossipManager) routeAndProcess(ctx context.Context, data *sentinel.Goss return g.syncCommitteeMessagesService.ProcessMessage(ctx, data.SubnetId, msg) case gossip.IsTopicBeaconAttestation(data.Name): obj := &services.AttestationWithGossipData{ - GossipData: copyOfSentinelData(data), - Attestation: &solid.Attestation{}, - ImmediateProcess: false, + GossipData: copyOfSentinelData(data), + Attestation: &solid.Attestation{}, + SingleAttestation: &solid.SingleAttestation{}, + ImmediateProcess: false, } - - if err := obj.Attestation.DecodeSSZ(common.CopyBytes(data.Data), int(version)); err != nil { - return err - } - if g.committeeSub.NeedToAggregate(obj.Attestation) || g.attestationsLimiter.tryAcquire() { - return g.attestationService.ProcessMessage(ctx, data.SubnetId, obj) + if version < clparams.ElectraVersion { + if err := obj.Attestation.DecodeSSZ(common.CopyBytes(data.Data), int(version)); err != nil { + return err + } + if g.committeeSub.NeedToAggregate(obj.Attestation) || g.attestationsLimiter.tryAcquire() { + return g.attestationService.ProcessMessage(ctx, data.SubnetId, obj) + } + } else { + // after electra + if err := obj.SingleAttestation.DecodeSSZ(common.CopyBytes(data.Data), int(version)); err != nil { + return err + } + if g.attestationsLimiter.tryAcquire() { + return g.attestationService.ProcessMessage(ctx, data.SubnetId, obj) + } } return services.ErrIgnore default: @@ -330,7 +335,7 @@ func (g *GossipManager) Start(ctx context.Context) { select { case ch <- data: default: - //log.Warn("[Beacon Gossip] Dropping message due to full channel", "topic", data.Name) + log.Trace("[Beacon Gossip] Dropping message due to full channel", "topic", data.Name) } } diff --git a/cl/phase1/network/services/aggregate_and_proof_service.go b/cl/phase1/network/services/aggregate_and_proof_service.go index 97373c9ccc5..1e80db2a673 100644 --- a/cl/phase1/network/services/aggregate_and_proof_service.go +++ b/cl/phase1/network/services/aggregate_and_proof_service.go @@ -113,11 +113,16 @@ func (a *aggregateAndProofServiceImpl) ProcessMessage( epoch := slot / a.beaconCfg.SlotsPerEpoch clversion := a.beaconCfg.GetCurrentStateVersion(epoch) if clversion.AfterOrEqual(clparams.ElectraVersion) { - index, err := aggregate.ElectraSingleCommitteeIndex() - if err != nil { - return err + // [REJECT] len(committee_indices) == 1, where committee_indices = get_committee_indices(aggregate). + indices := aggregate.CommitteeBits.GetOnIndices() + if len(indices) != 1 { + return fmt.Errorf("invalid committee_bits length in aggregate and proof: %v", len(indices)) + } + // [REJECT] aggregate.data.index == 0 + if aggregate.Data.CommitteeIndex != 0 { + return errors.New("invalid committee_index in aggregate and proof") } - committeeIndex = index + committeeIndex = uint64(indices[0]) } var ( diff --git a/cl/phase1/network/services/attestation_service.go b/cl/phase1/network/services/attestation_service.go index 165211ca6a5..6c7adfba1fa 100644 --- a/cl/phase1/network/services/attestation_service.go +++ b/cl/phase1/network/services/attestation_service.go @@ -23,6 +23,7 @@ import ( "time" "github.com/erigontech/erigon-lib/common" + libcommon "github.com/erigontech/erigon-lib/common" sentinel "github.com/erigontech/erigon-lib/gointerfaces/sentinelproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/aggregation" @@ -65,8 +66,9 @@ type attestationService struct { // AttestationWithGossipData type represents attestation with the gossip data where it's coming from. type AttestationWithGossipData struct { - Attestation *solid.Attestation - GossipData *sentinel.GossipData + Attestation *solid.Attestation + SingleAttestation *solid.SingleAttestation // New container after Electra + GossipData *sentinel.GossipData // ImmediateProcess indicates whether the attestation should be processed immediately or able to be scheduled for later processing. ImmediateProcess bool } @@ -103,20 +105,37 @@ func NewAttestationService( func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, att *AttestationWithGossipData) error { var ( - root = att.Attestation.Data.BeaconBlockRoot - slot = att.Attestation.Data.Slot - committeeIndex = att.Attestation.Data.CommitteeIndex - targetEpoch = att.Attestation.Data.Target.Epoch - attEpoch = s.ethClock.GetEpochAtSlot(slot) - clVersion = s.beaconCfg.GetCurrentStateVersion(attEpoch) + root libcommon.Hash + slot uint64 + committeeIndex uint64 + targetEpoch uint64 + signature [96]byte + data *solid.AttestationData ) - - if clVersion.AfterOrEqual(clparams.ElectraVersion) { - index, err := att.Attestation.ElectraSingleCommitteeIndex() - if err != nil { - return err - } - committeeIndex = index + if att.Attestation != nil { + slot = att.Attestation.Data.Slot + } else { + slot = att.SingleAttestation.Data.Slot + } + attEpoch := s.ethClock.GetEpochAtSlot(slot) + clVersion := s.beaconCfg.GetCurrentStateVersion(attEpoch) + + var err error + if clVersion >= clparams.ElectraVersion { + root = att.SingleAttestation.Data.BeaconBlockRoot + slot = att.SingleAttestation.Data.Slot + committeeIndex = att.SingleAttestation.CommitteeIndex + targetEpoch = att.SingleAttestation.Data.Target.Epoch + signature = att.SingleAttestation.Signature + data = att.SingleAttestation.Data + } else { + // deneb and before case + root = att.Attestation.Data.BeaconBlockRoot + slot = att.Attestation.Data.Slot + committeeIndex = att.Attestation.Data.CommitteeIndex + targetEpoch = att.Attestation.Data.Target.Epoch + signature = att.Attestation.Signature + data = att.Attestation.Data } // Commented because we have a check in validatorAttestationSeen that does the same thing. @@ -142,9 +161,9 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, } var ( - domain []byte - pubKey common.Bytes48 - signature common.Bytes96 + domain []byte + pubKey common.Bytes48 + attestation *solid.Attestation // SingleAttestation will be transformed to Attestation struct with given member index in committee ) if err := s.syncedDataManager.ViewHeadState(func(headState *state.CachingBeaconState) error { // [REJECT] The committee index is within the expected range @@ -157,50 +176,61 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, if subnet == nil || subnetId != *subnet { return errors.New("wrong subnet") } - beaconCommittee, err := headState.GetBeaconCommitee(slot, committeeIndex) if err != nil { return err } + var vIndex uint64 + if clVersion <= clparams.DenebVersion { + // [REJECT] The number of aggregation bits matches the committee size -- i.e. len(aggregation_bits) == len(get_beacon_committee(state, attestation.data.slot, index)). + bits := att.Attestation.AggregationBits.Bytes() + expectedAggregationBitsLength := len(beaconCommittee) + actualAggregationBitsLength := utils.GetBitlistLength(bits) + if actualAggregationBitsLength != expectedAggregationBitsLength { + return fmt.Errorf("aggregation bits count mismatch: %d != %d", actualAggregationBitsLength, expectedAggregationBitsLength) + } - // [REJECT] The number of aggregation bits matches the committee size -- i.e. len(aggregation_bits) == len(get_beacon_committee(state, attestation.data.slot, index)). - bits := att.Attestation.AggregationBits.Bytes() - expectedAggregationBitsLength := len(beaconCommittee) - actualAggregationBitsLength := utils.GetBitlistLength(bits) - if actualAggregationBitsLength != expectedAggregationBitsLength { - return fmt.Errorf("aggregation bits count mismatch: %d != %d", actualAggregationBitsLength, expectedAggregationBitsLength) - } - - //[REJECT] The attestation is unaggregated -- that is, it has exactly one participating validator (len([bit for bit in aggregation_bits if bit]) == 1, i.e. exactly 1 bit is set). - setBits := 0 - onBitIndex := 0 // Aggregationbits is []byte, so we need to iterate over all bits. - for i := 0; i < len(bits); i++ { - for j := 0; j < 8; j++ { - if bits[i]&(1<= len(beaconCommittee) { - continue + //[REJECT] The attestation is unaggregated -- that is, it has exactly one participating validator (len([bit for bit in aggregation_bits if bit]) == 1, i.e. exactly 1 bit is set). + setBits := 0 + onBitIndex := 0 // Aggregationbits is []byte, so we need to iterate over all bits. + for i := 0; i < len(bits); i++ { + for j := 0; j < 8; j++ { + if bits[i]&(1<= len(beaconCommittee) { + continue + } + setBits++ + onBitIndex = i*8 + j } - setBits++ - onBitIndex = i*8 + j } } - } - - if setBits == 0 { - return ErrIgnore // Ignore if it is just an empty bitlist - } - if setBits != 1 { - return errors.New("attestation does not have exactly one participating validator") + if setBits == 0 { + return ErrIgnore // Ignore if it is just an empty bitlist + } + if setBits != 1 { + return errors.New("attestation does not have exactly one participating validator") + } + if onBitIndex >= len(beaconCommittee) { + return errors.New("on bit index out of committee range") + } + vIndex = beaconCommittee[onBitIndex] + attestation = att.Attestation + } else { + // electra and after + // [REJECT] attestation.data.index == 0 + if att.SingleAttestation.Data.CommitteeIndex != 0 { + return errors.New("committee index must be 0") + } + // [REJECT] The attester is a member of the committee -- i.e. attestation.attester_index in get_beacon_committee(state, attestation.data.slot, index). + memIndexInCommittee := contains(att.SingleAttestation.AttesterIndex, beaconCommittee) + if memIndexInCommittee < 0 { + return errors.New("attester is not a member of the committee") + } + vIndex = att.SingleAttestation.AttesterIndex + attestation = att.SingleAttestation.ToAttestation(memIndexInCommittee) } // [IGNORE] There has been no other valid attestation seen on an attestation subnet that has an identical attestation.data.target.epoch and participating validator index. - if err != nil { - return err - } - if onBitIndex >= len(beaconCommittee) { - return errors.New("on bit index out of committee range") - } // mark the validator as seen - vIndex := beaconCommittee[onBitIndex] epochLastTime, ok := s.validatorAttestationSeen.Get(vIndex) if ok && epochLastTime == targetEpoch { return fmt.Errorf("validator already seen in target epoch %w", ErrIgnore) @@ -208,8 +238,7 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, s.validatorAttestationSeen.Add(vIndex, targetEpoch) // [REJECT] The signature of attestation is valid. - signature = att.Attestation.Signature - pubKey, err = headState.ValidatorPublicKey(int(beaconCommittee[onBitIndex])) + pubKey, err = headState.ValidatorPublicKey(int(vIndex)) if err != nil { return fmt.Errorf("unable to get public key: %v", err) } @@ -221,7 +250,7 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, }); err != nil { return err } - signingRoot, err := computeSigningRoot(att.Attestation.Data, domain) + signingRoot, err := computeSigningRoot(data, domain) if err != nil { return fmt.Errorf("unable to get signing root: %v", err) } @@ -236,8 +265,8 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, // [REJECT] The attestation's target block is an ancestor of the block named in the LMD vote -- i.e. // get_checkpoint_block(store, attestation.data.beacon_block_root, attestation.data.target.epoch) == attestation.data.target.root startSlotAtEpoch := targetEpoch * s.beaconCfg.SlotsPerEpoch - if targetBlock := s.forkchoiceStore.Ancestor(root, startSlotAtEpoch); targetBlock != att.Attestation.Data.Target.Root { - return fmt.Errorf("invalid target block. root %v targetEpoch %v attTargetBlockRoot %v targetBlock %v", root.Hex(), targetEpoch, att.Attestation.Data.Target.Root.Hex(), targetBlock.Hex()) + if targetBlock := s.forkchoiceStore.Ancestor(root, startSlotAtEpoch); targetBlock != data.Target.Root { + return fmt.Errorf("invalid target block. root %v targetEpoch %v attTargetBlockRoot %v targetBlock %v", root.Hex(), targetEpoch, data.Target.Root.Hex(), targetBlock.Hex()) } // [IGNORE] The current finalized_checkpoint is an ancestor of the block defined by attestation.data.beacon_block_root -- // i.e. get_checkpoint_block(store, attestation.data.beacon_block_root, store.finalized_checkpoint.epoch) == store.finalized_checkpoint.root @@ -254,18 +283,16 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, F: func() { start := time.Now() defer monitor.ObserveAggregateAttestation(start) - if s.committeeSubscribe.NeedToAggregate(att.Attestation) { - err = s.committeeSubscribe.AggregateAttestation(att.Attestation) - if errors.Is(err, aggregation.ErrIsSuperset) { - return - } + err = s.committeeSubscribe.AggregateAttestation(attestation) + if errors.Is(err, aggregation.ErrIsSuperset) { + return } if err != nil { log.Warn("could not check aggregate attestation", "err", err) return } - s.emitters.Operation().SendAttestation(att.Attestation) + s.emitters.Operation().SendAttestation(attestation) }, } @@ -328,3 +355,12 @@ func (s *attestationService) ProcessMessage(ctx context.Context, subnet *uint64, // }) // } // } + +func contains[T comparable](target T, slices []T) int { + for i, s := range slices { + if s == target { + return i + } + } + return -1 +} diff --git a/cl/phase1/network/services/attestation_service_test.go b/cl/phase1/network/services/attestation_service_test.go index a362fb0f666..45d5a008435 100644 --- a/cl/phase1/network/services/attestation_service_test.go +++ b/cl/phase1/network/services/attestation_service_test.go @@ -331,7 +331,7 @@ func (t *attestationTestSuite) TestAttestationProcessMessage() { mockFinalizedCheckPoint.Epoch * mockSlotsPerEpoch: mockFinalizedCheckPoint.Root, } t.mockForkChoice.FinalizedCheckpointVal = *mockFinalizedCheckPoint - t.committeeSubscibe.EXPECT().NeedToAggregate(att).Return(true).Times(1) + //t.committeeSubscibe.EXPECT().NeedToAggregate(att).Return(true).Times(1) t.committeeSubscibe.EXPECT().AggregateAttestation(att).Return(nil).Times(1) }, args: args{ diff --git a/cl/phase1/stages/forkchoice.go b/cl/phase1/stages/forkchoice.go index 3b673499de5..e4d51ccaed5 100644 --- a/cl/phase1/stages/forkchoice.go +++ b/cl/phase1/stages/forkchoice.go @@ -254,7 +254,8 @@ func emitNextPaylodAttributesEvent(cfg *Cfg, headSlot uint64, headRoot common.Ha return err } withdrawals := []*types.Withdrawal{} - for _, w := range state.ExpectedWithdrawals(s, epoch) { + expWithdrawals, _ := state.ExpectedWithdrawals(s, epoch) + for _, w := range expWithdrawals { withdrawals = append(withdrawals, &types.Withdrawal{ Amount: w.Amount, Index: w.Index, diff --git a/cl/spectest/Makefile b/cl/spectest/Makefile index b8e1fedbb1a..7c046849726 100644 --- a/cl/spectest/Makefile +++ b/cl/spectest/Makefile @@ -2,13 +2,26 @@ tests: - wget https://github.com/ethereum/consensus-spec-tests/releases/download/v1.4.0-beta.5/mainnet.tar.gz + wget https://github.com/ethereum/consensus-spec-tests/releases/download/v1.5.0-alpha.8/mainnet.tar.gz tar xf mainnet.tar.gz rm mainnet.tar.gz # not needed for now rm -rf tests/mainnet/eip6110 + clean: rm -rf tests mainnet: CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/ -v --timeout 30m + +electra: + CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/electra/ -v --timeout 30m + +whisk: + CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/whisk/ -v --timeout 30m + +eip7594: + CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/eip7594/ -v --timeout 30m + +deneb: + CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/deneb/ -v --timeout 30m diff --git a/cl/spectest/consensus_tests/appendix.go b/cl/spectest/consensus_tests/appendix.go index 623a9b04816..c31d3f8d370 100644 --- a/cl/spectest/consensus_tests/appendix.go +++ b/cl/spectest/consensus_tests/appendix.go @@ -48,7 +48,9 @@ func init() { With("rewards_and_penalties", rewardsAndPenaltiesTest). With("slashings", slashingsTest). With("slashings_reset", slashingsResetTest). - With("participation_record_updates", participationRecordUpdatesTest) + With("participation_record_updates", participationRecordUpdatesTest). + With("pending_deposits", pendingDepositTest). + With("pending_consolidations", PendingConsolidationTest) TestFormats.Add("finality"). With("finality", FinalityFinality) TestFormats.Add("fork_choice"). @@ -76,7 +78,10 @@ func init() { WithFn("voluntary_exit", operationVoluntaryExitHandler). WithFn("sync_aggregate", operationSyncAggregateHandler). WithFn("withdrawals", operationWithdrawalHandler). - WithFn("bls_to_execution-change", operationSignedBlsChangeHandler) + WithFn("bls_to_execution_change", operationSignedBlsChangeHandler). + WithFn("consolidation_request", operationConsolidationRequestHandler). + WithFn("deposit_request", operationDepositRequstHandler). + WithFn("withdrawal_request", operationWithdrawalRequstHandler) TestFormats.Add("random"). With("random", SanityBlocks) TestFormats.Add("rewards"). @@ -101,11 +106,7 @@ func init() { func addSszTests() { TestFormats.Add("ssz_static"). With("AggregateAndProof", getSSZStaticConsensusTest(&cltypes.AggregateAndProof{})). - With("Attestation", getSSZStaticConsensusTest(&solid.Attestation{})). With("AttestationData", getSSZStaticConsensusTest(&solid.AttestationData{})). - With("AttesterSlashing", getSSZStaticConsensusTest(&cltypes.AttesterSlashing{})). - With("BeaconBlock", getSSZStaticConsensusTest(cltypes.NewBeaconBlock(&clparams.MainnetBeaconConfig, clparams.DenebVersion))). - With("BeaconBlockBody", getSSZStaticConsensusTest(cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, clparams.DenebVersion))). With("BeaconBlockHeader", getSSZStaticConsensusTest(&cltypes.BeaconBlockHeader{})). With("BeaconState", getSSZStaticConsensusTest(state.New(&clparams.MainnetBeaconConfig))). With("BlobIdentifier", getSSZStaticConsensusTest(&cltypes.BlobIdentifier{})). @@ -118,23 +119,18 @@ func addSszTests() { // With("DepositMessage", getSSZStaticConsensusTest(&cltypes.DepositMessage{})). // With("Eth1Block", getSSZStaticConsensusTest(&cltypes.Eth1Block{})). With("Eth1Data", getSSZStaticConsensusTest(&cltypes.Eth1Data{})). - With("ExecutionPayload", getSSZStaticConsensusTest(cltypes.NewEth1Block(clparams.Phase0Version, &clparams.MainnetBeaconConfig))). - //With("ExecutionPayloadHeader", getSSZStaticConsensusTest(&cltypes.Eth1Header{})). With("Fork", getSSZStaticConsensusTest(&cltypes.Fork{})). //With("ForkData", getSSZStaticConsensusTest(&cltypes.ForkData{})). //With("HistoricalBatch", getSSZStaticConsensusTest(&cltypes.HistoricalBatch{})). With("HistoricalSummary", getSSZStaticConsensusTest(&cltypes.HistoricalSummary{})). - With("IndexedAttestation", getSSZStaticConsensusTest(&cltypes.IndexedAttestation{})). With("LightClientBootstrap", getSSZStaticConsensusTest(&cltypes.LightClientBootstrap{})). With("LightClientFinalityUpdate", getSSZStaticConsensusTest(&cltypes.LightClientFinalityUpdate{})). - With("LightClientHeader", getSSZStaticConsensusTest(&cltypes.LightClientHeader{})). With("LightClientOptimisticUpdate", getSSZStaticConsensusTest(&cltypes.LightClientOptimisticUpdate{})). - With("LightClientUpdate", getSSZStaticConsensusTest(&cltypes.LightClientUpdate{})). + //With("LightClientUpdate", getSSZStaticConsensusTest(&cltypes.LightClientUpdate{})). With("PendingAttestation", getSSZStaticConsensusTest(&solid.PendingAttestation{})). // With("PowBlock", getSSZStaticConsensusTest(&cltypes.PowBlock{})). Unimplemented With("ProposerSlashing", getSSZStaticConsensusTest(&cltypes.ProposerSlashing{})). With("SignedAggregateAndProof", getSSZStaticConsensusTest(&cltypes.SignedAggregateAndProof{})). - With("SignedBeaconBlock", getSSZStaticConsensusTest(cltypes.NewSignedBeaconBlock(&clparams.MainnetBeaconConfig, clparams.DenebVersion))). With("SignedBeaconBlockHeader", getSSZStaticConsensusTest(&cltypes.SignedBeaconBlockHeader{})). //With("SignedBlobSidecar", getSSZStaticConsensusTest(&cltypes.SignedBlobSideCar{})). With("SignedBLSToExecutionChange", getSSZStaticConsensusTest(&cltypes.SignedBLSToExecutionChange{})). @@ -144,9 +140,60 @@ func addSszTests() { With("SyncAggregate", getSSZStaticConsensusTest(&cltypes.SyncAggregate{})). With("SyncAggregatorSelectionData", getSSZStaticConsensusTest(&cltypes.SyncAggregatorSelectionData{})). With("SyncCommittee", getSSZStaticConsensusTest(&solid.SyncCommittee{})). - // With("SyncCommitteeContribution", getSSZStaticConsensusTest(&cltypes.SyncCommitteeContribution{})). // With("SyncCommitteeMessage", getSSZStaticConsensusTest(&cltypes.SyncCommitteeMessage{})). - With("Validator", getSSZStaticConsensusTest(solid.NewValidator())) - // With("VoluntaryExit", getSSZStaticConsensusTest(&cltypes.VoluntaryExit{})) TODO - // With("Withdrawal", getSSZStaticConsensusTest(&types.Withdrawal{})) TODO + With("Validator", getSSZStaticConsensusTest(solid.NewValidator())). + With("ExecutionPayloadHeader", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.Eth1Header { + return cltypes.NewEth1Header(v) + }, withTestJson())). + With("SyncCommitteeContribution", sszStaticTestByEmptyObject(&cltypes.Contribution{})). + With("Withdrawal", sszStaticTestByEmptyObject(&cltypes.Withdrawal{}, withTestJson())). + With("LightClientHeader", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.LightClientHeader { + return cltypes.NewLightClientHeader(v) + }, withTestJson())). + With("LightClientUpdate", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.LightClientUpdate { + return cltypes.NewLightClientUpdate(v) + }, withTestJson())). + With("SignedBeaconBlock", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.SignedBeaconBlock { + return cltypes.NewSignedBeaconBlock(&clparams.MainnetBeaconConfig, v) + }, withTestJson())). + With("ExecutionPayload", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.Eth1Block { + return cltypes.NewEth1Block(v, &clparams.MainnetBeaconConfig) + }, withTestJson())). + With("ExecutionRequests", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.ExecutionRequests { + return cltypes.NewExecutionRequests(&clparams.MainnetBeaconConfig) + }, withTestJson(), runAfterVersion(clparams.ElectraVersion))). + With("IndexedAttestation", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.IndexedAttestation { + return cltypes.NewIndexedAttestation(v) + }, withTestJson())). + With("BeaconBlock", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.BeaconBlock { + return cltypes.NewBeaconBlock(&clparams.MainnetBeaconConfig, v) + }, withTestJson())). + With("AttesterSlashing", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.AttesterSlashing { + return cltypes.NewAttesterSlashing(v) + }, withTestJson())). + With("BeaconBlockBody", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *cltypes.BeaconBody { + return cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, v) + }, withTestJson())). + With("Attestation", sszStaticTestNewObjectByFunc( + func(v clparams.StateVersion) *solid.Attestation { + return &solid.Attestation{} + }, withTestJson())). + With("VoluntaryExit", sszStaticTestByEmptyObject(&cltypes.VoluntaryExit{}, withTestJson())). + With("SingleAttestation", sszStaticTestByEmptyObject(&solid.SingleAttestation{}, withTestJson(), runAfterVersion(clparams.ElectraVersion))). + With("WithdrawalRequest", sszStaticTestByEmptyObject(&solid.WithdrawalRequest{}, runAfterVersion(clparams.ElectraVersion))). + With("DepositRequest", sszStaticTestByEmptyObject(&solid.DepositRequest{}, withTestJson(), runAfterVersion(clparams.ElectraVersion))). + With("ConsolidationRequest", sszStaticTestByEmptyObject(&solid.ConsolidationRequest{}, withTestJson(), runAfterVersion(clparams.ElectraVersion))). + With("PendingConsolidation", sszStaticTestByEmptyObject(&solid.PendingConsolidation{}, runAfterVersion(clparams.ElectraVersion))). // no need json test + With("PendingDeposit", sszStaticTestByEmptyObject(&solid.PendingDeposit{}, runAfterVersion(clparams.ElectraVersion))). // no need json test + With("PendingPartialWithdrawal", sszStaticTestByEmptyObject(&solid.PendingPartialWithdrawal{}, runAfterVersion(clparams.ElectraVersion))) // no need json test } diff --git a/cl/spectest/consensus_tests/eip4844_proofs.go b/cl/spectest/consensus_tests/eip4844_proofs.go index e05c336d6b9..65e86701293 100644 --- a/cl/spectest/consensus_tests/eip4844_proofs.go +++ b/cl/spectest/consensus_tests/eip4844_proofs.go @@ -46,7 +46,7 @@ var Eip4844MerkleProof = spectest.HandlerFunc(func(t *testing.T, root fs.FS, c s branch[i] = libcommon.HexToHash(b) } leaf := libcommon.HexToHash(proofYaml.Leaf) - beaconBody := cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, clparams.DenebVersion) + beaconBody := cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, c.Version()) require.NoError(t, spectest.ReadSsz(root, c.Version(), spectest.ObjectSSZ, beaconBody)) proof, err := beaconBody.KzgCommitmentMerkleProof(0) require.NoError(t, err) diff --git a/cl/spectest/consensus_tests/epoch_processing.go b/cl/spectest/consensus_tests/epoch_processing.go index df5a7417cc8..491b5fe2bfa 100644 --- a/cl/spectest/consensus_tests/epoch_processing.go +++ b/cl/spectest/consensus_tests/epoch_processing.go @@ -123,3 +123,13 @@ var recordsResetTest = NewEpochProcessing(func(s abstract.BeaconState) error { statechange.ProcessParticipationRecordUpdates(s) return nil }) + +var pendingDepositTest = NewEpochProcessing(func(s abstract.BeaconState) error { + statechange.ProcessPendingDeposits(s) + return nil +}) + +var PendingConsolidationTest = NewEpochProcessing(func(s abstract.BeaconState) error { + statechange.ProcessPendingConsolidations(s) + return nil +}) diff --git a/cl/spectest/consensus_tests/fork_choice.go b/cl/spectest/consensus_tests/fork_choice.go index fc8b37f9b97..aedc1e859e1 100644 --- a/cl/spectest/consensus_tests/fork_choice.go +++ b/cl/spectest/consensus_tests/fork_choice.go @@ -238,7 +238,7 @@ func (b *ForkChoice) Run(t *testing.T, root fs.FS, c spectest.TestCase) (err err case "on_merge_block": return nil case "on_block": - blk := cltypes.NewSignedBeaconBlock(anchorState.BeaconConfig(), clparams.DenebVersion) + blk := cltypes.NewSignedBeaconBlock(anchorState.BeaconConfig(), c.Version()) err := spectest.ReadSsz(root, c.Version(), step.GetBlock()+".ssz_snappy", blk) require.NoError(t, err, stepstr) blobs := solid.NewStaticListSSZ[*cltypes.Blob](6, len(cltypes.Blob{})) diff --git a/cl/spectest/consensus_tests/light_client.go b/cl/spectest/consensus_tests/light_client.go index d3e7413b113..d06ad28ae7a 100644 --- a/cl/spectest/consensus_tests/light_client.go +++ b/cl/spectest/consensus_tests/light_client.go @@ -36,7 +36,7 @@ var LightClientBeaconBlockBodyExecutionMerkleProof = spectest.HandlerFunc(func(t var proof [][32]byte switch c.CaseName { case "execution_merkle_proof": - beaconBody := cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, clparams.DenebVersion) + beaconBody := cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, c.Version()) require.NoError(t, spectest.ReadSsz(root, c.Version(), spectest.ObjectSSZ, beaconBody)) proof, err = beaconBody.ExecutionPayloadMerkleProof() require.NoError(t, err) diff --git a/cl/spectest/consensus_tests/operations.go b/cl/spectest/consensus_tests/operations.go index 60be44d30ec..0e3b7a3acc4 100644 --- a/cl/spectest/consensus_tests/operations.go +++ b/cl/spectest/consensus_tests/operations.go @@ -373,3 +373,127 @@ func operationSignedBlsChangeHandler(t *testing.T, root fs.FS, c spectest.TestCa assert.EqualValues(t, haveRoot, expectedRoot) return nil } + +func operationConsolidationRequestHandler(t *testing.T, root fs.FS, c spectest.TestCase) error { + preState, err := spectest.ReadBeaconState(root, c.Version(), "pre.ssz_snappy") + require.NoError(t, err) + postState, err := spectest.ReadBeaconState(root, c.Version(), "post.ssz_snappy") + expectedError := os.IsNotExist(err) + if err != nil && !expectedError { + return err + } + consolidation := &solid.ConsolidationRequest{} + if err := spectest.ReadSszOld(root, consolidation, c.Version(), "consolidation_request.ssz_snappy"); err != nil { + return err + } + if err := c.Machine.ProcessConsolidationRequest(preState, consolidation); err != nil { + if expectedError { + return nil + } + return err + } + if expectedError { + return errors.New("expected error") + } + haveRoot, err := preState.HashSSZ() + require.NoError(t, err) + + expectedRoot, err := postState.HashSSZ() + require.NoError(t, err) + + assert.EqualValues(t, haveRoot, expectedRoot) + return nil +} + +func operationDepositRequstHandler(t *testing.T, root fs.FS, c spectest.TestCase) error { + preState, err := spectest.ReadBeaconState(root, c.Version(), "pre.ssz_snappy") + require.NoError(t, err) + postState, err := spectest.ReadBeaconState(root, c.Version(), "post.ssz_snappy") + expectedError := os.IsNotExist(err) + if err != nil && !expectedError { + return err + } + request := &solid.DepositRequest{} + if err := spectest.ReadSszOld(root, request, c.Version(), "deposit_request.ssz_snappy"); err != nil { + return err + } + if err := c.Machine.ProcessDepositRequest(preState, request); err != nil { + if expectedError { + return nil + } + return err + } + if expectedError { + return errors.New("expected error") + } + haveRoot, err := preState.HashSSZ() + require.NoError(t, err) + + expectedRoot, err := postState.HashSSZ() + require.NoError(t, err) + + assert.EqualValues(t, haveRoot, expectedRoot) + return nil +} + +func operationWithdrawalRequstHandler(t *testing.T, root fs.FS, c spectest.TestCase) error { + preState, err := spectest.ReadBeaconState(root, c.Version(), "pre.ssz_snappy") + require.NoError(t, err) + postState, err := spectest.ReadBeaconState(root, c.Version(), "post.ssz_snappy") + expectedError := os.IsNotExist(err) + if err != nil && !expectedError { + return err + } + request := &solid.WithdrawalRequest{} + if err := spectest.ReadSszOld(root, request, c.Version(), "withdrawal_request.ssz_snappy"); err != nil { + return err + } + if err := c.Machine.ProcessWithdrawalRequest(preState, request); err != nil { + if expectedError { + return nil + } + return err + } + if expectedError { + return errors.New("expected error") + } + haveRoot, err := preState.HashSSZ() + require.NoError(t, err) + + expectedRoot, err := postState.HashSSZ() + require.NoError(t, err) + + assert.EqualValues(t, haveRoot, expectedRoot) + return nil +} + +func operationExecutionPayloadHandler(t *testing.T, root fs.FS, c spectest.TestCase) error { + preState, err := spectest.ReadBeaconState(root, c.Version(), "pre.ssz_snappy") + require.NoError(t, err) + postState, err := spectest.ReadBeaconState(root, c.Version(), "post.ssz_snappy") + expectedError := os.IsNotExist(err) + if err != nil && !expectedError { + return err + } + body := cltypes.NewBeaconBody(&clparams.MainnetBeaconConfig, c.Version()) + if err := spectest.ReadSszOld(root, body, c.Version(), "body.ssz_snappy"); err != nil { + return err + } + if err := c.Machine.ProcessExecutionPayload(preState, body); err != nil { + if expectedError { + return nil + } + return err + } + if expectedError { + return errors.New("expected error") + } + haveRoot, err := preState.HashSSZ() + require.NoError(t, err) + + expectedRoot, err := postState.HashSSZ() + require.NoError(t, err) + + assert.EqualValues(t, haveRoot, expectedRoot) + return nil +} diff --git a/cl/spectest/consensus_tests/ssz_static.go b/cl/spectest/consensus_tests/ssz_static.go index e65fcceffd8..9141f743435 100644 --- a/cl/spectest/consensus_tests/ssz_static.go +++ b/cl/spectest/consensus_tests/ssz_static.go @@ -61,6 +61,10 @@ func getSSZStaticConsensusTest[T unmarshalerMarshalerHashable](ref T) spectest.H require.NoError(t, err) expectedRoot := libcommon.HexToHash(root.Root) object := ref.Clone().(unmarshalerMarshalerHashable) + if versionObj, ok := object.(interface{ SetVersion(clparams.StateVersion) }); ok { + // Note: a bit tricky to change version here :( + versionObj.SetVersion(c.Version()) + } _, isBeaconState := object.(*state.CachingBeaconState) snappyEncoded, err := fs.ReadFile(fsroot, serializedFile) @@ -75,7 +79,7 @@ func getSSZStaticConsensusTest[T unmarshalerMarshalerHashable](ref T) spectest.H haveRoot, err := object.HashSSZ() require.NoError(t, err) require.EqualValues(t, expectedRoot, haveRoot) - // Cannot test it without a config. + // Cannot test it without a config. ????? if isBeaconState { return nil } @@ -111,6 +115,10 @@ func getSSZStaticConsensusTest[T unmarshalerMarshalerHashable](ref T) spectest.H } obj2 := object.Clone() + if versionObj, ok := obj2.(interface{ SetVersion(clparams.StateVersion) }); ok { + // Note: a bit tricky to change version here :( + versionObj.SetVersion(c.Version()) + } // test json jsonBlock, err := json.Marshal(object) require.NoError(t, err) @@ -123,3 +131,86 @@ func getSSZStaticConsensusTest[T unmarshalerMarshalerHashable](ref T) spectest.H return nil }) } + +func sszStaticTestByEmptyObject[T unmarshalerMarshalerHashable]( + obj T, opts ...func(*sszStaticTestOption), +) spectest.Handler { + return sszStaticTestNewObjectByFunc(func(v clparams.StateVersion) T { + return obj.Clone().(T) + }, opts...) +} + +func sszStaticTestNewObjectByFunc[T unmarshalerMarshalerHashable]( + newObjFunc func(v clparams.StateVersion) T, opts ...func(*sszStaticTestOption), +) spectest.Handler { + return spectest.HandlerFunc(func(t *testing.T, fsroot fs.FS, c spectest.TestCase) (err error) { + testOptions := sszStaticTestOption{} + for _, opt := range opts { + opt(&testOptions) + } + + if c.Version() < testOptions.runAfterVersion { + // skip + return nil + } + + // expected root + rootBytes, err := fs.ReadFile(fsroot, rootsFile) + require.NoError(t, err) + root := Root{} + require.NoError(t, yaml.Unmarshal(rootBytes, &root)) + expectedRoot := libcommon.HexToHash(root.Root) + + // new container + object := newObjFunc(c.Version()) + + // read ssz bytes and decode + snappyEncoded, err := fs.ReadFile(fsroot, serializedFile) + require.NoError(t, err) + encoded, err := utils.DecompressSnappy(snappyEncoded) + require.NoError(t, err) + if err := object.DecodeSSZ(encoded, int(c.Version())); err != nil { + return err + } + + // 1. check hash root + hashRoot, err := object.HashSSZ() + require.NoError(t, err) + require.EqualValues(t, expectedRoot, hashRoot, "hash root not equal") + + // 2. check ssz bytes + sszBytes, err := object.EncodeSSZ(nil) + require.NoError(t, err) + require.EqualValues(t, encoded, sszBytes, "ssz bytes not equal") + + if testOptions.testJson { + jsonObject := newObjFunc(c.Version()) + // make sure object data stay the same after marshal and unmarshal + jsonBytes, err := json.Marshal(object) + require.NoError(t, err, "json.Marshal failed") + require.NoError(t, json.Unmarshal(jsonBytes, jsonObject), "json.Unmarshal failed") + // check hash root again + hashRoot, err := jsonObject.HashSSZ() + require.NoError(t, err, "failed in HashSSZ") + require.Equal(t, expectedRoot, libcommon.Hash(hashRoot), "json not equal") + } + return nil + }) +} + +type sszStaticTestOption struct { + testJson bool + runAfterVersion clparams.StateVersion +} + +func withTestJson() func(*sszStaticTestOption) { + return func(opt *sszStaticTestOption) { + opt.testJson = true + } +} + +func runAfterVersion(version clparams.StateVersion) func(*sszStaticTestOption) { + return func(opt *sszStaticTestOption) { + opt.runAfterVersion = version + } +} diff --git a/cl/spectest/consensus_tests/transition.go b/cl/spectest/consensus_tests/transition.go index edd10497938..8ce522bcfd0 100644 --- a/cl/spectest/consensus_tests/transition.go +++ b/cl/spectest/consensus_tests/transition.go @@ -57,6 +57,8 @@ func (b *TransitionCore) Run(t *testing.T, root fs.FS, c spectest.TestCase) (err startState.BeaconConfig().CapellaForkEpoch = meta.ForkEpoch case clparams.DenebVersion: startState.BeaconConfig().DenebForkEpoch = meta.ForkEpoch + case clparams.ElectraVersion: + startState.BeaconConfig().ElectraForkEpoch = meta.ForkEpoch } startSlot := startState.Slot() blockIndex := 0 diff --git a/cl/ssz/encode.go b/cl/ssz/encode.go index b7bfea6c0b3..54f1ba67e8a 100644 --- a/cl/ssz/encode.go +++ b/cl/ssz/encode.go @@ -101,9 +101,11 @@ func MarshalSSZ(buf []byte, schema ...any) (dst []byte, err error) { startSize := len(dst) if obj.Static() { // If the object is static (fixed size), encode it using SSZ and update the dst - if dst, err = obj.EncodeSSZ(dst); err != nil { + encodedBytes, err := obj.EncodeSSZ(nil) + if err != nil { return nil, err } + dst = append(dst, encodedBytes...) } else { // If the object is dynamic (variable size), store the start offset and the object in separate slices offsetsStarts = append(offsetsStarts, startSize) diff --git a/cl/transition/impl/eth2/operations.go b/cl/transition/impl/eth2/operations.go index b7164ddd5ad..e686c815355 100644 --- a/cl/transition/impl/eth2/operations.go +++ b/cl/transition/impl/eth2/operations.go @@ -17,6 +17,7 @@ package eth2 import ( + "bytes" "errors" "fmt" "slices" @@ -41,6 +42,10 @@ import ( "github.com/erigontech/erigon/cl/utils" ) +const ( + FullExitRequestAmount = 0 +) + func (I *impl) FullValidate() bool { return I.FullValidation } @@ -138,6 +143,31 @@ func (I *impl) ProcessAttesterSlashing( return nil } +func isValidDepositSignature(depositData *cltypes.DepositData, cfg *clparams.BeaconChainConfig) (bool, error) { + // Agnostic domain. + domain, err := fork.ComputeDomain( + cfg.DomainDeposit[:], + utils.Uint32ToBytes4(uint32(cfg.GenesisForkVersion)), + [32]byte{}, + ) + if err != nil { + return false, err + } + depositMessageRoot, err := depositData.MessageHash() + if err != nil { + return false, err + } + signedRoot := utils.Sha256(depositMessageRoot[:], domain) + // Perform BLS verification and if successful noice. + valid, err := bls.Verify(depositData.Signature[:], signedRoot[:], depositData.PubKey[:]) + if err != nil || !valid { + // ignore err here + log.Debug("Validator BLS verification failed", "valid", valid, "err", err) + return false, nil + } + return true, nil +} + func (I *impl) ProcessDeposit(s abstract.BeaconState, deposit *cltypes.Deposit) error { if deposit == nil { return nil @@ -163,7 +193,6 @@ func (I *impl) ProcessDeposit(s abstract.BeaconState, deposit *cltypes.Deposit) ) { return errors.New("processDepositForAltair: Could not validate deposit root") } - // Increment index s.SetEth1DepositIndex(depositIndex + 1) publicKey := deposit.Data.PubKey @@ -171,39 +200,46 @@ func (I *impl) ProcessDeposit(s abstract.BeaconState, deposit *cltypes.Deposit) // Check if pub key is in validator set validatorIndex, has := s.ValidatorIndexByPubkey(publicKey) if !has { - // Agnostic domain. - domain, err := fork.ComputeDomain( - s.BeaconConfig().DomainDeposit[:], - utils.Uint32ToBytes4(uint32(s.BeaconConfig().GenesisForkVersion)), - [32]byte{}, - ) - if err != nil { - return err - } - depositMessageRoot, err := deposit.Data.MessageHash() - if err != nil { + // Check if the deposit is valid + if valid, err := statechange.IsValidDepositSignature(deposit.Data, s.BeaconConfig()); err != nil { return err - } - signedRoot := utils.Sha256(depositMessageRoot[:], domain) - // Perform BLS verification and if successful noice. - valid, err := bls.Verify(deposit.Data.Signature[:], signedRoot[:], publicKey[:]) - // Literally you can input it trash. - if !valid || err != nil { - log.Debug("Validator BLS verification failed", "valid", valid, "err", err) + } else if !valid { return nil } // Append validator - s.AddValidator(state.ValidatorFromDeposit(s.BeaconConfig(), deposit), amount) - // Altair forward - if s.Version() >= clparams.AltairVersion { - s.AddCurrentEpochParticipationFlags(cltypes.ParticipationFlags(0)) - s.AddPreviousEpochParticipationFlags(cltypes.ParticipationFlags(0)) - s.AddInactivityScore(0) + if s.Version() >= clparams.ElectraVersion { + statechange.AddValidatorToRegistry(s, publicKey, deposit.Data.WithdrawalCredentials, 0) + } else { + // Append validator and done + statechange.AddValidatorToRegistry(s, publicKey, deposit.Data.WithdrawalCredentials, amount) + return nil } + } + if s.Version() >= clparams.ElectraVersion { + s.AppendPendingDeposit(&solid.PendingDeposit{ + PubKey: publicKey, + WithdrawalCredentials: deposit.Data.WithdrawalCredentials, + Amount: amount, + Signature: deposit.Data.Signature, + Slot: s.BeaconConfig().GenesisSlot, // Use GENESIS_SLOT to distinguish from a pending deposit request + }) return nil + } else { + // Deneb and before: Increase the balance if exists already + return state.IncreaseBalance(s, validatorIndex, amount) } - // Increase the balance if exists already - return state.IncreaseBalance(s, validatorIndex, amount) +} + +func getPendingBalanceToWithdraw(s abstract.BeaconState, validatorIndex uint64) uint64 { + ws := s.GetPendingPartialWithdrawals() + balance := uint64(0) + ws.Range(func(index int, withdrawal *solid.PendingPartialWithdrawal, length int) bool { + if withdrawal.Index == validatorIndex { + balance += withdrawal.Amount + } + return true + }) + return balance } func IsVoluntaryExitApplicable(s abstract.BeaconState, voluntaryExit *cltypes.VoluntaryExit) error { @@ -212,20 +248,30 @@ func IsVoluntaryExitApplicable(s abstract.BeaconState, voluntaryExit *cltypes.Vo if err != nil { return err } + // Verify the validator is active if !validator.Active(currentEpoch) { return errors.New("ProcessVoluntaryExit: validator is not active") } + // Verify exit has not been initiated if validator.ExitEpoch() != s.BeaconConfig().FarFutureEpoch { return errors.New( "ProcessVoluntaryExit: another exit for the same validator is already getting processed", ) } + // Exits must specify an epoch when they become valid; they are not valid before then if currentEpoch < voluntaryExit.Epoch { return errors.New("ProcessVoluntaryExit: exit is happening in the future") } + // Verify the validator has been active long enough if currentEpoch < validator.ActivationEpoch()+s.BeaconConfig().ShardCommitteePeriod { return errors.New("ProcessVoluntaryExit: exit is happening too fast") } + if s.Version() >= clparams.ElectraVersion { + // Only exit validator if it has no pending withdrawals in the queue + if b := getPendingBalanceToWithdraw(s, voluntaryExit.ValidatorIndex); b > 0 { + return fmt.Errorf("ProcessVoluntaryExit: validator has pending balance to withdraw: %d", b) + } + } return nil } @@ -257,8 +303,8 @@ func (I *impl) ProcessWithdrawals( numValidators := uint64(s.ValidatorLength()) // Check if full validation is required and verify expected withdrawals. + expectedWithdrawals, partialWithdrawalsCount := state.ExpectedWithdrawals(s, state.Epoch(s)) if I.FullValidation { - expectedWithdrawals := state.ExpectedWithdrawals(s, state.Epoch(s)) if len(expectedWithdrawals) != withdrawals.Len() { return fmt.Errorf( "ProcessWithdrawals: expected %d withdrawals, but got %d", @@ -276,6 +322,13 @@ func (I *impl) ProcessWithdrawals( } } + if s.Version() >= clparams.ElectraVersion { + // Update pending partial withdrawals [New in Electra:EIP7251] + pendingPartialWithdrawal := s.GetPendingPartialWithdrawals() + pendingPartialWithdrawal.Cut(int(partialWithdrawalsCount)) + s.SetPendingPartialWithdrawals(pendingPartialWithdrawal) + } + if err := solid.RangeErr[*cltypes.Withdrawal](withdrawals, func(_ int, w *cltypes.Withdrawal, _ int) error { if err := state.DecreaseBalance(s, w.Validator, w.Amount); err != nil { return err @@ -304,22 +357,43 @@ func (I *impl) ProcessWithdrawals( } // ProcessExecutionPayload sets the latest payload header accordinly. -func (I *impl) ProcessExecutionPayload(s abstract.BeaconState, parentHash, prevRandao common.Hash, time uint64, payloadHeader *cltypes.Eth1Header) error { +func (I *impl) ProcessExecutionPayload(s abstract.BeaconState, body cltypes.GenericBeaconBody) error { + payloadHeader, err := body.GetPayloadHeader() + if err != nil { + return err + } + parentHash := payloadHeader.ParentHash + prevRandao := payloadHeader.PrevRandao + time := payloadHeader.Time if state.IsMergeTransitionComplete(s) { - if parentHash != s.LatestExecutionPayloadHeader().BlockHash { + // Verify consistency of the parent hash with respect to the previous execution payload header + // assert payload.parent_hash == state.latest_execution_payload_header.block_hash + if !bytes.Equal(parentHash[:], s.LatestExecutionPayloadHeader().BlockHash[:]) { return errors.New("ProcessExecutionPayload: invalid eth1 chain. mismatching parent") } } - if prevRandao != s.GetRandaoMixes(state.Epoch(s)) { + random := s.GetRandaoMixes(state.Epoch(s)) + if !bytes.Equal(prevRandao[:], random[:]) { + // Verify prev_randao + // assert payload.prev_randao == get_randao_mix(state, get_current_epoch(state)) return fmt.Errorf( "ProcessExecutionPayload: randao mix mismatches with mix digest, expected %x, got %x", - s.GetRandaoMixes(state.Epoch(s)), + random, prevRandao, ) } if time != state.ComputeTimestampAtSlot(s, s.Slot()) { + // Verify timestamp + // assert payload.timestamp == compute_timestamp_at_slot(state, state.slot) return errors.New("ProcessExecutionPayload: invalid Eth1 timestamp") } + + // Verify commitments are under limit + // assert len(body.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK + if body.GetBlobKzgCommitments().Len() > int(s.BeaconConfig().MaxBlobsPerBlock) { + return errors.New("ProcessExecutionPayload: too many blob commitments") + } + s.SetLatestExecutionPayloadHeader(payloadHeader) return nil } @@ -430,10 +504,39 @@ func (I *impl) ProcessBlsToExecutionChange( if err != nil { return err } + credentials := validator.WithdrawalCredentials() + // assert validator.withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX + if credentials[0] != byte(beaconConfig.BLSWithdrawalPrefixByte) { + return errors.New("ProcessBlsToExecutionChange: withdrawal credentials prefix mismatch") + } + // assert validator.withdrawal_credentials[1:] == hash(address_change.from_bls_pubkey)[1:] + hashKey := utils.Sha256(change.From[:]) + if !bytes.Equal(credentials[1:], hashKey[1:]) { + return errors.New("ProcessBlsToExecutionChange: withdrawal credentials mismatch") + } + + // Fork-agnostic domain since address changes are valid across forks + domain, err := fork.ComputeDomain( + s.BeaconConfig().DomainBLSToExecutionChange[:], + utils.Uint32ToBytes4(uint32(s.BeaconConfig().GenesisForkVersion)), + s.GenesisValidatorsRoot()) + if err != nil { + return err + } + signingRoot, err := fork.ComputeSigningRoot(change, domain) + if err != nil { + return err + } + // Verify the signature + ok, err := bls.Verify(signedChange.Signature[:], signingRoot[:], change.From[:]) + if err != nil { + return err + } + if !ok { + return errors.New("ProcessBlsToExecutionChange: invalid signature") + } // Perform full validation if requested. - wc := validator.WithdrawalCredentials() - credentials := wc // Reset the validator's withdrawal credentials. credentials[0] = byte(beaconConfig.ETH1AddressWithdrawalPrefixByte) copy(credentials[1:], make([]byte, 11)) @@ -489,6 +592,42 @@ func (I *impl) processAttestationPostAltair( stateSlot := s.Slot() beaconConfig := s.BeaconConfig() + if s.Version() >= clparams.ElectraVersion { + // assert index == 0 + if data.CommitteeIndex != 0 { + return nil, errors.New("processAttestationPostAltair: committee index must be 0") + } + // check committee + committeeIndices := attestation.CommitteeBits.GetOnIndices() + committeeOffset := 0 + for _, committeeIndex := range committeeIndices { + // assert committee_index < get_committee_count_per_slot(state, data.target.epoch) + if uint64(committeeIndex) >= s.CommitteeCount(currentEpoch) { + return nil, errors.New("processAttestationPostAltair: committee index out of bounds") + } + committee, err := s.GetBeaconCommitee(data.Slot, uint64(committeeIndex)) + if err != nil { + return nil, err + } + attesters := []uint64{} + for i, attester := range committee { + if attestation.AggregationBits.GetBitAt(committeeOffset + i) { + attesters = append(attesters, attester) + } + } + // assert len(committee_attesters) > 0 + if len(attesters) == 0 { + return nil, errors.New("processAttestationPostAltair: no attesters in committee") + } + committeeOffset += len(committee) + } + // Bitfield length matches total number of participants + // assert len(attestation.aggregation_bits) == committee_offset + if attestation.AggregationBits.Bits() != committeeOffset { + return nil, errors.New("processAttestationPostAltair: aggregation bits length mismatch") + } + } + participationFlagsIndicies, err := s.GetAttestationParticipationFlagIndicies( data, stateSlot-data.Slot, @@ -687,7 +826,7 @@ func IsAttestationApplicable(s abstract.BeaconState, attestation *solid.Attestat } cIndex := data.CommitteeIndex if s.Version().AfterOrEqual(clparams.ElectraVersion) { - index, err := attestation.ElectraSingleCommitteeIndex() + index, err := attestation.GetCommitteeIndexFromBits() if err != nil { return err } @@ -899,6 +1038,7 @@ func (I *impl) ProcessSlots(s abstract.BeaconState, slot uint64) error { return err } } + if state.Epoch(s) == beaconConfig.ElectraForkEpoch { if err := s.UpgradeToElectra(); err != nil { return err @@ -907,3 +1047,255 @@ func (I *impl) ProcessSlots(s abstract.BeaconState, slot uint64) error { } return nil } + +func (I *impl) ProcessDepositRequest(s abstract.BeaconState, depositRequest *solid.DepositRequest) error { + if s.GetDepositRequestsStartIndex() == s.BeaconConfig().UnsetDepositRequestsStartIndex { + s.SetDepositRequestsStartIndex(depositRequest.Index) + } + + // Create pending deposit + s.AppendPendingDeposit(&solid.PendingDeposit{ + PubKey: depositRequest.PubKey, + WithdrawalCredentials: depositRequest.WithdrawalCredentials, + Amount: depositRequest.Amount, + Signature: depositRequest.Signature, + Slot: s.Slot(), + }) + return nil +} + +func (I *impl) ProcessWithdrawalRequest(s abstract.BeaconState, req *solid.WithdrawalRequest) error { + var ( + amount = req.Amount + isFullExitRequest = req.Amount == FullExitRequestAmount + reqPubkey = req.ValidatorPubKey + ) + // If partial withdrawal queue is full, only full exits are processed + if uint64(s.GetPendingPartialWithdrawals().Len()) >= s.BeaconConfig().PendingPartialWithdrawalsLimit && !isFullExitRequest { + return nil + } + // Verify pubkey exists + vindex, exist := s.ValidatorIndexByPubkey(reqPubkey) + if !exist { + return nil + } + validator, err := s.ValidatorForValidatorIndex(int(vindex)) + if err != nil { + return err + } + // Verify withdrawal credentials + hasCorrectCredential := state.HasExecutionWithdrawalCredential(validator, s.BeaconConfig()) + wc := validator.WithdrawalCredentials() + isCorrectSourceAddress := bytes.Equal(req.SourceAddress[:], wc[12:]) + if !(isCorrectSourceAddress && hasCorrectCredential) { + return nil + } + // check validator is active + if !validator.Active(state.Epoch(s)) { + return nil + } + // Verify exit has not been initiated + if validator.ExitEpoch() != s.BeaconConfig().FarFutureEpoch { + return nil + } + // Verify the validator has been active long enough + if state.Epoch(s) < validator.ActivationEpoch()+s.BeaconConfig().ShardCommitteePeriod { + return nil + } + pendingBalanceToWithdraw := getPendingBalanceToWithdraw(s, vindex) + if isFullExitRequest { + // Only exit validator if it has no pending withdrawals in the queue + if pendingBalanceToWithdraw == 0 { + return s.InitiateValidatorExit(vindex) + } + } + + vbalance, err := s.ValidatorBalance(int(vindex)) + if err != nil { + return err + } + hasSufficientEffectiveBalance := validator.EffectiveBalance() >= s.BeaconConfig().MinActivationBalance + hasExcessBalance := vbalance > s.BeaconConfig().MinActivationBalance+pendingBalanceToWithdraw + // Only allow partial withdrawals with compounding withdrawal credentials + if state.HasCompoundingWithdrawalCredential(validator, s.BeaconConfig()) && hasSufficientEffectiveBalance && hasExcessBalance { + toWithdraw := min( + vbalance-s.BeaconConfig().MinActivationBalance-pendingBalanceToWithdraw, + amount, + ) + exitQueueEpoch := s.ComputeExitEpochAndUpdateChurn(validator.EffectiveBalance()) + withdrawableEpoch := exitQueueEpoch + s.BeaconConfig().MinValidatorWithdrawabilityDelay + s.AppendPendingPartialWithdrawal(&solid.PendingPartialWithdrawal{ + Index: vindex, + Amount: toWithdraw, + WithdrawableEpoch: withdrawableEpoch, + }) + } + return nil +} + +func (I *impl) ProcessConsolidationRequest(s abstract.BeaconState, consolidationRequest *solid.ConsolidationRequest) error { + if isValidSwitchToCompoundingRequest(s, consolidationRequest) { + // source index + sourceIndex, exist := s.ValidatorIndexByPubkey(consolidationRequest.SourcePubKey) + if !exist { + log.Warn("Validator index not found for source pubkey", "pubkey", consolidationRequest.SourcePubKey) + return nil + } + if err := switchToCompoundingValidator(s, sourceIndex); err != nil { + return err + } + return nil + } + // Verify that source != target, so a consolidation cannot be used as an exit. + if bytes.Equal(consolidationRequest.SourcePubKey[:], consolidationRequest.TargetPubKey[:]) { + return nil + } + // If the pending consolidations queue is full, consolidation requests are ignored + if s.GetPendingConsolidations().Len() == int(s.BeaconConfig().PendingConsolidationsLimit) { + return nil + } + // If there is too little available consolidation churn limit, consolidation requests are ignored + if state.GetConsolidationChurnLimit(s) <= s.BeaconConfig().MinActivationBalance { + return nil + } + // source/target index and validator + sourceIndex, exist := s.ValidatorIndexByPubkey(consolidationRequest.SourcePubKey) + if !exist { + log.Warn("Validator index not found for source pubkey", "pubkey", consolidationRequest.SourcePubKey) + return nil + } + targetIndex, exist := s.ValidatorIndexByPubkey(consolidationRequest.TargetPubKey) + if !exist { + log.Warn("Validator index not found for target pubkey", "pubkey", consolidationRequest.TargetPubKey) + return nil + } + sourceValidator, err := s.ValidatorForValidatorIndex(int(sourceIndex)) + if err != nil { + return err + } + targetValidator, err := s.ValidatorForValidatorIndex(int(targetIndex)) + if err != nil { + return err + } + + // Verify source withdrawal credentials + hasCorrectCredential := state.HasExecutionWithdrawalCredential(sourceValidator, s.BeaconConfig()) + sourceWc := sourceValidator.WithdrawalCredentials() + isCorrectSourceAddress := bytes.Equal(consolidationRequest.SourceAddress[:], sourceWc[12:]) + if !(isCorrectSourceAddress && hasCorrectCredential) { + return nil + } + // Verify that target has execution withdrawal credentials + if !state.HasExecutionWithdrawalCredential(targetValidator, s.BeaconConfig()) { + return nil + } + // Verify the source and the target are active + curEpoch := state.Epoch(s) + if !sourceValidator.Active(curEpoch) || !targetValidator.Active(curEpoch) { + return nil + } + // Verify exits for source and target have not been initiated + if sourceValidator.ExitEpoch() != s.BeaconConfig().FarFutureEpoch || + targetValidator.ExitEpoch() != s.BeaconConfig().FarFutureEpoch { + return nil + } + // Verify the source has been active long enough + if curEpoch < sourceValidator.ActivationEpoch()+s.BeaconConfig().ShardCommitteePeriod { + return nil + } + // Verify the source has no pending withdrawals in the queue + if getPendingBalanceToWithdraw(s, sourceIndex) > 0 { + return nil + } + + // Initiate source validator exit and append pending consolidation + sourceValidator.SetExitEpoch(computeConsolidationEpochAndUpdateChurn(s, sourceValidator.EffectiveBalance())) + sourceValidator.SetWithdrawableEpoch(sourceValidator.ExitEpoch() + s.BeaconConfig().MinValidatorWithdrawabilityDelay) + s.SetValidatorAtIndex(int(sourceIndex), sourceValidator) // update the state and underlying validator set. Mark the merkle tree dirty. + s.AppendPendingConsolidation(&solid.PendingConsolidation{ + SourceIndex: sourceIndex, + TargetIndex: targetIndex, + }) + if state.HasEth1WithdrawalCredential(targetValidator, s.BeaconConfig()) { + return switchToCompoundingValidator(s, targetIndex) + } + return nil +} + +func isValidSwitchToCompoundingRequest(s abstract.BeaconState, request *solid.ConsolidationRequest) bool { + // Switch to compounding requires source and target be equal + if !bytes.Equal(request.SourcePubKey[:], request.TargetPubKey[:]) { + return false + } + // Verify pubkey exists + vindex, exist := s.ValidatorIndexByPubkey(request.SourcePubKey) + if !exist { + return false + } + sourceValidator, err := s.ValidatorForValidatorIndex(int(vindex)) + if err != nil { + log.Warn("Error getting validator for source pubkey", "error", err) + return false + } + // Verify request has been authorized + wc := sourceValidator.WithdrawalCredentials() + if !bytes.Equal(wc[12:], request.SourceAddress[:]) { + return false + } + // Verify source withdrawal credentials + if !state.HasEth1WithdrawalCredential(sourceValidator, s.BeaconConfig()) { + return false + } + // Verify the source is active + curEpoch := state.Epoch(s) + if !sourceValidator.Active(curEpoch) { + return false + } + // Verify exit for source has not been initiated + if sourceValidator.ExitEpoch() != s.BeaconConfig().FarFutureEpoch { + return false + } + return true +} + +func switchToCompoundingValidator(s abstract.BeaconState, vindex uint64) error { + validator, err := s.ValidatorForValidatorIndex(int(vindex)) + if err != nil { + return err + } + // copy the withdrawal credentials + wc := validator.WithdrawalCredentials() + newWc := common.Hash{} + copy(newWc[:], wc[:]) + newWc[0] = s.BeaconConfig().CompoundingWithdrawalPrefix + validator.SetWithdrawalCredentials(newWc) + s.SetValidatorAtIndex(int(vindex), validator) // update the state + return state.QueueExcessActiveBalance(s, vindex, &validator) +} + +// compute_consolidation_epoch_and_update_churn +func computeConsolidationEpochAndUpdateChurn(s abstract.BeaconState, consolidationBalance uint64) uint64 { + earlistConsolidationEpoch := max( + s.GetEarlistConsolidationEpoch(), + state.ComputeActivationExitEpoch(s.BeaconConfig(), state.Epoch(s)), + ) + perEpochConsolidationChurn := state.GetConsolidationChurnLimit(s) + // New epoch for consolidations. + var consolidationBalanceToConsume uint64 + if s.GetEarlistConsolidationEpoch() < earlistConsolidationEpoch { + consolidationBalanceToConsume = perEpochConsolidationChurn + } else { + consolidationBalanceToConsume = s.GetConsolidationBalanceToConsume() + } + // Consolidation doesn't fit in the current earliest epoch. + if consolidationBalance > consolidationBalanceToConsume { + balanceToProcess := consolidationBalance - consolidationBalanceToConsume + additionalEpochs := (balanceToProcess-1)/perEpochConsolidationChurn + 1 + earlistConsolidationEpoch += additionalEpochs + consolidationBalanceToConsume += additionalEpochs * perEpochConsolidationChurn + } + // Consume the balance and update state variables. + s.SetConsolidationBalanceToConsume(consolidationBalanceToConsume - consolidationBalance) + s.SetEarlistConsolidationEpoch(earlistConsolidationEpoch) + return earlistConsolidationEpoch +} diff --git a/cl/transition/impl/eth2/statechange/process_effective_balance_update.go b/cl/transition/impl/eth2/statechange/process_effective_balance_update.go index 2f8765937d5..5f2c1f0a440 100644 --- a/cl/transition/impl/eth2/statechange/process_effective_balance_update.go +++ b/cl/transition/impl/eth2/statechange/process_effective_balance_update.go @@ -20,29 +20,32 @@ import ( "github.com/erigontech/erigon/cl/abstract" "github.com/erigontech/erigon/cl/cltypes/solid" "github.com/erigontech/erigon/cl/monitor" + "github.com/erigontech/erigon/cl/phase1/core/state" ) // ProcessEffectiveBalanceUpdates updates the effective balance of validators. Specs at: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#effective-balances-updates -func ProcessEffectiveBalanceUpdates(state abstract.BeaconState) error { +func ProcessEffectiveBalanceUpdates(s abstract.BeaconState) error { defer monitor.ObserveElaspedTime(monitor.ProcessEffectiveBalanceUpdatesTime).End() - beaconConfig := state.BeaconConfig() + beaconConfig := s.BeaconConfig() // Define non-changing constants to avoid recomputation. histeresisIncrement := beaconConfig.EffectiveBalanceIncrement / beaconConfig.HysteresisQuotient downwardThreshold := histeresisIncrement * beaconConfig.HysteresisDownwardMultiplier upwardThreshold := histeresisIncrement * beaconConfig.HysteresisUpwardMultiplier + // Iterate over validator set and compute the diff of each validator. var err error var balance uint64 - state.ForEachValidator(func(validator solid.Validator, index, total int) bool { - balance, err = state.ValidatorBalance(index) + s.ForEachValidator(func(validator solid.Validator, index, total int) bool { + balance, err = s.ValidatorBalance(index) if err != nil { return false } eb := validator.EffectiveBalance() if balance+downwardThreshold < eb || eb+upwardThreshold < balance { // Set new effective balance - effectiveBalance := min(balance-(balance%beaconConfig.EffectiveBalanceIncrement), beaconConfig.MaxEffectiveBalance) - state.SetEffectiveBalanceForValidatorAtIndex(index, effectiveBalance) + maxEffectiveBalance := state.GetMaxEffectiveBalanceByVersion(validator, s.BeaconConfig(), s.Version()) + effectiveBalance := min(balance-(balance%beaconConfig.EffectiveBalanceIncrement), maxEffectiveBalance) + s.SetEffectiveBalanceForValidatorAtIndex(index, effectiveBalance) } return true }) diff --git a/cl/transition/impl/eth2/statechange/process_epoch.go b/cl/transition/impl/eth2/statechange/process_epoch.go index 0b31fd2dd6c..ae97c5e12c2 100644 --- a/cl/transition/impl/eth2/statechange/process_epoch.go +++ b/cl/transition/impl/eth2/statechange/process_epoch.go @@ -75,6 +75,11 @@ func ProcessEpoch(s abstract.BeaconState) error { } ProcessEth1DataReset(s) + if s.Version() >= clparams.ElectraVersion { + ProcessPendingDeposits(s) + ProcessPendingConsolidations(s) + } + if err := ProcessEffectiveBalanceUpdates(s); err != nil { return err } diff --git a/cl/transition/impl/eth2/statechange/process_pending_consolidations.go b/cl/transition/impl/eth2/statechange/process_pending_consolidations.go new file mode 100644 index 00000000000..aecff774d94 --- /dev/null +++ b/cl/transition/impl/eth2/statechange/process_pending_consolidations.go @@ -0,0 +1,45 @@ +package statechange + +import ( + "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/cl/abstract" + "github.com/erigontech/erigon/cl/cltypes/solid" + "github.com/erigontech/erigon/cl/phase1/core/state" +) + +func ProcessPendingConsolidations(s abstract.BeaconState) { + nextEpoch := s.Slot()/s.BeaconConfig().SlotsPerEpoch + 1 + nextConsolidationIndex := 0 + s.GetPendingConsolidations().Range(func(i int, c *solid.PendingConsolidation, length int) bool { + sourceValidator, err := s.ValidatorForValidatorIndex(int(c.SourceIndex)) + if err != nil { + log.Warn("Failed to get source validator for consolidation", "index", c.SourceIndex) + nextConsolidationIndex++ + return true + } + if sourceValidator.Slashed() { + nextConsolidationIndex++ + return true + } + if sourceValidator.WithdrawableEpoch() > nextEpoch { + return false // stop processing + } + // Calculate the consolidated balance + maxEffectiveBalance := state.GetMaxEffectiveBalanceByVersion(sourceValidator, s.BeaconConfig(), s.Version()) + vBalance, err := s.ValidatorBalance(int(c.SourceIndex)) + if err != nil { + log.Warn("Failed to get validator balance for consolidation", "index", c.SourceIndex) + nextConsolidationIndex++ + return true + } + sourceEffectiveBalance := min(vBalance, maxEffectiveBalance) + // Move active balance to target. Excess balance is withdrawable. + state.DecreaseBalance(s, c.SourceIndex, sourceEffectiveBalance) + state.IncreaseBalance(s, c.TargetIndex, sourceEffectiveBalance) + nextConsolidationIndex++ + return true + }) + pendingConsolidations := s.GetPendingConsolidations().ShallowCopy() + pendingConsolidations.Cut(nextConsolidationIndex) + s.SetPendingConsolidations(pendingConsolidations) +} diff --git a/cl/transition/impl/eth2/statechange/process_pending_deposits.go b/cl/transition/impl/eth2/statechange/process_pending_deposits.go new file mode 100644 index 00000000000..e166915687d --- /dev/null +++ b/cl/transition/impl/eth2/statechange/process_pending_deposits.go @@ -0,0 +1,94 @@ +package statechange + +import ( + "github.com/erigontech/erigon/cl/abstract" + "github.com/erigontech/erigon/cl/cltypes" + "github.com/erigontech/erigon/cl/cltypes/solid" + "github.com/erigontech/erigon/cl/monitor" + "github.com/erigontech/erigon/cl/phase1/core/state" +) + +func ProcessPendingDeposits(s abstract.BeaconState) { + defer monitor.ObserveElaspedTime(monitor.ProcessPendingDepositsTime).End() + + var ( + nextEpoch = s.Slot()/s.BeaconConfig().SlotsPerEpoch + 1 + availableForProcessing = s.GetDepositBalanceToConsume() + state.GetActivationExitChurnLimit(s) + processAmount = uint64(0) + nextDepositIndex = 0 + depositToPostpone = []*solid.PendingDeposit{} + isChurnLimitReached = false + finalizedSlot = s.FinalizedCheckpoint().Epoch * s.BeaconConfig().SlotsPerEpoch + ) + s.GetPendingDeposits().Range(func(i int, d *solid.PendingDeposit, length int) bool { + // Do not process deposit requests if Eth1 bridge deposits are not yet applied. + if d.Slot > s.BeaconConfig().GenesisSlot && s.Eth1DepositIndex() < s.GetDepositRequestsStartIndex() { + return false + } + // Check if deposit has been finalized, otherwise, stop processing. + if d.Slot > finalizedSlot { + return false + } + // Check if number of processed deposits has not reached the limit, otherwise, stop processing. + if nextDepositIndex >= int(s.BeaconConfig().MaxPendingDepositsPerEpoch) { + return false + } + isValidatorExited := false + isValidatorWithdrawn := false + if vindex, exist := s.ValidatorIndexByPubkey(d.PubKey); exist { + validator := s.ValidatorSet().Get(int(vindex)) + isValidatorExited = validator.ExitEpoch() < s.BeaconConfig().FarFutureEpoch + isValidatorWithdrawn = validator.WithdrawableEpoch() < nextEpoch + } + + if isValidatorWithdrawn { + // Deposited balance will never become active. Increase balance but do not consume churn + applyPendingDeposit(s, d) + } else if isValidatorExited { + // Validator is exiting, postpone the deposit until after withdrawable epoch + depositToPostpone = append(depositToPostpone, d) + } else { + // Check if deposit fits in the churn, otherwise, do no more deposit processing in this epoch. + isChurnLimitReached = processAmount+d.Amount > availableForProcessing + if isChurnLimitReached { + return false + } + // Consume churn and apply deposit. + processAmount += d.Amount + applyPendingDeposit(s, d) + } + nextDepositIndex++ + return true + }) + + // update pending deposits. [nextDepositIndex:] + [postponed] + newPendingDeposits := s.GetPendingDeposits().ShallowCopy() + newPendingDeposits.Cut(nextDepositIndex) + for _, d := range depositToPostpone { + newPendingDeposits.Append(d) + } + s.SetPendingDeposits(newPendingDeposits) + + // Accumulate churn only if the churn limit has been hit. + if isChurnLimitReached { + s.SetDepositBalanceToConsume(availableForProcessing - processAmount) + } else { + s.SetDepositBalanceToConsume(0) + } +} + +func applyPendingDeposit(s abstract.BeaconState, d *solid.PendingDeposit) { + if vindex, exist := s.ValidatorIndexByPubkey(d.PubKey); !exist { + if valid, _ := IsValidDepositSignature(&cltypes.DepositData{ + PubKey: d.PubKey, + WithdrawalCredentials: d.WithdrawalCredentials, + Amount: d.Amount, + Signature: d.Signature, + }, s.BeaconConfig()); valid { + AddValidatorToRegistry(s, d.PubKey, d.WithdrawalCredentials, d.Amount) + } + } else { + // increase balance + state.IncreaseBalance(s, vindex, d.Amount) + } +} diff --git a/cl/transition/impl/eth2/statechange/process_registry_updates.go b/cl/transition/impl/eth2/statechange/process_registry_updates.go index 90b60fc5f73..2423b69a54f 100644 --- a/cl/transition/impl/eth2/statechange/process_registry_updates.go +++ b/cl/transition/impl/eth2/statechange/process_registry_updates.go @@ -51,18 +51,17 @@ func ProcessRegistryUpdates(s abstract.BeaconState) error { // Process activation eligibility and ejections. if err := threading.ParallellForLoop(runtime.NumCPU(), 0, s.ValidatorSet().Length(), func(i int) error { validator := s.ValidatorSet().Get(i) - activationEligibilityEpoch := validator.ActivationEligibilityEpoch() - effectivaBalance := validator.EffectiveBalance() - if activationEligibilityEpoch == s.BeaconConfig().FarFutureEpoch && - validator.EffectiveBalance() == s.BeaconConfig().MaxEffectiveBalance { + if state.IsValidatorEligibleForActivationQueue(s, validator) { s.SetActivationEligibilityEpochForValidatorAtIndex(i, currentEpoch+1) } + effectivaBalance := validator.EffectiveBalance() if validator.Active(currentEpoch) && effectivaBalance <= beaconConfig.EjectionBalance { if err := s.InitiateValidatorExit(uint64(i)); err != nil { return err } } // Insert in the activation queue in case. + activationEligibilityEpoch := validator.ActivationEligibilityEpoch() if activationEligibilityEpoch <= s.FinalizedCheckpoint().Epoch && validator.ActivationEpoch() == s.BeaconConfig().FarFutureEpoch { m.Lock() @@ -76,18 +75,22 @@ func ProcessRegistryUpdates(s abstract.BeaconState) error { }); err != nil { return err } - // order the queue accordingly. - sort.Slice(activationQueue, func(i, j int) bool { - // Order by the sequence of activation_eligibility_epoch setting and then index. - if activationQueue[i].activationEligibilityEpoch != activationQueue[j].activationEligibilityEpoch { - return activationQueue[i].activationEligibilityEpoch < activationQueue[j].activationEligibilityEpoch + + if s.Version() <= clparams.DenebVersion { + // order the queue accordingly. + sort.Slice(activationQueue, func(i, j int) bool { + // Order by the sequence of activation_eligibility_epoch setting and then index. + if activationQueue[i].activationEligibilityEpoch != activationQueue[j].activationEligibilityEpoch { + return activationQueue[i].activationEligibilityEpoch < activationQueue[j].activationEligibilityEpoch + } + return activationQueue[i].validatorIndex < activationQueue[j].validatorIndex + }) + activationQueueLength := s.GetValidatorActivationChurnLimit() + if len(activationQueue) > int(activationQueueLength) { + activationQueue = activationQueue[:activationQueueLength] } - return activationQueue[i].validatorIndex < activationQueue[j].validatorIndex - }) - activationQueueLength := s.GetValidatorActivationChurnLimit() - if len(activationQueue) > int(activationQueueLength) { - activationQueue = activationQueue[:activationQueueLength] } + // Only process up to epoch limit. for _, entry := range activationQueue { s.SetActivationEpochForValidatorAtIndex(int(entry.validatorIndex), computeActivationExitEpoch(beaconConfig, currentEpoch)) diff --git a/cl/transition/impl/eth2/statechange/process_slashings.go b/cl/transition/impl/eth2/statechange/process_slashings.go index 15415f9d3a8..5bd7fc7203a 100644 --- a/cl/transition/impl/eth2/statechange/process_slashings.go +++ b/cl/transition/impl/eth2/statechange/process_slashings.go @@ -26,14 +26,19 @@ import ( "github.com/erigontech/erigon/cl/utils/threading" ) -func processSlashings(s abstract.BeaconState, slashingMultiplier uint64) error { - // Get the current epoch +func ProcessSlashings(s abstract.BeaconState) error { + defer monitor.ObserveElaspedTime(monitor.ProcessSlashingsTime).End() + if s.Version().AfterOrEqual(clparams.ElectraVersion) { + // Switch to Electra slashing + return processSlashingsElectra(s) + } + epoch := state.Epoch(s) // Get the total active balance totalBalance := s.GetTotalActiveBalance() // Calculate the total slashing amount // by summing all slashings and multiplying by the provided multiplier - slashing := state.GetTotalSlashingAmount(s) * slashingMultiplier + slashing := state.GetTotalSlashingAmount(s) * s.BeaconConfig().GetProportionalSlashingMultiplier(s.Version()) // Adjust the total slashing amount to be no greater than the total active balance if totalBalance < slashing { slashing = totalBalance @@ -56,15 +61,24 @@ func processSlashings(s abstract.BeaconState, slashingMultiplier uint64) error { }) } -func ProcessSlashings(state abstract.BeaconState) error { - defer monitor.ObserveElaspedTime(monitor.ProcessSlashingsTime).End() - // Depending on the version of the state, use different multipliers - switch state.Version() { - case clparams.Phase0Version: - return processSlashings(state, state.BeaconConfig().ProportionalSlashingMultiplier) - case clparams.AltairVersion: - return processSlashings(state, state.BeaconConfig().ProportionalSlashingMultiplierAltair) - default: - return processSlashings(state, state.BeaconConfig().ProportionalSlashingMultiplierBellatrix) - } +func processSlashingsElectra(s abstract.BeaconState) error { + // see: https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/beacon-chain.md#modified-process_slashings + epoch := state.Epoch(s) + totalBalance := s.GetTotalActiveBalance() + adjustTotalSlashingBalance := min( + state.GetTotalSlashingAmount(s)*s.BeaconConfig().GetProportionalSlashingMultiplier(s.Version()), + totalBalance, + ) + cfg := s.BeaconConfig() + increment := cfg.EffectiveBalanceIncrement + penaltyPerEffectiveBalanceIncr := adjustTotalSlashingBalance / (totalBalance / increment) + return threading.ParallellForLoop(runtime.NumCPU(), 0, s.ValidatorSet().Length(), func(i int) error { + v := s.ValidatorSet().Get(i) + if !v.Slashed() || epoch+cfg.EpochsPerSlashingsVector/2 != v.WithdrawableEpoch() { + return nil + } + effectiveBalanceIncrements := v.EffectiveBalance() / increment + penalty := penaltyPerEffectiveBalanceIncr * effectiveBalanceIncrements + return state.DecreaseBalance(s, uint64(i), penalty) + }) } diff --git a/cl/transition/impl/eth2/statechange/utils.go b/cl/transition/impl/eth2/statechange/utils.go new file mode 100644 index 00000000000..e34a1d07de9 --- /dev/null +++ b/cl/transition/impl/eth2/statechange/utils.go @@ -0,0 +1,56 @@ +package statechange + +import ( + "github.com/Giulio2002/bls" + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/cl/abstract" + "github.com/erigontech/erigon/cl/clparams" + "github.com/erigontech/erigon/cl/cltypes" + "github.com/erigontech/erigon/cl/fork" + "github.com/erigontech/erigon/cl/phase1/core/state" + "github.com/erigontech/erigon/cl/utils" +) + +func IsValidDepositSignature( + depositData *cltypes.DepositData, + cfg *clparams.BeaconChainConfig) (bool, error) { + // Agnostic domain. + domain, err := fork.ComputeDomain( + cfg.DomainDeposit[:], + utils.Uint32ToBytes4(uint32(cfg.GenesisForkVersion)), + [32]byte{}, + ) + if err != nil { + return false, err + } + depositMessageRoot, err := depositData.MessageHash() + if err != nil { + return false, err + } + signedRoot := utils.Sha256(depositMessageRoot[:], domain) + // Perform BLS verification and if successful noice. + valid, err := bls.Verify(depositData.Signature[:], signedRoot[:], depositData.PubKey[:]) + if err != nil || !valid { + // ignore err here + log.Debug("Validator BLS verification failed", "valid", valid, "err", err) + return false, nil + } + return true, nil +} + +func AddValidatorToRegistry( + s abstract.BeaconState, + pubkey [48]byte, + withdrawalCredentials common.Hash, + amount uint64, +) { + // Append validator + s.AddValidator(state.GetValidatorFromDeposit(s, pubkey, withdrawalCredentials, amount), amount) + if s.Version() >= clparams.AltairVersion { + // Altair forward + s.AddCurrentEpochParticipationFlags(cltypes.ParticipationFlags(0)) + s.AddPreviousEpochParticipationFlags(cltypes.ParticipationFlags(0)) + s.AddInactivityScore(0) + } +} diff --git a/cl/transition/impl/funcmap/impl.go b/cl/transition/impl/funcmap/impl.go index 557bd776496..3cea6cfea68 100644 --- a/cl/transition/impl/funcmap/impl.go +++ b/cl/transition/impl/funcmap/impl.go @@ -16,6 +16,7 @@ package funcmap +/* import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/abstract" @@ -108,3 +109,4 @@ func (i Impl) ProcessBlsToExecutionChange(state abstract.BeaconState, signedChan func (i Impl) ProcessSlots(s abstract.BeaconState, slot uint64) error { return i.FnProcessSlots(s, slot) } +*/ diff --git a/cl/transition/machine/block.go b/cl/transition/machine/block.go index 7a0d0e83aef..c1854b0699b 100644 --- a/cl/transition/machine/block.go +++ b/cl/transition/machine/block.go @@ -46,20 +46,20 @@ func ProcessBlock(impl BlockProcessor, s abstract.BeaconState, block cltypes.Gen // Check the state version is correct. if block.Version() != version { - return fmt.Errorf("processBlindedBlock: wrong state version for block at slot %d", block.GetSlot()) + return fmt.Errorf("processBlock: wrong state version for block at slot %d. state version %v. block version %v", block.GetSlot(), version, block.Version()) } bodyRoot, err := body.HashSSZ() if err != nil { - return errors.WithMessagef(err, "processBlindedBlock: failed to hash block body") + return errors.WithMessagef(err, "processBlock: failed to hash block body") } if err := impl.ProcessBlockHeader(s, block.GetSlot(), block.GetProposerIndex(), block.GetParentRoot(), bodyRoot); err != nil { - return fmt.Errorf("processBlindedBlock: failed to process block header: %v", err) + return fmt.Errorf("processBlock: failed to process block header: %v", err) } // Process execution payload if enabled. if version >= clparams.BellatrixVersion && executionEnabled(s, payloadHeader.BlockHash) { if s.Version() >= clparams.CapellaVersion { // Process withdrawals in the execution payload. - expect := state.ExpectedWithdrawals(s, state.Epoch(s)) + expect, _ := state.ExpectedWithdrawals(s, state.Epoch(s)) expectWithdrawals := solid.NewStaticListSSZ[*cltypes.Withdrawal](int(s.BeaconConfig().MaxWithdrawalsPerPayload), 44) for i := range expect { expectWithdrawals.Append(expect[i]) @@ -68,10 +68,7 @@ func ProcessBlock(impl BlockProcessor, s abstract.BeaconState, block cltypes.Gen return fmt.Errorf("processBlock: failed to process withdrawals: %v", err) } } - parentHash := payloadHeader.ParentHash - prevRandao := payloadHeader.PrevRandao - time := payloadHeader.Time - if err := impl.ProcessExecutionPayload(s, parentHash, prevRandao, time, payloadHeader); err != nil { + if err := impl.ProcessExecutionPayload(s, body); err != nil { return fmt.Errorf("processBlock: failed to process execution payload: %v", err) } } @@ -131,13 +128,9 @@ func ProcessOperations(impl BlockOperationProcessor, s abstract.BeaconState, blo } signatures, messages, publicKeys = append(signatures, sigs...), append(messages, msgs...), append(publicKeys, pubKeys...) - if err := solid.RangeErr[*cltypes.AttesterSlashing](blockBody.GetAttesterSlashings(), func(index int, slashing *cltypes.AttesterSlashing, length int) error { - if err = impl.ProcessAttesterSlashing(s, slashing); err != nil { - return fmt.Errorf("ProcessAttesterSlashing: %s", err) - } - return nil - }); err != nil { - return nil, nil, nil, err + // attester slashings + if err := forEachProcess(s, blockBody.GetAttesterSlashings(), impl.ProcessAttesterSlashing); err != nil { + return nil, nil, nil, fmt.Errorf("ProcessProposerSlashing: %s", err) } // Process each attestations @@ -146,13 +139,8 @@ func ProcessOperations(impl BlockOperationProcessor, s abstract.BeaconState, blo } // Process each deposit - if err := solid.RangeErr[*cltypes.Deposit](blockBody.GetDeposits(), func(index int, deposit *cltypes.Deposit, length int) error { - if err = impl.ProcessDeposit(s, deposit); err != nil { - return fmt.Errorf("ProcessDeposit: %s", err) - } - return nil - }); err != nil { - return nil, nil, nil, err + if err := forEachProcess(s, blockBody.GetDeposits(), impl.ProcessDeposit); err != nil { + return nil, nil, nil, fmt.Errorf("ProcessDeposit: %s", err) } // Process each voluntary exit. @@ -173,9 +161,30 @@ func ProcessOperations(impl BlockOperationProcessor, s abstract.BeaconState, blo } signatures, messages, publicKeys = append(signatures, sigs...), append(messages, msgs...), append(publicKeys, pubKeys...) + if s.Version() >= clparams.ElectraVersion { + if err := forEachProcess(s, blockBody.GetExecutionRequests().Deposits, impl.ProcessDepositRequest); err != nil { + return nil, nil, nil, fmt.Errorf("ProcessDepositRequest: %s", err) + } + if err := forEachProcess(s, blockBody.GetExecutionRequests().Withdrawals, impl.ProcessWithdrawalRequest); err != nil { + return nil, nil, nil, fmt.Errorf("ProcessWithdrawalRequest: %s", err) + } + if err := forEachProcess(s, blockBody.GetExecutionRequests().Consolidations, impl.ProcessConsolidationRequest); err != nil { + return nil, nil, nil, fmt.Errorf("ProcessConsolidationRequest: %s", err) + } + } + return } +func forEachProcess[T solid.EncodableHashableSSZ]( + s abstract.BeaconState, + list *solid.ListSSZ[T], + f func(s abstract.BeaconState, item T) error) error { + return solid.RangeErr(list, func(index int, item T, length int) error { + return f(s, item) + }) +} + func processRandao(impl BlockProcessor, s abstract.BeaconState, body cltypes.GenericBeaconBody, block cltypes.GenericBeaconBlock) (sigs [][]byte, msgs [][]byte, pubKeys [][]byte, err error) { // Process RANDAO reveal. proposerIndex := block.GetProposerIndex() @@ -285,9 +294,9 @@ func processBlsToExecutionChanges(impl BlockOperationProcessor, s abstract.Beaco return err } - // Perform full validation if requested. - wc := validator.WithdrawalCredentials() if impl.FullValidate() { + // Perform full validation if requested. + wc := validator.WithdrawalCredentials() // Check the validator's withdrawal credentials prefix. if wc[0] != byte(beaconConfig.BLSWithdrawalPrefixByte) { return errors.New("invalid withdrawal credentials prefix") diff --git a/cl/transition/machine/machine.go b/cl/transition/machine/machine.go index e160ed18bf1..a7d7d573936 100644 --- a/cl/transition/machine/machine.go +++ b/cl/transition/machine/machine.go @@ -47,7 +47,7 @@ type SlotProcessor interface { type BlockHeaderProcessor interface { ProcessBlockHeader(s abstract.BeaconState, slot, proposerIndex uint64, parentRoot common.Hash, bodyRoot [32]byte) error ProcessWithdrawals(s abstract.BeaconState, withdrawals *solid.ListSSZ[*cltypes.Withdrawal]) error - ProcessExecutionPayload(s abstract.BeaconState, parentHash, prevRandao common.Hash, time uint64, payloadHeader *cltypes.Eth1Header) error + ProcessExecutionPayload(s abstract.BeaconState, body cltypes.GenericBeaconBody) error ProcessRandao(s abstract.BeaconState, randao [96]byte, proposerIndex uint64) error ProcessEth1Data(state abstract.BeaconState, eth1Data *cltypes.Eth1Data) error ProcessSyncAggregate(s abstract.BeaconState, sync *cltypes.SyncAggregate) error @@ -60,5 +60,8 @@ type BlockOperationProcessor interface { ProcessDeposit(s abstract.BeaconState, deposit *cltypes.Deposit) error ProcessVoluntaryExit(s abstract.BeaconState, signedVoluntaryExit *cltypes.SignedVoluntaryExit) error ProcessBlsToExecutionChange(state abstract.BeaconState, signedChange *cltypes.SignedBLSToExecutionChange) error + ProcessDepositRequest(s abstract.BeaconState, depositRequest *solid.DepositRequest) error + ProcessWithdrawalRequest(s abstract.BeaconState, withdrawalRequest *solid.WithdrawalRequest) error + ProcessConsolidationRequest(s abstract.BeaconState, consolidationRequest *solid.ConsolidationRequest) error FullValidate() bool } diff --git a/cl/validator/committee_subscription/committee_subscription.go b/cl/validator/committee_subscription/committee_subscription.go index 652e99968cf..fc7e41e5f94 100644 --- a/cl/validator/committee_subscription/committee_subscription.go +++ b/cl/validator/committee_subscription/committee_subscription.go @@ -141,7 +141,7 @@ func (c *CommitteeSubscribeMgmt) AggregateAttestation(att *solid.Attestation) er clVersion = c.beaconConfig.GetCurrentStateVersion(slot / c.beaconConfig.SlotsPerEpoch) ) if clVersion.AfterOrEqual(clparams.ElectraVersion) { - index, err := att.ElectraSingleCommitteeIndex() + index, err := att.GetCommitteeIndexFromBits() if err != nil { return err } @@ -166,7 +166,7 @@ func (c *CommitteeSubscribeMgmt) NeedToAggregate(att *solid.Attestation) bool { ) clVersion := c.beaconConfig.GetCurrentStateVersion(slot / c.beaconConfig.SlotsPerEpoch) if clVersion.AfterOrEqual(clparams.ElectraVersion) { - index, err := att.ElectraSingleCommitteeIndex() + index, err := att.GetCommitteeIndexFromBits() if err != nil { return false } diff --git a/spectest/suite.go b/spectest/suite.go index a234a94bcd0..73ec2a2393b 100644 --- a/spectest/suite.go +++ b/spectest/suite.go @@ -40,6 +40,10 @@ func RunCases(t *testing.T, app Appendix, machineImpl machine.Interface, root fs t.Run(s, func(t *testing.T) { t.Parallel() m.Range0(func(key string, value TestCase) bool { + if value.ForkPhaseName == "whisk" || value.ForkPhaseName == "eip7594" { + t.Skipf("skipping %s", value.ForkPhaseName) + return true + } t.Run(key, func(t *testing.T) { require.NotPanics(t, func() { t.Parallel()