From ffb869925d768a825b984f893c7f50493f3888e8 Mon Sep 17 00:00:00 2001 From: Potuz Date: Sat, 12 Nov 2022 12:08:26 -0300 Subject: [PATCH 1/4] rename last_withdrawal_validator_index --- beacon-chain/core/blocks/withdrawals_test.go | 2 +- beacon-chain/core/capella/upgrade.go | 2 +- beacon-chain/state/state-native/getters_state.go | 4 ++-- beacon-chain/state/state-native/state_trie.go | 2 +- proto/engine/v1/generated.ssz.go | 2 +- proto/eth/ext/options.pb.go | 14 +++++++------- proto/eth/v1/generated.ssz.go | 2 +- proto/eth/v2/generated.ssz.go | 2 +- proto/prysm/v1alpha1/beacon_state.pb.go | 12 ++++++------ proto/prysm/v1alpha1/beacon_state.proto | 2 +- proto/prysm/v1alpha1/generated.ssz.go | 14 +++++++------- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/beacon-chain/core/blocks/withdrawals_test.go b/beacon-chain/core/blocks/withdrawals_test.go index 19c838c85f10..9acfffa5ebe2 100644 --- a/beacon-chain/core/blocks/withdrawals_test.go +++ b/beacon-chain/core/blocks/withdrawals_test.go @@ -563,7 +563,7 @@ func TestProcessWithdrawals(t *testing.T) { require.NoError(t, err) spb := ðpb.BeaconStateCapella{ Slot: slot, - LastWithdrawalValidatorIndex: test.Args.LastWithdrawalValidatorIndex, + NextWithdrawalValidatorIndex: test.Args.LastWithdrawalValidatorIndex, NextWithdrawalIndex: test.Args.NextWithdrawalIndex, } st, err := prepareValidators(spb, test.Args) diff --git a/beacon-chain/core/capella/upgrade.go b/beacon-chain/core/capella/upgrade.go index 013ee403b625..6163f7ea8146 100644 --- a/beacon-chain/core/capella/upgrade.go +++ b/beacon-chain/core/capella/upgrade.go @@ -89,7 +89,7 @@ func UpgradeToCapella(state state.BeaconState) (state.BeaconState, error) { WithdrawalsRoot: make([]byte, 32), }, NextWithdrawalIndex: 0, - LastWithdrawalValidatorIndex: 0, + NextWithdrawalValidatorIndex: 0, } return state_native.InitializeFromProtoUnsafeCapella(s) diff --git a/beacon-chain/state/state-native/getters_state.go b/beacon-chain/state/state-native/getters_state.go index dd96816daa0e..8c252f3580d8 100644 --- a/beacon-chain/state/state-native/getters_state.go +++ b/beacon-chain/state/state-native/getters_state.go @@ -125,7 +125,7 @@ func (b *BeaconState) ToProtoUnsafe() interface{} { NextSyncCommittee: b.nextSyncCommittee, LatestExecutionPayloadHeader: b.latestExecutionPayloadHeaderCapella, NextWithdrawalIndex: b.nextWithdrawalIndex, - LastWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, + NextWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, } default: return nil @@ -251,7 +251,7 @@ func (b *BeaconState) ToProto() interface{} { NextSyncCommittee: b.nextSyncCommitteeVal(), LatestExecutionPayloadHeader: b.latestExecutionPayloadHeaderCapellaVal(), NextWithdrawalIndex: b.nextWithdrawalIndex, - LastWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, + NextWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, } default: return nil diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index d6285eb54e7d..409d63ba20d2 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -432,7 +432,7 @@ func InitializeFromProtoUnsafeCapella(st *ethpb.BeaconStateCapella) (state.Beaco nextSyncCommittee: st.NextSyncCommittee, latestExecutionPayloadHeaderCapella: st.LatestExecutionPayloadHeader, nextWithdrawalIndex: st.NextWithdrawalIndex, - lastWithdrawalValidatorIndex: st.LastWithdrawalValidatorIndex, + lastWithdrawalValidatorIndex: st.NextWithdrawalValidatorIndex, dirtyFields: make(map[nativetypes.FieldIndex]bool, fieldCount), dirtyIndices: make(map[nativetypes.FieldIndex][]uint64, fieldCount), diff --git a/proto/engine/v1/generated.ssz.go b/proto/engine/v1/generated.ssz.go index eea7213491a5..d94ffa8b28a4 100644 --- a/proto/engine/v1/generated.ssz.go +++ b/proto/engine/v1/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 4e8004aa4b0d6e4e28f371cdc26af4fa63db0b593f92b190ebe7ad8897e76d91 +// Hash: 0861ebfee0a62ce9e10d8b677c0f8aa1f12c99ee69d3a864018818270a981c57 package enginev1 import ( diff --git a/proto/eth/ext/options.pb.go b/proto/eth/ext/options.pb.go index 827f9f8e2d50..f87a62f72444 100755 --- a/proto/eth/ext/options.pb.go +++ b/proto/eth/ext/options.pb.go @@ -9,9 +9,9 @@ package ext import ( reflect "reflect" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" ) const ( @@ -23,7 +23,7 @@ const ( var file_proto_eth_ext_options_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*string)(nil), Field: 50000, Name: "ethereum.eth.ext.cast_type", @@ -31,7 +31,7 @@ var file_proto_eth_ext_options_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "proto/eth/ext/options.proto", }, { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*string)(nil), Field: 50001, Name: "ethereum.eth.ext.ssz_size", @@ -39,7 +39,7 @@ var file_proto_eth_ext_options_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "proto/eth/ext/options.proto", }, { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*string)(nil), Field: 50002, Name: "ethereum.eth.ext.ssz_max", @@ -47,7 +47,7 @@ var file_proto_eth_ext_options_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "proto/eth/ext/options.proto", }, { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*string)(nil), Field: 50003, Name: "ethereum.eth.ext.spec_name", @@ -56,7 +56,7 @@ var file_proto_eth_ext_options_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.FieldOptions. +// Extension fields to descriptorpb.FieldOptions. var ( // optional string cast_type = 50000; E_CastType = &file_proto_eth_ext_options_proto_extTypes[0] @@ -103,7 +103,7 @@ var file_proto_eth_ext_options_proto_rawDesc = []byte{ } var file_proto_eth_ext_options_proto_goTypes = []interface{}{ - (*descriptor.FieldOptions)(nil), // 0: google.protobuf.FieldOptions + (*descriptorpb.FieldOptions)(nil), // 0: google.protobuf.FieldOptions } var file_proto_eth_ext_options_proto_depIdxs = []int32{ 0, // 0: ethereum.eth.ext.cast_type:extendee -> google.protobuf.FieldOptions diff --git a/proto/eth/v1/generated.ssz.go b/proto/eth/v1/generated.ssz.go index bc491259a55f..bf2fca40e581 100644 --- a/proto/eth/v1/generated.ssz.go +++ b/proto/eth/v1/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 3678f7a589562bfa6f57a029a8af1b650a425ceaac9640563f0c6acbe4605afb +// Hash: ea151ac65a951845c7bff5e78aea6951ca6a0674af711b1b14fea69df1829e84 package v1 import ( diff --git a/proto/eth/v2/generated.ssz.go b/proto/eth/v2/generated.ssz.go index 5a4f531abac3..fbf12f2f84a4 100644 --- a/proto/eth/v2/generated.ssz.go +++ b/proto/eth/v2/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 5c8f9b4b976753e80d600bd0a18f70be6d3021b18e7d4b82a5ab22e5c521f061 +// Hash: 659a6a0cf6db5ac28f8999f1649a50f2feebffc84f3bb8a20e4b124c88015253 package eth import ( diff --git a/proto/prysm/v1alpha1/beacon_state.pb.go b/proto/prysm/v1alpha1/beacon_state.pb.go index 2405a8777a28..199ab95e1822 100755 --- a/proto/prysm/v1alpha1/beacon_state.pb.go +++ b/proto/prysm/v1alpha1/beacon_state.pb.go @@ -1339,7 +1339,7 @@ type BeaconStateCapella struct { NextSyncCommittee *SyncCommittee `protobuf:"bytes,9003,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"` LatestExecutionPayloadHeader *v1.ExecutionPayloadHeaderCapella `protobuf:"bytes,10001,opt,name=latest_execution_payload_header,json=latestExecutionPayloadHeader,proto3" json:"latest_execution_payload_header,omitempty"` NextWithdrawalIndex uint64 `protobuf:"varint,11001,opt,name=next_withdrawal_index,json=nextWithdrawalIndex,proto3" json:"next_withdrawal_index,omitempty"` - LastWithdrawalValidatorIndex github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex `protobuf:"varint,11002,opt,name=last_withdrawal_validator_index,json=lastWithdrawalValidatorIndex,proto3" json:"last_withdrawal_validator_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"` + NextWithdrawalValidatorIndex github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex `protobuf:"varint,11002,opt,name=next_withdrawal_validator_index,json=nextWithdrawalValidatorIndex,proto3" json:"next_withdrawal_validator_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"` } func (x *BeaconStateCapella) Reset() { @@ -1556,9 +1556,9 @@ func (x *BeaconStateCapella) GetNextWithdrawalIndex() uint64 { return 0 } -func (x *BeaconStateCapella) GetLastWithdrawalValidatorIndex() github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex { +func (x *BeaconStateCapella) GetNextWithdrawalValidatorIndex() github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex { if x != nil { - return x.LastWithdrawalValidatorIndex + return x.NextWithdrawalValidatorIndex } return github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex(0) } @@ -2194,15 +2194,15 @@ var file_proto_prysm_v1alpha1_beacon_state_proto_rawDesc = []byte{ 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0xf9, 0x55, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x6e, 0x65, 0x78, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x12, 0x97, 0x01, 0x0a, 0x1f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x64, + 0x78, 0x12, 0x97, 0x01, 0x0a, 0x1f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0xfa, 0x55, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x1c, 0x6c, - 0x61, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x56, 0x61, 0x6c, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x1c, 0x6e, + 0x65, 0x78, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x8d, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x25, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, diff --git a/proto/prysm/v1alpha1/beacon_state.proto b/proto/prysm/v1alpha1/beacon_state.proto index 08fdd664dbc1..87296c1a706f 100644 --- a/proto/prysm/v1alpha1/beacon_state.proto +++ b/proto/prysm/v1alpha1/beacon_state.proto @@ -285,7 +285,7 @@ message BeaconStateCapella { // Capella fields [11001-12000] uint64 next_withdrawal_index = 11001; // [New in Capella] - uint64 last_withdrawal_validator_index = 11002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"]; // [New in Capella] + uint64 next_withdrawal_validator_index = 11002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"]; // [New in Capella] } // PowBlock is a definition from Bellatrix fork choice spec to represent a block with total difficulty in the PoW chain. diff --git a/proto/prysm/v1alpha1/generated.ssz.go b/proto/prysm/v1alpha1/generated.ssz.go index 963ee5bc7944..e75ffa2029d9 100644 --- a/proto/prysm/v1alpha1/generated.ssz.go +++ b/proto/prysm/v1alpha1/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: e37978aba7c76852f838285a3da40b5f5269ec01320882c5a6c557e84ab7ddd1 +// Hash: 8962105c98680286d2c628c358c5a37aeef5a3f92bfab69b89b13a7510b05da4 package eth import ( @@ -10245,8 +10245,8 @@ func (b *BeaconStateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { // Field (25) 'NextWithdrawalIndex' dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - // Field (26) 'LastWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.LastWithdrawalValidatorIndex)) + // Field (26) 'NextWithdrawalValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) // Field (7) 'HistoricalRoots' if size := len(b.HistoricalRoots); size > 16777216 { @@ -10499,8 +10499,8 @@ func (b *BeaconStateCapella) UnmarshalSSZ(buf []byte) error { // Field (25) 'NextWithdrawalIndex' b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - // Field (26) 'LastWithdrawalValidatorIndex' - b.LastWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) + // Field (26) 'NextWithdrawalValidatorIndex' + b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v3_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) // Field (7) 'HistoricalRoots' { @@ -10950,8 +10950,8 @@ func (b *BeaconStateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (25) 'NextWithdrawalIndex' hh.PutUint64(b.NextWithdrawalIndex) - // Field (26) 'LastWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.LastWithdrawalValidatorIndex)) + // Field (26) 'NextWithdrawalValidatorIndex' + hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) if ssz.EnableVectorizedHTR { hh.MerkleizeVectorizedHTR(indx) From 9d6e526082384ad42794ddc18ffdaba7eb3c1e2f Mon Sep 17 00:00:00 2001 From: Potuz Date: Sat, 12 Nov 2022 12:32:07 -0300 Subject: [PATCH 2/4] Update Capella methods to Specs #3068 --- beacon-chain/core/blocks/withdrawals.go | 7 ++- beacon-chain/core/blocks/withdrawals_test.go | 52 +++++++++---------- beacon-chain/state/interfaces.go | 2 +- .../state-native/beacon_state_mainnet.go | 2 +- .../state/state-native/getters_state.go | 4 +- .../state/state-native/getters_withdrawal.go | 15 +++--- .../state-native/getters_withdrawal_test.go | 4 +- beacon-chain/state/state-native/hasher.go | 2 +- .../state/state-native/hasher_test.go | 2 +- .../state/state-native/setters_withdrawal.go | 6 +-- .../state-native/setters_withdrawal_test.go | 6 +-- beacon-chain/state/state-native/state_trie.go | 6 +-- 12 files changed, 58 insertions(+), 50 deletions(-) diff --git a/beacon-chain/core/blocks/withdrawals.go b/beacon-chain/core/blocks/withdrawals.go index ff5c1f65ab92..348770a14933 100644 --- a/beacon-chain/core/blocks/withdrawals.go +++ b/beacon-chain/core/blocks/withdrawals.go @@ -8,6 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/v3/beacon-chain/core/signing" "github.com/prysmaticlabs/prysm/v3/beacon-chain/state" "github.com/prysmaticlabs/prysm/v3/config/params" + types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v3/crypto/hash/htr" "github.com/prysmaticlabs/prysm/v3/encoding/bytesutil" enginev1 "github.com/prysmaticlabs/prysm/v3/proto/engine/v1" @@ -110,7 +111,11 @@ func ProcessWithdrawals(st state.BeaconState, withdrawals []*enginev1.Withdrawal if err := st.SetNextWithdrawalIndex(withdrawals[len(withdrawals)-1].WithdrawalIndex + 1); err != nil { return nil, errors.Wrap(err, "could not set next withdrawal index") } - if err := st.SetLastWithdrawalValidatorIndex(withdrawals[len(withdrawals)-1].ValidatorIndex); err != nil { + nextValidatorIndex := withdrawals[len(withdrawals)-1].ValidatorIndex + 1 + if nextValidatorIndex == types.ValidatorIndex(st.NumValidators()) { + nextValidatorIndex = 0 + } + if err := st.SetNextWithdrawalValidatorIndex(nextValidatorIndex); err != nil { return nil, errors.Wrap(err, "could not set latest withdrawal validator index") } } diff --git a/beacon-chain/core/blocks/withdrawals_test.go b/beacon-chain/core/blocks/withdrawals_test.go index 9acfffa5ebe2..53468762f556 100644 --- a/beacon-chain/core/blocks/withdrawals_test.go +++ b/beacon-chain/core/blocks/withdrawals_test.go @@ -210,14 +210,14 @@ func TestProcessWithdrawals(t *testing.T) { type args struct { Name string - LastWithdrawalValidatorIndex types.ValidatorIndex + NextWithdrawalValidatorIndex types.ValidatorIndex NextWithdrawalIndex uint64 FullWithdrawalIndices []types.ValidatorIndex PartialWithdrawalIndices []types.ValidatorIndex Withdrawals []*enginev1.Withdrawal } type control struct { - LastWithdrawalValidatorIndex types.ValidatorIndex + NextWithdrawalValidatorIndex types.ValidatorIndex NextWithdrawalIndex uint64 ExpectedError bool Balances map[uint64]uint64 @@ -254,11 +254,11 @@ func TestProcessWithdrawals(t *testing.T) { { Args: args{ Name: "success no withdrawals", - LastWithdrawalValidatorIndex: 10, + NextWithdrawalValidatorIndex: 10, NextWithdrawalIndex: 3, }, Control: control{ - LastWithdrawalValidatorIndex: 10, + NextWithdrawalValidatorIndex: 10, NextWithdrawalIndex: 3, }, }, @@ -266,14 +266,14 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success one full withdrawal", NextWithdrawalIndex: 3, - LastWithdrawalValidatorIndex: 5, + NextWithdrawalValidatorIndex: 5, FullWithdrawalIndices: []types.ValidatorIndex{1}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(1, 3), }, }, Control: control{ - LastWithdrawalValidatorIndex: 1, + NextWithdrawalValidatorIndex: 2, NextWithdrawalIndex: 4, Balances: map[uint64]uint64{1: 0}, }, @@ -282,14 +282,14 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success one partial withdrawal", NextWithdrawalIndex: 21, - LastWithdrawalValidatorIndex: 37, + NextWithdrawalValidatorIndex: 37, PartialWithdrawalIndices: []types.ValidatorIndex{7}, Withdrawals: []*enginev1.Withdrawal{ partialWithdrawal(7, 21), }, }, Control: control{ - LastWithdrawalValidatorIndex: 7, + NextWithdrawalValidatorIndex: 8, NextWithdrawalIndex: 22, Balances: map[uint64]uint64{7: maxEffectiveBalance}, }, @@ -298,7 +298,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success many full withdrawals", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, FullWithdrawalIndices: []types.ValidatorIndex{7, 19, 28, 1}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(7, 22), fullWithdrawal(19, 23), fullWithdrawal(28, 24), @@ -306,7 +306,7 @@ func TestProcessWithdrawals(t *testing.T) { }, }, Control: control{ - LastWithdrawalValidatorIndex: 1, + NextWithdrawalValidatorIndex: 2, NextWithdrawalIndex: 26, Balances: map[uint64]uint64{7: 0, 19: 0, 28: 0, 1: 0}, }, @@ -315,7 +315,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success many partial withdrawals", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, PartialWithdrawalIndices: []types.ValidatorIndex{7, 19, 28, 1}, Withdrawals: []*enginev1.Withdrawal{ partialWithdrawal(7, 22), partialWithdrawal(19, 23), partialWithdrawal(28, 24), @@ -323,7 +323,7 @@ func TestProcessWithdrawals(t *testing.T) { }, }, Control: control{ - LastWithdrawalValidatorIndex: 1, + NextWithdrawalValidatorIndex: 2, NextWithdrawalIndex: 26, Balances: map[uint64]uint64{ 7: maxEffectiveBalance, @@ -337,7 +337,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success many withdrawals", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 12, + NextWithdrawalValidatorIndex: 12, FullWithdrawalIndices: []types.ValidatorIndex{7, 19, 28}, PartialWithdrawalIndices: []types.ValidatorIndex{2, 1, 89, 15}, Withdrawals: []*enginev1.Withdrawal{ @@ -347,7 +347,7 @@ func TestProcessWithdrawals(t *testing.T) { }, }, Control: control{ - LastWithdrawalValidatorIndex: 7, + NextWithdrawalValidatorIndex: 8, NextWithdrawalIndex: 29, Balances: map[uint64]uint64{ 7: 0, 19: 0, 28: 0, @@ -360,7 +360,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success more than max fully withdrawals", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 0, + NextWithdrawalValidatorIndex: 0, FullWithdrawalIndices: []types.ValidatorIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 29, 35, 89}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(1, 22), fullWithdrawal(2, 23), fullWithdrawal(3, 24), @@ -372,7 +372,7 @@ func TestProcessWithdrawals(t *testing.T) { }, }, Control: control{ - LastWithdrawalValidatorIndex: 27, + NextWithdrawalValidatorIndex: 28, NextWithdrawalIndex: 38, Balances: map[uint64]uint64{ 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, @@ -384,7 +384,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "success more than max partially withdrawals", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 0, + NextWithdrawalValidatorIndex: 0, PartialWithdrawalIndices: []types.ValidatorIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 29, 35, 89}, Withdrawals: []*enginev1.Withdrawal{ partialWithdrawal(1, 22), partialWithdrawal(2, 23), partialWithdrawal(3, 24), @@ -396,7 +396,7 @@ func TestProcessWithdrawals(t *testing.T) { }, }, Control: control{ - LastWithdrawalValidatorIndex: 27, + NextWithdrawalValidatorIndex: 28, NextWithdrawalIndex: 38, Balances: map[uint64]uint64{ 1: maxEffectiveBalance, @@ -422,7 +422,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "failure wrong number of partial withdrawal", NextWithdrawalIndex: 21, - LastWithdrawalValidatorIndex: 37, + NextWithdrawalValidatorIndex: 37, PartialWithdrawalIndices: []types.ValidatorIndex{7}, Withdrawals: []*enginev1.Withdrawal{ partialWithdrawal(7, 21), partialWithdrawal(9, 22), @@ -436,7 +436,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "failure invalid withdrawal index", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, FullWithdrawalIndices: []types.ValidatorIndex{7, 19, 28, 1}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(7, 22), fullWithdrawal(19, 23), fullWithdrawal(28, 25), @@ -451,7 +451,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "failure invalid validator index", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, FullWithdrawalIndices: []types.ValidatorIndex{7, 19, 28, 1}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(7, 22), fullWithdrawal(19, 23), fullWithdrawal(27, 24), @@ -466,7 +466,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "failure invalid withdrawal amount", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, FullWithdrawalIndices: []types.ValidatorIndex{7, 19, 28, 1}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(7, 22), fullWithdrawal(19, 23), partialWithdrawal(28, 24), @@ -481,7 +481,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "failure validator not fully withdrawable", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, FullWithdrawalIndices: []types.ValidatorIndex{notWithdrawableIndex}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(notWithdrawableIndex, 22), @@ -495,7 +495,7 @@ func TestProcessWithdrawals(t *testing.T) { Args: args{ Name: "failure validator not partially withdrawable", NextWithdrawalIndex: 22, - LastWithdrawalValidatorIndex: 4, + NextWithdrawalValidatorIndex: 4, PartialWithdrawalIndices: []types.ValidatorIndex{notPartiallyWithdrawable}, Withdrawals: []*enginev1.Withdrawal{ fullWithdrawal(notPartiallyWithdrawable, 22), @@ -510,7 +510,7 @@ func TestProcessWithdrawals(t *testing.T) { checkPostState := func(t *testing.T, expected control, st state.BeaconState) { l, err := st.LastWithdrawalValidatorIndex() require.NoError(t, err) - require.Equal(t, expected.LastWithdrawalValidatorIndex, l) + require.Equal(t, expected.NextWithdrawalValidatorIndex, l) n, err := st.NextWithdrawalIndex() require.NoError(t, err) @@ -563,7 +563,7 @@ func TestProcessWithdrawals(t *testing.T) { require.NoError(t, err) spb := ðpb.BeaconStateCapella{ Slot: slot, - NextWithdrawalValidatorIndex: test.Args.LastWithdrawalValidatorIndex, + NextWithdrawalValidatorIndex: test.Args.NextWithdrawalValidatorIndex, NextWithdrawalIndex: test.Args.NextWithdrawalIndex, } st, err := prepareValidators(spb, test.Args) diff --git a/beacon-chain/state/interfaces.go b/beacon-chain/state/interfaces.go index 1a50af2286ff..992825f09dad 100644 --- a/beacon-chain/state/interfaces.go +++ b/beacon-chain/state/interfaces.go @@ -87,7 +87,7 @@ type WriteOnlyBeaconState interface { AppendHistoricalRoots(root [32]byte) error SetLatestExecutionPayloadHeader(payload interfaces.ExecutionData) error SetNextWithdrawalIndex(i uint64) error - SetLastWithdrawalValidatorIndex(i types.ValidatorIndex) error + SetNextWithdrawalValidatorIndex(i types.ValidatorIndex) error } // ReadOnlyValidator defines a struct which only has read access to validator methods. diff --git a/beacon-chain/state/state-native/beacon_state_mainnet.go b/beacon-chain/state/state-native/beacon_state_mainnet.go index 905147a02cee..4b37a0d276cf 100644 --- a/beacon-chain/state/state-native/beacon_state_mainnet.go +++ b/beacon-chain/state/state-native/beacon_state_mainnet.go @@ -48,7 +48,7 @@ type BeaconState struct { latestExecutionPayloadHeader *enginev1.ExecutionPayloadHeader latestExecutionPayloadHeaderCapella *enginev1.ExecutionPayloadHeaderCapella nextWithdrawalIndex uint64 - lastWithdrawalValidatorIndex eth2types.ValidatorIndex + nextWithdrawalValidatorIndex eth2types.ValidatorIndex lock sync.RWMutex dirtyFields map[nativetypes.FieldIndex]bool diff --git a/beacon-chain/state/state-native/getters_state.go b/beacon-chain/state/state-native/getters_state.go index 8c252f3580d8..89c3eab37d48 100644 --- a/beacon-chain/state/state-native/getters_state.go +++ b/beacon-chain/state/state-native/getters_state.go @@ -125,7 +125,7 @@ func (b *BeaconState) ToProtoUnsafe() interface{} { NextSyncCommittee: b.nextSyncCommittee, LatestExecutionPayloadHeader: b.latestExecutionPayloadHeaderCapella, NextWithdrawalIndex: b.nextWithdrawalIndex, - NextWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, + NextWithdrawalValidatorIndex: b.nextWithdrawalValidatorIndex, } default: return nil @@ -251,7 +251,7 @@ func (b *BeaconState) ToProto() interface{} { NextSyncCommittee: b.nextSyncCommitteeVal(), LatestExecutionPayloadHeader: b.latestExecutionPayloadHeaderCapellaVal(), NextWithdrawalIndex: b.nextWithdrawalIndex, - NextWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, + NextWithdrawalValidatorIndex: b.nextWithdrawalValidatorIndex, } default: return nil diff --git a/beacon-chain/state/state-native/getters_withdrawal.go b/beacon-chain/state/state-native/getters_withdrawal.go index d82468567cca..5c8dd621022a 100644 --- a/beacon-chain/state/state-native/getters_withdrawal.go +++ b/beacon-chain/state/state-native/getters_withdrawal.go @@ -34,7 +34,7 @@ func (b *BeaconState) LastWithdrawalValidatorIndex() (types.ValidatorIndex, erro b.lock.RLock() defer b.lock.RUnlock() - return b.lastWithdrawalValidatorIndex, nil + return b.nextWithdrawalValidatorIndex, nil } // ExpectedWithdrawals returns the withdrawals that a proposer will need to pack in the next block @@ -49,14 +49,13 @@ func (b *BeaconState) ExpectedWithdrawals() ([]*enginev1.Withdrawal, error) { defer b.lock.RUnlock() withdrawals := make([]*enginev1.Withdrawal, 0, params.BeaconConfig().MaxWithdrawalsPerPayload) - validatorIndex := b.lastWithdrawalValidatorIndex + validatorIndex := b.nextWithdrawalValidatorIndex + 1 + if uint64(validatorIndex) == uint64(len(b.validators)) { + validatorIndex = 0 + } withdrawalIndex := b.nextWithdrawalIndex epoch := slots.ToEpoch(b.slot) for range b.validators { - validatorIndex += 1 - if uint64(validatorIndex) == uint64(len(b.validators)) { - validatorIndex = types.ValidatorIndex(0) - } val := b.validators[validatorIndex] balance := b.balances[validatorIndex] if isFullyWithdrawableValidator(val, epoch) { @@ -79,6 +78,10 @@ func (b *BeaconState) ExpectedWithdrawals() ([]*enginev1.Withdrawal, error) { if uint64(len(withdrawals)) == params.BeaconConfig().MaxWithdrawalsPerPayload { break } + validatorIndex += 1 + if uint64(validatorIndex) == uint64(len(b.validators)) { + validatorIndex = 0 + } } return withdrawals, nil } diff --git a/beacon-chain/state/state-native/getters_withdrawal_test.go b/beacon-chain/state/state-native/getters_withdrawal_test.go index 3c6a91619706..62959e929f90 100644 --- a/beacon-chain/state/state-native/getters_withdrawal_test.go +++ b/beacon-chain/state/state-native/getters_withdrawal_test.go @@ -28,7 +28,7 @@ func TestNextWithdrawalIndex(t *testing.T) { func TestLastWithdrawalValidatorIndex(t *testing.T) { t.Run("ok", func(t *testing.T) { - s := BeaconState{version: version.Capella, lastWithdrawalValidatorIndex: 123} + s := BeaconState{version: version.Capella, nextWithdrawalValidatorIndex: 123} i, err := s.LastWithdrawalValidatorIndex() require.NoError(t, err) assert.Equal(t, types.ValidatorIndex(123), i) @@ -136,7 +136,7 @@ func TestExpectedWithdrawals(t *testing.T) { version: version.Capella, validators: make([]*ethpb.Validator, 100), balances: make([]uint64, 100), - lastWithdrawalValidatorIndex: 20, + nextWithdrawalValidatorIndex: 20, } for i := range s.validators { s.balances[i] = params.BeaconConfig().MaxEffectiveBalance diff --git a/beacon-chain/state/state-native/hasher.go b/beacon-chain/state/state-native/hasher.go index 28fc588cdf17..6c1dca800d3b 100644 --- a/beacon-chain/state/state-native/hasher.go +++ b/beacon-chain/state/state-native/hasher.go @@ -253,7 +253,7 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b // Next partial withdrawal validator index root. nextPartialWithdrawalValidatorIndexRoot := make([]byte, 32) - binary.LittleEndian.PutUint64(nextPartialWithdrawalValidatorIndexRoot, uint64(state.lastWithdrawalValidatorIndex)) + binary.LittleEndian.PutUint64(nextPartialWithdrawalValidatorIndexRoot, uint64(state.nextWithdrawalValidatorIndex)) fieldRoots[nativetypes.LastWithdrawalValidatorIndex.RealPosition()] = nextPartialWithdrawalValidatorIndexRoot } diff --git a/beacon-chain/state/state-native/hasher_test.go b/beacon-chain/state/state-native/hasher_test.go index 7b081f72aacc..b21c62124c8c 100644 --- a/beacon-chain/state/state-native/hasher_test.go +++ b/beacon-chain/state/state-native/hasher_test.go @@ -257,7 +257,7 @@ func TestComputeFieldRootsWithHasher_Capella(t *testing.T) { require.NoError(t, err) require.NoError(t, beaconState.SetLatestExecutionPayloadHeader(wrappedHeader)) require.NoError(t, beaconState.SetNextWithdrawalIndex(123)) - require.NoError(t, beaconState.SetLastWithdrawalValidatorIndex(123)) + require.NoError(t, beaconState.SetNextWithdrawalValidatorIndex(123)) nativeState, ok := beaconState.(*statenative.BeaconState) require.Equal(t, true, ok) diff --git a/beacon-chain/state/state-native/setters_withdrawal.go b/beacon-chain/state/state-native/setters_withdrawal.go index a19156a0b5e6..bb6ee91a62c1 100644 --- a/beacon-chain/state/state-native/setters_withdrawal.go +++ b/beacon-chain/state/state-native/setters_withdrawal.go @@ -20,14 +20,14 @@ func (b *BeaconState) SetNextWithdrawalIndex(i uint64) error { // SetLastWithdrawalValidatorIndex sets the index of the validator which is // next in line for a partial withdrawal. -func (b *BeaconState) SetLastWithdrawalValidatorIndex(i types.ValidatorIndex) error { +func (b *BeaconState) SetNextWithdrawalValidatorIndex(i types.ValidatorIndex) error { if b.version < version.Capella { - return errNotSupported("SetNextPartialWithdrawalValidatorIndex", b.version) + return errNotSupported("SetNextWithdrawalValidatorIndex", b.version) } b.lock.Lock() defer b.lock.Unlock() - b.lastWithdrawalValidatorIndex = i + b.nextWithdrawalValidatorIndex = i return nil } diff --git a/beacon-chain/state/state-native/setters_withdrawal_test.go b/beacon-chain/state/state-native/setters_withdrawal_test.go index 09ede1c4d5a3..6cb28a7b5df9 100644 --- a/beacon-chain/state/state-native/setters_withdrawal_test.go +++ b/beacon-chain/state/state-native/setters_withdrawal_test.go @@ -19,8 +19,8 @@ func TestSetNextWithdrawalIndex(t *testing.T) { func TestSetLastWithdrawalValidatorIndex(t *testing.T) { s := BeaconState{ version: version.Capella, - lastWithdrawalValidatorIndex: 3, + nextWithdrawalValidatorIndex: 3, } - require.NoError(t, s.SetLastWithdrawalValidatorIndex(5)) - require.Equal(t, types.ValidatorIndex(5), s.lastWithdrawalValidatorIndex) + require.NoError(t, s.SetNextWithdrawalValidatorIndex(5)) + require.Equal(t, types.ValidatorIndex(5), s.nextWithdrawalValidatorIndex) } diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index 409d63ba20d2..f5c5a63f341e 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -432,7 +432,7 @@ func InitializeFromProtoUnsafeCapella(st *ethpb.BeaconStateCapella) (state.Beaco nextSyncCommittee: st.NextSyncCommittee, latestExecutionPayloadHeaderCapella: st.LatestExecutionPayloadHeader, nextWithdrawalIndex: st.NextWithdrawalIndex, - lastWithdrawalValidatorIndex: st.NextWithdrawalValidatorIndex, + nextWithdrawalValidatorIndex: st.NextWithdrawalValidatorIndex, dirtyFields: make(map[nativetypes.FieldIndex]bool, fieldCount), dirtyIndices: make(map[nativetypes.FieldIndex][]uint64, fieldCount), @@ -498,7 +498,7 @@ func (b *BeaconState) Copy() state.BeaconState { slot: b.slot, eth1DepositIndex: b.eth1DepositIndex, nextWithdrawalIndex: b.nextWithdrawalIndex, - lastWithdrawalValidatorIndex: b.lastWithdrawalValidatorIndex, + nextWithdrawalValidatorIndex: b.nextWithdrawalValidatorIndex, // Large arrays, infrequently changed, constant size. blockRoots: b.blockRoots, @@ -832,7 +832,7 @@ func (b *BeaconState) rootSelector(ctx context.Context, field nativetypes.FieldI case nativetypes.NextWithdrawalIndex: return ssz.Uint64Root(b.nextWithdrawalIndex), nil case nativetypes.LastWithdrawalValidatorIndex: - return ssz.Uint64Root(uint64(b.lastWithdrawalValidatorIndex)), nil + return ssz.Uint64Root(uint64(b.nextWithdrawalValidatorIndex)), nil } return [32]byte{}, errors.New("invalid field index provided") } From 8fe5383b436423fa3601e9379ec514febc220efe Mon Sep 17 00:00:00 2001 From: Potuz Date: Sat, 12 Nov 2022 12:39:30 -0300 Subject: [PATCH 3/4] Add missing renames --- beacon-chain/state/state-native/hasher.go | 2 +- beacon-chain/state/state-native/state_trie.go | 4 ++-- beacon-chain/state/state-native/types/types.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/beacon-chain/state/state-native/hasher.go b/beacon-chain/state/state-native/hasher.go index 6c1dca800d3b..0377e1b65acb 100644 --- a/beacon-chain/state/state-native/hasher.go +++ b/beacon-chain/state/state-native/hasher.go @@ -254,7 +254,7 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b // Next partial withdrawal validator index root. nextPartialWithdrawalValidatorIndexRoot := make([]byte, 32) binary.LittleEndian.PutUint64(nextPartialWithdrawalValidatorIndexRoot, uint64(state.nextWithdrawalValidatorIndex)) - fieldRoots[nativetypes.LastWithdrawalValidatorIndex.RealPosition()] = nextPartialWithdrawalValidatorIndexRoot + fieldRoots[nativetypes.NextWithdrawalValidatorIndex.RealPosition()] = nextPartialWithdrawalValidatorIndexRoot } return fieldRoots, nil diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index f5c5a63f341e..3a833dc08ab0 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -81,7 +81,7 @@ var capellaFields = append( altairFields, nativetypes.LatestExecutionPayloadHeaderCapella, nativetypes.NextWithdrawalIndex, - nativetypes.LastWithdrawalValidatorIndex, + nativetypes.NextWithdrawalValidatorIndex, ) const ( @@ -831,7 +831,7 @@ func (b *BeaconState) rootSelector(ctx context.Context, field nativetypes.FieldI return b.latestExecutionPayloadHeaderCapella.HashTreeRoot() case nativetypes.NextWithdrawalIndex: return ssz.Uint64Root(b.nextWithdrawalIndex), nil - case nativetypes.LastWithdrawalValidatorIndex: + case nativetypes.NextWithdrawalValidatorIndex: return ssz.Uint64Root(uint64(b.nextWithdrawalValidatorIndex)), nil } return [32]byte{}, errors.New("invalid field index provided") diff --git a/beacon-chain/state/state-native/types/types.go b/beacon-chain/state/state-native/types/types.go index caab5400f3e2..e929521927ab 100644 --- a/beacon-chain/state/state-native/types/types.go +++ b/beacon-chain/state/state-native/types/types.go @@ -69,7 +69,7 @@ func (f FieldIndex) String(_ int) string { return "LatestExecutionPayloadHeaderCapella" case NextWithdrawalIndex: return "NextWithdrawalIndex" - case LastWithdrawalValidatorIndex: + case NextWithdrawalValidatorIndex: return "LastWithdrawalValidatorIndex" default: return "" @@ -132,7 +132,7 @@ func (f FieldIndex) RealPosition() int { return 24 case NextWithdrawalIndex: return 25 - case LastWithdrawalValidatorIndex: + case NextWithdrawalValidatorIndex: return 26 default: return -1 @@ -190,5 +190,5 @@ const ( LatestExecutionPayloadHeader LatestExecutionPayloadHeaderCapella NextWithdrawalIndex - LastWithdrawalValidatorIndex + NextWithdrawalValidatorIndex ) From db07e1cd1a6128d276aa87c44adda4d633cd0be5 Mon Sep 17 00:00:00 2001 From: Potuz Date: Sat, 12 Nov 2022 14:11:43 -0300 Subject: [PATCH 4/4] rename minimal state --- beacon-chain/state/state-native/beacon_state_minimal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon-chain/state/state-native/beacon_state_minimal.go b/beacon-chain/state/state-native/beacon_state_minimal.go index 133d669c1e4c..11679c83b1d2 100644 --- a/beacon-chain/state/state-native/beacon_state_minimal.go +++ b/beacon-chain/state/state-native/beacon_state_minimal.go @@ -48,7 +48,7 @@ type BeaconState struct { latestExecutionPayloadHeader *enginev1.ExecutionPayloadHeader latestExecutionPayloadHeaderCapella *enginev1.ExecutionPayloadHeaderCapella nextWithdrawalIndex uint64 - lastWithdrawalValidatorIndex eth2types.ValidatorIndex + nextWithdrawalValidatorIndex eth2types.ValidatorIndex lock sync.RWMutex dirtyFields map[nativetypes.FieldIndex]bool