diff --git a/beacon-chain/attestation/service.go b/beacon-chain/attestation/service.go index e63228c58c..370e5855bf 100644 --- a/beacon-chain/attestation/service.go +++ b/beacon-chain/attestation/service.go @@ -101,10 +101,10 @@ func (a *Service) IncomingAttestationFeed() *event.Feed { // BeaconBlock` be the target block in the attestation // `get_latest_attestation(store, validator_index)`. func (a *Service) LatestAttestationTarget(beaconState *pb.BeaconState, index uint64) (*pb.AttestationTarget, error) { - if index >= uint64(len(beaconState.ValidatorRegistry)) { + if index >= uint64(len(beaconState.Validators)) { return nil, fmt.Errorf("invalid validator index %d", index) } - validator := beaconState.ValidatorRegistry[index] + validator := beaconState.Validators[index] pubKey := bytesutil.ToBytes48(validator.Pubkey) a.store.RLock() @@ -262,14 +262,14 @@ func (a *Service) updateAttestation(beaconState *pb.BeaconState, attestation *pb return nil } - if int(committee[i]) >= len(beaconState.ValidatorRegistry) { + if int(committee[i]) >= len(beaconState.Validators) { log.Debugf("index doesn't exist in validator registry: index %d", committee[i]) return nil } // If the attestation came from this attester. We use the slot committee to find the // validator's actual index. - pubkey := bytesutil.ToBytes48(beaconState.ValidatorRegistry[committee[i]].Pubkey) + pubkey := bytesutil.ToBytes48(beaconState.Validators[committee[i]].Pubkey) newAttestationSlot := slot currentAttestationSlot := uint64(0) a.store.Lock() diff --git a/beacon-chain/attestation/service_test.go b/beacon-chain/attestation/service_test.go index 3dc44e70a1..67733cc638 100644 --- a/beacon-chain/attestation/service_test.go +++ b/beacon-chain/attestation/service_test.go @@ -39,9 +39,9 @@ func TestUpdateLatestAttestation_UpdatesLatest(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 1, - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } block := &pb.BeaconBlock{ Slot: 1, @@ -66,7 +66,7 @@ func TestUpdateLatestAttestation_UpdatesLatest(t *testing.T) { if err := service.UpdateLatestAttestation(ctx, attestation); err != nil { t.Fatalf("could not update latest attestation: %v", err) } - pubkey := bytesutil.ToBytes48(beaconState.ValidatorRegistry[10].Pubkey) + pubkey := bytesutil.ToBytes48(beaconState.Validators[10].Pubkey) if service.store.m[pubkey].Data.Crosslink.Shard != attestation.Data.Crosslink.Shard { t.Errorf("Incorrect shard stored, wanted: %d, got: %d", @@ -75,9 +75,9 @@ func TestUpdateLatestAttestation_UpdatesLatest(t *testing.T) { beaconState = &pb.BeaconState{ Slot: 36, - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } if err := beaconDB.UpdateChainHead(ctx, block, beaconState); err != nil { t.Fatalf("could not save state: %v", err) @@ -109,7 +109,7 @@ func TestAttestationPool_UpdatesAttestationPool(t *testing.T) { } beaconState := &pb.BeaconState{ Slot: 1, - ValidatorRegistry: validators, + Validators: validators, } block := &pb.BeaconBlock{ Slot: 1, @@ -142,7 +142,7 @@ func TestLatestAttestationTarget_CantGetAttestation(t *testing.T) { ctx := context.Background() if err := beaconDB.SaveState(ctx, &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{{}}, + Validators: []*pb.Validator{{}}, }); err != nil { t.Fatalf("could not save state: %v", err) } @@ -166,7 +166,7 @@ func TestLatestAttestationTarget_ReturnsLatestAttestedBlock(t *testing.T) { pubKey := []byte{'A'} if err := beaconDB.SaveState(ctx, &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{{Pubkey: pubKey}}, + Validators: []*pb.Validator{{Pubkey: pubKey}}, }); err != nil { t.Fatalf("could not save state: %v", err) } @@ -228,9 +228,9 @@ func TestUpdateLatestAttestation_InvalidIndex(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 1, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), - ValidatorRegistry: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), + Validators: validators, } block := &pb.BeaconBlock{ Slot: 1, @@ -280,9 +280,9 @@ func TestBatchUpdate_FromSync(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 1, - ValidatorRegistry: validators, - LatestRandaoMixes: latestRandaoMixes, - LatestActiveIndexRoots: latestActiveIndexRoots, + Validators: validators, + RandaoMixes: latestRandaoMixes, + ActiveIndexRoots: latestActiveIndexRoots, } block := &pb.BeaconBlock{ Slot: 1, @@ -330,9 +330,9 @@ func TestUpdateLatestAttestation_BatchUpdate(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 1, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), - ValidatorRegistry: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), + Validators: validators, } block := &pb.BeaconBlock{ Slot: 1, diff --git a/beacon-chain/blockchain/block_processing.go b/beacon-chain/blockchain/block_processing.go index 60b85e9d42..7529b8a617 100644 --- a/beacon-chain/blockchain/block_processing.go +++ b/beacon-chain/blockchain/block_processing.go @@ -279,11 +279,11 @@ func (c *ChainService) saveValidatorIdx(state *pb.BeaconState) error { for _, idx := range activatedValidators { // If for some reason the activated validator indices is not in state, // we skip them and save them to process for next epoch. - if int(idx) >= len(state.ValidatorRegistry) { + if int(idx) >= len(state.Validators) { idxNotInState = append(idxNotInState, idx) continue } - pubKey := state.ValidatorRegistry[idx].Pubkey + pubKey := state.Validators[idx].Pubkey if err := c.beaconDB.SaveValidatorIndex(pubKey, int(idx)); err != nil { return fmt.Errorf("could not save validator index: %v", err) } @@ -301,7 +301,7 @@ func (c *ChainService) saveValidatorIdx(state *pb.BeaconState) error { func (c *ChainService) deleteValidatorIdx(state *pb.BeaconState) error { exitedValidators := validators.ExitedValFromEpoch(helpers.CurrentEpoch(state) + 1) for _, idx := range exitedValidators { - pubKey := state.ValidatorRegistry[idx].Pubkey + pubKey := state.Validators[idx].Pubkey if err := c.beaconDB.DeleteValidatorIndex(pubKey); err != nil { return fmt.Errorf("could not delete validator index: %v", err) } diff --git a/beacon-chain/blockchain/block_processing_test.go b/beacon-chain/blockchain/block_processing_test.go index 91c5d2ae7a..d6a9896872 100644 --- a/beacon-chain/blockchain/block_processing_test.go +++ b/beacon-chain/blockchain/block_processing_test.go @@ -116,7 +116,7 @@ func TestReceiveBlock_ProcessCorrectly(t *testing.T) { if err != nil { t.Fatalf("Can't generate genesis state: %v", err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) genesis := b.NewGenesisBlock([]byte{}) bodyRoot, err := ssz.HashTreeRoot(genesis.Body) if err != nil { @@ -193,7 +193,7 @@ func TestReceiveBlock_UsesParentBlockState(t *testing.T) { if err != nil { t.Fatalf("Can't generate genesis state: %v", err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) genesis := b.NewGenesisBlock([]byte{}) bodyRoot, err := ssz.HashTreeRoot(genesis.Body) if err != nil { @@ -256,7 +256,7 @@ func TestReceiveBlock_DeletesBadBlock(t *testing.T) { if err != nil { t.Fatalf("Can't generate genesis state: %v", err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) genesis := b.NewGenesisBlock([]byte{}) bodyRoot, err := ssz.HashTreeRoot(genesis.Body) if err != nil { @@ -349,7 +349,7 @@ func TestReceiveBlock_CheckBlockStateRoot_GoodState(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) beaconState.LatestBlockHeader = &pb.BeaconBlockHeader{ Slot: genesis.Slot, ParentRoot: genesis.ParentRoot, @@ -412,7 +412,7 @@ func TestReceiveBlock_CheckBlockStateRoot_BadState(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) beaconState.LatestBlockHeader = &pb.BeaconBlockHeader{ Slot: genesis.Slot, ParentRoot: genesis.ParentRoot, @@ -478,7 +478,7 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) beaconState.LatestBlockHeader = &pb.BeaconBlockHeader{ Slot: genesis.Slot, ParentRoot: genesis.ParentRoot, @@ -510,7 +510,7 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) { } pendingDeposits := []*pb.Deposit{ - createPreChainStartDeposit([]byte{'F'}, beaconState.DepositIndex), + createPreChainStartDeposit([]byte{'F'}, beaconState.Eth1DepositIndex), } pendingDepositsData := make([][]byte, len(pendingDeposits)) for i, pd := range pendingDeposits { @@ -533,7 +533,7 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) { pendingDeposits[i].Proof = proof } depositRoot := depositTrie.Root() - beaconState.LatestEth1Data.DepositRoot = depositRoot[:] + beaconState.Eth1Data.DepositRoot = depositRoot[:] if err := db.SaveHistoricalState(context.Background(), beaconState, parentHash); err != nil { t.Fatal(err) } @@ -557,7 +557,7 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) { } beaconState.Slot-- - beaconState.DepositIndex = 0 + beaconState.Eth1DepositIndex = 0 if err := chainService.beaconDB.SaveState(ctx, beaconState); err != nil { t.Fatal(err) } @@ -594,8 +594,8 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) { if err != nil { t.Fatal(err) } - for i := 0; i < len(beaconState.ValidatorRegistry); i++ { - pubKey := bytesutil.ToBytes48(beaconState.ValidatorRegistry[i].Pubkey) + for i := 0; i < len(beaconState.Validators); i++ { + pubKey := bytesutil.ToBytes48(beaconState.Validators[i].Pubkey) attsService.InsertAttestationIntoStore(pubKey, &pb.Attestation{ Data: &pb.AttestationData{ BeaconBlockRoot: blockRoot[:], @@ -660,7 +660,7 @@ func TestReceiveBlock_OnChainSplit(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) beaconState.LatestBlockHeader = &pb.BeaconBlockHeader{ Slot: genesis.Slot, ParentRoot: genesis.ParentRoot, @@ -831,7 +831,7 @@ func TestIsBlockReadyForProcessing_ValidBlock(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) beaconState.LatestBlockHeader = &pb.BeaconBlockHeader{ Slot: genesis.Slot, ParentRoot: genesis.ParentRoot, @@ -859,7 +859,7 @@ func TestIsBlockReadyForProcessing_ValidBlock(t *testing.T) { t.Fatalf("unable to get root of canonical head: %v", err) } - beaconState.LatestEth1Data = &pb.Eth1Data{ + beaconState.Eth1Data = &pb.Eth1Data{ DepositRoot: []byte{2}, BlockHash: []byte{3}, } @@ -916,7 +916,7 @@ func TestDeleteValidatorIdx_DeleteWorks(t *testing.T) { }) } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: epoch * params.BeaconConfig().SlotsPerEpoch, } chainService := setupBeaconChain(t, db, nil) @@ -958,7 +958,7 @@ func TestSaveValidatorIdx_SaveRetrieveWorks(t *testing.T) { }) } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: epoch * params.BeaconConfig().SlotsPerEpoch, } chainService := setupBeaconChain(t, db, nil) @@ -996,7 +996,7 @@ func TestSaveValidatorIdx_IdxNotInState(t *testing.T) { }) } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: epoch * params.BeaconConfig().SlotsPerEpoch, } chainService := setupBeaconChain(t, db, nil) diff --git a/beacon-chain/blockchain/fork_choice.go b/beacon-chain/blockchain/fork_choice.go index 7317f0bde1..6024701e59 100644 --- a/beacon-chain/blockchain/fork_choice.go +++ b/beacon-chain/blockchain/fork_choice.go @@ -420,7 +420,7 @@ func VoteCount(block *pb.BeaconBlock, state *pb.BeaconState, targets map[uint64] } if bytes.Equal(blockRoot[:], ancestorRoot) { - balances += int(state.ValidatorRegistry[validatorIndex].EffectiveBalance) + balances += int(state.Validators[validatorIndex].EffectiveBalance) } } return balances, nil diff --git a/beacon-chain/blockchain/fork_choice_reorg_test.go b/beacon-chain/blockchain/fork_choice_reorg_test.go index 223fb246c2..778053dd75 100644 --- a/beacon-chain/blockchain/fork_choice_reorg_test.go +++ b/beacon-chain/blockchain/fork_choice_reorg_test.go @@ -39,7 +39,7 @@ func TestApplyForkChoice_ChainSplitReorg(t *testing.T) { if err != nil { t.Fatalf("Can't generate genesis state: %v", err) } - justifiedState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + justifiedState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) justifiedState.LatestBlockHeader = &pb.BeaconBlockHeader{ StateRoot: []byte{}, } diff --git a/beacon-chain/blockchain/fork_choice_test.go b/beacon-chain/blockchain/fork_choice_test.go index 30f5f68577..c3adb0210d 100644 --- a/beacon-chain/blockchain/fork_choice_test.go +++ b/beacon-chain/blockchain/fork_choice_test.go @@ -203,7 +203,7 @@ func TestVoteCount_IncreaseCountCorrectly(t *testing.T) { if err := beaconDB.SaveBlock(potentialHead2); err != nil { t.Fatal(err) } - beaconState := &pb.BeaconState{ValidatorRegistry: []*pb.Validator{{EffectiveBalance: 1e9}, {EffectiveBalance: 1e9}}} + beaconState := &pb.BeaconState{Validators: []*pb.Validator{{EffectiveBalance: 1e9}, {EffectiveBalance: 1e9}}} voteTargets := make(map[uint64]*pb.AttestationTarget) voteTargets[0] = &pb.AttestationTarget{ Slot: potentialHead.Slot, @@ -233,7 +233,7 @@ func TestAttestationTargets_RetrieveWorks(t *testing.T) { pubKey := []byte{'A'} beaconState := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{{ + Validators: []*pb.Validator{{ Pubkey: pubKey, ExitEpoch: params.BeaconConfig().FarFutureEpoch}}, } @@ -502,7 +502,7 @@ func TestLMDGhost_TrivialHeadUpdate(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 10, Balances: []uint64{params.BeaconConfig().MaxDepositAmount}, - ValidatorRegistry: []*pb.Validator{{}}, + Validators: []*pb.Validator{{}}, } chainService := setupBeaconChain(t, beaconDB, nil) @@ -571,7 +571,7 @@ func TestLMDGhost_3WayChainSplitsSameHeight(t *testing.T) { params.BeaconConfig().MaxDepositAmount, params.BeaconConfig().MaxDepositAmount, params.BeaconConfig().MaxDepositAmount}, - ValidatorRegistry: []*pb.Validator{{EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, + Validators: []*pb.Validator{{EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, {EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, {EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, {EffectiveBalance: params.BeaconConfig().MaxDepositAmount}}, @@ -776,7 +776,7 @@ func TestLMDGhost_2WayChainSplitsDiffHeight(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 10, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, {EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, {EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, @@ -1506,7 +1506,7 @@ func setupFFGTest(t *testing.T) ([32]byte, *pb.BeaconBlock, *pb.BeaconState, []* } latestRandaoMixes := make( [][]byte, - params.BeaconConfig().LatestRandaoMixesLength, + params.BeaconConfig().RandaoMixesLength, ) for i := 0; i < len(latestRandaoMixes); i++ { latestRandaoMixes[i] = make([]byte, 32) @@ -1538,12 +1538,12 @@ func setupFFGTest(t *testing.T) ([32]byte, *pb.BeaconBlock, *pb.BeaconState, []* } gState := &pb.BeaconState{ Slot: genesisSlot, - LatestBlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot), - LatestRandaoMixes: latestRandaoMixes, - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), + BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot), + RandaoMixes: latestRandaoMixes, + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), CurrentCrosslinks: crosslinks, - ValidatorRegistry: validatorRegistry, + Validators: validatorRegistry, Balances: validatorBalances, Fork: &pb.Fork{ PreviousVersion: params.BeaconConfig().GenesisForkVersion, @@ -1590,7 +1590,7 @@ func TestVoteCount_CacheEnabledAndMiss(t *testing.T) { if err := beaconDB.SaveBlock(potentialHead2); err != nil { t.Fatal(err) } - beaconState := &pb.BeaconState{ValidatorRegistry: []*pb.Validator{{EffectiveBalance: 1e9}, {EffectiveBalance: 1e9}}} + beaconState := &pb.BeaconState{Validators: []*pb.Validator{{EffectiveBalance: 1e9}, {EffectiveBalance: 1e9}}} voteTargets := make(map[uint64]*pb.AttestationTarget) voteTargets[0] = &pb.AttestationTarget{ Slot: potentialHead.Slot, @@ -1655,7 +1655,7 @@ func TestVoteCount_CacheEnabledAndHit(t *testing.T) { beaconState := &pb.BeaconState{ Balances: []uint64{1e9, 1e9}, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {EffectiveBalance: 1e9}, {EffectiveBalance: 1e9}, }, diff --git a/beacon-chain/cache/seed_test.go b/beacon-chain/cache/seed_test.go index b39d4248c9..e13234f836 100644 --- a/beacon-chain/cache/seed_test.go +++ b/beacon-chain/cache/seed_test.go @@ -64,7 +64,7 @@ func TestSeedCache_SeedByEpoch(t *testing.T) { func TestSeed_MaxSize(t *testing.T) { cache := NewSeedCache() - for i := uint64(0); i < params.BeaconConfig().LatestRandaoMixesLength+100; i++ { + for i := uint64(0); i < params.BeaconConfig().RandaoMixesLength+100; i++ { tInfo := &SeedByEpoch{ Epoch: i, } diff --git a/beacon-chain/cache/total_balance_test.go b/beacon-chain/cache/total_balance_test.go index 3078c5e0ac..55ada6d499 100644 --- a/beacon-chain/cache/total_balance_test.go +++ b/beacon-chain/cache/total_balance_test.go @@ -64,7 +64,7 @@ func TestTotalBalanceCache_TotalBalanceByEpoch(t *testing.T) { func TestTotalBalance_MaxSize(t *testing.T) { cache := NewTotalBalanceCache() - for i := uint64(0); i < params.BeaconConfig().LatestRandaoMixesLength+100; i++ { + for i := uint64(0); i < params.BeaconConfig().RandaoMixesLength+100; i++ { tInfo := &TotalBalanceByEpoch{ Epoch: i, } diff --git a/beacon-chain/chaintest/backend/fork_choice_test_format.go b/beacon-chain/chaintest/backend/fork_choice_test_format.go index 84199f1ced..42705060cf 100644 --- a/beacon-chain/chaintest/backend/fork_choice_test_format.go +++ b/beacon-chain/chaintest/backend/fork_choice_test_format.go @@ -46,6 +46,6 @@ type TestBlock struct { // TestAttestation -- type TestAttestation struct { Block string `yaml:"block"` - ValidatorRegistry string `yaml:"validators"` + Validators string `yaml:"validators"` CommitteeSlot uint64 `yaml:"committee_slot"` } diff --git a/beacon-chain/chaintest/backend/simulated_backend.go b/beacon-chain/chaintest/backend/simulated_backend.go index 2d23b92dc6..1f8b25092e 100644 --- a/beacon-chain/chaintest/backend/simulated_backend.go +++ b/beacon-chain/chaintest/backend/simulated_backend.go @@ -103,7 +103,7 @@ func (sb *SimulatedBackend) GenerateBlockAndAdvanceChain(objects *SimulatedObjec return fmt.Errorf("could not generate simulated beacon block %v", err) } newState := sb.state - newState.LatestEth1Data = newBlock.Body.Eth1Data + newState.Eth1Data = newBlock.Body.Eth1Data newState, err = state.ExecuteStateTransition( context.Background(), sb.state, @@ -263,7 +263,7 @@ func (sb *SimulatedBackend) setupBeaconStateAndGenesisBlock(initialDeposits []*p if err != nil { return fmt.Errorf("could not initialize simulated beacon state: %v", err) } - sb.state.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + sb.state.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) sb.historicalDeposits = initialDeposits // We do not expect hashing initial beacon state and genesis block to @@ -345,47 +345,47 @@ func (sb *SimulatedBackend) compareTestCase(testCase *StateTestCase) error { testCase.Results.Slot, ) } - if len(sb.state.ValidatorRegistry) != testCase.Results.NumValidators { + if len(sb.state.Validators) != testCase.Results.NumValidators { return fmt.Errorf( "incorrect num validators after %d state transitions without blocks, wanted %d, received %d", testCase.Config.NumSlots, testCase.Results.NumValidators, - len(sb.state.ValidatorRegistry), + len(sb.state.Validators), ) } for _, slashed := range testCase.Results.SlashedValidators { - if !sb.state.ValidatorRegistry[slashed].Slashed { + if !sb.state.Validators[slashed].Slashed { return fmt.Errorf( "expected validator at index %d to have been slashed", slashed, ) } - if sb.state.ValidatorRegistry[slashed].ExitEpoch != params.BeaconConfig().FarFutureEpoch { + if sb.state.Validators[slashed].ExitEpoch != params.BeaconConfig().FarFutureEpoch { return fmt.Errorf( "expected validator at index %d to have exited", slashed, ) } - if sb.state.ValidatorRegistry[slashed].WithdrawableEpoch != params.BeaconConfig().FarFutureEpoch { + if sb.state.Validators[slashed].WithdrawableEpoch != params.BeaconConfig().FarFutureEpoch { return fmt.Errorf( "expected validator at index %d withdrawable epoch to have been changed, received: %d", slashed, - sb.state.ValidatorRegistry[slashed].WithdrawableEpoch, + sb.state.Validators[slashed].WithdrawableEpoch, ) } } for _, exited := range testCase.Results.ExitedValidators { - if sb.state.ValidatorRegistry[exited].ExitEpoch != params.BeaconConfig().FarFutureEpoch { + if sb.state.Validators[exited].ExitEpoch != params.BeaconConfig().FarFutureEpoch { return fmt.Errorf( "expected validator at index %d to have exited", exited, ) } - if sb.state.ValidatorRegistry[exited].WithdrawableEpoch != params.BeaconConfig().FarFutureEpoch { + if sb.state.Validators[exited].WithdrawableEpoch != params.BeaconConfig().FarFutureEpoch { return fmt.Errorf( "expected validator at index %d withdrawable epoch to have been changed, received: %d", exited, - sb.state.ValidatorRegistry[exited].WithdrawableEpoch, + sb.state.Validators[exited].WithdrawableEpoch, ) } } diff --git a/beacon-chain/core/blocks/block_operations.go b/beacon-chain/core/blocks/block_operations.go index 876a6257cf..d18515eb42 100644 --- a/beacon-chain/core/blocks/block_operations.go +++ b/beacon-chain/core/blocks/block_operations.go @@ -70,7 +70,7 @@ func ProcessEth1DataInBlock(beaconState *pb.BeaconState, block *pb.BeaconBlock) } if voteCount*2 > params.BeaconConfig().SlotsPerEth1VotingPeriod { - beaconState.LatestEth1Data = block.Body.Eth1Data + beaconState.Eth1Data = block.Body.Eth1Data } return beaconState, nil @@ -127,7 +127,7 @@ func ProcessBlockHeader( if err != nil { return nil, err } - proposer := beaconState.ValidatorRegistry[idx] + proposer := beaconState.Validators[idx] if proposer.Slashed { return nil, fmt.Errorf("proposer at index %d was previously slashed", idx) } @@ -172,21 +172,21 @@ func ProcessRandao( } // If block randao passed verification, we XOR the state's latest randao mix with the block's // randao and update the state's corresponding latest randao mix value. - latestMixesLength := params.BeaconConfig().LatestRandaoMixesLength + latestMixesLength := params.BeaconConfig().RandaoMixesLength currentEpoch := helpers.CurrentEpoch(beaconState) - latestMixSlice := beaconState.LatestRandaoMixes[currentEpoch%latestMixesLength] + latestMixSlice := beaconState.RandaoMixes[currentEpoch%latestMixesLength] blockRandaoReveal := hashutil.Hash(body.RandaoReveal) for i, x := range blockRandaoReveal { latestMixSlice[i] ^= x } - beaconState.LatestRandaoMixes[currentEpoch%latestMixesLength] = latestMixSlice + beaconState.RandaoMixes[currentEpoch%latestMixesLength] = latestMixSlice return beaconState, nil } // Verify that bls_verify(proposer.pubkey, hash_tree_root(get_current_epoch(state)), // block.body.randao_reveal, domain=get_domain(state.fork, get_current_epoch(state), DOMAIN_RANDAO)) func verifyBlockRandao(beaconState *pb.BeaconState, body *pb.BeaconBlockBody, proposerIdx uint64, enableLogging bool) error { - proposer := beaconState.ValidatorRegistry[proposerIdx] + proposer := beaconState.Validators[proposerIdx] pub, err := bls.PublicKeyFromBytes(proposer.Pubkey) if err != nil { return fmt.Errorf("could not deserialize proposer public key: %v", err) @@ -239,7 +239,7 @@ func ProcessProposerSlashings( verifySignatures bool, ) (*pb.BeaconState, error) { body := block.Body - registry := beaconState.ValidatorRegistry + registry := beaconState.Validators if uint64(len(body.ProposerSlashings)) > params.BeaconConfig().MaxProposerSlashings { return nil, fmt.Errorf( "number of proposer slashings (%d) exceeds allowed threshold of %d", @@ -333,7 +333,7 @@ func ProcessAttesterSlashings( var err error var slashedAny bool for _, validatorIndex := range slashableIndices { - if helpers.IsSlashableValidator(beaconState.ValidatorRegistry[validatorIndex], currentEpoch) { + if helpers.IsSlashableValidator(beaconState.Validators[validatorIndex], currentEpoch) { beaconState, err = v.SlashValidator(beaconState, validatorIndex, 0) if err != nil { return nil, fmt.Errorf("could not slash validator index %d: %v", @@ -677,7 +677,7 @@ func ProcessValidatorDeposits( var err error deposits := block.Body.Deposits // Verify that outstanding deposits are processed up to the maximum number of deposits. - maxDeposits := beaconState.LatestEth1Data.DepositCount - beaconState.DepositIndex + maxDeposits := beaconState.Eth1Data.DepositCount - beaconState.Eth1DepositIndex if params.BeaconConfig().MaxDepositAmount < maxDeposits { maxDeposits = params.BeaconConfig().MaxDepositAmount } @@ -754,7 +754,7 @@ func ProcessDeposit( if err := verifyDeposit(beaconState, deposit, verifyTree); err != nil { return nil, fmt.Errorf("could not verify deposit #%d: %v", deposit.Index, err) } - beaconState.DepositIndex++ + beaconState.Eth1DepositIndex++ pubKey := deposit.Data.Pubkey amount := deposit.Data.Amount index, ok := valIndexMap[bytesutil.ToBytes32(pubKey)] @@ -766,7 +766,7 @@ func ProcessDeposit( if params.BeaconConfig().MaxEffectiveBalance < effectiveBalance { effectiveBalance = params.BeaconConfig().MaxEffectiveBalance } - beaconState.ValidatorRegistry = append(beaconState.ValidatorRegistry, &pb.Validator{ + beaconState.Validators = append(beaconState.Validators, &pb.Validator{ Pubkey: pubKey, WithdrawalCredentials: deposit.Data.WithdrawalCredentials, ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, @@ -786,7 +786,7 @@ func ProcessDeposit( func verifyDeposit(beaconState *pb.BeaconState, deposit *pb.Deposit, verifyTree bool) error { if verifyTree { // Verify Merkle proof of deposit and deposit trie root. - receiptRoot := beaconState.LatestEth1Data.DepositRoot + receiptRoot := beaconState.Eth1Data.DepositRoot leaf, err := ssz.HashTreeRoot(deposit.Data) if err != nil { return fmt.Errorf("could not tree hash deposit data: %v", err) @@ -805,10 +805,10 @@ func verifyDeposit(beaconState *pb.BeaconState, deposit *pb.Deposit, verifyTree } // Deposits must be processed in order - if deposit.Index != beaconState.DepositIndex { + if deposit.Index != beaconState.Eth1DepositIndex { return fmt.Errorf( "expected deposit merkle tree index to match beacon state deposit index, wanted: %d, received: %d", - beaconState.DepositIndex, + beaconState.Eth1DepositIndex, deposit.Index, ) } @@ -867,7 +867,7 @@ func ProcessValidatorExits( } func verifyExit(beaconState *pb.BeaconState, exit *pb.VoluntaryExit, verifySignatures bool) error { - validator := beaconState.ValidatorRegistry[exit.ValidatorIndex] + validator := beaconState.Validators[exit.ValidatorIndex] currentEpoch := helpers.CurrentEpoch(beaconState) // Verify the validator is active. if !helpers.IsActiveValidator(validator, currentEpoch) { @@ -992,7 +992,7 @@ func verifyTransfer(beaconState *pb.BeaconState, transfer *pb.Transfer, verifySi if transfer.Amount > maxVal { maxVal = transfer.Amount } - sender := beaconState.ValidatorRegistry[transfer.Sender] + sender := beaconState.Validators[transfer.Sender] senderBalance := beaconState.Balances[transfer.Sender] // Verify the amount and fee are not individually too big (for anti-overflow purposes). if senderBalance < maxVal { diff --git a/beacon-chain/core/blocks/block_operations_test.go b/beacon-chain/core/blocks/block_operations_test.go index d9b0ba4622..27cf8b2a73 100644 --- a/beacon-chain/core/blocks/block_operations_test.go +++ b/beacon-chain/core/blocks/block_operations_test.go @@ -46,15 +46,15 @@ func TestProcessBlockHeader_WrongProposerSig(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, LatestBlockHeader: &pb.BeaconBlockHeader{Slot: 9}, Fork: &pb.Fork{ PreviousVersion: []byte{0, 0, 0, 0}, CurrentVersion: []byte{0, 0, 0, 0}, }, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } validators[5896].Slashed = false @@ -106,15 +106,15 @@ func TestProcessBlockHeader_DifferentSlots(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, LatestBlockHeader: &pb.BeaconBlockHeader{Slot: 9}, Fork: &pb.Fork{ PreviousVersion: []byte{0, 0, 0, 0}, CurrentVersion: []byte{0, 0, 0, 0}, }, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } lbhsr, err := ssz.HashTreeRoot(state.LatestBlockHeader) @@ -159,15 +159,15 @@ func TestProcessBlockHeader_PreviousBlockRootNotSignedRoot(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, LatestBlockHeader: &pb.BeaconBlockHeader{Slot: 9}, Fork: &pb.Fork{ PreviousVersion: []byte{0, 0, 0, 0}, CurrentVersion: []byte{0, 0, 0, 0}, }, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } currentEpoch := helpers.CurrentEpoch(state) @@ -208,15 +208,15 @@ func TestProcessBlockHeader_SlashedProposer(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, LatestBlockHeader: &pb.BeaconBlockHeader{Slot: 9}, Fork: &pb.Fork{ PreviousVersion: []byte{0, 0, 0, 0}, CurrentVersion: []byte{0, 0, 0, 0}, }, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } parentRoot, err := ssz.SigningRoot(state.LatestBlockHeader) @@ -263,15 +263,15 @@ func TestProcessBlockHeader_OK(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, LatestBlockHeader: &pb.BeaconBlockHeader{Slot: 9}, Fork: &pb.Fork{ PreviousVersion: []byte{0, 0, 0, 0}, CurrentVersion: []byte{0, 0, 0, 0}, }, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } validators[5593].Slashed = false @@ -381,7 +381,7 @@ func TestProcessRandao_SignatureVerifiesAndUpdatesLatestStateMixes(t *testing.T) t.Errorf("Unexpected error processing block randao: %v", err) } currentEpoch := helpers.CurrentEpoch(beaconState) - mix := newState.LatestRandaoMixes[currentEpoch%params.BeaconConfig().LatestRandaoMixesLength] + mix := newState.RandaoMixes[currentEpoch%params.BeaconConfig().RandaoMixesLength] if bytes.Equal(mix, params.BeaconConfig().ZeroHash[:]) { t.Errorf( @@ -416,11 +416,11 @@ func TestProcessEth1Data_SetsCorrectly(t *testing.T) { if len(newETH1DataVotes) <= 1 { t.Error("Expected new ETH1 data votes to have length > 1") } - if !proto.Equal(beaconState.LatestEth1Data, block.Body.Eth1Data) { + if !proto.Equal(beaconState.Eth1Data, block.Body.Eth1Data) { t.Errorf( "Expected latest eth1 data to have been set to %v, received %v", block.Body.Eth1Data, - beaconState.LatestEth1Data, + beaconState.Eth1Data, ) } } @@ -436,7 +436,7 @@ func TestProcessProposerSlashings_ThresholdReached(t *testing.T) { params.BeaconConfig().MaxProposerSlashings, ) beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -471,7 +471,7 @@ func TestProcessProposerSlashings_UnmatchedHeaderEpochs(t *testing.T) { } beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -505,7 +505,7 @@ func TestProcessProposerSlashings_SameHeaders(t *testing.T) { } beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -549,7 +549,7 @@ func TestProcessProposerSlashings_ValidatorNotSlashable(t *testing.T) { } beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -559,7 +559,7 @@ func TestProcessProposerSlashings_ValidatorNotSlashable(t *testing.T) { } want := fmt.Sprintf( "validator with key %#x is not slashable", - beaconState.ValidatorRegistry[0].Pubkey, + beaconState.Validators[0].Pubkey, ) if _, err := blocks.ProcessProposerSlashings( @@ -605,12 +605,12 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { } currentSlot := uint64(0) beaconState := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: currentSlot, Balances: validatorBalances, - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -627,7 +627,7 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { t.Fatalf("Unexpected error: %s", err) } - newStateVals := newState.ValidatorRegistry + newStateVals := newState.Validators if newStateVals[1].ExitEpoch != validators[1].ExitEpoch { t.Errorf("Proposer with index 1 did not correctly exit,"+"wanted slot:%d, got:%d", newStateVals[1].ExitEpoch, validators[1].ExitEpoch) @@ -640,7 +640,7 @@ func TestProcessAttesterSlashings_ThresholdReached(t *testing.T) { currentSlot := uint64(0) beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -690,7 +690,7 @@ func TestProcessAttesterSlashings_DataNotSlashable(t *testing.T) { currentSlot := uint64(0) beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -740,7 +740,7 @@ func TestProcessAttesterSlashings_IndexedAttestationFailedToVerify(t *testing.T) currentSlot := uint64(0) beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: currentSlot, } block := &pb.BeaconBlock{ @@ -839,12 +839,12 @@ func TestProcessAttesterSlashings_AppliesCorrectStatus(t *testing.T) { currentSlot := 2 * params.BeaconConfig().SlotsPerEpoch beaconState := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: currentSlot, Balances: validatorBalances, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -859,7 +859,7 @@ func TestProcessAttesterSlashings_AppliesCorrectStatus(t *testing.T) { if err != nil { t.Fatal(err) } - newRegistry := newState.ValidatorRegistry + newRegistry := newState.Validators // Given the intersection of slashable indices is [1], only validator // at index 1 should be slashed and exited. We confirm this below. @@ -1251,9 +1251,9 @@ func TestConvertToIndexed_OK(t *testing.T) { state := &pb.BeaconState{ Slot: 5, - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } tests := []struct { aggregationBitfield []byte @@ -1338,10 +1338,10 @@ func TestProcessValidatorDeposits_ThresholdReached(t *testing.T) { }, } beaconState := &pb.BeaconState{ - LatestEth1Data: &pb.Eth1Data{ + Eth1Data: &pb.Eth1Data{ DepositCount: params.BeaconConfig().MaxDeposits, }, - DepositIndex: 0, + Eth1DepositIndex: 0, } want := "exceeds allowed threshold" if _, err := blocks.ProcessValidatorDeposits( @@ -1382,7 +1382,7 @@ func TestProcessValidatorDeposits_MerkleBranchFailsVerification(t *testing.T) { }, } beaconState := &pb.BeaconState{ - LatestEth1Data: &pb.Eth1Data{ + Eth1Data: &pb.Eth1Data{ DepositRoot: []byte{0}, BlockHash: []byte{1}, }, @@ -1434,12 +1434,12 @@ func TestProcessValidatorDeposits_IncorrectMerkleIndex(t *testing.T) { balances := []uint64{0} depositRoot := depositTrie.Root() beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Balances: balances, Slot: 0, GenesisTime: uint64(0), - DepositIndex: 1, - LatestEth1Data: &pb.Eth1Data{ + Eth1DepositIndex: 1, + Eth1Data: &pb.Eth1Data{ DepositRoot: depositRoot[:], BlockHash: []byte{1}, }, @@ -1493,9 +1493,9 @@ func TestProcessValidatorDeposits_ProcessCorrectly(t *testing.T) { balances := []uint64{0} root := depositTrie.Root() beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Balances: balances, - LatestEth1Data: &pb.Eth1Data{ + Eth1Data: &pb.Eth1Data{ DepositRoot: root[:], BlockHash: root[:], }, @@ -1530,7 +1530,7 @@ func TestProcessDeposit_RepeatedDeposit(t *testing.T) { balances := []uint64{0, 50} beaconState := &pb.BeaconState{ Balances: balances, - ValidatorRegistry: registry, + Validators: registry, } deposit := &pb.Deposit{ @@ -1571,7 +1571,7 @@ func TestProcessDeposit_PublicKeyDoesNotExist(t *testing.T) { balances := []uint64{1000, 1000} beaconState := &pb.BeaconState{ Balances: balances, - ValidatorRegistry: registry, + Validators: registry, } deposit := &pb.Deposit{ @@ -1616,7 +1616,7 @@ func TestProcessDeposit_PublicKeyDoesNotExistAndEmptyValidator(t *testing.T) { beaconState := &pb.BeaconState{ Slot: params.BeaconConfig().SlotsPerEpoch, Balances: balances, - ValidatorRegistry: registry, + Validators: registry, } deposit := &pb.Deposit{ @@ -1650,7 +1650,7 @@ func TestProcessValidatorExits_ThresholdReached(t *testing.T) { exits := make([]*pb.VoluntaryExit, params.BeaconConfig().MaxVoluntaryExits+1) registry := []*pb.Validator{} state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -1686,7 +1686,7 @@ func TestProcessValidatorExits_ValidatorNotActive(t *testing.T) { }, } state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -1718,7 +1718,7 @@ func TestProcessValidatorExits_InvalidExitEpoch(t *testing.T) { }, } state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: 0, } block := &pb.BeaconBlock{ @@ -1752,7 +1752,7 @@ func TestProcessValidatorExits_NotActiveLongEnoughToExit(t *testing.T) { }, } state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: 10, } block := &pb.BeaconBlock{ @@ -1786,7 +1786,7 @@ func TestProcessValidatorExits_AppliesCorrectStatus(t *testing.T) { }, } state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: params.BeaconConfig().SlotsPerEpoch * 5, } state.Slot = state.Slot + (params.BeaconConfig().PersistentCommitteePeriod * params.BeaconConfig().SlotsPerEpoch) @@ -1799,7 +1799,7 @@ func TestProcessValidatorExits_AppliesCorrectStatus(t *testing.T) { if err != nil { t.Fatalf("Could not process exits: %v", err) } - newRegistry := newState.ValidatorRegistry + newRegistry := newState.Validators if newRegistry[0].ExitEpoch != helpers.DelayedActivationExitEpoch(state.Slot/params.BeaconConfig().SlotsPerEpoch) { t.Errorf("Expected validator exit epoch to be %d, got %d", helpers.DelayedActivationExitEpoch(state.Slot/params.BeaconConfig().SlotsPerEpoch), newRegistry[0].ExitEpoch) @@ -1810,7 +1810,7 @@ func TestProcessBeaconTransfers_ThresholdReached(t *testing.T) { transfers := make([]*pb.Transfer, params.BeaconConfig().MaxTransfers+1) registry := []*pb.Validator{} state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -1847,7 +1847,7 @@ func TestProcessBeaconTransfers_DuplicateTransfer(t *testing.T) { } registry := []*pb.Validator{} state := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -1880,7 +1880,7 @@ func TestProcessBeaconTransfers_FailsVerification(t *testing.T) { balances := []uint64{params.BeaconConfig().MaxDepositAmount} state := &pb.BeaconState{ Slot: 0, - ValidatorRegistry: registry, + Validators: registry, Balances: balances, } transfers := []*pb.Transfer{ @@ -1925,8 +1925,8 @@ func TestProcessBeaconTransfers_FailsVerification(t *testing.T) { t.Errorf("Expected %s, received %v", want, err) } - state.ValidatorRegistry[0].WithdrawableEpoch = params.BeaconConfig().FarFutureEpoch - state.ValidatorRegistry[0].ActivationEligibilityEpoch = 0 + state.Validators[0].WithdrawableEpoch = params.BeaconConfig().FarFutureEpoch + state.Validators[0].ActivationEligibilityEpoch = 0 block.Body.Transfers = []*pb.Transfer{ { Fee: params.BeaconConfig().MinDepositAmount, @@ -1943,13 +1943,13 @@ func TestProcessBeaconTransfers_FailsVerification(t *testing.T) { t.Errorf("Expected %s, received %v", want, err) } - state.ValidatorRegistry[0].WithdrawableEpoch = 0 - state.ValidatorRegistry[0].ActivationEligibilityEpoch = params.BeaconConfig().FarFutureEpoch + state.Validators[0].WithdrawableEpoch = 0 + state.Validators[0].ActivationEligibilityEpoch = params.BeaconConfig().FarFutureEpoch buf := []byte{params.BeaconConfig().BLSWithdrawalPrefixByte} pubKey := []byte("B") hashed := hashutil.Hash(pubKey) buf = append(buf, hashed[:]...) - state.ValidatorRegistry[0].WithdrawalCredentials = buf + state.Validators[0].WithdrawalCredentials = buf block.Body.Transfers = []*pb.Transfer{ { Fee: params.BeaconConfig().MinDepositAmount, @@ -1988,12 +1988,12 @@ func TestProcessBeaconTransfers_OK(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, Balances: validatorBalances, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } transfers := []*pb.Transfer{ { @@ -2014,8 +2014,8 @@ func TestProcessBeaconTransfers_OK(t *testing.T) { pubKey := []byte("A") hashed := hashutil.Hash(pubKey) buf = append(buf, hashed[:]...) - state.ValidatorRegistry[0].WithdrawalCredentials = buf - state.ValidatorRegistry[0].ActivationEligibilityEpoch = params.BeaconConfig().FarFutureEpoch + state.Validators[0].WithdrawalCredentials = buf + state.Validators[0].ActivationEligibilityEpoch = params.BeaconConfig().FarFutureEpoch newState, err := blocks.ProcessTransfers( state, block, diff --git a/beacon-chain/core/blocks/validity_conditions.go b/beacon-chain/core/blocks/validity_conditions.go index 936b4fad0a..45f6847821 100644 --- a/beacon-chain/core/blocks/validity_conditions.go +++ b/beacon-chain/core/blocks/validity_conditions.go @@ -32,7 +32,7 @@ func IsValidBlock( return fmt.Errorf("unprocessed parent block as it is not saved in the db: %#x", parentRoot) } - h := common.BytesToHash(state.LatestEth1Data.BlockHash) + h := common.BytesToHash(state.Eth1Data.BlockHash) powBlock, err := GetPOWBlock(ctx, h) if err != nil { return fmt.Errorf("unable to retrieve POW chain reference block: %v", err) @@ -42,7 +42,7 @@ func IsValidBlock( // The block pointed to by the state in state.processed_pow_receipt_root has // been processed in the ETH 1.0 chain. if powBlock == nil { - return fmt.Errorf("proof-of-Work chain reference in state does not exist: %#x", state.LatestEth1Data.BlockHash) + return fmt.Errorf("proof-of-Work chain reference in state does not exist: %#x", state.Eth1Data.BlockHash) } // Pre-Processing Condition 4: diff --git a/beacon-chain/core/blocks/validity_conditions_test.go b/beacon-chain/core/blocks/validity_conditions_test.go index 307f870367..2b46a63997 100644 --- a/beacon-chain/core/blocks/validity_conditions_test.go +++ b/beacon-chain/core/blocks/validity_conditions_test.go @@ -77,7 +77,7 @@ func TestIsValidBlock_InvalidSlot(t *testing.T) { block.Slot = 3 db.hasBlock = true - beaconState.LatestEth1Data = &pb.Eth1Data{ + beaconState.Eth1Data = &pb.Eth1Data{ DepositRoot: []byte{2}, BlockHash: []byte{3}, } @@ -106,7 +106,7 @@ func TestIsValidBlock_InvalidPoWReference(t *testing.T) { db.hasBlock = true block.Slot = 4 powClient.blockExists = false - beaconState.LatestEth1Data = &pb.Eth1Data{ + beaconState.Eth1Data = &pb.Eth1Data{ DepositRoot: []byte{2}, BlockHash: []byte{3}, } @@ -129,7 +129,7 @@ func TestIsValidBlock_InvalidGenesis(t *testing.T) { powClient.blockExists = false beaconState.Slot = 3 - beaconState.LatestEth1Data = &pb.Eth1Data{ + beaconState.Eth1Data = &pb.Eth1Data{ DepositRoot: []byte{2}, BlockHash: []byte{3}, } @@ -159,7 +159,7 @@ func TestIsValidBlock_GoodBlock(t *testing.T) { powClient.blockExists = true beaconState.Slot = 3 - beaconState.LatestEth1Data = &pb.Eth1Data{ + beaconState.Eth1Data = &pb.Eth1Data{ DepositRoot: []byte{2}, BlockHash: []byte{3}, } diff --git a/beacon-chain/core/epoch/epoch_processing.go b/beacon-chain/core/epoch/epoch_processing.go index 9b0a2a3970..4450d80f5f 100644 --- a/beacon-chain/core/epoch/epoch_processing.go +++ b/beacon-chain/core/epoch/epoch_processing.go @@ -322,7 +322,7 @@ func ProcessRewardsAndPenalties(state *pb.BeaconState) (*pb.BeaconState, error) if err != nil { return nil, fmt.Errorf("could not get crosslink delta: %v ", err) } - for i := 0; i < len(state.ValidatorRegistry); i++ { + for i := 0; i < len(state.Validators); i++ { state = helpers.IncreaseBalance(state, uint64(i), attsRewards[i]+clRewards[i]) state = helpers.DecreaseBalance(state, uint64(i), attsPenalties[i]+clPenalties[i]) } @@ -358,7 +358,7 @@ func ProcessRewardsAndPenalties(state *pb.BeaconState) (*pb.BeaconState, error) // validator.activation_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state)) func ProcessRegistryUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { currentEpoch := helpers.CurrentEpoch(state) - for idx, validator := range state.ValidatorRegistry { + for idx, validator := range state.Validators { // Process the validators for activation eligibility. eligibleToActivate := validator.ActivationEligibilityEpoch == params.BeaconConfig().FarFutureEpoch properBalance := validator.EffectiveBalance >= params.BeaconConfig().MaxEffectiveBalance @@ -375,7 +375,7 @@ func ProcessRegistryUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { // Queue the validators whose eligible to activate and sort them by activation eligibility epoch number var activationQ []uint64 - for idx, validator := range state.ValidatorRegistry { + for idx, validator := range state.Validators { eligibleActivated := validator.ActivationEligibilityEpoch != params.BeaconConfig().FarFutureEpoch canBeActive := validator.ActivationEpoch >= helpers.DelayedActivationExitEpoch(state.FinalizedEpoch) if eligibleActivated && canBeActive { @@ -383,7 +383,7 @@ func ProcessRegistryUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { } } sort.Slice(activationQ, func(i, j int) bool { - return state.ValidatorRegistry[i].ActivationEligibilityEpoch < state.ValidatorRegistry[j].ActivationEligibilityEpoch + return state.Validators[i].ActivationEligibilityEpoch < state.Validators[j].ActivationEligibilityEpoch }) // Only activate just enough validators according to the activation churn limit. @@ -398,7 +398,7 @@ func ProcessRegistryUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { limit = int(churnLimit) } for _, index := range activationQ[:limit] { - validator := state.ValidatorRegistry[index] + validator := state.Validators[index] if validator.ActivationEpoch == params.BeaconConfig().FarFutureEpoch { validator.ActivationEpoch = helpers.DelayedActivationExitEpoch(currentEpoch) } @@ -432,13 +432,13 @@ func ProcessSlashings(state *pb.BeaconState) (*pb.BeaconState, error) { } // Compute slashed balances in the current epoch - exitLength := params.BeaconConfig().LatestSlashedExitLength - totalAtStart := state.LatestSlashedBalances[(currentEpoch+1)%exitLength] - totalAtEnd := state.LatestSlashedBalances[currentEpoch%exitLength] + exitLength := params.BeaconConfig().SlashedExitLength + totalAtStart := state.SlashedBalances[(currentEpoch+1)%exitLength] + totalAtEnd := state.SlashedBalances[currentEpoch%exitLength] totalPenalties := totalAtEnd - totalAtStart // Compute slashing for each validator. - for index, validator := range state.ValidatorRegistry { + for index, validator := range state.Validators { correctEpoch := currentEpoch == validator.WithdrawableEpoch-exitLength/2 if validator.Slashed && correctEpoch { minPenalties := totalPenalties * 3 @@ -504,7 +504,7 @@ func ProcessFinalUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { } // Update effective balances with hysteresis. - for i, v := range state.ValidatorRegistry { + for i, v := range state.Validators { balance := state.Balances[i] halfInc := params.BeaconConfig().EffectiveBalanceIncrement / 2 if balance < v.EffectiveBalance || v.EffectiveBalance+3*halfInc < balance { @@ -520,12 +520,12 @@ func ProcessFinalUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { if err != nil { return nil, fmt.Errorf("could not get shard delta: %v", err) } - state.LatestStartShard = (state.LatestStartShard + delta) % + state.StartShard = (state.StartShard + delta) % params.BeaconConfig().ShardCount // Set active index root. activationDelay := params.BeaconConfig().ActivationExitDelay - idxRootPosition := (nextEpoch + activationDelay) % params.BeaconConfig().LatestActiveIndexRootsLength + idxRootPosition := (nextEpoch + activationDelay) % params.BeaconConfig().ActiveIndexRootsLength activeIndices, err := helpers.ActiveValidatorIndices(state, nextEpoch+activationDelay) if err != nil { return nil, fmt.Errorf("could not get active indices: %v", err) @@ -534,24 +534,24 @@ func ProcessFinalUpdates(state *pb.BeaconState) (*pb.BeaconState, error) { if err != nil { return nil, fmt.Errorf("could not tree hash active indices: %v", err) } - state.LatestActiveIndexRoots[idxRootPosition] = idxRoot[:] + state.ActiveIndexRoots[idxRootPosition] = idxRoot[:] // Set total slashed balances. - slashedExitLength := params.BeaconConfig().LatestSlashedExitLength - state.LatestSlashedBalances[nextEpoch%slashedExitLength] = - state.LatestSlashedBalances[currentEpoch%slashedExitLength] + slashedExitLength := params.BeaconConfig().SlashedExitLength + state.SlashedBalances[nextEpoch%slashedExitLength] = + state.SlashedBalances[currentEpoch%slashedExitLength] // Set RANDAO mix. - randaoMixLength := params.BeaconConfig().LatestRandaoMixesLength + randaoMixLength := params.BeaconConfig().RandaoMixesLength mix := helpers.RandaoMix(state, currentEpoch) - state.LatestRandaoMixes[nextEpoch%randaoMixLength] = mix + state.RandaoMixes[nextEpoch%randaoMixLength] = mix // Set historical root accumulator. epochsPerHistoricalRoot := params.BeaconConfig().SlotsPerHistoricalRoot / params.BeaconConfig().SlotsPerEpoch if nextEpoch%epochsPerHistoricalRoot == 0 { historicalBatch := &pb.HistoricalBatch{ - BlockRoots: state.LatestBlockRoots, - StateRoots: state.LatestStateRoots, + BlockRoots: state.BlockRoots, + StateRoots: state.StateRoots, } batchRoot, err := hashutil.HashProto(historicalBatch) if err != nil { @@ -589,7 +589,7 @@ func unslashedAttestingIndices(state *pb.BeaconState, atts []*pb.PendingAttestat sort.Slice(setIndices, func(i, j int) bool { return setIndices[i] < setIndices[j] }) // Remove the slashed validator indices. for i := 0; i < len(setIndices); i++ { - if state.ValidatorRegistry[setIndices[i]].Slashed { + if state.Validators[setIndices[i]].Slashed { setIndices = append(setIndices[:i], setIndices[i+1:]...) } } @@ -693,7 +693,7 @@ func baseReward(state *pb.BeaconState, index uint64) (uint64, error) { if err != nil { return 0, fmt.Errorf("could not calculate active balance: %v", err) } - effectiveBalance := state.ValidatorRegistry[index].EffectiveBalance + effectiveBalance := state.Validators[index].EffectiveBalance baseReward := effectiveBalance * params.BeaconConfig().BaseRewardFactor / mathutil.IntegerSquareRoot(totalBalance) / params.BeaconConfig().BaseRewardsPerEpoch return baseReward, nil @@ -756,13 +756,13 @@ func attestationDelta(state *pb.BeaconState) ([]uint64, []uint64, error) { return nil, nil, fmt.Errorf("could not get total active balance: %v", err) } - rewards := make([]uint64, len(state.ValidatorRegistry)) - penalties := make([]uint64, len(state.ValidatorRegistry)) + rewards := make([]uint64, len(state.Validators)) + penalties := make([]uint64, len(state.Validators)) // Filter out the list of eligible validator indices. The eligible validator // has to be active or slashed but before withdrawn. var eligible []uint64 - for i, v := range state.ValidatorRegistry { + for i, v := range state.Validators { isActive := helpers.IsActiveValidator(v, prevEpoch) isSlashed := v.Slashed && (prevEpoch+1 < v.WithdrawableEpoch) if isActive || isSlashed { @@ -864,7 +864,7 @@ func attestationDelta(state *pb.BeaconState) ([]uint64, []uint64, error) { } penalties[index] += params.BeaconConfig().BaseRewardsPerEpoch * base if _, ok := attestedTarget[index]; !ok { - penalties[index] += state.ValidatorRegistry[index].EffectiveBalance * finalityDelay / + penalties[index] += state.Validators[index].EffectiveBalance * finalityDelay / params.BeaconConfig().InactivityPenaltyQuotient } } @@ -898,8 +898,8 @@ func attestationDelta(state *pb.BeaconState) ([]uint64, []uint64, error) { // penalties[index] += base_reward // return rewards, penalties func crosslinkDelta(state *pb.BeaconState) ([]uint64, []uint64, error) { - rewards := make([]uint64, len(state.ValidatorRegistry)) - penalties := make([]uint64, len(state.ValidatorRegistry)) + rewards := make([]uint64, len(state.Validators)) + penalties := make([]uint64, len(state.Validators)) epoch := helpers.PrevEpoch(state) count, err := helpers.EpochCommitteeCount(state, epoch) if err != nil { diff --git a/beacon-chain/core/epoch/epoch_processing_test.go b/beacon-chain/core/epoch/epoch_processing_test.go index 59add1f240..9b8aaa8e56 100644 --- a/beacon-chain/core/epoch/epoch_processing_test.go +++ b/beacon-chain/core/epoch/epoch_processing_test.go @@ -85,9 +85,9 @@ func TestUnslashedAttestingIndices_CanSortAndFilter(t *testing.T) { } state := &pb.BeaconState{ Slot: 0, - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } indices, err := unslashedAttestingIndices(state, atts) @@ -102,7 +102,7 @@ func TestUnslashedAttestingIndices_CanSortAndFilter(t *testing.T) { // Verify the slashed validator is filtered. slashedValidator := indices[0] - state.ValidatorRegistry[slashedValidator].Slashed = true + state.Validators[slashedValidator].Slashed = true indices, err = unslashedAttestingIndices(state, atts) if err != nil { t.Fatal(err) @@ -130,8 +130,8 @@ func TestUnslashedAttestingIndices_CantGetIndicesBitfieldError(t *testing.T) { state := &pb.BeaconState{ Slot: 0, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } const wantedErr = "could not get attester indices: wanted participants bitfield length 2, got: 1" if _, err := unslashedAttestingIndices(state, atts); !strings.Contains(err.Error(), wantedErr) { @@ -168,9 +168,9 @@ func TestAttestingBalance_CorrectBalance(t *testing.T) { } state := &pb.BeaconState{ Slot: 0, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), - ValidatorRegistry: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), + Validators: validators, Balances: balances, } @@ -202,8 +202,8 @@ func TestAttestingBalance_CantGetIndicesBitfieldError(t *testing.T) { state := &pb.BeaconState{ Slot: 0, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } const wantedErr = "could not get attester indices: wanted participants bitfield length 0, got: 1" if _, err := AttestingBalance(state, atts); !strings.Contains(err.Error(), wantedErr) { @@ -244,9 +244,9 @@ func TestMatchAttestations_PrevEpoch(t *testing.T) { Slot: s + e + 2, CurrentEpochAttestations: currentAtts, PreviousEpochAttestations: prevAtts, - LatestBlockRoots: blockRoots, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + BlockRoots: blockRoots, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } mAtts, err := MatchAttestations(state, 0) @@ -319,7 +319,7 @@ func TestMatchAttestations_CurrentEpoch(t *testing.T) { Slot: s + e + 2, CurrentEpochAttestations: currentAtts, PreviousEpochAttestations: prevAtts, - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, } mAtts, err := MatchAttestations(state, 1) @@ -395,7 +395,7 @@ func TestWinningCrosslink_ReturnGensisCrosslink(t *testing.T) { state := &pb.BeaconState{ Slot: gs + e + 2, PreviousEpochAttestations: []*pb.PendingAttestation{}, - LatestBlockRoots: make([][]byte, 128), + BlockRoots: make([][]byte, 128), CurrentCrosslinks: []*pb.Crosslink{{StartEpoch: ge}}, } @@ -466,10 +466,10 @@ func TestWinningCrosslink_CanGetWinningRoot(t *testing.T) { state := &pb.BeaconState{ Slot: gs + e + 2, PreviousEpochAttestations: atts, - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, CurrentCrosslinks: crosslinks, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } winner, indices, err := winningCrosslink(state, 1, ge) @@ -512,11 +512,11 @@ func TestProcessCrosslinks_NoUpdate(t *testing.T) { } state := &pb.BeaconState{ Slot: params.BeaconConfig().SlotsPerEpoch + 1, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, - LatestBlockRoots: blockRoots, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + BlockRoots: blockRoots, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), CurrentCrosslinks: crosslinks, } newState, err := ProcessCrosslinks(state) @@ -577,13 +577,13 @@ func TestProcessCrosslinks_SuccessfulUpdate(t *testing.T) { } state := &pb.BeaconState{ Slot: gs + e + 2, - ValidatorRegistry: validators, + Validators: validators, PreviousEpochAttestations: atts, Balances: balances, - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, CurrentCrosslinks: crosslinks, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } newState, err := ProcessCrosslinks(state) if err != nil { @@ -611,7 +611,7 @@ func TestBaseReward_AccurateRewards(t *testing.T) { for _, tt := range tests { helpers.ClearAllCaches() state := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {ExitEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: tt.b}}, Balances: []uint64{tt.a}, } @@ -648,7 +648,7 @@ func TestProcessJustificationFinalization_CantJustifyFinalize(t *testing.T) { PreviousJustifiedRoot: params.BeaconConfig().ZeroHash[:], CurrentJustifiedEpoch: 0, CurrentJustifiedRoot: params.BeaconConfig().ZeroHash[:], - ValidatorRegistry: []*pb.Validator{{ExitEpoch: e, EffectiveBalance: a}, {ExitEpoch: e, EffectiveBalance: a}, + Validators: []*pb.Validator{{ExitEpoch: e, EffectiveBalance: a}, {ExitEpoch: e, EffectiveBalance: a}, {ExitEpoch: e, EffectiveBalance: a}, {ExitEpoch: e, EffectiveBalance: a}}, } // Since Attested balances are less than total balances, nothing happened. @@ -675,9 +675,9 @@ func TestProcessJustificationFinalization_NoBlockRootCurrentEpoch(t *testing.T) CurrentJustifiedEpoch: 0, CurrentJustifiedRoot: params.BeaconConfig().ZeroHash[:], JustificationBitfield: 3, - ValidatorRegistry: []*pb.Validator{{ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}}, + Validators: []*pb.Validator{{ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}}, Balances: []uint64{a, a, a, a}, // validator total balance should be 128000000000 - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, } attestedBalance := 4 * e * 3 / 2 _, err := ProcessJustificationAndFinalization(state, 0, attestedBalance) @@ -701,9 +701,9 @@ func TestProcessJustificationFinalization_JustifyCurrentEpoch(t *testing.T) { CurrentJustifiedEpoch: 0, CurrentJustifiedRoot: params.BeaconConfig().ZeroHash[:], JustificationBitfield: 3, - ValidatorRegistry: []*pb.Validator{{ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}}, + Validators: []*pb.Validator{{ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}}, Balances: []uint64{a, a, a, a}, // validator total balance should be 128000000000 - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, } attestedBalance := 4 * e * 3 / 2 newState, err := ProcessJustificationAndFinalization(state, 0, attestedBalance) @@ -742,9 +742,9 @@ func TestProcessJustificationFinalization_JustifyPrevEpoch(t *testing.T) { CurrentJustifiedEpoch: 0, CurrentJustifiedRoot: params.BeaconConfig().ZeroHash[:], JustificationBitfield: 3, - ValidatorRegistry: []*pb.Validator{{ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}}, + Validators: []*pb.Validator{{ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}, {ExitEpoch: e}}, Balances: []uint64{a, a, a, a}, // validator total balance should be 128000000000 - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, } attestedBalance := 4 * e * 3 / 2 newState, err := ProcessJustificationAndFinalization(state, attestedBalance, 0) @@ -771,9 +771,9 @@ func TestProcessJustificationFinalization_JustifyPrevEpoch(t *testing.T) { func TestProcessSlashings_NotSlashed(t *testing.T) { s := &pb.BeaconState{ Slot: 0, - ValidatorRegistry: []*pb.Validator{{Slashed: true}}, + Validators: []*pb.Validator{{Slashed: true}}, Balances: []uint64{params.BeaconConfig().MaxDepositAmount}, - LatestSlashedBalances: []uint64{0, 1e9}, + SlashedBalances: []uint64{0, 1e9}, } newState, err := ProcessSlashings(s) if err != nil { @@ -789,13 +789,13 @@ func TestProcessSlashings_SlashedLess(t *testing.T) { helpers.ClearAllCaches() s := &pb.BeaconState{ Slot: 0, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {Slashed: true, - WithdrawableEpoch: params.BeaconConfig().LatestSlashedExitLength / 2, + WithdrawableEpoch: params.BeaconConfig().SlashedExitLength / 2, EffectiveBalance: params.BeaconConfig().MaxDepositAmount}, {ExitEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MaxDepositAmount}}, Balances: []uint64{params.BeaconConfig().MaxDepositAmount, params.BeaconConfig().MaxDepositAmount}, - LatestSlashedBalances: []uint64{0, 1e9}, + SlashedBalances: []uint64{0, 1e9}, } newState, err := ProcessSlashings(s) if err != nil { @@ -813,38 +813,38 @@ func TestProcessFinalUpdates_CanProcess(t *testing.T) { ne := ce + 1 s.Eth1DataVotes = []*pb.Eth1Data{} s.Balances[0] = 29 * 1e9 - s.LatestSlashedBalances[ce] = 100 - s.LatestRandaoMixes[ce] = []byte{'A'} + s.SlashedBalances[ce] = 100 + s.RandaoMixes[ce] = []byte{'A'} newS, err := ProcessFinalUpdates(s) if err != nil { t.Fatal(err) } // Verify effective balance is correctly updated. - if newS.ValidatorRegistry[0].EffectiveBalance != 29*1e9 { - t.Errorf("effective balance incorrectly updated, got %d", s.ValidatorRegistry[0].EffectiveBalance) + if newS.Validators[0].EffectiveBalance != 29*1e9 { + t.Errorf("effective balance incorrectly updated, got %d", s.Validators[0].EffectiveBalance) } // Verify start shard is correctly updated. - if newS.LatestStartShard != 64 { + if newS.StartShard != 64 { t.Errorf("start shard incorrectly updated, got %d", 64) } // Verify latest active index root is correctly updated in the right position. - pos := (ne + params.BeaconConfig().ActivationExitDelay) % params.BeaconConfig().LatestActiveIndexRootsLength - if bytes.Equal(newS.LatestActiveIndexRoots[pos], params.BeaconConfig().ZeroHash[:]) { + pos := (ne + params.BeaconConfig().ActivationExitDelay) % params.BeaconConfig().ActiveIndexRootsLength + if bytes.Equal(newS.ActiveIndexRoots[pos], params.BeaconConfig().ZeroHash[:]) { t.Error("latest active index roots still zero hashes") } // Verify slashed balances correctly updated. - if newS.LatestSlashedBalances[ce] != newS.LatestSlashedBalances[ne] { + if newS.SlashedBalances[ce] != newS.SlashedBalances[ne] { t.Errorf("wanted slashed balance %d, got %d", - newS.LatestSlashedBalances[ce], - newS.LatestSlashedBalances[ne]) + newS.SlashedBalances[ce], + newS.SlashedBalances[ne]) } // Verify randao is correctly updated in the right position. - if bytes.Equal(newS.LatestRandaoMixes[ne], params.BeaconConfig().ZeroHash[:]) { + if bytes.Equal(newS.RandaoMixes[ne], params.BeaconConfig().ZeroHash[:]) { t.Error("latest RANDAO still zero hashes") } @@ -884,7 +884,7 @@ func TestCrosslinkDelta_NoOneAttested(t *testing.T) { func TestProcessRegistryUpdates_NoRotation(t *testing.T) { state := &pb.BeaconState{ Slot: 5 * params.BeaconConfig().SlotsPerEpoch, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {ExitEpoch: params.BeaconConfig().ActivationExitDelay}, {ExitEpoch: params.BeaconConfig().ActivationExitDelay}, }, @@ -897,7 +897,7 @@ func TestProcessRegistryUpdates_NoRotation(t *testing.T) { if err != nil { t.Fatal(err) } - for i, validator := range newState.ValidatorRegistry { + for i, validator := range newState.Validators { if validator.ExitEpoch != params.BeaconConfig().ActivationExitDelay { t.Errorf("could not update registry %d, wanted exit slot %d got %d", i, params.BeaconConfig().ActivationExitDelay, validator.ExitEpoch) @@ -1112,7 +1112,7 @@ func TestProcessRegistryUpdates_EligibleToActivate(t *testing.T) { } limit, _ := helpers.ChurnLimit(state) for i := 0; i < int(limit)+10; i++ { - state.ValidatorRegistry = append(state.ValidatorRegistry, &pb.Validator{ + state.Validators = append(state.Validators, &pb.Validator{ ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance, ActivationEpoch: params.BeaconConfig().FarFutureEpoch, @@ -1120,7 +1120,7 @@ func TestProcessRegistryUpdates_EligibleToActivate(t *testing.T) { } currentEpoch := helpers.CurrentEpoch(state) newState, _ := ProcessRegistryUpdates(state) - for i, validator := range newState.ValidatorRegistry { + for i, validator := range newState.Validators { if validator.ActivationEligibilityEpoch != currentEpoch { t.Errorf("could not update registry %d, wanted activation eligibility epoch %d got %d", i, currentEpoch, validator.ActivationEligibilityEpoch) @@ -1139,7 +1139,7 @@ func TestProcessRegistryUpdates_EligibleToActivate(t *testing.T) { func TestProcessRegistryUpdates_ActivationCompletes(t *testing.T) { state := &pb.BeaconState{ Slot: 5 * params.BeaconConfig().SlotsPerEpoch, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {ExitEpoch: params.BeaconConfig().ActivationExitDelay, ActivationEpoch: 5 + params.BeaconConfig().ActivationExitDelay + 1}, {ExitEpoch: params.BeaconConfig().ActivationExitDelay, @@ -1151,7 +1151,7 @@ func TestProcessRegistryUpdates_ActivationCompletes(t *testing.T) { }, } newState, _ := ProcessRegistryUpdates(state) - for i, validator := range newState.ValidatorRegistry { + for i, validator := range newState.Validators { if validator.ExitEpoch != params.BeaconConfig().ActivationExitDelay { t.Errorf("could not update registry %d, wanted exit slot %d got %d", i, params.BeaconConfig().ActivationExitDelay, validator.ExitEpoch) @@ -1165,7 +1165,7 @@ func TestProcessRegistryUpdates_CanExits(t *testing.T) { minWithdrawalDelay := params.BeaconConfig().MinValidatorWithdrawalDelay state := &pb.BeaconState{ Slot: epoch * params.BeaconConfig().SlotsPerEpoch, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ { ExitEpoch: exitEpoch, WithdrawableEpoch: exitEpoch + minWithdrawalDelay}, @@ -1182,7 +1182,7 @@ func TestProcessRegistryUpdates_CanExits(t *testing.T) { if err != nil { t.Fatal(err) } - for i, validator := range newState.ValidatorRegistry { + for i, validator := range newState.Validators { if validator.ExitEpoch != exitEpoch { t.Errorf("could not update registry %d, wanted exit slot %d got %d", i, @@ -1194,7 +1194,7 @@ func TestProcessRegistryUpdates_CanExits(t *testing.T) { } func TestProcessRewardsAndPenalties_GenesisEpoch(t *testing.T) { - state := &pb.BeaconState{Slot: params.BeaconConfig().SlotsPerEpoch - 1, LatestStartShard: 999} + state := &pb.BeaconState{Slot: params.BeaconConfig().SlotsPerEpoch - 1, StartShard: 999} newState, err := ProcessRewardsAndPenalties(state) if err != nil { t.Fatal(err) @@ -1264,14 +1264,14 @@ func buildState(slot uint64, validatorCount uint64) *pb.BeaconState { } latestActiveIndexRoots := make( [][]byte, - params.BeaconConfig().LatestActiveIndexRootsLength, + params.BeaconConfig().ActiveIndexRootsLength, ) for i := 0; i < len(latestActiveIndexRoots); i++ { latestActiveIndexRoots[i] = params.BeaconConfig().ZeroHash[:] } latestRandaoMixes := make( [][]byte, - params.BeaconConfig().LatestRandaoMixesLength, + params.BeaconConfig().RandaoMixesLength, ) for i := 0; i < len(latestRandaoMixes); i++ { latestRandaoMixes[i] = params.BeaconConfig().ZeroHash[:] @@ -1279,11 +1279,11 @@ func buildState(slot uint64, validatorCount uint64) *pb.BeaconState { return &pb.BeaconState{ Slot: slot, Balances: validatorBalances, - ValidatorRegistry: validators, + Validators: validators, CurrentCrosslinks: make([]*pb.Crosslink, params.BeaconConfig().ShardCount), - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), - LatestBlockRoots: make([][]byte, params.BeaconConfig().SlotsPerEpoch*10), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), + BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerEpoch*10), } } diff --git a/beacon-chain/core/helpers/block.go b/beacon-chain/core/helpers/block.go index da3dc0c77e..1ad7298ddf 100644 --- a/beacon-chain/core/helpers/block.go +++ b/beacon-chain/core/helpers/block.go @@ -30,7 +30,7 @@ func BlockRootAtSlot(state *pb.BeaconState, slot uint64) ([]byte, error) { state.Slot, ) } - return state.LatestBlockRoots[slot%params.BeaconConfig().SlotsPerHistoricalRoot], nil + return state.BlockRoots[slot%params.BeaconConfig().SlotsPerHistoricalRoot], nil } // BlockRoot returns the block root stored in the BeaconState for epoch start slot. diff --git a/beacon-chain/core/helpers/block_test.go b/beacon-chain/core/helpers/block_test.go index 5fb7173fb1..418aac1cbc 100644 --- a/beacon-chain/core/helpers/block_test.go +++ b/beacon-chain/core/helpers/block_test.go @@ -16,7 +16,7 @@ func TestBlockRootAtSlot_CorrectBlockRoot(t *testing.T) { blockRoots = append(blockRoots, []byte{byte(i)}) } s := &pb.BeaconState{ - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, } tests := []struct { @@ -73,7 +73,7 @@ func TestBlockRootAtSlot_OutOfBounds(t *testing.T) { blockRoots = append(blockRoots, []byte{byte(i)}) } state := &pb.BeaconState{ - LatestBlockRoots: blockRoots, + BlockRoots: blockRoots, } tests := []struct { diff --git a/beacon-chain/core/helpers/committee.go b/beacon-chain/core/helpers/committee.go index 1fab3e1a10..9ea478816a 100644 --- a/beacon-chain/core/helpers/committee.go +++ b/beacon-chain/core/helpers/committee.go @@ -330,7 +330,7 @@ func EpochStartShard(state *pb.BeaconState, epoch uint64) (uint64, error) { return 0, fmt.Errorf("could not get shard delta: %v", err) } - startShard = (state.LatestStartShard + delta) % params.BeaconConfig().ShardCount + startShard = (state.StartShard + delta) % params.BeaconConfig().ShardCount for checkEpoch > epoch { checkEpoch-- delta, err = ShardDelta(state, checkEpoch) diff --git a/beacon-chain/core/helpers/committee_test.go b/beacon-chain/core/helpers/committee_test.go index 17f05dd7fb..e8b064a711 100644 --- a/beacon-chain/core/helpers/committee_test.go +++ b/beacon-chain/core/helpers/committee_test.go @@ -35,7 +35,7 @@ func TestEpochCommitteeCount_OK(t *testing.T) { } } s := &pb.BeaconState{ - ValidatorRegistry: vals, + Validators: vals, } count, err := EpochCommitteeCount(s, 1) if err != nil { @@ -64,7 +64,7 @@ func TestEpochCommitteeCount_LessShardsThanEpoch(t *testing.T) { } } s := &pb.BeaconState{ - ValidatorRegistry: vals, + Validators: vals, } count, err := EpochCommitteeCount(s, 1) if err != nil { @@ -98,7 +98,7 @@ func TestShardDelta_OK(t *testing.T) { } } s := &pb.BeaconState{ - ValidatorRegistry: vals, + Validators: vals, } delta, err := ShardDelta(s, 1) if err != nil { @@ -124,10 +124,10 @@ func TestComputeCommittee_WithoutCache(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 200, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) @@ -183,10 +183,10 @@ func TestComputeCommittee_WithCache(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 200, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) @@ -229,9 +229,9 @@ func TestAttestationParticipants_NoCommitteeCache(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } attestationData := &pb.AttestationData{} @@ -298,9 +298,9 @@ func TestAttestationParticipants_IncorrectBitfield(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } attestationData := &pb.AttestationData{Crosslink: &pb.Crosslink{}} @@ -355,10 +355,10 @@ func TestCommitteeAssignment_CanRetrieve(t *testing.T) { } } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: params.BeaconConfig().SlotsPerEpoch, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } tests := []struct { @@ -426,8 +426,8 @@ func TestCommitteeAssignment_CanRetrieve(t *testing.T) { func TestCommitteeAssignment_CantFindValidator(t *testing.T) { state := &pb.BeaconState{ Slot: params.BeaconConfig().SlotsPerEpoch, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } index := uint64(10000) _, _, _, _, err := CommitteeAssignment(state, 1, index) @@ -462,7 +462,7 @@ func TestShardDelta_Ok(t *testing.T) { ExitEpoch: params.BeaconConfig().FarFutureEpoch, } } - state := &pb.BeaconState{ValidatorRegistry: validators} + state := &pb.BeaconState{Validators: validators} delta, err := ShardDelta(state, 0) if err != nil { t.Fatal(err) @@ -504,7 +504,7 @@ func TestEpochStartShard_AccurateShard(t *testing.T) { ExitEpoch: params.BeaconConfig().FarFutureEpoch, } } - state := &pb.BeaconState{ValidatorRegistry: validators, LatestStartShard: 100, Slot: 500} + state := &pb.BeaconState{Validators: validators, StartShard: 100, Slot: 500} startShard, err := EpochStartShard(state, 0) if err != nil { t.Fatal(err) @@ -521,7 +521,7 @@ func TestVerifyAttestationBitfield_OK(t *testing.T) { } validators := make([]*pb.Validator, 2*params.BeaconConfig().SlotsPerEpoch) - activeRoots := make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength) + activeRoots := make([][]byte, params.BeaconConfig().ActiveIndexRootsLength) for i := 0; i < len(validators); i++ { validators[i] = &pb.Validator{ ExitEpoch: params.BeaconConfig().FarFutureEpoch, @@ -530,9 +530,9 @@ func TestVerifyAttestationBitfield_OK(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestActiveIndexRoots: activeRoots, - LatestRandaoMixes: activeRoots, + Validators: validators, + ActiveIndexRoots: activeRoots, + RandaoMixes: activeRoots, } tests := []struct { @@ -636,9 +636,9 @@ func BenchmarkComputeCommittee300000_WithPreCache(b *testing.B) { } } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) @@ -675,9 +675,9 @@ func BenchmarkComputeCommittee3000000_WithPreCache(b *testing.B) { } } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) @@ -714,9 +714,9 @@ func BenchmarkComputeCommittee128000_WithOutPreCache(b *testing.B) { } } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) @@ -754,9 +754,9 @@ func BenchmarkComputeCommittee1000000_WithOutCache(b *testing.B) { } } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) @@ -794,9 +794,9 @@ func BenchmarkComputeCommittee4000000_WithOutCache(b *testing.B) { } } state := &pb.BeaconState{ - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } epoch := CurrentEpoch(state) diff --git a/beacon-chain/core/helpers/randao.go b/beacon-chain/core/helpers/randao.go index c4970a8349..8a4aa20cf4 100644 --- a/beacon-chain/core/helpers/randao.go +++ b/beacon-chain/core/helpers/randao.go @@ -36,7 +36,7 @@ func GenerateSeed(state *pb.BeaconState, epoch uint64) ([32]byte, error) { return bytesutil.ToBytes32(seed), nil } - lookAheadEpoch := epoch + params.BeaconConfig().LatestRandaoMixesLength - + lookAheadEpoch := epoch + params.BeaconConfig().RandaoMixesLength - params.BeaconConfig().MinSeedLookahead randaoMix := RandaoMix(state, lookAheadEpoch) @@ -70,7 +70,7 @@ func GenerateSeed(state *pb.BeaconState, epoch uint64) ([32]byte, error) { // """ // return state.latest_active_index_roots[epoch % LATEST_ACTIVE_INDEX_ROOTS_LENGTH] func ActiveIndexRoot(state *pb.BeaconState, epoch uint64) []byte { - return state.LatestActiveIndexRoots[epoch%params.BeaconConfig().LatestActiveIndexRootsLength] + return state.ActiveIndexRoots[epoch%params.BeaconConfig().ActiveIndexRootsLength] } // RandaoMix returns the randao mix (xor'ed seed) @@ -85,7 +85,7 @@ func ActiveIndexRoot(state *pb.BeaconState, epoch uint64) []byte { // """ // return state.latest_randao_mixes[epoch % LATEST_RANDAO_MIXES_LENGTH] func RandaoMix(state *pb.BeaconState, epoch uint64) []byte { - return state.LatestRandaoMixes[epoch%params.BeaconConfig().LatestRandaoMixesLength] + return state.RandaoMixes[epoch%params.BeaconConfig().RandaoMixesLength] } // CreateRandaoReveal generates a epoch signature using the beacon proposer priv key. diff --git a/beacon-chain/core/helpers/randao_test.go b/beacon-chain/core/helpers/randao_test.go index 38501dd48d..f1b34f56c1 100644 --- a/beacon-chain/core/helpers/randao_test.go +++ b/beacon-chain/core/helpers/randao_test.go @@ -10,13 +10,13 @@ import ( ) func TestRandaoMix_OK(t *testing.T) { - randaoMixes := make([][]byte, params.BeaconConfig().LatestRandaoMixesLength) + randaoMixes := make([][]byte, params.BeaconConfig().RandaoMixesLength) for i := 0; i < len(randaoMixes); i++ { intInBytes := make([]byte, 32) binary.LittleEndian.PutUint64(intInBytes, uint64(i)) randaoMixes[i] = intInBytes } - state := &pb.BeaconState{LatestRandaoMixes: randaoMixes} + state := &pb.BeaconState{RandaoMixes: randaoMixes} tests := []struct { epoch uint64 randaoMix []byte @@ -31,7 +31,7 @@ func TestRandaoMix_OK(t *testing.T) { }, { epoch: 99999, - randaoMix: randaoMixes[99999%params.BeaconConfig().LatestRandaoMixesLength], + randaoMix: randaoMixes[99999%params.BeaconConfig().RandaoMixesLength], }, } for _, test := range tests { @@ -45,13 +45,13 @@ func TestRandaoMix_OK(t *testing.T) { } func TestActiveIndexRoot_OK(t *testing.T) { - activeIndexRoots := make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength) + activeIndexRoots := make([][]byte, params.BeaconConfig().ActiveIndexRootsLength) for i := 0; i < len(activeIndexRoots); i++ { intInBytes := make([]byte, 32) binary.LittleEndian.PutUint64(intInBytes, uint64(i)) activeIndexRoots[i] = intInBytes } - state := &pb.BeaconState{LatestActiveIndexRoots: activeIndexRoots} + state := &pb.BeaconState{ActiveIndexRoots: activeIndexRoots} tests := []struct { epoch uint64 }{ @@ -70,9 +70,9 @@ func TestActiveIndexRoot_OK(t *testing.T) { for i := 0; i <= int(params.BeaconConfig().ActivationExitDelay); i++ { indexRoot := ActiveIndexRoot(state, test.epoch+uint64(i)) - if !bytes.Equal(activeIndexRoots[(test.epoch+uint64(i))%params.BeaconConfig().LatestActiveIndexRootsLength], indexRoot) { + if !bytes.Equal(activeIndexRoots[(test.epoch+uint64(i))%params.BeaconConfig().ActiveIndexRootsLength], indexRoot) { t.Errorf("Incorrect index root. Wanted: %#x, got: %#x", - activeIndexRoots[(test.epoch+uint64(i))%params.BeaconConfig().LatestActiveIndexRootsLength], indexRoot) + activeIndexRoots[(test.epoch+uint64(i))%params.BeaconConfig().ActiveIndexRootsLength], indexRoot) } } @@ -82,13 +82,13 @@ func TestActiveIndexRoot_OK(t *testing.T) { func TestGenerateSeed_OK(t *testing.T) { ClearAllCaches() - activeIndexRoots := make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength) + activeIndexRoots := make([][]byte, params.BeaconConfig().ActiveIndexRootsLength) for i := 0; i < len(activeIndexRoots); i++ { intInBytes := make([]byte, 32) binary.LittleEndian.PutUint64(intInBytes, uint64(i)) activeIndexRoots[i] = intInBytes } - randaoMixes := make([][]byte, params.BeaconConfig().LatestRandaoMixesLength) + randaoMixes := make([][]byte, params.BeaconConfig().RandaoMixesLength) for i := 0; i < len(randaoMixes); i++ { intInBytes := make([]byte, 32) binary.LittleEndian.PutUint64(intInBytes, uint64(i)) @@ -96,8 +96,8 @@ func TestGenerateSeed_OK(t *testing.T) { } slot := 10 * params.BeaconConfig().MinSeedLookahead * params.BeaconConfig().SlotsPerEpoch state := &pb.BeaconState{ - LatestActiveIndexRoots: activeIndexRoots, - LatestRandaoMixes: randaoMixes, + ActiveIndexRoots: activeIndexRoots, + RandaoMixes: randaoMixes, Slot: slot} got, err := GenerateSeed(state, 10) diff --git a/beacon-chain/core/helpers/rewards_penalties.go b/beacon-chain/core/helpers/rewards_penalties.go index 0024a1d9e0..a3ae006c84 100644 --- a/beacon-chain/core/helpers/rewards_penalties.go +++ b/beacon-chain/core/helpers/rewards_penalties.go @@ -32,7 +32,7 @@ func TotalBalance(state *pb.BeaconState, indices []uint64) (uint64, error) { total = 0 for _, idx := range indices { - total += state.ValidatorRegistry[idx].EffectiveBalance + total += state.Validators[idx].EffectiveBalance } if err := totalBalanceCache.AddTotalBalance(&cache.TotalBalanceByEpoch{ @@ -62,9 +62,9 @@ func TotalActiveBalance(state *pb.BeaconState) (uint64, error) { } total = 0 - for i, v := range state.ValidatorRegistry { + for i, v := range state.Validators { if IsActiveValidator(v, epoch) { - total += state.ValidatorRegistry[i].EffectiveBalance + total += state.Validators[i].EffectiveBalance } } diff --git a/beacon-chain/core/helpers/rewards_penalties_test.go b/beacon-chain/core/helpers/rewards_penalties_test.go index 27ac52d81e..ef1e52be1a 100644 --- a/beacon-chain/core/helpers/rewards_penalties_test.go +++ b/beacon-chain/core/helpers/rewards_penalties_test.go @@ -7,7 +7,7 @@ import ( ) func TestTotalBalance_OK(t *testing.T) { - state := &pb.BeaconState{ValidatorRegistry: []*pb.Validator{ + state := &pb.BeaconState{Validators: []*pb.Validator{ {EffectiveBalance: 27 * 1e9}, {EffectiveBalance: 28 * 1e9}, {EffectiveBalance: 32 * 1e9}, {EffectiveBalance: 40 * 1e9}, }} @@ -53,7 +53,7 @@ func TestIncreseBalance_OK(t *testing.T) { } for _, test := range tests { state := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {EffectiveBalance: 4}, {EffectiveBalance: 4}, {EffectiveBalance: 4}}, Balances: test.b, } @@ -76,7 +76,7 @@ func TestDecreseBalance_OK(t *testing.T) { } for _, test := range tests { state := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {EffectiveBalance: 4}, {EffectiveBalance: 4}, {EffectiveBalance: 4}}, Balances: test.b, } diff --git a/beacon-chain/core/helpers/validators.go b/beacon-chain/core/helpers/validators.go index 70b0820241..328053a273 100644 --- a/beacon-chain/core/helpers/validators.go +++ b/beacon-chain/core/helpers/validators.go @@ -67,7 +67,7 @@ func ActiveValidatorIndices(state *pb.BeaconState, epoch uint64) ([]uint64, erro return indices, nil } - for i, v := range state.ValidatorRegistry { + for i, v := range state.Validators { if IsActiveValidator(v, epoch) { indices = append(indices, uint64(i)) } @@ -95,7 +95,7 @@ func ActiveValidatorCount(state *pb.BeaconState, epoch uint64) (uint64, error) { } count = 0 - for _, v := range state.ValidatorRegistry { + for _, v := range state.Validators { if IsActiveValidator(v, epoch) { count++ } @@ -207,7 +207,7 @@ func BeaconProposerIndex(state *pb.BeaconState) (uint64, error) { candidateIndex := firstCommittee[(e+i)%uint64(len(firstCommittee))] b := append(seed[:], bytesutil.Bytes8(i)...) randomByte := hashutil.Hash(b)[i%32] - effectiveBal := state.ValidatorRegistry[candidateIndex].EffectiveBalance + effectiveBal := state.Validators[candidateIndex].EffectiveBalance if effectiveBal*maxRandomByte >= params.BeaconConfig().MaxEffectiveBalance*uint64(randomByte) { return candidateIndex, nil } diff --git a/beacon-chain/core/helpers/validators_test.go b/beacon-chain/core/helpers/validators_test.go index edf66e8404..ae0e2f90e2 100644 --- a/beacon-chain/core/helpers/validators_test.go +++ b/beacon-chain/core/helpers/validators_test.go @@ -43,10 +43,10 @@ func TestBeaconProposerIndex_OK(t *testing.T) { } state := &pb.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: 0, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } tests := []struct { @@ -96,8 +96,8 @@ func TestBeaconProposerIndex_EmptyCommittee(t *testing.T) { ClearAllCaches() beaconState := &pb.BeaconState{ Slot: 0, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } _, err := BeaconProposerIndex(beaconState) expected := fmt.Sprintf("empty first committee at slot %d", 0) @@ -136,9 +136,9 @@ func TestChurnLimit_OK(t *testing.T) { beaconState := &pb.BeaconState{ Slot: 1, - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } resultChurn, err := ChurnLimit(beaconState) if err != nil { diff --git a/beacon-chain/core/state/state.go b/beacon-chain/core/state/state.go index b21e4d7891..73d5476a42 100644 --- a/beacon-chain/core/state/state.go +++ b/beacon-chain/core/state/state.go @@ -44,14 +44,14 @@ import ( // // return state func GenesisBeaconState(deposits []*pb.Deposit, genesisTime uint64, eth1Data *pb.Eth1Data) (*pb.BeaconState, error) { - latestRandaoMixes := make([][]byte, params.BeaconConfig().LatestRandaoMixesLength) + latestRandaoMixes := make([][]byte, params.BeaconConfig().RandaoMixesLength) for i := 0; i < len(latestRandaoMixes); i++ { latestRandaoMixes[i] = make([]byte, 32) } zeroHash := params.BeaconConfig().ZeroHash[:] - latestActiveIndexRoots := make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength) + latestActiveIndexRoots := make([][]byte, params.BeaconConfig().ActiveIndexRootsLength) for i := 0; i < len(latestActiveIndexRoots); i++ { latestActiveIndexRoots[i] = zeroHash } @@ -68,7 +68,7 @@ func GenesisBeaconState(deposits []*pb.Deposit, genesisTime uint64, eth1Data *pb latestBlockRoots[i] = zeroHash } - latestSlashedExitBalances := make([]uint64, params.BeaconConfig().LatestSlashedExitLength) + latestSlashedExitBalances := make([]uint64, params.BeaconConfig().SlashedExitLength) if eth1Data == nil { eth1Data = &pb.Eth1Data{} @@ -86,11 +86,11 @@ func GenesisBeaconState(deposits []*pb.Deposit, genesisTime uint64, eth1Data *pb }, // Validator registry fields. - ValidatorRegistry: []*pb.Validator{}, + Validators: []*pb.Validator{}, Balances: []uint64{}, // Randomness and committees. - LatestRandaoMixes: latestRandaoMixes, + RandaoMixes: latestRandaoMixes, // Finality. PreviousJustifiedEpoch: 0, @@ -104,16 +104,16 @@ func GenesisBeaconState(deposits []*pb.Deposit, genesisTime uint64, eth1Data *pb // Recent state. CurrentCrosslinks: crosslinks, PreviousCrosslinks: crosslinks, - LatestActiveIndexRoots: latestActiveIndexRoots, - LatestBlockRoots: latestBlockRoots, - LatestSlashedBalances: latestSlashedExitBalances, + ActiveIndexRoots: latestActiveIndexRoots, + BlockRoots: latestBlockRoots, + SlashedBalances: latestSlashedExitBalances, CurrentEpochAttestations: []*pb.PendingAttestation{}, PreviousEpochAttestations: []*pb.PendingAttestation{}, // Eth1 data. - LatestEth1Data: eth1Data, + Eth1Data: eth1Data, Eth1DataVotes: []*pb.Eth1Data{}, - DepositIndex: 0, + Eth1DepositIndex: 0, } // Process initial deposits. @@ -132,8 +132,8 @@ func GenesisBeaconState(deposits []*pb.Deposit, genesisTime uint64, eth1Data *pb return nil, fmt.Errorf("could not process validator deposit: %v", err) } } - for i := 0; i < len(state.ValidatorRegistry); i++ { - if state.ValidatorRegistry[i].EffectiveBalance >= + for i := 0; i < len(state.Validators); i++ { + if state.Validators[i].EffectiveBalance >= params.BeaconConfig().MaxDepositAmount { state, err = v.ActivateValidator(state, uint64(i), true) if err != nil { @@ -153,8 +153,8 @@ func GenesisBeaconState(deposits []*pb.Deposit, genesisTime uint64, eth1Data *pb indicesBytes = append(indicesBytes, buf...) } genesisActiveIndexRoot := hashutil.Hash(indicesBytes) - for i := uint64(0); i < params.BeaconConfig().LatestActiveIndexRootsLength; i++ { - state.LatestActiveIndexRoots[i] = genesisActiveIndexRoot[:] + for i := uint64(0); i < params.BeaconConfig().ActiveIndexRootsLength; i++ { + state.ActiveIndexRoots[i] = genesisActiveIndexRoot[:] } return state, nil } diff --git a/beacon-chain/core/state/state_test.go b/beacon-chain/core/state/state_test.go index cb404c7ac5..b22bfeb3b1 100644 --- a/beacon-chain/core/state/state_test.go +++ b/beacon-chain/core/state/state_test.go @@ -38,10 +38,10 @@ func TestGenesisBeaconState_OK(t *testing.T) { t.Error("ZeroHash should be all 0s for these tests to pass") } - if params.BeaconConfig().LatestRandaoMixesLength != 8192 { - t.Error("LatestRandaoMixesLength should be 8192 for these tests to pass") + if params.BeaconConfig().RandaoMixesLength != 8192 { + t.Error("RandaoMixesLength should be 8192 for these tests to pass") } - latestRandaoMixesLength := int(params.BeaconConfig().LatestRandaoMixesLength) + latestRandaoMixesLength := int(params.BeaconConfig().RandaoMixesLength) if params.BeaconConfig().ShardCount != 1024 { t.Error("ShardCount should be 1024 for these tests to pass") @@ -57,8 +57,8 @@ func TestGenesisBeaconState_OK(t *testing.T) { } depositsForChainStart := int(params.BeaconConfig().DepositsForChainStart) - if params.BeaconConfig().LatestSlashedExitLength != 8192 { - t.Error("LatestSlashedExitLength should be 8192 for these tests to pass") + if params.BeaconConfig().SlashedExitLength != 8192 { + t.Error("slashed exit length should be 8192 for these tests to pass") } genesisTime := uint64(99999) @@ -90,16 +90,16 @@ func TestGenesisBeaconState_OK(t *testing.T) { } // Validator registry fields checks. - if len(newState.ValidatorRegistry) != depositsForChainStart { - t.Error("ValidatorRegistry was not correctly initialized") + if len(newState.Validators) != depositsForChainStart { + t.Error("Validators was not correctly initialized") } if len(newState.Balances) != depositsForChainStart { t.Error("Balances was not correctly initialized") } // Randomness and committees fields checks. - if len(newState.LatestRandaoMixes) != latestRandaoMixesLength { - t.Error("Length of LatestRandaoMixes was not correctly initialized") + if len(newState.RandaoMixes) != latestRandaoMixesLength { + t.Error("Length of RandaoMixes was not correctly initialized") } // Finality fields checks. @@ -123,8 +123,8 @@ func TestGenesisBeaconState_OK(t *testing.T) { if len(newState.PreviousCrosslinks) != shardCount { t.Error("Length of PreviousCrosslinks was not correctly initialized") } - if !reflect.DeepEqual(newState.LatestSlashedBalances, make([]uint64, params.BeaconConfig().LatestSlashedExitLength)) { - t.Error("LatestSlashedBalances was not correctly initialized") + if !reflect.DeepEqual(newState.SlashedBalances, make([]uint64, params.BeaconConfig().SlashedExitLength)) { + t.Error("SlashedBalances was not correctly initialized") } if !reflect.DeepEqual(newState.CurrentEpochAttestations, []*pb.PendingAttestation{}) { t.Error("CurrentEpochAttestations was not correctly initialized") @@ -141,21 +141,21 @@ func TestGenesisBeaconState_OK(t *testing.T) { indicesBytes = append(indicesBytes, buf...) } genesisActiveIndexRoot := hashutil.Hash(indicesBytes) - if !bytes.Equal(newState.LatestActiveIndexRoots[0], genesisActiveIndexRoot[:]) { + if !bytes.Equal(newState.ActiveIndexRoots[0], genesisActiveIndexRoot[:]) { t.Errorf( "Expected index roots to be the tree hash root of active validator indices, received %#x", - newState.LatestActiveIndexRoots[0], + newState.ActiveIndexRoots[0], ) } - if !bytes.Equal(newState.LatestActiveIndexRoots[0], genesisActiveIndexRoot[:]) { + if !bytes.Equal(newState.ActiveIndexRoots[0], genesisActiveIndexRoot[:]) { t.Errorf( "Expected index roots to be the tree hash root of active validator indices, received %#x", - newState.LatestActiveIndexRoots[0], + newState.ActiveIndexRoots[0], ) } // deposit root checks. - if !bytes.Equal(newState.LatestEth1Data.DepositRoot, eth1Data.DepositRoot) { - t.Error("LatestEth1Data DepositRoot was not correctly initialized") + if !bytes.Equal(newState.Eth1Data.DepositRoot, eth1Data.DepositRoot) { + t.Error("Eth1Data DepositRoot was not correctly initialized") } if !reflect.DeepEqual(newState.Eth1DataVotes, []*pb.Eth1Data{}) { t.Error("Eth1DataVotes was not correctly initialized") @@ -180,17 +180,17 @@ func TestGenesisState_HashEquality(t *testing.T) { func TestGenesisState_InitializesLatestBlockHashes(t *testing.T) { s, _ := state.GenesisBeaconState(nil, 0, nil) - want, got := len(s.LatestBlockRoots), int(params.BeaconConfig().SlotsPerHistoricalRoot) + want, got := len(s.BlockRoots), int(params.BeaconConfig().SlotsPerHistoricalRoot) if want != got { t.Errorf("Wrong number of recent block hashes. Got: %d Want: %d", got, want) } - want = cap(s.LatestBlockRoots) + want = cap(s.BlockRoots) if want != got { t.Errorf("The slice underlying array capacity is wrong. Got: %d Want: %d", got, want) } - for _, h := range s.LatestBlockRoots { + for _, h := range s.BlockRoots { if !bytes.Equal(h, params.BeaconConfig().ZeroHash[:]) { t.Errorf("Unexpected non-zero hash data: %v", h) } diff --git a/beacon-chain/core/state/stateutils/validator_index_map.go b/beacon-chain/core/state/stateutils/validator_index_map.go index 2a5ae96b36..f4579b2183 100644 --- a/beacon-chain/core/state/stateutils/validator_index_map.go +++ b/beacon-chain/core/state/stateutils/validator_index_map.go @@ -9,7 +9,7 @@ import ( // a validator by their public key. func ValidatorIndexMap(state *pb.BeaconState) map[[32]byte]int { m := make(map[[32]byte]int) - for idx, record := range state.ValidatorRegistry { + for idx, record := range state.Validators { key := bytesutil.ToBytes32(record.Pubkey) m[key] = idx } diff --git a/beacon-chain/core/state/stateutils/validator_index_map_test.go b/beacon-chain/core/state/stateutils/validator_index_map_test.go index 87f5b44ea7..6e5b6533cc 100644 --- a/beacon-chain/core/state/stateutils/validator_index_map_test.go +++ b/beacon-chain/core/state/stateutils/validator_index_map_test.go @@ -10,7 +10,7 @@ import ( func TestValidatorIndexMap_OK(t *testing.T) { state := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ { Pubkey: []byte("zero"), }, diff --git a/beacon-chain/core/state/transition.go b/beacon-chain/core/state/transition.go index 0f10ce4110..c898e79b41 100644 --- a/beacon-chain/core/state/transition.go +++ b/beacon-chain/core/state/transition.go @@ -85,7 +85,7 @@ func ProcessSlot(ctx context.Context, state *pb.BeaconState) (*pb.BeaconState, e if err != nil { return nil, fmt.Errorf("could not tree hash prev state root: %v", err) } - state.LatestStateRoots[state.Slot%params.BeaconConfig().SlotsPerHistoricalRoot] = prevStateRoot[:] + state.StateRoots[state.Slot%params.BeaconConfig().SlotsPerHistoricalRoot] = prevStateRoot[:] zeroHash := params.BeaconConfig().ZeroHash // Cache latest block header state root. @@ -97,7 +97,7 @@ func ProcessSlot(ctx context.Context, state *pb.BeaconState) (*pb.BeaconState, e return nil, fmt.Errorf("could not determine prev block root: %v", err) } // Cache the block root. - state.LatestBlockRoots[state.Slot%params.BeaconConfig().SlotsPerHistoricalRoot] = prevBlockRoot[:] + state.BlockRoots[state.Slot%params.BeaconConfig().SlotsPerHistoricalRoot] = prevBlockRoot[:] return state, nil } diff --git a/beacon-chain/core/state/transition_test.go b/beacon-chain/core/state/transition_test.go index 1058bc4ba4..9ef2bc2b08 100644 --- a/beacon-chain/core/state/transition_test.go +++ b/beacon-chain/core/state/transition_test.go @@ -157,7 +157,7 @@ func TestProcessBlock_IncorrectProcessBlockAttestations(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestSlashedBalances = make([]uint64, params.BeaconConfig().LatestSlashedExitLength) + beaconState.SlashedBalances = make([]uint64, params.BeaconConfig().SlashedExitLength) proposerSlashings := []*pb.ProposerSlashing{ { ProposerIndex: 3, @@ -247,7 +247,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { if err != nil { t.Fatal(err) } - beaconState.LatestSlashedBalances = make([]uint64, params.BeaconConfig().LatestSlashedExitLength) + beaconState.SlashedBalances = make([]uint64, params.BeaconConfig().SlashedExitLength) proposerSlashings := []*pb.ProposerSlashing{ { ProposerIndex: 3, @@ -287,7 +287,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { for i := uint64(0); i < params.BeaconConfig().SlotsPerHistoricalRoot; i++ { blockRoots = append(blockRoots, []byte{byte(i)}) } - beaconState.LatestBlockRoots = blockRoots + beaconState.BlockRoots = blockRoots beaconState.CurrentCrosslinks = []*pb.Crosslink{ { DataRoot: []byte{1}, @@ -378,7 +378,7 @@ func TestProcessBlock_PassesProcessingConditions(t *testing.T) { ParentRoot: genesisBlock.ParentRoot, BodyRoot: bodyRoot[:], } - beaconState.LatestSlashedBalances = make([]uint64, params.BeaconConfig().LatestSlashedExitLength) + beaconState.SlashedBalances = make([]uint64, params.BeaconConfig().SlashedExitLength) proposerSlashings := []*pb.ProposerSlashing{ { ProposerIndex: 3, @@ -420,7 +420,7 @@ func TestProcessBlock_PassesProcessingConditions(t *testing.T) { for i := uint64(0); i < params.BeaconConfig().SlotsPerHistoricalRoot; i++ { blockRoots = append(blockRoots, []byte{byte(i)}) } - beaconState.LatestBlockRoots = blockRoots + beaconState.BlockRoots = blockRoots beaconState.CurrentCrosslinks = []*pb.Crosslink{ { DataRoot: []byte{1}, @@ -501,9 +501,9 @@ func TestProcessEpoch_CantGetTgtAttsCurrEpoch(t *testing.T) { atts := []*pb.PendingAttestation{{Data: &pb.AttestationData{Crosslink: &pb.Crosslink{Shard: 100}}}} _, err := state.ProcessEpoch(context.Background(), &pb.BeaconState{ Slot: epoch * params.BeaconConfig().SlotsPerEpoch, - LatestBlockRoots: make([][]byte, 128), - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + BlockRoots: make([][]byte, 128), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), CurrentEpochAttestations: atts}) if !strings.Contains(err.Error(), "could not get target atts current epoch") { t.Fatal("Did not receive wanted error") @@ -518,9 +518,9 @@ func TestProcessEpoch_CantGetAttsBalancePrevEpoch(t *testing.T) { atts := []*pb.PendingAttestation{{Data: &pb.AttestationData{Crosslink: &pb.Crosslink{Shard: 961}}, AggregationBitfield: []byte{1}}} _, err := state.ProcessEpoch(context.Background(), &pb.BeaconState{ Slot: epoch*params.BeaconConfig().SlotsPerEpoch + 1, - LatestBlockRoots: make([][]byte, 128), - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + BlockRoots: make([][]byte, 128), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), PreviousEpochAttestations: atts}) if !strings.Contains(err.Error(), "could not get attesting balance prev epoch") { t.Fatal("Did not receive wanted error") @@ -533,9 +533,9 @@ func TestProcessEpoch_CantGetAttsBalanceCurrentEpoch(t *testing.T) { atts := []*pb.PendingAttestation{{Data: &pb.AttestationData{Crosslink: &pb.Crosslink{Shard: 961}}, AggregationBitfield: []byte{1}}} _, err := state.ProcessEpoch(context.Background(), &pb.BeaconState{ Slot: epoch*params.BeaconConfig().SlotsPerEpoch + 1, - LatestBlockRoots: make([][]byte, 128), - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + BlockRoots: make([][]byte, 128), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), CurrentEpochAttestations: atts}) if !strings.Contains(err.Error(), "could not get attesting balance current epoch") { t.Fatal("Did not receive wanted error") @@ -555,10 +555,10 @@ func TestProcessEpoch_CanProcess(t *testing.T) { } newState, err := state.ProcessEpoch(context.Background(), &pb.BeaconState{ Slot: epoch*params.BeaconConfig().SlotsPerEpoch + 1, - LatestBlockRoots: make([][]byte, 128), - LatestSlashedBalances: []uint64{0, 1e9, 0}, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + BlockRoots: make([][]byte, 128), + SlashedBalances: []uint64{0, 1e9, 0}, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), CurrentCrosslinks: crosslinks, CurrentEpochAttestations: atts}) if err != nil { @@ -566,16 +566,16 @@ func TestProcessEpoch_CanProcess(t *testing.T) { } wanted := uint64(1e9) - if newState.LatestSlashedBalances[2] != wanted { + if newState.SlashedBalances[2] != wanted { t.Errorf("Wanted slashed balance: %d, got: %d", wanted, newState.Balances[2]) } } func TestProcessEpoch_NotPanicOnEmptyActiveValidatorIndices(t *testing.T) { newState := &pb.BeaconState{ - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), - LatestRandaoMixes: make([][]byte, params.BeaconConfig().SlotsPerEpoch), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), + RandaoMixes: make([][]byte, params.BeaconConfig().SlotsPerEpoch), } config := state.DefaultConfig() config.Logging = true @@ -626,13 +626,13 @@ func BenchmarkProcessEpoch65536Validators(b *testing.B) { s := &pb.BeaconState{ Slot: epoch*params.BeaconConfig().SlotsPerEpoch + 1, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, - LatestStartShard: 512, - LatestBlockRoots: make([][]byte, 254), - LatestSlashedBalances: []uint64{0, 1e9, 0}, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + StartShard: 512, + BlockRoots: make([][]byte, 254), + SlashedBalances: []uint64{0, 1e9, 0}, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), CurrentCrosslinks: crosslinks, PreviousEpochAttestations: atts, } @@ -675,7 +675,7 @@ func BenchmarkProcessBlk_65536Validators_FullBlock(b *testing.B) { validatorBalances[i] = params.BeaconConfig().MaxDepositAmount } - randaoMixes := make([][]byte, params.BeaconConfig().LatestRandaoMixesLength) + randaoMixes := make([][]byte, params.BeaconConfig().RandaoMixesLength) for i := 0; i < len(randaoMixes); i++ { randaoMixes[i] = params.BeaconConfig().ZeroHash[:] } @@ -690,12 +690,12 @@ func BenchmarkProcessBlk_65536Validators_FullBlock(b *testing.B) { s := &pb.BeaconState{ Slot: 20, - LatestBlockRoots: make([][]byte, 254), - LatestRandaoMixes: randaoMixes, - ValidatorRegistry: validators, + BlockRoots: make([][]byte, 254), + RandaoMixes: randaoMixes, + Validators: validators, Balances: validatorBalances, - LatestSlashedBalances: make([]uint64, params.BeaconConfig().LatestSlashedExitLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + SlashedBalances: make([]uint64, params.BeaconConfig().SlashedExitLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), CurrentJustifiedRoot: []byte("hello-world"), Fork: &pb.Fork{ PreviousVersion: []byte{0, 0, 0, 0}, @@ -778,7 +778,7 @@ func BenchmarkProcessBlk_65536Validators_FullBlock(b *testing.B) { if err != nil { b.Fatal(err) } - s.ValidatorRegistry[proposerIdx].Pubkey = priv.PublicKey().Marshal() + s.Validators[proposerIdx].Pubkey = priv.PublicKey().Marshal() buf := make([]byte, 32) binary.LittleEndian.PutUint64(buf, 0) domain := helpers.DomainVersion(s, 0, params.BeaconConfig().DomainRandao) @@ -799,7 +799,7 @@ func BenchmarkProcessBlk_65536Validators_FullBlock(b *testing.B) { pubKey := []byte("A") hashed := hashutil.Hash(pubKey) buf = append(buf, hashed[:]...) - s.ValidatorRegistry[3].WithdrawalCredentials = buf + s.Validators[3].WithdrawalCredentials = buf // Set up attestations obj for block. encoded, err := ssz.HashTreeRoot(s.CurrentCrosslinks[0]) @@ -853,8 +853,8 @@ func BenchmarkProcessBlk_65536Validators_FullBlock(b *testing.B) { b.Fatal(err) } // Reset state fields to process block again - s.ValidatorRegistry[1].Slashed = false - s.ValidatorRegistry[2].Slashed = false + s.Validators[1].Slashed = false + s.Validators[2].Slashed = false s.Balances[3] += 2 * params.BeaconConfig().MinDepositAmount } } diff --git a/beacon-chain/core/validators/validator.go b/beacon-chain/core/validators/validator.go index 79b9d549eb..290e1a587b 100644 --- a/beacon-chain/core/validators/validator.go +++ b/beacon-chain/core/validators/validator.go @@ -43,7 +43,7 @@ var VStore = validatorStore{ // // validator.activation_epoch = GENESIS_EPOCH if is_genesis else get_entry_exit_effect_epoch(get_current_epoch(state)) func ActivateValidator(state *pb.BeaconState, idx uint64, genesis bool) (*pb.BeaconState, error) { - validator := state.ValidatorRegistry[idx] + validator := state.Validators[idx] if genesis { validator.ActivationEligibilityEpoch = 0 validator.ActivationEpoch = 0 @@ -51,7 +51,7 @@ func ActivateValidator(state *pb.BeaconState, idx uint64, genesis bool) (*pb.Bea validator.ActivationEpoch = helpers.DelayedActivationExitEpoch(helpers.CurrentEpoch(state)) } - state.ValidatorRegistry[idx] = validator + state.Validators[idx] = validator log.WithFields(logrus.Fields{ "index": idx, @@ -85,12 +85,12 @@ func ActivateValidator(state *pb.BeaconState, idx uint64, genesis bool) (*pb.Bea // validator.exit_epoch = exit_queue_epoch // validator.withdrawable_epoch = validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY func InitiateValidatorExit(state *pb.BeaconState, idx uint64) (*pb.BeaconState, error) { - validator := state.ValidatorRegistry[idx] + validator := state.Validators[idx] if validator.ExitEpoch != params.BeaconConfig().FarFutureEpoch { return state, nil } exitEpochs := []uint64{} - for _, val := range state.ValidatorRegistry { + for _, val := range state.Validators { if val.ExitEpoch != params.BeaconConfig().FarFutureEpoch { exitEpochs = append(exitEpochs, val.ExitEpoch) } @@ -107,7 +107,7 @@ func InitiateValidatorExit(state *pb.BeaconState, idx uint64) (*pb.BeaconState, // We use the exit queue churn to determine if we have passed a churn limit. exitQueueChurn := 0 - for _, val := range state.ValidatorRegistry { + for _, val := range state.Validators { if val.ExitEpoch == exitQueueEpoch { exitQueueChurn++ } @@ -120,8 +120,8 @@ func InitiateValidatorExit(state *pb.BeaconState, idx uint64) (*pb.BeaconState, if uint64(exitQueueChurn) >= churn { exitQueueEpoch++ } - state.ValidatorRegistry[idx].ExitEpoch = exitQueueEpoch - state.ValidatorRegistry[idx].WithdrawableEpoch = exitQueueEpoch + params.BeaconConfig().MinValidatorWithdrawalDelay + state.Validators[idx].ExitEpoch = exitQueueEpoch + state.Validators[idx].WithdrawableEpoch = exitQueueEpoch + params.BeaconConfig().MinValidatorWithdrawalDelay return state, nil } @@ -142,7 +142,7 @@ func InitiateValidatorExit(state *pb.BeaconState, idx uint64) (*pb.BeaconState, // // validator.exit_epoch = get_entry_exit_effect_epoch(get_current_epoch(state)) func ExitValidator(state *pb.BeaconState, idx uint64) *pb.BeaconState { - validator := state.ValidatorRegistry[idx] + validator := state.Validators[idx] if validator.ExitEpoch != params.BeaconConfig().FarFutureEpoch { return state @@ -178,10 +178,10 @@ func ExitValidator(state *pb.BeaconState, idx uint64) *pb.BeaconState { func SlashValidator(state *pb.BeaconState, slashedIdx uint64, whistleBlowerIdx uint64) (*pb.BeaconState, error) { state = ExitValidator(state, slashedIdx) currentEpoch := helpers.CurrentEpoch(state) - state.ValidatorRegistry[slashedIdx].Slashed = true - state.ValidatorRegistry[slashedIdx].WithdrawableEpoch = currentEpoch + params.BeaconConfig().LatestSlashedExitLength - slashedBalance := state.ValidatorRegistry[slashedIdx].EffectiveBalance - state.LatestSlashedBalances[currentEpoch%params.BeaconConfig().LatestSlashedExitLength] += slashedBalance + state.Validators[slashedIdx].Slashed = true + state.Validators[slashedIdx].WithdrawableEpoch = currentEpoch + params.BeaconConfig().SlashedExitLength + slashedBalance := state.Validators[slashedIdx].EffectiveBalance + state.SlashedBalances[currentEpoch%params.BeaconConfig().SlashedExitLength] += slashedBalance proposerIdx, err := helpers.BeaconProposerIndex(state) if err != nil { diff --git a/beacon-chain/core/validators/validator_test.go b/beacon-chain/core/validators/validator_test.go index 6449edf9e6..70cc1cc794 100644 --- a/beacon-chain/core/validators/validator_test.go +++ b/beacon-chain/core/validators/validator_test.go @@ -48,7 +48,7 @@ func TestHasVoted_OK(t *testing.T) { func TestActivateValidatorGenesis_OK(t *testing.T) { state := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {Pubkey: []byte{'A'}}, }, } @@ -56,20 +56,20 @@ func TestActivateValidatorGenesis_OK(t *testing.T) { if err != nil { t.Fatalf("could not execute activateValidator:%v", err) } - if newState.ValidatorRegistry[0].ActivationEpoch != 0 { + if newState.Validators[0].ActivationEpoch != 0 { t.Errorf("Wanted activation epoch = genesis epoch, got %d", - newState.ValidatorRegistry[0].ActivationEpoch) + newState.Validators[0].ActivationEpoch) } - if newState.ValidatorRegistry[0].ActivationEligibilityEpoch != 0 { + if newState.Validators[0].ActivationEligibilityEpoch != 0 { t.Errorf("Wanted activation eligibility epoch = genesis epoch, got %d", - newState.ValidatorRegistry[0].ActivationEligibilityEpoch) + newState.Validators[0].ActivationEligibilityEpoch) } } func TestActivateValidator_OK(t *testing.T) { state := &pb.BeaconState{ Slot: 100, // epoch 2 - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {Pubkey: []byte{'A'}}, }, } @@ -79,32 +79,32 @@ func TestActivateValidator_OK(t *testing.T) { } currentEpoch := helpers.CurrentEpoch(state) wantedEpoch := helpers.DelayedActivationExitEpoch(currentEpoch) - if newState.ValidatorRegistry[0].ActivationEpoch != wantedEpoch { + if newState.Validators[0].ActivationEpoch != wantedEpoch { t.Errorf("Wanted activation slot = %d, got %d", wantedEpoch, - newState.ValidatorRegistry[0].ActivationEpoch) + newState.Validators[0].ActivationEpoch) } } func TestInitiateValidatorExit_AlreadyExited(t *testing.T) { exitEpoch := uint64(199) - state := &pb.BeaconState{ValidatorRegistry: []*pb.Validator{{ + state := &pb.BeaconState{Validators: []*pb.Validator{{ ExitEpoch: exitEpoch}, }} newState, err := InitiateValidatorExit(state, 0) if err != nil { t.Fatal(err) } - if newState.ValidatorRegistry[0].ExitEpoch != exitEpoch { + if newState.Validators[0].ExitEpoch != exitEpoch { t.Errorf("Already exited, wanted exit epoch %d, got %d", - exitEpoch, newState.ValidatorRegistry[0].ExitEpoch) + exitEpoch, newState.Validators[0].ExitEpoch) } } func TestInitiateValidatorExit_ProperExit(t *testing.T) { exitedEpoch := uint64(100) idx := uint64(3) - state := &pb.BeaconState{ValidatorRegistry: []*pb.Validator{ + state := &pb.BeaconState{Validators: []*pb.Validator{ {ExitEpoch: exitedEpoch}, {ExitEpoch: exitedEpoch + 1}, {ExitEpoch: exitedEpoch + 2}, @@ -114,16 +114,16 @@ func TestInitiateValidatorExit_ProperExit(t *testing.T) { if err != nil { t.Fatal(err) } - if newState.ValidatorRegistry[idx].ExitEpoch != exitedEpoch+2 { + if newState.Validators[idx].ExitEpoch != exitedEpoch+2 { t.Errorf("Exit epoch was not the highest, wanted exit epoch %d, got %d", - exitedEpoch+2, newState.ValidatorRegistry[idx].ExitEpoch) + exitedEpoch+2, newState.Validators[idx].ExitEpoch) } } func TestInitiateValidatorExit_ChurnOverflow(t *testing.T) { exitedEpoch := uint64(100) idx := uint64(4) - state := &pb.BeaconState{ValidatorRegistry: []*pb.Validator{ + state := &pb.BeaconState{Validators: []*pb.Validator{ {ExitEpoch: exitedEpoch + 2}, {ExitEpoch: exitedEpoch + 2}, {ExitEpoch: exitedEpoch + 2}, @@ -137,19 +137,19 @@ func TestInitiateValidatorExit_ChurnOverflow(t *testing.T) { // Because of exit queue overflow, // validator who init exited has to wait one more epoch. - wantedEpoch := state.ValidatorRegistry[0].ExitEpoch + 1 + wantedEpoch := state.Validators[0].ExitEpoch + 1 - if newState.ValidatorRegistry[idx].ExitEpoch != wantedEpoch { + if newState.Validators[idx].ExitEpoch != wantedEpoch { t.Errorf("Exit epoch did not cover overflow case, wanted exit epoch %d, got %d", - wantedEpoch, newState.ValidatorRegistry[idx].ExitEpoch) + wantedEpoch, newState.Validators[idx].ExitEpoch) } } func TestExitValidator_OK(t *testing.T) { state := &pb.BeaconState{ Slot: 100, // epoch 2 - LatestSlashedBalances: []uint64{0}, - ValidatorRegistry: []*pb.Validator{ + SlashedBalances: []uint64{0}, + Validators: []*pb.Validator{ {ExitEpoch: params.BeaconConfig().FarFutureEpoch, Pubkey: []byte{'B'}}, }, } @@ -157,22 +157,22 @@ func TestExitValidator_OK(t *testing.T) { currentEpoch := helpers.CurrentEpoch(state) wantedEpoch := helpers.DelayedActivationExitEpoch(currentEpoch) - if newState.ValidatorRegistry[0].ExitEpoch != wantedEpoch { + if newState.Validators[0].ExitEpoch != wantedEpoch { t.Errorf("Wanted exit slot %d, got %d", wantedEpoch, - newState.ValidatorRegistry[0].ExitEpoch) + newState.Validators[0].ExitEpoch) } } func TestExitValidator_AlreadyExited(t *testing.T) { state := &pb.BeaconState{ Slot: 1000, - ValidatorRegistry: []*pb.Validator{ + Validators: []*pb.Validator{ {ExitEpoch: params.BeaconConfig().ActivationExitDelay}, }, } state = ExitValidator(state, 0) - if state.ValidatorRegistry[0].ExitEpoch != params.BeaconConfig().ActivationExitDelay { + if state.Validators[0].ExitEpoch != params.BeaconConfig().ActivationExitDelay { t.Error("Expected exited validator to stay exited") } } @@ -191,7 +191,7 @@ func TestInitializeValidatoreStore(t *testing.T) { } bState := &pb.BeaconState{ - ValidatorRegistry: registry, + Validators: registry, Slot: 0, } diff --git a/beacon-chain/db/state.go b/beacon-chain/db/state.go index 140ed7a3da..ebc483167d 100644 --- a/beacon-chain/db/state.go +++ b/beacon-chain/db/state.go @@ -78,7 +78,7 @@ func (db *BeaconDB) InitializeState(ctx context.Context, genesisTime uint64, dep return err } - for i, validator := range beaconState.ValidatorRegistry { + for i, validator := range beaconState.Validators { h := hashutil.Hash(validator.Pubkey) buf := make([]byte, binary.MaxVarintLen64) n := binary.PutUvarint(buf, uint64(i)) @@ -168,10 +168,10 @@ func (db *BeaconDB) SaveState(ctx context.Context, beaconState *pb.BeaconState) } stateHash := hashutil.Hash(enc) tempState := &pb.BeaconState{} - tempState.ValidatorRegistry = beaconState.ValidatorRegistry + tempState.Validators = beaconState.Validators copy(db.validatorBalances, beaconState.Balances) - db.validatorRegistry = proto.Clone(tempState).(*pb.BeaconState).ValidatorRegistry + db.validatorRegistry = proto.Clone(tempState).(*pb.BeaconState).Validators db.serializedState = enc db.stateHash = stateHash @@ -345,9 +345,9 @@ func (db *BeaconDB) HistoricalStateFromSlot(ctx context.Context, slot uint64, bl return beaconState, err } -// ValidatorRegistry fetches the current validator registry stored in state. -func (db *BeaconDB) ValidatorRegistry(ctx context.Context) ([]*pb.Validator, error) { - ctx, span := trace.StartSpan(ctx, "BeaconDB.ValidatorRegistry") +// Validators fetches the current validator registry stored in state. +func (db *BeaconDB) Validators(ctx context.Context) ([]*pb.Validator, error) { + ctx, span := trace.StartSpan(ctx, "BeaconDB.Validators") defer span.End() db.stateLock.RLock() @@ -355,13 +355,13 @@ func (db *BeaconDB) ValidatorRegistry(ctx context.Context) ([]*pb.Validator, err // Return in-memory cached state, if available. if db.validatorRegistry != nil { - _, span := trace.StartSpan(ctx, "proto.Clone.ValidatorRegistry") + _, span := trace.StartSpan(ctx, "proto.Clone.Validators") defer span.End() tempState := &pb.BeaconState{ - ValidatorRegistry: db.validatorRegistry, + Validators: db.validatorRegistry, } newState := proto.Clone(tempState).(*pb.BeaconState) - return newState.ValidatorRegistry, nil + return newState.Validators, nil } var beaconState *pb.BeaconState @@ -380,7 +380,7 @@ func (db *BeaconDB) ValidatorRegistry(ctx context.Context) ([]*pb.Validator, err return err }) - return beaconState.ValidatorRegistry, err + return beaconState.Validators, err } // ValidatorFromState fetches the validator with the desired index from the cached registry. @@ -421,7 +421,7 @@ func (db *BeaconDB) ValidatorFromState(ctx context.Context, index uint64) (*pb.V return nil, fmt.Errorf("invalid validator index %d", index) } - return beaconState.ValidatorRegistry[index], err + return beaconState.Validators[index], err } // Balances fetches the current validator balances stored in state. diff --git a/beacon-chain/db/state_metrics.go b/beacon-chain/db/state_metrics.go index c5596325d2..29517a62dd 100644 --- a/beacon-chain/db/state_metrics.go +++ b/beacon-chain/db/state_metrics.go @@ -62,12 +62,12 @@ func reportStateMetrics(state *pb.BeaconState) { // Validator balances for i, bal := range state.Balances { validatorBalancesGauge.WithLabelValues( - "0x" + hex.EncodeToString(state.ValidatorRegistry[i].Pubkey), // Validator + "0x" + hex.EncodeToString(state.Validators[i].Pubkey), // Validator ).Set(float64(bal)) } var active float64 - for i, v := range state.ValidatorRegistry { + for i, v := range state.Validators { // Track individual Validator's activation epochs validatorActivatedGauge.WithLabelValues( strconv.Itoa(i), //Validator index @@ -80,7 +80,7 @@ func reportStateMetrics(state *pb.BeaconState) { if v.Slashed { validatorSlashedGauge.WithLabelValues( strconv.Itoa(i), //Validator index - ).Set(float64(v.WithdrawableEpoch - params.BeaconConfig().LatestSlashedExitLength)) + ).Set(float64(v.WithdrawableEpoch - params.BeaconConfig().SlashedExitLength)) } else { validatorSlashedGauge.WithLabelValues( strconv.Itoa(i), //Validator index diff --git a/beacon-chain/db/validator.go b/beacon-chain/db/validator.go index fd41072d70..7afebb7fee 100644 --- a/beacon-chain/db/validator.go +++ b/beacon-chain/db/validator.go @@ -47,8 +47,8 @@ func (db *BeaconDB) ValidatorIndex(pubKey []byte) (uint64, error) { if err != nil { return 0, err } - for i := 0; i < len(state.ValidatorRegistry); i++ { - v := state.ValidatorRegistry[i] + for i := 0; i < len(state.Validators); i++ { + v := state.Validators[i] if bytes.Equal(v.Pubkey, pubKey) { if err := db.SaveValidatorIndex(pubKey, i); err != nil { return 0, err @@ -119,8 +119,8 @@ func (db *BeaconDB) HasAnyValidators(state *pb.BeaconState, pubKeys [][]byte) (b if !exists { for _, pubKey := range pubKeys { - for i := 0; i < len(state.ValidatorRegistry); i++ { - v := state.ValidatorRegistry[i] + for i := 0; i < len(state.Validators); i++ { + v := state.Validators[i] if bytes.Equal(v.Pubkey, pubKey) { if err := db.SaveValidatorIndex(pubKey, i); err != nil { return false, err diff --git a/beacon-chain/db/validator_test.go b/beacon-chain/db/validator_test.go index 175633065e..8b54454c92 100644 --- a/beacon-chain/db/validator_test.go +++ b/beacon-chain/db/validator_test.go @@ -125,7 +125,7 @@ func TestHasAnyValidator(t *testing.T) { } beaconState := &pb.BeaconState{ - ValidatorRegistry: []*pb.Validator{}, + Validators: []*pb.Validator{}, } has, err := db.HasAnyValidators(beaconState, append(knownPubKeys, unknownPubKeys...)) diff --git a/beacon-chain/powchain/log_processing.go b/beacon-chain/powchain/log_processing.go index 61abb52750..ef7b0c36fd 100644 --- a/beacon-chain/powchain/log_processing.go +++ b/beacon-chain/powchain/log_processing.go @@ -221,8 +221,8 @@ func (w *Web3Service) processPastLogs() error { if err != nil { return fmt.Errorf("could not get head state: %v", err) } - if currentState != nil && currentState.DepositIndex > 0 { - w.beaconDB.PrunePendingDeposits(w.ctx, currentState.DepositIndex) + if currentState != nil && currentState.Eth1DepositIndex > 0 { + w.beaconDB.PrunePendingDeposits(w.ctx, currentState.Eth1DepositIndex) } return nil diff --git a/beacon-chain/rpc/attester_server_test.go b/beacon-chain/rpc/attester_server_test.go index 253481444a..7ee7d36bf2 100644 --- a/beacon-chain/rpc/attester_server_test.go +++ b/beacon-chain/rpc/attester_server_test.go @@ -53,9 +53,9 @@ func TestSubmitAttestation_OK(t *testing.T) { state := &pbp2p.BeaconState{ Slot: params.BeaconConfig().SlotsPerEpoch + 1, - ValidatorRegistry: validators, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + Validators: validators, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } if err := db.SaveState(context.Background(), state); err != nil { @@ -106,7 +106,7 @@ func TestRequestAttestation_OK(t *testing.T) { beaconState := &pbp2p.BeaconState{ Slot: 3*params.BeaconConfig().SlotsPerEpoch + 1, CurrentJustifiedEpoch: 2 + 0, - LatestBlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot), + BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot), CurrentCrosslinks: []*pbp2p.Crosslink{ { DataRoot: []byte("A"), @@ -119,9 +119,9 @@ func TestRequestAttestation_OK(t *testing.T) { }, CurrentJustifiedRoot: justifiedRoot[:], } - beaconState.LatestBlockRoots[1] = blockRoot[:] - beaconState.LatestBlockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:] - beaconState.LatestBlockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:] + beaconState.BlockRoots[1] = blockRoot[:] + beaconState.BlockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:] + beaconState.BlockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:] attesterServer := &AttesterServer{ beaconDB: db, p2p: &mockBroadcaster{}, @@ -216,7 +216,7 @@ func TestAttestationDataAtSlot_handlesFarAwayJustifiedEpoch(t *testing.T) { beaconState := &pbp2p.BeaconState{ Slot: 10000, CurrentJustifiedEpoch: helpers.SlotToEpoch(1500), - LatestBlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot), + BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot), PreviousCrosslinks: []*pbp2p.Crosslink{ { DataRoot: []byte("A"), @@ -229,9 +229,9 @@ func TestAttestationDataAtSlot_handlesFarAwayJustifiedEpoch(t *testing.T) { }, CurrentJustifiedRoot: justifiedBlockRoot[:], } - beaconState.LatestBlockRoots[1] = blockRoot[:] - beaconState.LatestBlockRoots[1*params.BeaconConfig().SlotsPerEpoch] = epochBoundaryRoot[:] - beaconState.LatestBlockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedBlockRoot[:] + beaconState.BlockRoots[1] = blockRoot[:] + beaconState.BlockRoots[1*params.BeaconConfig().SlotsPerEpoch] = epochBoundaryRoot[:] + beaconState.BlockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedBlockRoot[:] attesterServer := &AttesterServer{ beaconDB: db, p2p: &mockBroadcaster{}, diff --git a/beacon-chain/rpc/beacon_server_test.go b/beacon-chain/rpc/beacon_server_test.go index 8a5657d290..1c4accae79 100644 --- a/beacon-chain/rpc/beacon_server_test.go +++ b/beacon-chain/rpc/beacon_server_test.go @@ -236,7 +236,7 @@ func TestBlockTree_OK(t *testing.T) { justifiedState := &pbp2p.BeaconState{ Slot: 0, Balances: make([]uint64, 11), - ValidatorRegistry: validators, + Validators: validators, } for i := 0; i < len(justifiedState.Balances); i++ { justifiedState.Balances[i] = params.BeaconConfig().MaxDepositAmount @@ -261,7 +261,7 @@ func TestBlockTree_OK(t *testing.T) { b1Root, _ := blockutil.BlockSigningRoot(b1) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b1Root); err != nil { t.Fatal(err) @@ -274,7 +274,7 @@ func TestBlockTree_OK(t *testing.T) { b2Root, _ := blockutil.BlockSigningRoot(b2) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b2Root); err != nil { t.Fatal(err) @@ -287,7 +287,7 @@ func TestBlockTree_OK(t *testing.T) { b3Root, _ := blockutil.BlockSigningRoot(b3) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b3Root); err != nil { t.Fatal(err) @@ -300,7 +300,7 @@ func TestBlockTree_OK(t *testing.T) { b4Root, _ := blockutil.BlockSigningRoot(b4) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 4, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b4Root); err != nil { t.Fatal(err) @@ -313,7 +313,7 @@ func TestBlockTree_OK(t *testing.T) { b5Root, _ := blockutil.BlockSigningRoot(b5) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 5, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b5Root); err != nil { t.Fatal(err) @@ -476,7 +476,7 @@ func TestBlockTreeBySlots_ArgsValildation(t *testing.T) { b1Root, _ := blockutil.BlockSigningRoot(b1) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b1Root); err != nil { t.Fatal(err) @@ -488,7 +488,7 @@ func TestBlockTreeBySlots_ArgsValildation(t *testing.T) { b2Root, _ := blockutil.BlockSigningRoot(b2) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b2Root); err != nil { t.Fatal(err) @@ -500,7 +500,7 @@ func TestBlockTreeBySlots_ArgsValildation(t *testing.T) { b3Root, _ := blockutil.BlockSigningRoot(b3) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b3Root); err != nil { t.Fatal(err) @@ -512,7 +512,7 @@ func TestBlockTreeBySlots_ArgsValildation(t *testing.T) { b4Root, _ := blockutil.BlockSigningRoot(b4) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 4, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b4Root); err != nil { t.Fatal(err) @@ -524,7 +524,7 @@ func TestBlockTreeBySlots_ArgsValildation(t *testing.T) { b5Root, _ := blockutil.BlockSigningRoot(b5) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 5, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b5Root); err != nil { t.Fatal(err) @@ -670,7 +670,7 @@ func TestBlockTreeBySlots_OK(t *testing.T) { for i := 0; i < 11; i++ { validators = append(validators, &pbp2p.Validator{ExitEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MaxDepositAmount}) } - justifiedState.ValidatorRegistry = validators + justifiedState.Validators = validators if err := db.SaveJustifiedState(justifiedState); err != nil { t.Fatal(err) } @@ -689,7 +689,7 @@ func TestBlockTreeBySlots_OK(t *testing.T) { b1Root, _ := blockutil.BlockSigningRoot(b1) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b1Root); err != nil { t.Fatal(err) @@ -701,7 +701,7 @@ func TestBlockTreeBySlots_OK(t *testing.T) { b2Root, _ := blockutil.BlockSigningRoot(b2) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b2Root); err != nil { t.Fatal(err) @@ -713,7 +713,7 @@ func TestBlockTreeBySlots_OK(t *testing.T) { b3Root, _ := blockutil.BlockSigningRoot(b3) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 3, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b3Root); err != nil { t.Fatal(err) @@ -725,7 +725,7 @@ func TestBlockTreeBySlots_OK(t *testing.T) { b4Root, _ := blockutil.BlockSigningRoot(b4) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 4, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b4Root); err != nil { t.Fatal(err) @@ -737,7 +737,7 @@ func TestBlockTreeBySlots_OK(t *testing.T) { b5Root, _ := blockutil.BlockSigningRoot(b5) if err := db.SaveHistoricalState(ctx, &pbp2p.BeaconState{ Slot: 5, - ValidatorRegistry: validators, + Validators: validators, Balances: balances, }, b5Root); err != nil { t.Fatal(err) diff --git a/beacon-chain/rpc/proposer_server.go b/beacon-chain/rpc/proposer_server.go index 37a9acc57d..795511124c 100644 --- a/beacon-chain/rpc/proposer_server.go +++ b/beacon-chain/rpc/proposer_server.go @@ -251,7 +251,7 @@ func (ps *ProposerServer) deposits(ctx context.Context) ([]*pbp2p.Deposit, error if err != nil { return nil, fmt.Errorf("could not fetch beacon state: %v", err) } - h := bytesutil.ToBytes32(beaconState.LatestEth1Data.BlockHash) + h := bytesutil.ToBytes32(beaconState.Eth1Data.BlockHash) _, latestEth1DataHeight, err := ps.powChainService.BlockExists(ctx, h) if err != nil { return nil, fmt.Errorf("could not fetch eth1data height: %v", err) @@ -260,12 +260,12 @@ func (ps *ProposerServer) deposits(ctx context.Context) ([]*pbp2p.Deposit, error // If this doesn't match the number of deposits stored in the cache, the generated trie will not be the same and // root will fail to verify. This can happen in a scenario where we perhaps have a deposit from height 101, // so we want to avoid any possible mismatches in these lengths. - upToLatestEth1DataDeposits := ps.beaconDB.AllDeposits(ctx, latestEth1DataHeight) - if len(upToLatestEth1DataDeposits) != len(allDeps) { + upToEth1DataDeposits := ps.beaconDB.AllDeposits(ctx, latestEth1DataHeight) + if len(upToEth1DataDeposits) != len(allDeps) { return nil, nil } depositData := [][]byte{} - for _, dep := range upToLatestEth1DataDeposits { + for _, dep := range upToEth1DataDeposits { depHash, err := hashutil.DepositHash(dep.Data) if err != nil { return nil, fmt.Errorf("coulf not hash deposit data %v", err) @@ -284,7 +284,7 @@ func (ps *ProposerServer) deposits(ctx context.Context) ([]*pbp2p.Deposit, error // deposits are sorted from lowest to highest. var pendingDeps []*pbp2p.Deposit for _, dep := range allPendingDeps { - if dep.Index >= beaconState.DepositIndex { + if dep.Index >= beaconState.Eth1DepositIndex { pendingDeps = append(pendingDeps, dep) } } diff --git a/beacon-chain/rpc/proposer_server_test.go b/beacon-chain/rpc/proposer_server_test.go index f0a28cc272..70a49a6989 100644 --- a/beacon-chain/rpc/proposer_server_test.go +++ b/beacon-chain/rpc/proposer_server_test.go @@ -83,7 +83,7 @@ func TestComputeStateRoot_OK(t *testing.T) { if err != nil { t.Fatalf("Could not instantiate genesis state: %v", err) } - beaconState.LatestStateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) + beaconState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot) beaconState.LatestBlockHeader = &pbp2p.BeaconBlockHeader{ StateRoot: []byte{}, } @@ -138,12 +138,12 @@ func TestPendingAttestations_FiltersWithinInclusionDelay(t *testing.T) { stateSlot := uint64(100) beaconState := &pbp2p.BeaconState{ Slot: stateSlot, - ValidatorRegistry: validators, + Validators: validators, CurrentCrosslinks: crosslinks, PreviousCrosslinks: crosslinks, - LatestStartShard: 100, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + StartShard: 100, + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } encoded, err := ssz.HashTreeRoot(beaconState.PreviousCrosslinks[0]) @@ -278,7 +278,7 @@ func TestPendingAttestations_FiltersExpiredAttestations(t *testing.T) { } beaconState := &pbp2p.BeaconState{ - ValidatorRegistry: validators, + Validators: validators, Slot: currentSlot + params.BeaconConfig().MinAttestationInclusionDelay, CurrentJustifiedEpoch: expectedEpoch, PreviousJustifiedEpoch: expectedEpoch, @@ -286,8 +286,8 @@ func TestPendingAttestations_FiltersExpiredAttestations(t *testing.T) { StartEpoch: 9, DataRoot: params.BeaconConfig().ZeroHash[:], }}, - LatestRandaoMixes: make([][]byte, params.BeaconConfig().LatestRandaoMixesLength), - LatestActiveIndexRoots: make([][]byte, params.BeaconConfig().LatestActiveIndexRootsLength), + RandaoMixes: make([][]byte, params.BeaconConfig().RandaoMixesLength), + ActiveIndexRoots: make([][]byte, params.BeaconConfig().ActiveIndexRootsLength), } if err := db.SaveState(ctx, beaconState); err != nil { @@ -365,10 +365,10 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) { d := internal.SetupDB(t) beaconState := &pbp2p.BeaconState{ - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte("0x0"), }, - DepositIndex: 2, + Eth1DepositIndex: 2, } if err := d.SaveState(ctx, beaconState); err != nil { t.Fatal(err) @@ -460,7 +460,7 @@ func Benchmark_Eth1Data(b *testing.B) { beaconState := &pbp2p.BeaconState{ Eth1DataVotes: []*pbp2p.Eth1Data{}, - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte("stub"), }, } @@ -496,7 +496,7 @@ func Benchmark_Eth1Data(b *testing.B) { } } -func TestPendingDeposits_CantReturnBelowStateDepositIndex(t *testing.T) { +func TestPendingDeposits_CantReturnBelowStateEth1DepositIndex(t *testing.T) { ctx := context.Background() height := big.NewInt(int64(params.BeaconConfig().Eth1FollowDistance)) @@ -509,10 +509,10 @@ func TestPendingDeposits_CantReturnBelowStateDepositIndex(t *testing.T) { d := internal.SetupDB(t) beaconState := &pbp2p.BeaconState{ - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte("0x0"), }, - DepositIndex: 10, + Eth1DepositIndex: 10, } if err := d.SaveState(ctx, beaconState); err != nil { t.Fatal(err) @@ -580,11 +580,11 @@ func TestPendingDeposits_CantReturnBelowStateDepositIndex(t *testing.T) { expectedDeposits, ) } - if deposits[0].Index != beaconState.DepositIndex { + if deposits[0].Index != beaconState.Eth1DepositIndex { t.Errorf( "Received unexpected merkle index: %d, wanted: %d", deposits[0].Index, - beaconState.DepositIndex, + beaconState.Eth1DepositIndex, ) } } @@ -602,10 +602,10 @@ func TestPendingDeposits_CantReturnMoreThanMax(t *testing.T) { d := internal.SetupDB(t) beaconState := &pbp2p.BeaconState{ - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte("0x0"), }, - DepositIndex: 2, + Eth1DepositIndex: 2, } if err := d.SaveState(ctx, beaconState); err != nil { t.Fatal(err) @@ -685,7 +685,7 @@ func TestEth1Data_EmptyVotesFetchBlockHashFailure(t *testing.T) { }, } beaconState := &pbp2p.BeaconState{ - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte{'a'}, }, Eth1DataVotes: []*pbp2p.Eth1Data{}, @@ -730,7 +730,7 @@ func TestEth1Data_EmptyVotesOk(t *testing.T) { } depositRoot := depositTrie.Root() beaconState := &pbp2p.BeaconState{ - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte("hash0"), DepositRoot: depositRoot[:], }, @@ -741,7 +741,7 @@ func TestEth1Data_EmptyVotesOk(t *testing.T) { latestBlockNumber: height, hashesByHeight: map[int][]byte{ 0: []byte("hash0"), - 1: beaconState.LatestEth1Data.BlockHash, + 1: beaconState.Eth1Data.BlockHash, }, } proposerServer := &ProposerServer{ @@ -776,7 +776,7 @@ func TestEth1Data_NonEmptyVotesSelectsBestVote(t *testing.T) { eth1DataVotes := []*pbp2p.Eth1Data{} beaconState := &pbp2p.BeaconState{ Eth1DataVotes: eth1DataVotes, - LatestEth1Data: &pbp2p.Eth1Data{ + Eth1Data: &pbp2p.Eth1Data{ BlockHash: []byte("stub"), }, } @@ -789,7 +789,7 @@ func TestEth1Data_NonEmptyVotesSelectsBestVote(t *testing.T) { powChainService: &mockPOWChainService{ latestBlockNumber: big.NewInt(int64(currentHeight)), hashesByHeight: map[int][]byte{ - 0: beaconState.LatestEth1Data.BlockHash, + 0: beaconState.Eth1Data.BlockHash, 1: beaconState.Eth1DataVotes[0].BlockHash, 2: beaconState.Eth1DataVotes[1].BlockHash, 3: beaconState.Eth1DataVotes[3].BlockHash, diff --git a/beacon-chain/rpc/validator_server.go b/beacon-chain/rpc/validator_server.go index d8dc814930..27eb75f18d 100644 --- a/beacon-chain/rpc/validator_server.go +++ b/beacon-chain/rpc/validator_server.go @@ -95,7 +95,7 @@ func (vs *ValidatorServer) ValidatorPerformance( if err != nil { return nil, fmt.Errorf("could not get head: %v", err) } - validatorRegistry, err := vs.beaconDB.ValidatorRegistry(ctx) + validatorRegistry, err := vs.beaconDB.Validators(ctx) if err != nil { return nil, fmt.Errorf("could not retrieve beacon state: %v", err) } @@ -151,7 +151,7 @@ func (vs *ValidatorServer) CommitteeAssignment(ctx context.Context, req *pb.Assi Status: pb.ValidatorStatus_UNKNOWN_STATUS, } - v := s.ValidatorRegistry[idx] + v := s.Validators[idx] // Update validator assignment when it is active if ok && helpers.IsActiveValidator(v, helpers.CurrentEpoch(s)) { assignment, err = vs.assignment(pk, s, req.EpochStart) @@ -358,7 +358,7 @@ func (vs *ValidatorServer) validatorStatus( activationEpoch := params.BeaconConfig().FarFutureEpoch var validatorInState *pbp2p.Validator var validatorIndex uint64 - for idx, val := range beaconState.ValidatorRegistry { + for idx, val := range beaconState.Validators { if ctx.Err() != nil { return nil } @@ -377,8 +377,8 @@ func (vs *ValidatorServer) validatorStatus( // If the validator has deposited and has been added to the state: if validatorInState != nil { var lastActivatedValidatorIdx uint64 - for j := len(beaconState.ValidatorRegistry) - 1; j >= 0; j-- { - if helpers.IsActiveValidator(beaconState.ValidatorRegistry[j], currEpoch) { + for j := len(beaconState.Validators) - 1; j >= 0; j-- { + if helpers.IsActiveValidator(beaconState.Validators[j], currEpoch) { lastActivatedValidatorIdx = uint64(j) break } @@ -399,7 +399,7 @@ func (vs *ValidatorServer) validatorStatus( func (vs *ValidatorServer) lookupValidatorStatus(validatorIdx uint64, beaconState *pbp2p.BeaconState) pb.ValidatorStatus { var status pb.ValidatorStatus - v := beaconState.ValidatorRegistry[validatorIdx] + v := beaconState.Validators[validatorIdx] epoch := helpers.CurrentEpoch(beaconState) farFutureEpoch := params.BeaconConfig().FarFutureEpoch diff --git a/beacon-chain/rpc/validator_server_test.go b/beacon-chain/rpc/validator_server_test.go index 0f4860d870..11878631b0 100644 --- a/beacon-chain/rpc/validator_server_test.go +++ b/beacon-chain/rpc/validator_server_test.go @@ -55,7 +55,7 @@ func TestValidatorIndex_InStateNotInDB(t *testing.T) { // Wanted validator with public key 'A' is in index '1'. s := &pbp2p.BeaconState{ - ValidatorRegistry: []*pbp2p.Validator{{Pubkey: []byte{0}}, {Pubkey: []byte{'A'}}, {Pubkey: []byte{'B'}}}, + Validators: []*pbp2p.Validator{{Pubkey: []byte{0}}, {Pubkey: []byte{'A'}}, {Pubkey: []byte{'B'}}}, } if err := db.SaveState(context.Background(), s); err != nil { @@ -301,7 +301,7 @@ func TestValidatorStatus_PendingActive(t *testing.T) { } // Pending active because activation epoch is still defaulted at far future slot. - if err := db.SaveState(ctx, &pbp2p.BeaconState{ValidatorRegistry: []*pbp2p.Validator{ + if err := db.SaveState(ctx, &pbp2p.BeaconState{Validators: []*pbp2p.Validator{ {ActivationEpoch: params.BeaconConfig().FarFutureEpoch, Pubkey: pubKey}, }, Slot: 5000, @@ -366,7 +366,7 @@ func TestValidatorStatus_Active(t *testing.T) { if err := db.SaveState(ctx, &pbp2p.BeaconState{ GenesisTime: uint64(time.Unix(0, 0).Unix()), Slot: 10000, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ ActivationEpoch: activeEpoch, ExitEpoch: params.BeaconConfig().FarFutureEpoch, Pubkey: pubKey}, @@ -418,7 +418,7 @@ func TestValidatorStatus_InitiatedExit(t *testing.T) { withdrawableEpoch := exitEpoch + params.BeaconConfig().MinValidatorWithdrawalDelay if err := db.SaveState(ctx, &pbp2p.BeaconState{ Slot: slot, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ Pubkey: pubKey, ActivationEpoch: 0, ExitEpoch: exitEpoch, @@ -472,7 +472,7 @@ func TestValidatorStatus_Withdrawable(t *testing.T) { epoch := helpers.SlotToEpoch(slot) if err := db.SaveState(ctx, &pbp2p.BeaconState{ Slot: 10000, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ WithdrawableEpoch: epoch - 1, ExitEpoch: epoch - 2, Pubkey: pubKey}, @@ -525,7 +525,7 @@ func TestValidatorStatus_ExitedSlashed(t *testing.T) { epoch := helpers.SlotToEpoch(slot) if err := db.SaveState(ctx, &pbp2p.BeaconState{ Slot: slot, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ Slashed: true, Pubkey: pubKey, WithdrawableEpoch: epoch + 1}, @@ -578,7 +578,7 @@ func TestValidatorStatus_Exited(t *testing.T) { epoch := helpers.SlotToEpoch(slot) if err := db.SaveState(ctx, &pbp2p.BeaconState{ Slot: slot, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ Pubkey: pubKey, WithdrawableEpoch: epoch + 1}, }}); err != nil { @@ -627,7 +627,7 @@ func TestValidatorStatus_UnknownStatus(t *testing.T) { if err := db.SaveState(ctx, &pbp2p.BeaconState{ Slot: 0, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ ActivationEpoch: 0, ExitEpoch: params.BeaconConfig().FarFutureEpoch, Pubkey: pubKey}, @@ -672,7 +672,7 @@ func TestWaitForActivation_ContextClosed(t *testing.T) { beaconState := &pbp2p.BeaconState{ Slot: 0, - ValidatorRegistry: []*pbp2p.Validator{}, + Validators: []*pbp2p.Validator{}, } if err := db.SaveState(ctx, beaconState); err != nil { t.Fatalf("could not save state: %v", err) @@ -723,7 +723,7 @@ func TestWaitForActivation_ValidatorOriginallyExists(t *testing.T) { beaconState := &pbp2p.BeaconState{ Slot: 4000, - ValidatorRegistry: []*pbp2p.Validator{ + Validators: []*pbp2p.Validator{ { ActivationEpoch: 0, ExitEpoch: params.BeaconConfig().FarFutureEpoch, @@ -811,7 +811,7 @@ func TestMultipleValidatorStatus_OK(t *testing.T) { beaconState := &pbp2p.BeaconState{ Slot: 4000, - ValidatorRegistry: []*pbp2p.Validator{{ + Validators: []*pbp2p.Validator{{ ActivationEpoch: 0, ExitEpoch: params.BeaconConfig().FarFutureEpoch, Pubkey: pubKeys[0]}, diff --git a/beacon-chain/sync/initial-sync/sync_state.go b/beacon-chain/sync/initial-sync/sync_state.go index 8d9fafe3f6..b4fb8af12c 100644 --- a/beacon-chain/sync/initial-sync/sync_state.go +++ b/beacon-chain/sync/initial-sync/sync_state.go @@ -67,7 +67,7 @@ func (s *InitialSync) processState(msg p2p.Message, chainHead *pb.ChainHeadRespo return nil } - exists, _, err := s.powchain.BlockExists(ctx, bytesutil.ToBytes32(finalizedState.LatestEth1Data.BlockHash)) + exists, _, err := s.powchain.BlockExists(ctx, bytesutil.ToBytes32(finalizedState.Eth1Data.BlockHash)) if err != nil { log.Errorf("Unable to get powchain block %v", err) } @@ -77,7 +77,7 @@ func (s *InitialSync) processState(msg p2p.Message, chainHead *pb.ChainHeadRespo return nil } - s.db.PrunePendingDeposits(ctx, finalizedState.DepositIndex) + s.db.PrunePendingDeposits(ctx, finalizedState.Eth1DepositIndex) if err := s.db.UpdateChainHead(ctx, blockWithNoBody, finalizedState); err != nil { log.Errorf("Could not update chain head: %v", err) diff --git a/proto/beacon/p2p/v1/messages.pb.go b/proto/beacon/p2p/v1/messages.pb.go index 4594ce2994..a4bd0865cf 100755 --- a/proto/beacon/p2p/v1/messages.pb.go +++ b/proto/beacon/p2p/v1/messages.pb.go @@ -5,11 +5,10 @@ package ethereum_beacon_p2p_v1 import ( fmt "fmt" - io "io" - math "math" - proto "github.com/gogo/protobuf/proto" types "github.com/gogo/protobuf/types" + io "io" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/beacon/p2p/v1/types.pb.go b/proto/beacon/p2p/v1/types.pb.go index 91cb701468..65544f668d 100755 --- a/proto/beacon/p2p/v1/types.pb.go +++ b/proto/beacon/p2p/v1/types.pb.go @@ -5,11 +5,10 @@ package ethereum_beacon_p2p_v1 import ( fmt "fmt" - io "io" - math "math" - proto "github.com/gogo/protobuf/proto" _ "github.com/prysmaticlabs/prysm/proto/common" + io "io" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -27,10 +26,10 @@ type BeaconState struct { GenesisTime uint64 `protobuf:"varint,1001,opt,name=genesis_time,json=genesisTime,proto3" json:"genesis_time,omitempty"` Fork *Fork `protobuf:"bytes,1002,opt,name=fork,proto3" json:"fork,omitempty"` Slot uint64 `protobuf:"varint,1003,opt,name=slot,proto3" json:"slot,omitempty"` - ValidatorRegistry []*Validator `protobuf:"bytes,2001,rep,name=validator_registry,json=validatorRegistry,proto3" json:"validator_registry,omitempty"` + Validators []*Validator `protobuf:"bytes,2001,rep,name=validators,proto3" json:"validators,omitempty"` Balances []uint64 `protobuf:"varint,2002,rep,packed,name=balances,proto3" json:"balances,omitempty"` - LatestRandaoMixes [][]byte `protobuf:"bytes,3001,rep,name=latest_randao_mixes,json=latestRandaoMixes,proto3" json:"latest_randao_mixes,omitempty"` - LatestStartShard uint64 `protobuf:"varint,3002,opt,name=latest_start_shard,json=latestStartShard,proto3" json:"latest_start_shard,omitempty"` + RandaoMixes [][]byte `protobuf:"bytes,3001,rep,name=randao_mixes,json=randaoMixes,proto3" json:"randao_mixes,omitempty"` + StartShard uint64 `protobuf:"varint,3002,opt,name=start_shard,json=startShard,proto3" json:"start_shard,omitempty"` PreviousEpochAttestations []*PendingAttestation `protobuf:"bytes,4001,rep,name=previous_epoch_attestations,json=previousEpochAttestations,proto3" json:"previous_epoch_attestations,omitempty"` CurrentEpochAttestations []*PendingAttestation `protobuf:"bytes,4002,rep,name=current_epoch_attestations,json=currentEpochAttestations,proto3" json:"current_epoch_attestations,omitempty"` PreviousJustifiedEpoch uint64 `protobuf:"varint,4003,opt,name=previous_justified_epoch,json=previousJustifiedEpoch,proto3" json:"previous_justified_epoch,omitempty"` @@ -42,15 +41,15 @@ type BeaconState struct { FinalizedRoot []byte `protobuf:"bytes,4009,opt,name=finalized_root,json=finalizedRoot,proto3" json:"finalized_root,omitempty"` CurrentCrosslinks []*Crosslink `protobuf:"bytes,5001,rep,name=current_crosslinks,json=currentCrosslinks,proto3" json:"current_crosslinks,omitempty"` PreviousCrosslinks []*Crosslink `protobuf:"bytes,5002,rep,name=previous_crosslinks,json=previousCrosslinks,proto3" json:"previous_crosslinks,omitempty"` - LatestBlockRoots [][]byte `protobuf:"bytes,5003,rep,name=latest_block_roots,json=latestBlockRoots,proto3" json:"latest_block_roots,omitempty"` - LatestStateRoots [][]byte `protobuf:"bytes,5004,rep,name=latest_state_roots,json=latestStateRoots,proto3" json:"latest_state_roots,omitempty"` - LatestActiveIndexRoots [][]byte `protobuf:"bytes,5005,rep,name=latest_active_index_roots,json=latestActiveIndexRoots,proto3" json:"latest_active_index_roots,omitempty"` - LatestSlashedBalances []uint64 `protobuf:"varint,5006,rep,packed,name=latest_slashed_balances,json=latestSlashedBalances,proto3" json:"latest_slashed_balances,omitempty"` + BlockRoots [][]byte `protobuf:"bytes,5003,rep,name=block_roots,json=blockRoots,proto3" json:"block_roots,omitempty"` + StateRoots [][]byte `protobuf:"bytes,5004,rep,name=state_roots,json=stateRoots,proto3" json:"state_roots,omitempty"` + ActiveIndexRoots [][]byte `protobuf:"bytes,5005,rep,name=active_index_roots,json=activeIndexRoots,proto3" json:"active_index_roots,omitempty"` + SlashedBalances []uint64 `protobuf:"varint,5006,rep,packed,name=slashed_balances,json=slashedBalances,proto3" json:"slashed_balances,omitempty"` LatestBlockHeader *BeaconBlockHeader `protobuf:"bytes,5007,opt,name=latest_block_header,json=latestBlockHeader,proto3" json:"latest_block_header,omitempty"` HistoricalRoots [][]byte `protobuf:"bytes,5008,rep,name=historical_roots,json=historicalRoots,proto3" json:"historical_roots,omitempty"` - LatestEth1Data *Eth1Data `protobuf:"bytes,6001,opt,name=latest_eth1_data,json=latestEth1Data,proto3" json:"latest_eth1_data,omitempty"` + Eth1Data *Eth1Data `protobuf:"bytes,6001,opt,name=eth1_data,json=eth1Data,proto3" json:"eth1_data,omitempty"` Eth1DataVotes []*Eth1Data `protobuf:"bytes,6002,rep,name=eth1_data_votes,json=eth1DataVotes,proto3" json:"eth1_data_votes,omitempty"` - DepositIndex uint64 `protobuf:"varint,6003,opt,name=deposit_index,json=depositIndex,proto3" json:"deposit_index,omitempty"` + Eth1DepositIndex uint64 `protobuf:"varint,6003,opt,name=eth1_deposit_index,json=eth1DepositIndex,proto3" json:"eth1_deposit_index,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -110,9 +109,9 @@ func (m *BeaconState) GetSlot() uint64 { return 0 } -func (m *BeaconState) GetValidatorRegistry() []*Validator { +func (m *BeaconState) GetValidators() []*Validator { if m != nil { - return m.ValidatorRegistry + return m.Validators } return nil } @@ -124,16 +123,16 @@ func (m *BeaconState) GetBalances() []uint64 { return nil } -func (m *BeaconState) GetLatestRandaoMixes() [][]byte { +func (m *BeaconState) GetRandaoMixes() [][]byte { if m != nil { - return m.LatestRandaoMixes + return m.RandaoMixes } return nil } -func (m *BeaconState) GetLatestStartShard() uint64 { +func (m *BeaconState) GetStartShard() uint64 { if m != nil { - return m.LatestStartShard + return m.StartShard } return 0 } @@ -215,30 +214,30 @@ func (m *BeaconState) GetPreviousCrosslinks() []*Crosslink { return nil } -func (m *BeaconState) GetLatestBlockRoots() [][]byte { +func (m *BeaconState) GetBlockRoots() [][]byte { if m != nil { - return m.LatestBlockRoots + return m.BlockRoots } return nil } -func (m *BeaconState) GetLatestStateRoots() [][]byte { +func (m *BeaconState) GetStateRoots() [][]byte { if m != nil { - return m.LatestStateRoots + return m.StateRoots } return nil } -func (m *BeaconState) GetLatestActiveIndexRoots() [][]byte { +func (m *BeaconState) GetActiveIndexRoots() [][]byte { if m != nil { - return m.LatestActiveIndexRoots + return m.ActiveIndexRoots } return nil } -func (m *BeaconState) GetLatestSlashedBalances() []uint64 { +func (m *BeaconState) GetSlashedBalances() []uint64 { if m != nil { - return m.LatestSlashedBalances + return m.SlashedBalances } return nil } @@ -257,9 +256,9 @@ func (m *BeaconState) GetHistoricalRoots() [][]byte { return nil } -func (m *BeaconState) GetLatestEth1Data() *Eth1Data { +func (m *BeaconState) GetEth1Data() *Eth1Data { if m != nil { - return m.LatestEth1Data + return m.Eth1Data } return nil } @@ -271,9 +270,9 @@ func (m *BeaconState) GetEth1DataVotes() []*Eth1Data { return nil } -func (m *BeaconState) GetDepositIndex() uint64 { +func (m *BeaconState) GetEth1DepositIndex() uint64 { if m != nil { - return m.DepositIndex + return m.Eth1DepositIndex } return 0 } @@ -862,69 +861,6 @@ func (m *Validator) GetEffectiveBalance() uint64 { return 0 } -type ShardReassignmentRecord struct { - ValidatorIndex uint64 `protobuf:"varint,1,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` - Shard uint64 `protobuf:"varint,2,opt,name=shard,proto3" json:"shard,omitempty"` - Slot uint64 `protobuf:"varint,3,opt,name=slot,proto3" json:"slot,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShardReassignmentRecord) Reset() { *m = ShardReassignmentRecord{} } -func (m *ShardReassignmentRecord) String() string { return proto.CompactTextString(m) } -func (*ShardReassignmentRecord) ProtoMessage() {} -func (*ShardReassignmentRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{9} -} -func (m *ShardReassignmentRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ShardReassignmentRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ShardReassignmentRecord.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ShardReassignmentRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShardReassignmentRecord.Merge(m, src) -} -func (m *ShardReassignmentRecord) XXX_Size() int { - return m.Size() -} -func (m *ShardReassignmentRecord) XXX_DiscardUnknown() { - xxx_messageInfo_ShardReassignmentRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_ShardReassignmentRecord proto.InternalMessageInfo - -func (m *ShardReassignmentRecord) GetValidatorIndex() uint64 { - if m != nil { - return m.ValidatorIndex - } - return 0 -} - -func (m *ShardReassignmentRecord) GetShard() uint64 { - if m != nil { - return m.Shard - } - return 0 -} - -func (m *ShardReassignmentRecord) GetSlot() uint64 { - if m != nil { - return m.Slot - } - return 0 -} - type Crosslink struct { Shard uint64 `protobuf:"varint,1,opt,name=shard,proto3" json:"shard,omitempty"` StartEpoch uint64 `protobuf:"varint,2,opt,name=start_epoch,json=startEpoch,proto3" json:"start_epoch,omitempty"` @@ -940,7 +876,7 @@ func (m *Crosslink) Reset() { *m = Crosslink{} } func (m *Crosslink) String() string { return proto.CompactTextString(m) } func (*Crosslink) ProtoMessage() {} func (*Crosslink) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{10} + return fileDescriptor_e719e7d82cfa7b0d, []int{9} } func (m *Crosslink) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1019,7 +955,7 @@ func (m *BeaconBlockHeader) Reset() { *m = BeaconBlockHeader{} } func (m *BeaconBlockHeader) String() string { return proto.CompactTextString(m) } func (*BeaconBlockHeader) ProtoMessage() {} func (*BeaconBlockHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{11} + return fileDescriptor_e719e7d82cfa7b0d, []int{10} } func (m *BeaconBlockHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1098,7 +1034,7 @@ func (m *BeaconBlock) Reset() { *m = BeaconBlock{} } func (m *BeaconBlock) String() string { return proto.CompactTextString(m) } func (*BeaconBlock) ProtoMessage() {} func (*BeaconBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{12} + return fileDescriptor_e719e7d82cfa7b0d, []int{11} } func (m *BeaconBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1181,7 +1117,7 @@ func (m *BeaconBlockBody) Reset() { *m = BeaconBlockBody{} } func (m *BeaconBlockBody) String() string { return proto.CompactTextString(m) } func (*BeaconBlockBody) ProtoMessage() {} func (*BeaconBlockBody) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{13} + return fileDescriptor_e719e7d82cfa7b0d, []int{12} } func (m *BeaconBlockBody) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1286,7 +1222,7 @@ func (m *ProposalSignedData) Reset() { *m = ProposalSignedData{} } func (m *ProposalSignedData) String() string { return proto.CompactTextString(m) } func (*ProposalSignedData) ProtoMessage() {} func (*ProposalSignedData) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{14} + return fileDescriptor_e719e7d82cfa7b0d, []int{13} } func (m *ProposalSignedData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1350,7 +1286,7 @@ func (m *SlashableAttestation) Reset() { *m = SlashableAttestation{} } func (m *SlashableAttestation) String() string { return proto.CompactTextString(m) } func (*SlashableAttestation) ProtoMessage() {} func (*SlashableAttestation) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{15} + return fileDescriptor_e719e7d82cfa7b0d, []int{14} } func (m *SlashableAttestation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1421,7 +1357,7 @@ func (m *DepositData) Reset() { *m = DepositData{} } func (m *DepositData) String() string { return proto.CompactTextString(m) } func (*DepositData) ProtoMessage() {} func (*DepositData) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{16} + return fileDescriptor_e719e7d82cfa7b0d, []int{15} } func (m *DepositData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1491,7 +1427,7 @@ func (m *ProposerSlashing) Reset() { *m = ProposerSlashing{} } func (m *ProposerSlashing) String() string { return proto.CompactTextString(m) } func (*ProposerSlashing) ProtoMessage() {} func (*ProposerSlashing) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{17} + return fileDescriptor_e719e7d82cfa7b0d, []int{16} } func (m *ProposerSlashing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1553,7 +1489,7 @@ func (m *AttesterSlashing) Reset() { *m = AttesterSlashing{} } func (m *AttesterSlashing) String() string { return proto.CompactTextString(m) } func (*AttesterSlashing) ProtoMessage() {} func (*AttesterSlashing) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{18} + return fileDescriptor_e719e7d82cfa7b0d, []int{17} } func (m *AttesterSlashing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1609,7 +1545,7 @@ func (m *Deposit) Reset() { *m = Deposit{} } func (m *Deposit) String() string { return proto.CompactTextString(m) } func (*Deposit) ProtoMessage() {} func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{19} + return fileDescriptor_e719e7d82cfa7b0d, []int{18} } func (m *Deposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1672,7 +1608,7 @@ func (m *VoluntaryExit) Reset() { *m = VoluntaryExit{} } func (m *VoluntaryExit) String() string { return proto.CompactTextString(m) } func (*VoluntaryExit) ProtoMessage() {} func (*VoluntaryExit) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{20} + return fileDescriptor_e719e7d82cfa7b0d, []int{19} } func (m *VoluntaryExit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1739,7 +1675,7 @@ func (m *Transfer) Reset() { *m = Transfer{} } func (m *Transfer) String() string { return proto.CompactTextString(m) } func (*Transfer) ProtoMessage() {} func (*Transfer) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{21} + return fileDescriptor_e719e7d82cfa7b0d, []int{20} } func (m *Transfer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1830,7 +1766,7 @@ func (m *Eth1Data) Reset() { *m = Eth1Data{} } func (m *Eth1Data) String() string { return proto.CompactTextString(m) } func (*Eth1Data) ProtoMessage() {} func (*Eth1Data) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{22} + return fileDescriptor_e719e7d82cfa7b0d, []int{21} } func (m *Eth1Data) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1892,7 +1828,7 @@ func (m *Eth1DataVote) Reset() { *m = Eth1DataVote{} } func (m *Eth1DataVote) String() string { return proto.CompactTextString(m) } func (*Eth1DataVote) ProtoMessage() {} func (*Eth1DataVote) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{23} + return fileDescriptor_e719e7d82cfa7b0d, []int{22} } func (m *Eth1DataVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1947,7 +1883,7 @@ func (m *HistoricalBatch) Reset() { *m = HistoricalBatch{} } func (m *HistoricalBatch) String() string { return proto.CompactTextString(m) } func (*HistoricalBatch) ProtoMessage() {} func (*HistoricalBatch) Descriptor() ([]byte, []int) { - return fileDescriptor_e719e7d82cfa7b0d, []int{24} + return fileDescriptor_e719e7d82cfa7b0d, []int{23} } func (m *HistoricalBatch) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2000,7 +1936,6 @@ func init() { proto.RegisterType((*AttestationDataAndCustodyBit)(nil), "ethereum.beacon.p2p.v1.AttestationDataAndCustodyBit") proto.RegisterType((*IndexedAttestation)(nil), "ethereum.beacon.p2p.v1.IndexedAttestation") proto.RegisterType((*Validator)(nil), "ethereum.beacon.p2p.v1.Validator") - proto.RegisterType((*ShardReassignmentRecord)(nil), "ethereum.beacon.p2p.v1.ShardReassignmentRecord") proto.RegisterType((*Crosslink)(nil), "ethereum.beacon.p2p.v1.Crosslink") proto.RegisterType((*BeaconBlockHeader)(nil), "ethereum.beacon.p2p.v1.BeaconBlockHeader") proto.RegisterType((*BeaconBlock)(nil), "ethereum.beacon.p2p.v1.BeaconBlock") @@ -2021,135 +1956,130 @@ func init() { func init() { proto.RegisterFile("proto/beacon/p2p/v1/types.proto", fileDescriptor_e719e7d82cfa7b0d) } var fileDescriptor_e719e7d82cfa7b0d = []byte{ - // 2041 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x23, 0x49, - 0x15, 0x57, 0x3b, 0x4e, 0x62, 0x3f, 0x3b, 0x71, 0x5c, 0x33, 0x49, 0x7a, 0xe7, 0x2b, 0x33, 0x1e, - 0x96, 0x64, 0x66, 0xb5, 0xc9, 0x3a, 0x2b, 0x18, 0xc1, 0x8a, 0x8f, 0xc9, 0x4c, 0x60, 0x06, 0xc4, - 0xc7, 0x76, 0x46, 0x83, 0xc4, 0xa5, 0x55, 0x76, 0x97, 0xed, 0xda, 0xb4, 0xbb, 0x4d, 0x57, 0xd9, - 0x3b, 0x41, 0x9c, 0x91, 0xf8, 0x46, 0xdc, 0x39, 0xb0, 0x7c, 0xdf, 0xf7, 0x02, 0xe2, 0x0a, 0x82, - 0xdb, 0x82, 0xe0, 0x80, 0xc4, 0x01, 0xcd, 0x0d, 0x38, 0x01, 0xff,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x37, 0x41, 0x93, 0x52, 0x1b, 0x92, 0x26, - 0x7d, 0x66, 0xae, 0x4b, 0x93, 0xf1, 0x9a, 0xa6, 0x59, 0x1b, 0x46, 0x04, 0x6d, 0x2c, 0x6a, 0x1b, - 0x9a, 0x84, 0x36, 0x3e, 0x01, 0x55, 0x0b, 0x9f, 0xee, 0x12, 0x9e, 0xc2, 0x53, 0x80, 0x67, 0xa6, - 0xd3, 0xea, 0x43, 0x33, 0x97, 0x87, 0x07, 0x68, 0x99, 0x10, 0x33, 0x1b, 0x39, 0xb9, 0xd1, 0xe8, - 0x32, 0x40, 0x2e, 0x2d, 0xfa, 0x8c, 0xaa, 0x1d, 0x9b, 0x90, 0x2d, 0xa8, 0x8d, 0x28, 0xb6, 0x4b, - 0x3e, 0x5a, 0x4d, 0x52, 0x02, 0xad, 0xaf, 0xc1, 0xa5, 0x42, 0xc2, 0x6f, 0x47, 0xc1, 0x1d, 0x7b, - 0x68, 0xff, 0x5f, 0x29, 0x6d, 0x41, 0x2d, 0x57, 0x17, 0xe8, 0x5d, 0xc5, 0x83, 0xac, 0x24, 0x5a, - 0x7f, 0x71, 0x80, 0x60, 0x09, 0xb3, 0x60, 0xba, 0x1f, 0xd7, 0x73, 0x7a, 0xfe, 0x6b, 0xaa, 0xf6, - 0xb9, 0x42, 0x65, 0x07, 0x41, 0x99, 0x64, 0x16, 0x5e, 0xbb, 0xaf, 0x39, 0x45, 0x95, 0xb6, 0x55, - 0x29, 0x15, 0x55, 0xda, 0xa9, 0x4a, 0x1a, 0xda, 0xc2, 0xf3, 0x84, 0x76, 0x76, 0x1d, 0xff, 0xad, - 0x04, 0x55, 0x3b, 0x7e, 0x92, 0x0d, 0x58, 0x1a, 0x8d, 0x3b, 0xc7, 0xec, 0xc4, 0x94, 0xad, 0x59, - 0xa9, 0x09, 0xe4, 0x6d, 0x2e, 0x07, 0x41, 0x42, 0xdf, 0xa6, 0xa1, 0xdf, 0x4d, 0x58, 0xc0, 0x22, - 0xc9, 0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x2a, 0xf6, 0x91, 0xe1, 0x1a, 0xa4, 0x6f, 0x00, 0xf9, - 0x1f, 0xb9, 0x9a, 0xa1, 0xe1, 0x35, 0x7e, 0x3d, 0x7b, 0x3c, 0xe8, 0xa2, 0xa7, 0xa5, 0xa9, 0xb7, - 0x83, 0x3b, 0xe8, 0xaf, 0xfd, 0xef, 0x51, 0x78, 0x97, 0x66, 0x0a, 0x29, 0x0a, 0xe9, 0x5a, 0x21, - 0xd4, 0x0f, 0x73, 0x2f, 0x12, 0xd3, 0xd7, 0xb0, 0xf3, 0xcc, 0xd7, 0xf0, 0x65, 0x80, 0x49, 0x2c, - 0xd9, 0x94, 0x3f, 0x55, 0x45, 0x41, 0x67, 0x5a, 0x47, 0xd0, 0xb8, 0x67, 0x5f, 0x66, 0x0e, 0xa8, - 0xd4, 0x23, 0x5d, 0xfe, 0xb5, 0x4b, 0xd7, 0x20, 0x74, 0xb2, 0x67, 0x2e, 0x3d, 0x31, 0xda, 0xf7, - 0xad, 0x92, 0x16, 0xb0, 0xc3, 0x8c, 0x38, 0xa8, 0xff, 0xfe, 0xf1, 0x15, 0xe7, 0xbd, 0xc7, 0x57, - 0x9c, 0xbf, 0x3f, 0xbe, 0xe2, 0x74, 0x96, 0xf0, 0x15, 0xfe, 0xf5, 0xff, 0x05, 0x00, 0x00, 0xff, - 0xff, 0xf3, 0x5c, 0xea, 0x19, 0xdd, 0x17, 0x00, 0x00, + // 1960 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcb, 0x6f, 0x1c, 0x49, + 0x19, 0x57, 0x8f, 0xc7, 0xf6, 0xcc, 0x37, 0xb6, 0x67, 0x5c, 0x49, 0x9c, 0x26, 0x2f, 0x7b, 0x27, + 0x5a, 0xec, 0x64, 0xb5, 0xf6, 0x8e, 0x57, 0xb0, 0x42, 0x2b, 0x1e, 0x71, 0x62, 0x48, 0x90, 0x78,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 0xe4, 0x33, 0xb0, 0xec, 0x14, 0x8e, 0xb0, 0x63, 0xe6, + 0xb4, 0x99, 0xcf, 0x32, 0xa7, 0x87, 0xad, 0xa9, 0xca, 0xd3, 0x29, 0x1b, 0xdc, 0x35, 0xc7, 0x7e, + 0x51, 0x83, 0xbb, 0xed, 0x04, 0x16, 0x4d, 0x48, 0xa8, 0x64, 0x19, 0x65, 0x69, 0xda, 0xc7, 0x28, + 0x5e, 0x0a, 0xf4, 0x42, 0x51, 0xf5, 0x1f, 0x30, 0x29, 0x84, 0x0b, 0xf2, 0xc6, 0x54, 0x94, 0xde, + 0x7e, 0x46, 0x2d, 0x29, 0x22, 0xb4, 0x1d, 0xc3, 0xf2, 0x54, 0x71, 0x28, 0x6e, 0x82, 0x9e, 0x73, + 0x13, 0x54, 0x57, 0xb0, 0xa9, 0xec, 0xca, 0xf7, 0x5f, 0x71, 0x73, 0x8b, 0x1d, 0x4f, 0x07, 0xd7, + 0x5c, 0x39, 0xb8, 0xde, 0xf5, 0xa0, 0x66, 0x2b, 0x88, 0x8a, 0x4f, 0xc1, 0x92, 0x88, 0x65, 0x66, + 0x2b, 0xb3, 0x52, 0x26, 0x32, 0xd6, 0xe3, 0x23, 0xce, 0x12, 0x69, 0x76, 0x29, 0x08, 0x33, 0xa3, + 0xba, 0x05, 0x73, 0x7d, 0xc6, 0xcc, 0x5c, 0xa6, 0x3e, 0xf3, 0x02, 0x34, 0xef, 0x14, 0xa0, 0x22, + 0xc5, 0x16, 0xa6, 0x52, 0x6c, 0x0a, 0xf6, 0x62, 0x19, 0xf6, 0x17, 0xa1, 0x66, 0x5b, 0x9b, 0xba, + 0xef, 0xd8, 0xfb, 0xba, 0x73, 0xb5, 0x6a, 0x18, 0x1a, 0xb6, 0xf1, 0xdb, 0xb0, 0x6c, 0x45, 0x7a, + 0x88, 0x54, 0x1f, 0xc2, 0xea, 0xdd, 0x47, 0xbc, 0xf9, 0x4d, 0x44, 0xd5, 0x3b, 0xeb, 0x29, 0xa4, + 0xa8, 0x4a, 0xd7, 0x8e, 0x61, 0x69, 0xdf, 0x79, 0x2c, 0x98, 0x6e, 0xc3, 0xde, 0x85, 0xdb, 0xf0, + 0x4d, 0x80, 0x49, 0x2a, 0xd9, 0x14, 0x9e, 0xba, 0xa2, 0x20, 0x98, 0xf6, 0x01, 0x34, 0x1f, 0xe6, + 0xef, 0x24, 0x7b, 0x54, 0xea, 0x91, 0xce, 0x7d, 0x4e, 0xf2, 0x4e, 0xbd, 0x26, 0xad, 0x4f, 0xbf, + 0x26, 0x55, 0xca, 0x8f, 0x49, 0x7b, 0x4b, 0xbf, 0x79, 0x7a, 0xcb, 0xfb, 0xdd, 0xd3, 0x5b, 0xde, + 0x5f, 0x9f, 0xde, 0xf2, 0xba, 0x0b, 0xf8, 0x6c, 0xfd, 0xfa, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x9a, 0xb2, 0x73, 0x0e, 0x0e, 0x17, 0x00, 0x00, } func (m *BeaconState) Marshal() (dAtA []byte, err error) { @@ -2193,8 +2123,8 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintTypes(dAtA, i, uint64(m.Slot)) } - if len(m.ValidatorRegistry) > 0 { - for _, msg := range m.ValidatorRegistry { + if len(m.Validators) > 0 { + for _, msg := range m.Validators { dAtA[i] = 0x8a i++ dAtA[i] = 0x7d @@ -2226,8 +2156,8 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(j2)) i += copy(dAtA[i:], dAtA3[:j2]) } - if len(m.LatestRandaoMixes) > 0 { - for _, b := range m.LatestRandaoMixes { + if len(m.RandaoMixes) > 0 { + for _, b := range m.RandaoMixes { dAtA[i] = 0xca i++ dAtA[i] = 0xbb @@ -2238,14 +2168,14 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], b) } } - if m.LatestStartShard != 0 { + if m.StartShard != 0 { dAtA[i] = 0xd0 i++ dAtA[i] = 0xbb i++ dAtA[i] = 0x1 i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LatestStartShard)) + i = encodeVarintTypes(dAtA, i, uint64(m.StartShard)) } if len(m.PreviousEpochAttestations) > 0 { for _, msg := range m.PreviousEpochAttestations { @@ -2377,8 +2307,8 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += n } } - if len(m.LatestBlockRoots) > 0 { - for _, b := range m.LatestBlockRoots { + if len(m.BlockRoots) > 0 { + for _, b := range m.BlockRoots { dAtA[i] = 0xda i++ dAtA[i] = 0xb8 @@ -2389,8 +2319,8 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], b) } } - if len(m.LatestStateRoots) > 0 { - for _, b := range m.LatestStateRoots { + if len(m.StateRoots) > 0 { + for _, b := range m.StateRoots { dAtA[i] = 0xe2 i++ dAtA[i] = 0xb8 @@ -2401,8 +2331,8 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], b) } } - if len(m.LatestActiveIndexRoots) > 0 { - for _, b := range m.LatestActiveIndexRoots { + if len(m.ActiveIndexRoots) > 0 { + for _, b := range m.ActiveIndexRoots { dAtA[i] = 0xea i++ dAtA[i] = 0xb8 @@ -2413,10 +2343,10 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], b) } } - if len(m.LatestSlashedBalances) > 0 { - dAtA5 := make([]byte, len(m.LatestSlashedBalances)*10) + if len(m.SlashedBalances) > 0 { + dAtA5 := make([]byte, len(m.SlashedBalances)*10) var j4 int - for _, num := range m.LatestSlashedBalances { + for _, num := range m.SlashedBalances { for num >= 1<<7 { dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 @@ -2460,15 +2390,15 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], b) } } - if m.LatestEth1Data != nil { + if m.Eth1Data != nil { dAtA[i] = 0x8a i++ dAtA[i] = 0xf7 i++ dAtA[i] = 0x2 i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LatestEth1Data.Size())) - n7, err := m.LatestEth1Data.MarshalTo(dAtA[i:]) + i = encodeVarintTypes(dAtA, i, uint64(m.Eth1Data.Size())) + n7, err := m.Eth1Data.MarshalTo(dAtA[i:]) if err != nil { return 0, err } @@ -2490,14 +2420,14 @@ func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { i += n } } - if m.DepositIndex != 0 { + if m.Eth1DepositIndex != 0 { dAtA[i] = 0x98 i++ dAtA[i] = 0xf7 i++ dAtA[i] = 0x2 i++ - i = encodeVarintTypes(dAtA, i, uint64(m.DepositIndex)) + i = encodeVarintTypes(dAtA, i, uint64(m.Eth1DepositIndex)) } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) @@ -2916,42 +2846,6 @@ func (m *Validator) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ShardReassignmentRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ShardReassignmentRecord) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ValidatorIndex != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ValidatorIndex)) - } - if m.Shard != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Shard)) - } - if m.Slot != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Slot)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - func (m *Crosslink) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3722,8 +3616,8 @@ func (m *BeaconState) Size() (n int) { if m.Slot != 0 { n += 2 + sovTypes(uint64(m.Slot)) } - if len(m.ValidatorRegistry) > 0 { - for _, e := range m.ValidatorRegistry { + if len(m.Validators) > 0 { + for _, e := range m.Validators { l = e.Size() n += 2 + l + sovTypes(uint64(l)) } @@ -3735,14 +3629,14 @@ func (m *BeaconState) Size() (n int) { } n += 2 + sovTypes(uint64(l)) + l } - if len(m.LatestRandaoMixes) > 0 { - for _, b := range m.LatestRandaoMixes { + if len(m.RandaoMixes) > 0 { + for _, b := range m.RandaoMixes { l = len(b) n += 3 + l + sovTypes(uint64(l)) } } - if m.LatestStartShard != 0 { - n += 3 + sovTypes(uint64(m.LatestStartShard)) + if m.StartShard != 0 { + n += 3 + sovTypes(uint64(m.StartShard)) } if len(m.PreviousEpochAttestations) > 0 { for _, e := range m.PreviousEpochAttestations { @@ -3792,27 +3686,27 @@ func (m *BeaconState) Size() (n int) { n += 3 + l + sovTypes(uint64(l)) } } - if len(m.LatestBlockRoots) > 0 { - for _, b := range m.LatestBlockRoots { + if len(m.BlockRoots) > 0 { + for _, b := range m.BlockRoots { l = len(b) n += 3 + l + sovTypes(uint64(l)) } } - if len(m.LatestStateRoots) > 0 { - for _, b := range m.LatestStateRoots { + if len(m.StateRoots) > 0 { + for _, b := range m.StateRoots { l = len(b) n += 3 + l + sovTypes(uint64(l)) } } - if len(m.LatestActiveIndexRoots) > 0 { - for _, b := range m.LatestActiveIndexRoots { + if len(m.ActiveIndexRoots) > 0 { + for _, b := range m.ActiveIndexRoots { l = len(b) n += 3 + l + sovTypes(uint64(l)) } } - if len(m.LatestSlashedBalances) > 0 { + if len(m.SlashedBalances) > 0 { l = 0 - for _, e := range m.LatestSlashedBalances { + for _, e := range m.SlashedBalances { l += sovTypes(uint64(e)) } n += 3 + sovTypes(uint64(l)) + l @@ -3827,8 +3721,8 @@ func (m *BeaconState) Size() (n int) { n += 3 + l + sovTypes(uint64(l)) } } - if m.LatestEth1Data != nil { - l = m.LatestEth1Data.Size() + if m.Eth1Data != nil { + l = m.Eth1Data.Size() n += 3 + l + sovTypes(uint64(l)) } if len(m.Eth1DataVotes) > 0 { @@ -3837,8 +3731,8 @@ func (m *BeaconState) Size() (n int) { n += 3 + l + sovTypes(uint64(l)) } } - if m.DepositIndex != 0 { - n += 3 + sovTypes(uint64(m.DepositIndex)) + if m.Eth1DepositIndex != 0 { + n += 3 + sovTypes(uint64(m.Eth1DepositIndex)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -4071,27 +3965,6 @@ func (m *Validator) Size() (n int) { return n } -func (m *ShardReassignmentRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ValidatorIndex != 0 { - n += 1 + sovTypes(uint64(m.ValidatorIndex)) - } - if m.Shard != 0 { - n += 1 + sovTypes(uint64(m.Shard)) - } - if m.Slot != 0 { - n += 1 + sovTypes(uint64(m.Slot)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *Crosslink) Size() (n int) { if m == nil { return 0 @@ -4632,7 +4505,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { } case 2001: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorRegistry", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4659,8 +4532,8 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorRegistry = append(m.ValidatorRegistry, &Validator{}) - if err := m.ValidatorRegistry[len(m.ValidatorRegistry)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Validators = append(m.Validators, &Validator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4742,7 +4615,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { } case 3001: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestRandaoMixes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RandaoMixes", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -4769,14 +4642,14 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LatestRandaoMixes = append(m.LatestRandaoMixes, make([]byte, postIndex-iNdEx)) - copy(m.LatestRandaoMixes[len(m.LatestRandaoMixes)-1], dAtA[iNdEx:postIndex]) + m.RandaoMixes = append(m.RandaoMixes, make([]byte, postIndex-iNdEx)) + copy(m.RandaoMixes[len(m.RandaoMixes)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3002: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestStartShard", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StartShard", wireType) } - m.LatestStartShard = 0 + m.StartShard = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -4786,7 +4659,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LatestStartShard |= uint64(b&0x7F) << shift + m.StartShard |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -5107,7 +4980,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5003: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlockRoots", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockRoots", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -5134,12 +5007,12 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LatestBlockRoots = append(m.LatestBlockRoots, make([]byte, postIndex-iNdEx)) - copy(m.LatestBlockRoots[len(m.LatestBlockRoots)-1], dAtA[iNdEx:postIndex]) + m.BlockRoots = append(m.BlockRoots, make([]byte, postIndex-iNdEx)) + copy(m.BlockRoots[len(m.BlockRoots)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5004: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestStateRoots", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StateRoots", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -5166,12 +5039,12 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LatestStateRoots = append(m.LatestStateRoots, make([]byte, postIndex-iNdEx)) - copy(m.LatestStateRoots[len(m.LatestStateRoots)-1], dAtA[iNdEx:postIndex]) + m.StateRoots = append(m.StateRoots, make([]byte, postIndex-iNdEx)) + copy(m.StateRoots[len(m.StateRoots)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5005: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestActiveIndexRoots", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ActiveIndexRoots", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -5198,8 +5071,8 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LatestActiveIndexRoots = append(m.LatestActiveIndexRoots, make([]byte, postIndex-iNdEx)) - copy(m.LatestActiveIndexRoots[len(m.LatestActiveIndexRoots)-1], dAtA[iNdEx:postIndex]) + m.ActiveIndexRoots = append(m.ActiveIndexRoots, make([]byte, postIndex-iNdEx)) + copy(m.ActiveIndexRoots[len(m.ActiveIndexRoots)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5006: if wireType == 0 { @@ -5218,7 +5091,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { break } } - m.LatestSlashedBalances = append(m.LatestSlashedBalances, v) + m.SlashedBalances = append(m.SlashedBalances, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5253,8 +5126,8 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.LatestSlashedBalances) == 0 { - m.LatestSlashedBalances = make([]uint64, 0, elementCount) + if elementCount != 0 && len(m.SlashedBalances) == 0 { + m.SlashedBalances = make([]uint64, 0, elementCount) } for iNdEx < postIndex { var v uint64 @@ -5272,10 +5145,10 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { break } } - m.LatestSlashedBalances = append(m.LatestSlashedBalances, v) + m.SlashedBalances = append(m.SlashedBalances, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field LatestSlashedBalances", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SlashedBalances", wireType) } case 5007: if wireType != 2 { @@ -5347,7 +5220,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6001: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestEth1Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Eth1Data", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5374,10 +5247,10 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.LatestEth1Data == nil { - m.LatestEth1Data = &Eth1Data{} + if m.Eth1Data == nil { + m.Eth1Data = &Eth1Data{} } - if err := m.LatestEth1Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Eth1Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5417,9 +5290,9 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6003: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Eth1DepositIndex", wireType) } - m.DepositIndex = 0 + m.Eth1DepositIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5429,7 +5302,7 @@ func (m *BeaconState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DepositIndex |= uint64(b&0x7F) << shift + m.Eth1DepositIndex |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -6948,117 +6821,6 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } return nil } -func (m *ShardReassignmentRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ShardReassignmentRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ShardReassignmentRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorIndex", wireType) - } - m.ValidatorIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidatorIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Shard", wireType) - } - m.Shard = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Shard |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) - } - m.Slot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Slot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Crosslink) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/proto/beacon/p2p/v1/types.proto b/proto/beacon/p2p/v1/types.proto index 50cb1a1999..b0636212f0 100644 --- a/proto/beacon/p2p/v1/types.proto +++ b/proto/beacon/p2p/v1/types.proto @@ -11,13 +11,13 @@ message BeaconState { uint64 slot = 1003; // Validator registry [2001-3000] - repeated Validator validator_registry = 2001; + repeated Validator validators = 2001; // Balances in Gwei repeated uint64 balances = 2002; // Randomness and committees [3001-4000] - repeated bytes latest_randao_mixes = 3001; - uint64 latest_start_shard = 3002; + repeated bytes randao_mixes = 3001; + uint64 start_shard = 3002; // Finality [4001-5000] repeated PendingAttestation previous_epoch_attestations = 4001; @@ -33,17 +33,17 @@ message BeaconState { // Recent state [5001-6000] repeated Crosslink current_crosslinks = 5001; repeated Crosslink previous_crosslinks = 5002; - repeated bytes latest_block_roots = 5003; - repeated bytes latest_state_roots = 5004; - repeated bytes latest_active_index_roots = 5005; - repeated uint64 latest_slashed_balances = 5006; + repeated bytes block_roots = 5003; + repeated bytes state_roots = 5004; + repeated bytes active_index_roots = 5005; + repeated uint64 slashed_balances = 5006; BeaconBlockHeader latest_block_header = 5007; repeated bytes historical_roots = 5008; // Ethereum 1.0 chain data [6001-7000] - Eth1Data latest_eth1_data = 6001; + Eth1Data eth1_data = 6001; repeated Eth1Data eth1_data_votes = 6002; - uint64 deposit_index = 6003; + uint64 eth1_deposit_index = 6003; } message Fork { @@ -117,12 +117,6 @@ message Validator { uint64 effective_balance = 8; } -message ShardReassignmentRecord { - uint64 validator_index = 1; - uint64 shard = 2; - uint64 slot = 3; -} - message Crosslink { uint64 shard = 1; uint64 start_epoch = 2; @@ -239,4 +233,3 @@ message HistoricalBatch { repeated bytes block_roots = 1; repeated bytes state_roots = 2; } - diff --git a/proto/beacon/rpc/v1/services.pb.go b/proto/beacon/rpc/v1/services.pb.go index 516906bc3d..5800aa0c39 100755 --- a/proto/beacon/rpc/v1/services.pb.go +++ b/proto/beacon/rpc/v1/services.pb.go @@ -7,15 +7,14 @@ import ( context "context" encoding_binary "encoding/binary" fmt "fmt" - io "io" - math "math" - proto "github.com/gogo/protobuf/proto" types "github.com/gogo/protobuf/types" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" v1 "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + io "io" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/beacon/rpc/v1_gateway/services.pb.go b/proto/beacon/rpc/v1_gateway/services.pb.go index 920033ea74..6a9ba530b7 100755 --- a/proto/beacon/rpc/v1_gateway/services.pb.go +++ b/proto/beacon/rpc/v1_gateway/services.pb.go @@ -6,14 +6,13 @@ package ethereum_beacon_rpc_v1 import ( context "context" fmt "fmt" - math "math" - proto "github.com/golang/protobuf/proto" empty "github.com/golang/protobuf/ptypes/empty" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" v1 "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/sharding/p2p/v1/messages.pb.go b/proto/sharding/p2p/v1/messages.pb.go index 61228b93de..ba268c5f4b 100644 --- a/proto/sharding/p2p/v1/messages.pb.go +++ b/proto/sharding/p2p/v1/messages.pb.go @@ -5,10 +5,9 @@ package ethereum_sharding_p2p_v1 import ( fmt "fmt" + proto "github.com/gogo/protobuf/proto" io "io" math "math" - - proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/shared/params/config.go b/shared/params/config.go index ebbffd9788..dacaef8662 100644 --- a/shared/params/config.go +++ b/shared/params/config.go @@ -49,9 +49,9 @@ type BeaconChainConfig struct { Eth1FollowDistance uint64 // Eth1FollowDistance is the number of eth1.0 blocks to wait before considering a new deposit for voting. This only applies after the chain as been started. // State list lengths - LatestRandaoMixesLength uint64 `yaml:"LATEST_RANDAO_MIXES_LENGTH"` // LatestRandaoMixesLength is the number of randao mixes kept in the beacon state. - LatestActiveIndexRootsLength uint64 `yaml:"LATEST_ACTIVE_INDEX_ROOTS_LENGTH"` // LatestIndexRootsLength is the number of index roots kept in beacon state, used by light client. - LatestSlashedExitLength uint64 `yaml:"LATEST_SLASHED_EXIT_LENGTH"` // LatestSlashedExitLength is used to track penalized exit balances per time interval. + RandaoMixesLength uint64 `yaml:"LATEST_RANDAO_MIXES_LENGTH"` // RandaoMixesLength is the number of randao mixes kept in the beacon state. + ActiveIndexRootsLength uint64 `yaml:"LATEST_ACTIVE_INDEX_ROOTS_LENGTH"` // ActiveIndexRootsLength is the number of index roots kept in beacon state, used by light client. + SlashedExitLength uint64 `yaml:"LATEST_SLASHED_EXIT_LENGTH"` // SlashedExitLength is used to track penalized exit balances per time interval. // Reward and penalty quotients constants. BaseRewardFactor uint64 `yaml:"BASE_REWARD_FACTOR"` // BaseRewardFactor is used to calculate validator per-slot interest rate. @@ -150,9 +150,9 @@ var defaultBeaconConfig = &BeaconChainConfig{ Eth1FollowDistance: 1024, // State list length constants. - LatestRandaoMixesLength: 8192, - LatestActiveIndexRootsLength: 8192, - LatestSlashedExitLength: 8192, + RandaoMixesLength: 8192, + ActiveIndexRootsLength: 8192, + SlashedExitLength: 8192, // Reward and penalty quotients constants. BaseRewardFactor: 32, @@ -238,9 +238,9 @@ func DemoBeaconConfig() *BeaconChainConfig { demoConfig.SyncPollingInterval = 1 * 10 // Query nodes over the network every slot. demoConfig.Eth1FollowDistance = 5 demoConfig.SlotsPerEth1VotingPeriod = 1 - demoConfig.LatestRandaoMixesLength = 5 * demoConfig.SlotsPerEpoch - demoConfig.LatestActiveIndexRootsLength = 5 * demoConfig.SlotsPerEpoch - demoConfig.LatestSlashedExitLength = 5 * demoConfig.SlotsPerEpoch + demoConfig.RandaoMixesLength = 5 * demoConfig.SlotsPerEpoch + demoConfig.ActiveIndexRootsLength = 5 * demoConfig.SlotsPerEpoch + demoConfig.SlashedExitLength = 5 * demoConfig.SlotsPerEpoch demoConfig.SlotsPerHistoricalRoot = 5 * demoConfig.SlotsPerEpoch return &demoConfig @@ -275,9 +275,9 @@ func MinimalSpecConfig() *BeaconChainConfig { minimalConfig.PersistentCommitteePeriod = 2048 minimalConfig.MaxEpochsPerCrosslink = 64 minimalConfig.MinEpochsToInactivityPenalty = 4 - minimalConfig.LatestRandaoMixesLength = 64 - minimalConfig.LatestActiveIndexRootsLength = 64 - minimalConfig.LatestSlashedExitLength = 64 + minimalConfig.RandaoMixesLength = 64 + minimalConfig.ActiveIndexRootsLength = 64 + minimalConfig.SlashedExitLength = 64 minimalConfig.BaseRewardFactor = 32 minimalConfig.WhistleBlowingRewardQuotient = 512 minimalConfig.ProposerRewardQuotient = 8