diff --git a/beacon-chain/chaintest/backend/simulated_backend.go b/beacon-chain/chaintest/backend/simulated_backend.go index fc0611d00f..ed434ec9da 100644 --- a/beacon-chain/chaintest/backend/simulated_backend.go +++ b/beacon-chain/chaintest/backend/simulated_backend.go @@ -69,7 +69,7 @@ func (sb *SimulatedBackend) RunChainTest(testCase *ChainTestCase) error { validators := make([]*pb.ValidatorRecord, testCase.Config.ValidatorCount) for i := uint64(0); i < testCase.Config.ValidatorCount; i++ { validators[i] = &pb.ValidatorRecord{ - Status: pb.ValidatorRecord_ACTIVE, + ExitSlot: params.BeaconConfig().EntryExitDelay, Balance: c.MaxDeposit * c.Gwei, Pubkey: []byte{}, RandaoCommitmentHash32: randaoReveal[:], diff --git a/beacon-chain/core/attestations/attestation.go b/beacon-chain/core/attestations/attestation.go index 4d9582677d..2e7f2164ae 100644 --- a/beacon-chain/core/attestations/attestation.go +++ b/beacon-chain/core/attestations/attestation.go @@ -48,7 +48,7 @@ func VerifyProposerAttestation(att *pb.AttestationData, pubKey [32]byte, propose att.Slot, proposerShardID, att.JustifiedSlot, - params.BeaconConfig().InitialForkVersion, + params.BeaconConfig().GenesisForkVersion, ) _ = attestationMsg _ = pubKey diff --git a/beacon-chain/core/balances/rewards_penalties.go b/beacon-chain/core/balances/rewards_penalties.go index 2d7fe060d4..7c8964c417 100644 --- a/beacon-chain/core/balances/rewards_penalties.go +++ b/beacon-chain/core/balances/rewards_penalties.go @@ -85,7 +85,7 @@ func FFGSrcRewardsPenalties( totalBalance } - allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) didNotAttestIndices := slices.Not(justifiedAttesterIndices, allValidatorIndices) for _, index := range didNotAttestIndices { @@ -122,7 +122,7 @@ func FFGTargetRewardsPenalties( totalBalance } - allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) didNotAttestIndices := slices.Not(boundaryAttesterIndices, allValidatorIndices) for _, index := range didNotAttestIndices { @@ -159,7 +159,7 @@ func ChainHeadRewardsPenalties( totalBalance } - allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) didNotAttestIndices := slices.Not(headAttesterIndices, allValidatorIndices) for _, index := range didNotAttestIndices { @@ -211,7 +211,7 @@ func InactivityFFGSrcPenalties( epochsSinceFinality uint64) *pb.BeaconState { baseRewardQuotient := baseRewardQuotient(totalBalance) - allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) didNotAttestIndices := slices.Not(justifiedAttesterIndices, allValidatorIndices) for _, index := range didNotAttestIndices { @@ -235,7 +235,7 @@ func InactivityFFGTargetPenalties( epochsSinceFinality uint64) *pb.BeaconState { baseRewardQuotient := baseRewardQuotient(totalBalance) - allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) didNotAttestIndices := slices.Not(boundaryAttesterIndices, allValidatorIndices) for _, index := range didNotAttestIndices { @@ -258,7 +258,7 @@ func InactivityHeadPenalties( totalBalance uint64) *pb.BeaconState { baseRewardQuotient := baseRewardQuotient(totalBalance) - allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + allValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) didNotAttestIndices := slices.Not(headAttesterIndices, allValidatorIndices) for _, index := range didNotAttestIndices { @@ -272,19 +272,19 @@ func InactivityHeadPenalties( // to inactive validators with status EXITED_WITH_PENALTY. // // Spec pseudocode definition: -// Any validator index with status == EXITED_WITH_PENALTY, +// Any active_validator index with validator.penalized_slot <= state.slot, // loses 2 * inactivity_penalty(state, index, epochs_since_finality) + -// base_reward(state, index) +// base_reward(state, index). func InactivityExitedPenalties( state *pb.BeaconState, totalBalance uint64, epochsSinceFinality uint64) *pb.BeaconState { baseRewardQuotient := baseRewardQuotient(totalBalance) - allValidatorIndices := validators.AllValidatorsIndices(state) + activeValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) - for _, index := range allValidatorIndices { - if state.ValidatorRegistry[index].Status == pb.ValidatorRecord_EXITED_WITH_PENALTY { + for _, index := range activeValidatorIndices { + if state.ValidatorRegistry[index].PenalizedSlot <= state.Slot { state.ValidatorBalances[index] -= 2*inactivityPenalty(state, index, baseRewardQuotient, epochsSinceFinality) + baseReward(state, index, baseRewardQuotient) diff --git a/beacon-chain/core/balances/rewards_penalties_test.go b/beacon-chain/core/balances/rewards_penalties_test.go index 81b04db7bd..3e205000d9 100644 --- a/beacon-chain/core/balances/rewards_penalties_test.go +++ b/beacon-chain/core/balances/rewards_penalties_test.go @@ -103,10 +103,10 @@ func TestFFGSrcRewardsPenalties(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, }, ValidatorBalances: validatorBalances, } @@ -142,10 +142,10 @@ func TestFFGTargetRewardsPenalties(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, }, ValidatorBalances: validatorBalances, } @@ -181,10 +181,10 @@ func TestChainHeadRewardsPenalties(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, }, ValidatorBalances: validatorBalances, } @@ -297,10 +297,10 @@ func TestInactivityFFGSrcPenalty(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, }, ValidatorBalances: validatorBalances, } @@ -336,10 +336,10 @@ func TestInactivityFFGTargetPenalty(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, }, ValidatorBalances: validatorBalances, } @@ -372,10 +372,10 @@ func TestInactivityHeadPenalty(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, }, ValidatorBalances: validatorBalances, } @@ -407,10 +407,10 @@ func TestInactivityExitedPenality(t *testing.T) { } state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_EXITED_WITH_PENALTY}, - {Status: pb.ValidatorRecord_EXITED_WITH_PENALTY}, - {Status: pb.ValidatorRecord_EXITED_WITH_PENALTY}, - {Status: pb.ValidatorRecord_EXITED_WITH_PENALTY}}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}}, ValidatorBalances: validatorBalances, } state = InactivityExitedPenalties( diff --git a/beacon-chain/core/blocks/block.go b/beacon-chain/core/blocks/block.go index f3d346c318..59a0ae46a8 100644 --- a/beacon-chain/core/blocks/block.go +++ b/beacon-chain/core/blocks/block.go @@ -29,7 +29,7 @@ func Hash(block *pb.BeaconBlock) ([32]byte, error) { // NewGenesisBlock returns the canonical, genesis block for the beacon chain protocol. func NewGenesisBlock(stateRoot []byte) *pb.BeaconBlock { block := &pb.BeaconBlock{ - Slot: params.BeaconConfig().InitialSlotNumber, + Slot: params.BeaconConfig().GenesisSlot, ParentRootHash32: params.BeaconConfig().ZeroHash[:], StateRootHash32: stateRoot, RandaoRevealHash32: params.BeaconConfig().ZeroHash[:], @@ -148,7 +148,7 @@ func EncodeDepositData( return nil, fmt.Errorf("failed to encode deposit input: %v", err) } encodedInput := wBuf.Bytes() - depositData := make([]byte,0,16+len(encodedInput)) + depositData := make([]byte, 0, 16+len(encodedInput)) value := make([]byte, 8) binary.BigEndian.PutUint64(value, depositValue) diff --git a/beacon-chain/core/blocks/block_operations.go b/beacon-chain/core/blocks/block_operations.go index 3ad722a986..dc8903a34c 100644 --- a/beacon-chain/core/blocks/block_operations.go +++ b/beacon-chain/core/blocks/block_operations.go @@ -3,7 +3,6 @@ package blocks import ( "bytes" "encoding/binary" - "errors" "fmt" "reflect" @@ -126,8 +125,8 @@ func verifyBlockRandao(proposer *pb.ValidatorRecord, block *pb.BeaconBlock) erro // Verify that proposer_slashing.proposal_data_1.slot == proposer_slashing.proposal_data_2.slot. // Verify that proposer_slashing.proposal_data_1.shard == proposer_slashing.proposal_data_2.shard. // Verify that proposer_slashing.proposal_data_1.block_root != proposer_slashing.proposal_data_2.block_root. -// Verify that proposer.status != EXITED_WITH_PENALTY. -// Run update_validator_status(state, proposer_slashing.proposer_index, new_status=EXITED_WITH_PENALTY). +// Verify that validator.penalized_slot > state.slot. +// Run penalize_validator(state, proposer_slashing.proposer_index). func ProcessProposerSlashings( beaconState *pb.BeaconState, block *pb.BeaconBlock, @@ -141,26 +140,20 @@ func ProcessProposerSlashings( params.BeaconConfig().MaxProposerSlashings, ) } - for idx, slashing := range body.ProposerSlashings { - if err := verifyProposerSlashing(slashing); err != nil { + var err error + for idx, slashing := range body.GetProposerSlashings() { + if err = verifyProposerSlashing(slashing); err != nil { return nil, fmt.Errorf("could not verify proposer slashing #%d: %v", idx, err) } - proposer := registry[slashing.ProposerIndex] - if proposer.Status != pb.ValidatorRecord_EXITED_WITH_PENALTY { - // TODO(#781): Replace with - // update_validator_status( - // state, - // proposer_slashing.proposer_index, - // new_status=EXITED_WITH_PENALTY, - // ) after update_validator_status is implemented. - registry[slashing.ProposerIndex] = v.ExitValidator( - proposer, - beaconState.Slot, - true, /* penalize */ - ) + proposer := registry[slashing.GetProposerIndex()] + if proposer.GetPenalizedSlot() > beaconState.Slot { + beaconState, err = v.PenalizeValidator(beaconState, slashing.ProposerIndex) + if err != nil { + return nil, fmt.Errorf("could not penalize proposer index %d: %v", + slashing.ProposerIndex, err) + } } } - beaconState.ValidatorRegistry = registry return beaconState, nil } @@ -215,9 +208,8 @@ func verifyProposerSlashing( // casper_slashing.votes_2.data.slot < casper_slashing.votes_1.data.slot // or casper_slashing.votes_1.data.slot == casper_slashing.votes_2.data.slot. // For each validator index i in intersection, -// if state.validator_registry[i].status does not equal -// EXITED_WITH_PENALTY, then run -// update_validator_status(state, i, new_status=EXITED_WITH_PENALTY) +// if state.validator_registry[i].penalized_slot > state.slot, then +// run penalize_validator(state, i) func ProcessCasperSlashings( beaconState *pb.BeaconState, block *pb.BeaconBlock, @@ -241,21 +233,15 @@ func ProcessCasperSlashings( } for _, validatorIndex := range validatorIndices { penalizedValidator := registry[validatorIndex] - if penalizedValidator.Status != pb.ValidatorRecord_EXITED_WITH_PENALTY { - // TODO(#781): Replace with update_validator_status( - // state, - // validatorIndex, - // new_status=EXITED_WITH_PENALTY, - // ) after update_validator_status is implemented. - registry[validatorIndex] = v.ExitValidator( - penalizedValidator, - beaconState.Slot, - true, /* penalize */ - ) + if penalizedValidator.GetPenalizedSlot() > beaconState.Slot { + beaconState, err = v.PenalizeValidator(beaconState, validatorIndex) + if err != nil { + return nil, fmt.Errorf("could not penalize validator index %d: %v", + validatorIndex, err) + } } } } - beaconState.ValidatorRegistry = registry return beaconState, nil } @@ -582,7 +568,7 @@ func ProcessValidatorDeposits( // depositTimestamp [8]byte. depositValue := depositData[len(depositData)-16 : len(depositData)-8] // We then mutate the beacon state with the verified validator deposit. - beaconState, _, err = v.ProcessDeposit( + beaconState, err = v.ProcessDeposit( beaconState, depositInput.Pubkey, binary.BigEndian.Uint64(depositValue), @@ -672,7 +658,7 @@ func verifyDeposit(beaconState *pb.BeaconState, deposit *pb.Deposit) error { // // For each exit in block.body.exits: // Let validator = state.validator_registry[exit.validator_index]. -// Verify that validator.status == ACTIVE. +// Verify that validator.exit_slot > state.slot + ENTRY_EXIT_DELAY. // Verify that state.slot >= exit.slot. // Verify that state.slot >= validator.latest_status_change_slot + // SHARD_PERSISTENT_COMMITTEE_CHANGE_PERIOD. @@ -682,8 +668,8 @@ func verifyDeposit(beaconState *pb.BeaconState, deposit *pb.Deposit) error { // signature=exit.signature, // domain=get_domain(state.fork_data, exit.slot, DOMAIN_EXIT), // ) -// Run update_validator_status( -// state, exit.validator_index, new_status=ACTIVE_PENDING_EXIT, +// Run initiate_validator_exit( +// state, exit.validator_index, // ) func ProcessValidatorExits( beaconState *pb.BeaconState, @@ -697,33 +683,24 @@ func ProcessValidatorExits( params.BeaconConfig().MaxExits, ) } + validatorRegistry := beaconState.ValidatorRegistry for idx, exit := range exits { if err := verifyExit(beaconState, exit); err != nil { return nil, fmt.Errorf("could not verify exit #%d: %v", idx, err) } - // TODO(#781): Replace with update_validator_status( - // state, - // validatorIndex, - // new_status=ACTIVE_PENDING_EXIT, - // ) after update_validator_status is implemented. - validator := validatorRegistry[exit.ValidatorIndex] - validatorRegistry[exit.ValidatorIndex] = v.ExitValidator( - validator, - beaconState.Slot, - true, /* penalize */ - ) + beaconState = v.InitiateValidatorExit(beaconState, exit.GetValidatorIndex()) } beaconState.ValidatorRegistry = validatorRegistry return beaconState, nil } func verifyExit(beaconState *pb.BeaconState, exit *pb.Exit) error { - validator := beaconState.ValidatorRegistry[exit.ValidatorIndex] - if validator.Status != pb.ValidatorRecord_ACTIVE { + validator := beaconState.GetValidatorRegistry()[exit.GetValidatorIndex()] + if validator.GetExitSlot() <= beaconState.Slot+params.BeaconConfig().EntryExitDelay { return fmt.Errorf( - "expected validator to have active status, received %v", - validator.Status, + "expected exit.Slot > state.Slot + EntryExitDelay, received %d < %d", + validator.GetExitSlot(), beaconState.Slot+params.BeaconConfig().EntryExitDelay, ) } if beaconState.Slot < exit.Slot { @@ -733,13 +710,6 @@ func verifyExit(beaconState *pb.BeaconState, exit *pb.Exit) error { exit.Slot, ) } - persistentCommitteeSlot := validator.LatestStatusChangeSlot + - params.BeaconConfig().ShardPersistentCommitteeChangePeriod - if beaconState.Slot < persistentCommitteeSlot { - return errors.New( - "expected validator.LatestStatusChangeSlot + PersistentCommitteePeriod >= state.Slot", - ) - } // TODO(#258): Verify using BLS signature verification below: // Verify that bls_verify( // pubkey=validator.pubkey, diff --git a/beacon-chain/core/blocks/block_operations_test.go b/beacon-chain/core/blocks/block_operations_test.go index d4ca49328e..8452b5c40e 100644 --- a/beacon-chain/core/blocks/block_operations_test.go +++ b/beacon-chain/core/blocks/block_operations_test.go @@ -312,14 +312,22 @@ func TestProcessProposerSlashings_UnmatchedBlockRoots(t *testing.T) { func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { // We test the case when data is correct and verify the validator // registry has been updated. + var shardAndCommittees []*pb.ShardAndCommitteeArray + for i := uint64(0); i < params.BeaconConfig().EpochLength*2; i++ { + shardAndCommittees = append(shardAndCommittees, &pb.ShardAndCommitteeArray{ + ArrayShardAndCommittee: []*pb.ShardAndCommittee{ + {Committee: []uint32{0, 1, 2, 3, 4, 5, 6, 7}}, + }, + }) + } registry := []*pb.ValidatorRecord{ { - Status: pb.ValidatorRecord_ACTIVE, - LatestStatusChangeSlot: 0, + ExitSlot: params.BeaconConfig().FarFutureSlot, + PenalizedSlot: 2, }, { - Status: pb.ValidatorRecord_ACTIVE, - LatestStatusChangeSlot: 0, + ExitSlot: params.BeaconConfig().FarFutureSlot, + PenalizedSlot: 2, }, } slashings := []*pb.ProposerSlashing{ @@ -341,6 +349,10 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { beaconState := &pb.BeaconState{ ValidatorRegistry: registry, Slot: currentSlot, + ValidatorBalances: []uint64{params.BeaconConfig().MaxDepositInGwei, + params.BeaconConfig().MaxDepositInGwei}, + LatestPenalizedExitBalances: []uint64{0}, + ShardAndCommitteesAtSlots: shardAndCommittees, } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -356,8 +368,10 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { if err != nil { t.Fatalf("Unexpected error: %s", err) } - if registry[1].Status != pb.ValidatorRecord_EXITED_WITH_PENALTY { - t.Errorf("Proposer with index 1 did not ExitWithPenalty in validator registry: %v", registry[1].Status) + if registry[1].ExitSlot != + beaconState.Slot+params.BeaconConfig().EntryExitDelay { + t.Errorf("Proposer with index 1 did not correctly exit,"+"wanted slot:%d, got:%d", + beaconState.Slot+params.BeaconConfig().EntryExitDelay, registry[1].ExitSlot) } } @@ -666,14 +680,22 @@ func TestProcessCasperSlashings_EmptyVoteIndexIntersection(t *testing.T) { func TestProcessCasperSlashings_AppliesCorrectStatus(t *testing.T) { // We test the case when data is correct and verify the validator // registry has been updated. + var shardAndCommittees []*pb.ShardAndCommitteeArray + for i := uint64(0); i < params.BeaconConfig().EpochLength*2; i++ { + shardAndCommittees = append(shardAndCommittees, &pb.ShardAndCommitteeArray{ + ArrayShardAndCommittee: []*pb.ShardAndCommittee{ + {Committee: []uint32{0, 1, 2, 3, 4, 5, 6, 7}}, + }, + }) + } registry := []*pb.ValidatorRecord{ { - Status: pb.ValidatorRecord_ACTIVE, - LatestStatusChangeSlot: 0, + ExitSlot: params.BeaconConfig().FarFutureSlot, + PenalizedSlot: 6, }, { - Status: pb.ValidatorRecord_ACTIVE, - LatestStatusChangeSlot: 0, + ExitSlot: params.BeaconConfig().FarFutureSlot, + PenalizedSlot: 6, }, } @@ -702,8 +724,11 @@ func TestProcessCasperSlashings_AppliesCorrectStatus(t *testing.T) { currentSlot := uint64(5) beaconState := &pb.BeaconState{ - ValidatorRegistry: registry, - Slot: currentSlot, + ValidatorRegistry: registry, + Slot: currentSlot, + ValidatorBalances: []uint64{32, 32, 32, 32, 32, 32}, + LatestPenalizedExitBalances: []uint64{0}, + ShardAndCommitteesAtSlots: shardAndCommittees, } block := &pb.BeaconBlock{ Body: &pb.BeaconBlockBody{ @@ -720,23 +745,23 @@ func TestProcessCasperSlashings_AppliesCorrectStatus(t *testing.T) { newRegistry := newState.ValidatorRegistry // Given the intersection of slashable indices is [1], only validator - // at index 1 should be penalized and change Status. We confirm this below. - if newRegistry[1].Status != pb.ValidatorRecord_EXITED_WITH_PENALTY { + // at index 1 should be penalized and exited. We confirm this below. + if newRegistry[1].ExitSlot != params.BeaconConfig().EntryExitDelay+currentSlot { t.Errorf( ` - Expected validator at index 1's status to change to - EXITED_WITH_PENALTY, received %v instead + Expected validator at index 1's exit slot to change to + %d, received %d instead `, - newRegistry[1].Status, + params.BeaconConfig().EntryExitDelay+currentSlot, newRegistry[1].ExitSlot, ) } - if newRegistry[0].Status != pb.ValidatorRecord_ACTIVE { + if newRegistry[0].ExitSlot != params.BeaconConfig().FarFutureSlot { t.Errorf( ` - Expected validator at index 0's status to remain - ACTIVE, received %v instead + Expected validator at index 0's exit slot to not change, + received %d instead `, - newRegistry[1].Status, + newRegistry[0].ExitSlot, ) } } @@ -1360,8 +1385,8 @@ func TestProcessValidatorDeposits_ProcessDepositHelperFuncFails(t *testing.T) { // the one specified in the deposit input, causing a failure. registry := []*pb.ValidatorRecord{ { - Pubkey: []byte{1}, - WithdrawalCredentials: []byte{4, 5, 6}, + Pubkey: []byte{1}, + WithdrawalCredentialsHash32: []byte{4, 5, 6}, }, } balances := []uint64{0} @@ -1447,8 +1472,8 @@ func TestProcessValidatorDeposits_ProcessCorrectly(t *testing.T) { } registry := []*pb.ValidatorRecord{ { - Pubkey: []byte{1}, - WithdrawalCredentials: []byte{1, 2, 3}, + Pubkey: []byte{1}, + WithdrawalCredentialsHash32: []byte{1, 2, 3}, }, } balances := []uint64{0} @@ -1509,7 +1534,7 @@ func TestProcessValidatorExits_ValidatorNotActive(t *testing.T) { } registry := []*pb.ValidatorRecord{ { - Status: pb.ValidatorRecord_EXITED_WITH_PENALTY, + ExitSlot: 0, }, } state := &pb.BeaconState{ @@ -1522,8 +1547,8 @@ func TestProcessValidatorExits_ValidatorNotActive(t *testing.T) { } want := fmt.Sprintf( - "expected validator to have active status, received %v", - pb.ValidatorRecord_EXITED_WITH_PENALTY, + "expected exit.Slot > state.Slot + EntryExitDelay, received 0 < %d", + params.BeaconConfig().EntryExitDelay, ) if _, err := ProcessValidatorExits( @@ -1542,7 +1567,7 @@ func TestProcessValidatorExits_InvalidExitSlot(t *testing.T) { } registry := []*pb.ValidatorRecord{ { - Status: pb.ValidatorRecord_ACTIVE, + ExitSlot: params.BeaconConfig().FarFutureSlot, }, } state := &pb.BeaconState{ @@ -1578,8 +1603,7 @@ func TestProcessValidatorExits_InvalidStatusChangeSlot(t *testing.T) { } registry := []*pb.ValidatorRecord{ { - Status: pb.ValidatorRecord_ACTIVE, - LatestStatusChangeSlot: 100, + ExitSlot: 1, }, } state := &pb.BeaconState{ @@ -1592,7 +1616,7 @@ func TestProcessValidatorExits_InvalidStatusChangeSlot(t *testing.T) { }, } - want := "expected validator.LatestStatusChangeSlot + PersistentCommitteePeriod >= state.Slot" + want := "expected exit.Slot > state.Slot + EntryExitDelay" if _, err := ProcessValidatorExits( state, block, @@ -1610,8 +1634,7 @@ func TestProcessValidatorExits_AppliesCorrectStatus(t *testing.T) { } registry := []*pb.ValidatorRecord{ { - Status: pb.ValidatorRecord_ACTIVE, - LatestStatusChangeSlot: 0, + ExitSlot: params.BeaconConfig().FarFutureSlot, }, } state := &pb.BeaconState{ @@ -1627,8 +1650,8 @@ func TestProcessValidatorExits_AppliesCorrectStatus(t *testing.T) { if err != nil { t.Fatalf("Could not process exits: %v", err) } - newRegistry := newState.ValidatorRegistry - if newRegistry[0].Status == pb.ValidatorRecord_ACTIVE { - t.Error("Expected validator status to change, remained ACTIVE") + newRegistry := newState.GetValidatorRegistry() + if newRegistry[0].StatusFlags == pb.ValidatorRecord_INITIAL { + t.Error("Expected validator status to change, remained INITIAL") } } diff --git a/beacon-chain/core/epoch/epoch_processing.go b/beacon-chain/core/epoch/epoch_processing.go index 81c08bfe8d..0d640994f3 100644 --- a/beacon-chain/core/epoch/epoch_processing.go +++ b/beacon-chain/core/epoch/epoch_processing.go @@ -178,15 +178,15 @@ func ProcessCrosslinks( // """ // for index in active_validator_indices(state.validator_registry): // if state.validator_balances[index] < EJECTION_BALANCE: -// update_validator_status(state, index, new_status=EXITED_WITHOUT_PENALTY) +// exit_validator(state, index) func ProcessEjections(state *pb.BeaconState) (*pb.BeaconState, error) { var err error - activeValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry) + activeValidatorIndices := validators.ActiveValidatorIndices(state.ValidatorRegistry, state.Slot) for _, index := range activeValidatorIndices { if state.ValidatorBalances[index] < params.BeaconConfig().EjectionBalanceInGwei { - state, err = validators.UpdateStatus(state, index, pb.ValidatorRecord_EXITED_WITHOUT_PENALTY) + state, err = validators.ExitValidator(state, index) if err != nil { - return nil, fmt.Errorf("could not update validator status: %v", err) + return nil, fmt.Errorf("could not exit validator %d: %v", index, err) } } } @@ -197,17 +197,17 @@ func ProcessEjections(state *pb.BeaconState) (*pb.BeaconState, error) { // reshuffles shard committees and returns the recomputed state. // // Spec pseudocode definition: -// Set state.validator_registry_latest_change_slot = state.slot. // Set state.shard_committees_at_slots[:EPOCH_LENGTH] = state.shard_committees_at_slots[EPOCH_LENGTH:]. // Set state.shard_committees_at_slots[EPOCH_LENGTH:] = -// get_new_shuffling(state.latest_randao_mixes[(state.slot - EPOCH_LENGTH) % -// LATEST_RANDAO_MIXES_LENGTH], state.validator_registry, next_start_shard) +// get_new_shuffling(state.latest_randao_mixes[(state.slot - SEED_LOOKAHEAD) % +// LATEST_RANDAO_MIXES_LENGTH], state.validator_registry, next_start_shard, state.slot) // where next_start_shard = (state.shard_committees_at_slots[-1][-1].shard + 1) % SHARD_COUNT func ProcessValidatorRegistry( state *pb.BeaconState) (*pb.BeaconState, error) { epochLength := int(params.BeaconConfig().EpochLength) randaoMixesLength := params.BeaconConfig().LatestRandaoMixesLength + seedLookahead := params.BeaconConfig().SeedLookahead shardCount := params.BeaconConfig().ShardCount shardCommittees := state.ShardAndCommitteesAtSlots @@ -217,9 +217,9 @@ func ProcessValidatorRegistry( shardCount var randaoHash32 [32]byte - copy(randaoHash32[:], state.LatestRandaoMixesHash32S[(state.Slot-uint64(epochLength))%randaoMixesLength]) + copy(randaoHash32[:], state.LatestRandaoMixesHash32S[(state.Slot- + uint64(seedLookahead))%randaoMixesLength]) - state.ValidatorRegistryLastChangeSlot = state.Slot for i := 0; i < epochLength; i++ { state.ShardAndCommitteesAtSlots[i] = state.ShardAndCommitteesAtSlots[epochLength+i] } @@ -227,6 +227,7 @@ func ProcessValidatorRegistry( randaoHash32, state.ValidatorRegistry, nextStartShard, + state.Slot, ) if err != nil { return nil, fmt.Errorf("could not shuffle validator registry for commtitees: %v", err) @@ -243,20 +244,21 @@ func ProcessValidatorRegistry( // validator registry update did not happen. // // Spec pseudocode definition: -// Set state.shard_committees_at_slots[:EPOCH_LENGTH] = state.shard_committees_at_slots[EPOCH_LENGTH:]. -// Let epochs_since_last_registry_change = (state.slot - state.validator_registry_latest_change_slot) // EPOCH_LENGTH. -// Let start_shard = state.shard_committees_at_slots[0][0].shard. +// Set state.shard_committees_at_slots[:EPOCH_LENGTH] = state.shard_committees_at_slots[EPOCH_LENGTH:] +// Let epochs_since_last_registry_change = +// (state.slot - state.validator_registry_latest_change_slot) // EPOCH_LENGTH // If epochs_since_last_registry_change is an exact power of 2: -// Set state.shard_committees_at_slots[EPOCH_LENGTH:] = -// get_new_shuffling(state.latest_randao_mixes[(state.slot - EPOCH_LENGTH) % -// LATEST_RANDAO_MIXES_LENGTH], state.validator_registry, start_shard) +// state.shard_committees_at_slots[EPOCH_LENGTH:] = +// get_shuffling(state.latest_randao_mixes[(state.slot - SEED_LOOKAHEAD) +// % LATEST_RANDAO_MIXES_LENGTH], state.validator_registry, start_shard, state.slot) func ProcessPartialValidatorRegistry( state *pb.BeaconState) (*pb.BeaconState, error) { epochLength := int(params.BeaconConfig().EpochLength) randaoMixesLength := params.BeaconConfig().LatestRandaoMixesLength + seedLookahead := params.BeaconConfig().SeedLookahead var randaoHash32 [32]byte - copy(randaoHash32[:], state.LatestRandaoMixesHash32S[(state.Slot-uint64(epochLength))%randaoMixesLength]) + copy(randaoHash32[:], state.LatestRandaoMixesHash32S[(state.Slot-uint64(seedLookahead))%randaoMixesLength]) for i := 0; i < epochLength; i++ { state.ShardAndCommitteesAtSlots[i] = state.ShardAndCommitteesAtSlots[epochLength+i] @@ -268,6 +270,7 @@ func ProcessPartialValidatorRegistry( randaoHash32, state.ValidatorRegistry, startShard, + state.Slot, ) if err != nil { return nil, fmt.Errorf("could not shuffle validator registry for commtitees: %v", err) diff --git a/beacon-chain/core/epoch/epoch_processing_test.go b/beacon-chain/core/epoch/epoch_processing_test.go index 8b1557c858..08858bd319 100644 --- a/beacon-chain/core/epoch/epoch_processing_test.go +++ b/beacon-chain/core/epoch/epoch_processing_test.go @@ -307,24 +307,28 @@ func TestProcessEjections_Ok(t *testing.T) { }) } state := &pb.BeaconState{ + Slot: 1, ShardAndCommitteesAtSlots: shardAndCommittees, ValidatorBalances: []uint64{ params.BeaconConfig().EjectionBalanceInGwei - 1, params.BeaconConfig().EjectionBalanceInGwei + 1}, LatestPenalizedExitBalances: []uint64{0}, ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - {Status: pb.ValidatorRecord_ACTIVE}}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}, + {ExitSlot: params.BeaconConfig().FarFutureSlot}}, } state, err := ProcessEjections(state) if err != nil { t.Fatalf("Could not execute ProcessEjections: %v", err) } - if state.ValidatorRegistry[0].Status != pb.ValidatorRecord_EXITED_WITHOUT_PENALTY { - t.Errorf("Expected EXITED_WITHOUT_PENALTY, but got %v", state.ValidatorRegistry[0].Status) + if state.ValidatorRegistry[0].ExitSlot != + params.BeaconConfig().EntryExitDelay+state.Slot { + t.Errorf("Expected exit slot %d, but got %d", + state.ValidatorRegistry[0].ExitSlot, params.BeaconConfig().EntryExitDelay) } - if state.ValidatorRegistry[1].Status != pb.ValidatorRecord_ACTIVE { - t.Errorf("Expected ACTIVE, but got %v", state.ValidatorRegistry[1].Status) + if state.ValidatorRegistry[1].ExitSlot != + params.BeaconConfig().FarFutureSlot { + t.Errorf("Expected exit slot 0, but got %v", state.ValidatorRegistry[1].ExitSlot) } } @@ -390,10 +394,6 @@ func TestProcessValidatorRegistry(t *testing.T) { if err != nil { t.Fatalf("Could not execute ProcessValidatorRegistry: %v", err) } - if newState.ValidatorRegistryLastChangeSlot != state.Slot { - t.Errorf("Incorrect ValidatorRegistryLastChangeSlot, wanted: %d, got: %d", - state.Slot, newState.ValidatorRegistryLastChangeSlot) - } if newState.ShardAndCommitteesAtSlots[0].ArrayShardAndCommittee[0].Shard != state.ShardAndCommitteesAtSlots[epochLength].ArrayShardAndCommittee[0].Shard { t.Errorf("Incorrect rotation for shard committees, wanted shard: %d, got shard: %d", @@ -411,7 +411,7 @@ func TestProcessValidatorRegistry_ReachedUpperBound(t *testing.T) { } } validators := make([]*pb.ValidatorRecord, 1< List[int]: +// def get_active_validator_indices(validators: [ValidatorRecord], slot: int) -> List[int]: // """ // Gets indices of active validators from ``validators``. // """ -// return [i for i, v in enumerate(validators) if is_active_validator(v)] -func ActiveValidatorIndices(validators []*pb.ValidatorRecord) []uint32 { +// return [i for i, v in enumerate(validators) if is_active_validator(v, slot)] +func ActiveValidatorIndices(validators []*pb.ValidatorRecord, slot uint64) []uint32 { indices := make([]uint32, 0, len(validators)) for i, v := range validators { - if isActiveValidator(v) { + if isActiveValidator(v, slot) { indices = append(indices, uint32(i)) } @@ -137,11 +137,10 @@ func ProposerShardAndIndex(state *pb.BeaconState, slot uint64) (uint64, uint64, // ValidatorIndex returns the index of the validator given an input public key. func ValidatorIndex(pubKey []byte, validators []*pb.ValidatorRecord) (uint32, error) { - activeValidatorRegistry := ActiveValidatorIndices(validators) - for _, index := range activeValidatorRegistry { + for index := range validators { if bytes.Equal(validators[index].Pubkey, pubKey) { - return index, nil + return uint32(index), nil } } @@ -245,22 +244,6 @@ func VotedBalanceInAttestation(validators []*pb.ValidatorRecord, indices []uint3 return totalBalance, voteBalance, nil } -// ExitValidator exits validator from the active list. It returns -// updated validator record with an appropriate status of each validator. -func ExitValidator( - validator *pb.ValidatorRecord, - currentSlot uint64, - penalize bool) *pb.ValidatorRecord { - // TODO(#614): Add validator set change - validator.LatestStatusChangeSlot = currentSlot - if penalize { - validator.Status = pb.ValidatorRecord_EXITED_WITH_PENALTY - } else { - validator.Status = pb.ValidatorRecord_ACTIVE_PENDING_EXIT - } - return validator -} - // NewRegistryDeltaChainTip returns the new validator registry delta chain tip. // // Spec pseudocode definition: @@ -282,6 +265,7 @@ func ExitValidator( func NewRegistryDeltaChainTip( flag pb.ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags, index uint32, + slot uint64, pubKey []byte, currentValidatorRegistryDeltaChainTip []byte) ([32]byte, error) { @@ -290,6 +274,7 @@ func NewRegistryDeltaChainTip( ValidatorIndex: index, Pubkey: pubKey, Flag: flag, + Slot: slot, } // TODO(716): Replace serialization with tree hash function. @@ -409,34 +394,6 @@ func AttestingBalance(state *pb.BeaconState, boundaryAttesterIndices []uint32) u return boundaryAttestingBalance } -// UpdateStatus updates validator to a new status, it handles -// other general accounting related to this status update. -// Spec pseudocode definition: -// def update_validator_status(state: BeaconState, -// index: int, -// new_status: int) -> None: -// if new_status == ACTIVE: -// activate_validator(state, index) -// if new_status == ACTIVE_PENDING_EXIT: -// initiate_validator_exit(state, index) -// if new_status in [EXITED_WITH_PENALTY, EXITED_WITHOUT_PENALTY]: -// exit_validator(state, index, new_status) -func UpdateStatus( - state *pb.BeaconState, - index uint32, - newStatus pb.ValidatorRecord_StatusCodes) (*pb.BeaconState, error) { - - switch newStatus { - case pb.ValidatorRecord_ACTIVE: - return activateValidator(state, index) - case pb.ValidatorRecord_ACTIVE_PENDING_EXIT: - return initiateValidatorExit(state, index) - case pb.ValidatorRecord_EXITED_WITH_PENALTY, pb.ValidatorRecord_EXITED_WITHOUT_PENALTY: - return exitValidator(state, index, newStatus) - } - return nil, fmt.Errorf("expected ACTIVE, ACTIVE_PENDING_EXIT, EXITED_WITH or WITHOUT_PENALTY, but got %v", newStatus) -} - // AllValidatorsIndices returns all validator indices from 0 to // the last validator. func AllValidatorsIndices(state *pb.BeaconState) []uint32 { @@ -456,12 +413,12 @@ func AllValidatorsIndices(state *pb.BeaconState) []uint32 { func ProcessDeposit( state *pb.BeaconState, pubkey []byte, - deposit uint64, + amount uint64, proofOfPossession []byte, withdrawalCredentials []byte, randaoCommitment []byte, pocCommitment []byte, -) (*pb.BeaconState, uint32, error) { +) (*pb.BeaconState, error) { // TODO(#258): Validate proof of possession using BLS. var publicKeyExists bool var existingValidatorIndex int @@ -478,110 +435,77 @@ func ProcessDeposit( Pubkey: pubkey, RandaoCommitmentHash32: randaoCommitment, RandaoLayers: 0, - Status: pb.ValidatorRecord_PENDING_ACTIVATION, - LatestStatusChangeSlot: state.Slot, ExitCount: 0, PocCommitmentHash32: pocCommitment, - LastPocChangeSlot: 0, - SecondLastPocChangeSlot: 0, + LastPocChangeSlot: params.BeaconConfig().GenesisSlot, + SecondLastPocChangeSlot: params.BeaconConfig().GenesisSlot, + ActivationSlot: params.BeaconConfig().FarFutureSlot, + ExitSlot: params.BeaconConfig().FarFutureSlot, + WithdrawalSlot: params.BeaconConfig().FarFutureSlot, + PenalizedSlot: params.BeaconConfig().FarFutureSlot, + StatusFlags: 0, } - idx, ok := minEmptyValidatorIndex( - state.ValidatorRegistry, - state.ValidatorBalances, - state.Slot, - ) - // In the case there is no empty validator index in the state, - // we append an entirely new record to the validator registry and list - // of validator balances. Otherwise, we simply overwrite the value at - // an existing index that has 0 balance and is outside the validator - // time to live window. - if !ok { - state.ValidatorRegistry = append(state.ValidatorRegistry, newValidator) - state.ValidatorBalances = append(state.ValidatorBalances, deposit) - idx = len(state.ValidatorRegistry) - 1 - } else { - state.ValidatorRegistry[idx] = newValidator - state.ValidatorBalances[idx] = deposit - } - return state, uint32(idx), nil - } - if !bytes.Equal( - state.ValidatorRegistry[existingValidatorIndex].WithdrawalCredentials, - withdrawalCredentials, - ) { - return nil, 0, fmt.Errorf( - "expected withdrawal credentials to match, received %#x == %#x", - state.ValidatorRegistry[existingValidatorIndex].WithdrawalCredentials, - withdrawalCredentials, - ) - } - state.ValidatorBalances[existingValidatorIndex] += deposit - return state, uint32(existingValidatorIndex), nil -} + state.ValidatorRegistry = append(state.ValidatorRegistry, newValidator) + state.ValidatorBalances = append(state.ValidatorBalances, amount) -// minEmptyValidatorIndex returns the lowest validator index which the balance is 0 -// and the time to live window is less than the current slot. -func minEmptyValidatorIndex( - validators []*pb.ValidatorRecord, - balances []uint64, - currentSlot uint64, -) (int, bool) { - for i := range validators { - lastStatusChange := validators[i].LatestStatusChangeSlot - ttlWindow := lastStatusChange + params.BeaconConfig().ZeroBalanceValidatorTTL - if balances[i] == 0 && ttlWindow <= currentSlot { - return i, true + } else { + if !bytes.Equal( + state.ValidatorRegistry[existingValidatorIndex].WithdrawalCredentialsHash32, + withdrawalCredentials, + ) { + return nil, fmt.Errorf( + "expected withdrawal credentials to match, received %#x == %#x", + state.ValidatorRegistry[existingValidatorIndex].WithdrawalCredentialsHash32, + withdrawalCredentials, + ) } + state.ValidatorBalances[existingValidatorIndex] += amount } - return 0, false + return state, nil } // isActiveValidator returns the boolean value on whether the validator // is active or not. // // Spec pseudocode definition: -// def is_active_validator(validator: ValidatorRecord) -> bool: +// def is_active_validator(validator: ValidatorRecord, slot: int) -> bool: // """ -// Returns the ``ShardCommittee`` for the ``slot``. +// Checks if ``validator`` is active. // """ -// return validator.status in [ACTIVE, ACTIVE_PENDING_EXIT] -func isActiveValidator(validator *pb.ValidatorRecord) bool { - return validator.Status == pb.ValidatorRecord_ACTIVE_PENDING_EXIT || - validator.Status == pb.ValidatorRecord_ACTIVE +// return validator.activation_slot <= slot < validator.exit_slot +func isActiveValidator(validator *pb.ValidatorRecord, slot uint64) bool { + return validator.ActivationSlot <= slot && + slot < validator.ExitSlot } -// activateValidator takes in validator index and activates -// validator from pending activation status to active status. +// ActivateValidator takes in validator index and updates +// validator's activation slot. // // Spec pseudocode definition: -// def activate_validator(state: BeaconState, -// index: int) -> None: -// """ -// Activate the validator with the given ``index``. -// Note that this function mutates ``state``. -// """ -// validator = state.validator_registry[index] -// if validator.status != PENDING_ACTIVATION: -// return +// def activate_validator(state: BeaconState, index: int, genesis: bool) -> None: +// validator = state.validator_registry[index] // -// validator.status = ACTIVE -// validator.latest_status_change_slot = state.slot -// state.validator_registry_delta_chain_tip = get_new_validator_registry_delta_chain_tip( -// current_validator_registry_delta_chain_tip=state.validator_registry_delta_chain_tip, -// validator_index=index, -// pubkey=validator.pubkey, -// flag=ACTIVATION) -func activateValidator(state *pb.BeaconState, index uint32) (*pb.BeaconState, error) { +// validator.activation_slot = GENESIS_SLOT if genesis else (state.slot + ENTRY_EXIT_DELAY) +// state.validator_registry_delta_chain_tip = hash_tree_root( +// ValidatorRegistryDeltaBlock( +// current_validator_registry_delta_chain_tip=state.validator_registry_delta_chain_tip, +// validator_index=index, +// pubkey=validator.pubkey, +// slot=validator.activation_slot, +// flag=ACTIVATION, +// ) +// ) +func ActivateValidator(state *pb.BeaconState, index uint32, genesis bool) (*pb.BeaconState, error) { validator := state.ValidatorRegistry[index] - if validator.Status != pb.ValidatorRecord_PENDING_ACTIVATION { - return nil, fmt.Errorf("expected validator %d to be PENDING_ACTIVATION, but was %v", - index, validator.Status) + if genesis { + validator.ActivationSlot = params.BeaconConfig().GenesisSlot + } else { + validator.ActivationSlot = state.Slot + params.BeaconConfig().EntryExitDelay } - validator.Status = pb.ValidatorRecord_ACTIVE - validator.LatestStatusChangeSlot = state.Slot newChainTip, err := NewRegistryDeltaChainTip( pb.ValidatorRegistryDeltaBlock_ACTIVATION, index, + validator.ActivationSlot, validator.Pubkey, state.ValidatorRegistryDeltaChainTipHash32, ) @@ -593,115 +517,58 @@ func activateValidator(state *pb.BeaconState, index uint32) (*pb.BeaconState, er return state, nil } -// initiateValidatorExit takes in validator index and exits -// validator from active status to active pending exit status. +// InitiateValidatorExit takes in validator index and updates +// validator with INITIATED_EXIT status flag. // // Spec pseudocode definition: -// def initiate_validator_exit(state: BeaconState, -// index: int) -> None: -// """ -// Initiate exit for the validator with the given ``index``. -// Note that this function mutates ``state``. -// """ +// def initiate_validator_exit(state: BeaconState, index: int) -> None: // validator = state.validator_registry[index] -// if validator.status != ACTIVE: -// return -// -// validator.status = ACTIVE_PENDING_EXIT -// validator.latest_status_change_slot = state.slot -func initiateValidatorExit(state *pb.BeaconState, index uint32) (*pb.BeaconState, error) { - validator := state.ValidatorRegistry[index] - if validator.Status != pb.ValidatorRecord_ACTIVE { - return nil, fmt.Errorf("expected validator %d to be ACTIVE, but was %v", - index, validator.Status) - } - validator.Status = pb.ValidatorRecord_ACTIVE_PENDING_EXIT - validator.LatestStatusChangeSlot = state.Slot - state.ValidatorRegistry[index] = validator - return state, nil +// validator.status_flags |= INITIATED_EXIT +func InitiateValidatorExit(state *pb.BeaconState, index uint32) *pb.BeaconState { + state.ValidatorRegistry[index].StatusFlags |= + pb.ValidatorRecord_INITIATED_EXIT + return state } -// exitValidator takes in validator index and does house -// keeping work for validators with exited with penalty or without penalty status. +// ExitValidator takes in validator index and does house +// keeping work to exit validator with entry exit delay. // // Spec pseudocode definition: -// def exit_validator(state: BeaconState, -// index: int, -// new_status: int) -> None: -// """ -// Exit the validator with the given ``index``. -// Note that this function mutates ``state``. -// """ +// def exit_validator(state: BeaconState, index: int) -> None: // validator = state.validator_registry[index] -// prev_status = validator.status // -// if prev_status == EXITED_WITH_PENALTY: +// if validator.exit_slot < state.slot + ENTRY_EXIT_DELAY: // return // -// validator.status = new_status -// validator.latest_status_change_slot = state.slot +// validator.exit_slot = state.slot + ENTRY_EXIT_DELAY // -// if new_status == EXITED_WITH_PENALTY: -// state.latest_penalized_exit_balances[state.slot // COLLECTIVE_PENALTY_CALCULATION_PERIOD] += get_effective_balance(state, index) -// -// whistleblower_index = get_beacon_proposer_index(state, state.slot) -// whistleblower_reward = get_effective_balance(state, index) // WHISTLEBLOWER_REWARD_QUOTIENT -// state.validator_balances[whistleblower_index] += whistleblower_reward -// state.validator_balances[index] -= whistleblower_reward -// -// if prev_status == EXITED_WITHOUT_PENALTY: -// return -// -// # The following updates only occur if not previous exited // state.validator_registry_exit_count += 1 // validator.exit_count = state.validator_registry_exit_count -// state.validator_registry_delta_chain_tip = get_new_validator_registry_delta_chain_tip( -// current_validator_registry_delta_chain_tip=state.validator_registry_delta_chain_tip, -// validator_index=index, -// pubkey=validator.pubkey, -// flag=EXIT, +// state.validator_registry_delta_chain_tip = hash_tree_root( +// ValidatorRegistryDeltaBlock( +// current_validator_registry_delta_chain_tip=state.validator_registry_delta_chain_tip, +// validator_index=index, +// pubkey=validator.pubkey, +// slot=validator.exit_slot, +// flag=EXIT, +// ) // ) -// -// # Remove validator from persistent committees -// for committee in state.persistent_committees: -// for i, validator_index in committee: -// if validator_index == index: -// committee.pop(i) -// break -func exitValidator(state *pb.BeaconState, index uint32, newStatus pb.ValidatorRecord_StatusCodes) (*pb.BeaconState, error) { +func ExitValidator(state *pb.BeaconState, index uint32) (*pb.BeaconState, error) { validator := state.ValidatorRegistry[index] - prevStatus := validator.Status - if prevStatus == pb.ValidatorRecord_EXITED_WITH_PENALTY { - return nil, fmt.Errorf("validator %d already exited due to penalty", index) + if validator.ExitSlot < state.Slot+params.BeaconConfig().EntryExitDelay { + return nil, fmt.Errorf("validator %d could not exit until slot %d", + index, state.Slot+params.BeaconConfig().EntryExitDelay) } - validator.Status = newStatus - validator.LatestStatusChangeSlot = state.Slot + validator.ExitSlot = state.Slot + params.BeaconConfig().EntryExitDelay - if newStatus == pb.ValidatorRecord_EXITED_WITH_PENALTY { - state.LatestPenalizedExitBalances[state.Slot/params.BeaconConfig().CollectivePenaltyCalculationPeriod] += - EffectiveBalance(state, index) - proposerIndex, err := BeaconProposerIndex(state, state.Slot) - if err != nil { - return nil, fmt.Errorf("could not get proposer index: %v", err) - } - whistleblowerIndex := proposerIndex - whistleblowerReward := EffectiveBalance(state, index) - state.ValidatorBalances[whistleblowerIndex] += whistleblowerReward - state.ValidatorBalances[index] -= whistleblowerReward - } - - if prevStatus == pb.ValidatorRecord_EXITED_WITHOUT_PENALTY { - return nil, fmt.Errorf("validator %d already exited without penalty", index) - } - - // The following only gets updated if not previous exited. state.ValidatorRegistryExitCount++ validator.ExitCount = state.ValidatorRegistryExitCount newChainTip, err := NewRegistryDeltaChainTip( pb.ValidatorRegistryDeltaBlock_EXIT, index, + validator.ExitSlot, validator.Pubkey, state.ValidatorRegistryDeltaChainTipHash32, ) @@ -710,16 +577,58 @@ func exitValidator(state *pb.BeaconState, index uint32, newStatus pb.ValidatorRe } state.ValidatorRegistryDeltaChainTipHash32 = newChainTip[:] - // Remove validator from persistent committees. - for i, committee := range state.PersistentCommittees { - for j, validatorIndex := range committee.List { - if validatorIndex == index { - state.PersistentCommittees[i].List = append( - state.PersistentCommittees[i].List[:j], - state.PersistentCommittees[i].List[j+1:]...) - break - } - } - } return state, nil } + +// PenalizeValidator slashes the malicious validator's balance and awards +// the whistleblower's balance. +// +// Spec pseudocode definition: +// def penalize_validator(state: BeaconState, index: int) -> None: +// exit_validator(state, index) +// validator = state.validator_registry[index] +// state.latest_penalized_exit_balances[(state.slot // EPOCH_LENGTH) % LATEST_PENALIZED_EXIT_LENGTH] += get_effective_balance(state, index) +// +// whistleblower_index = get_beacon_proposer_index(state, state.slot) +// whistleblower_reward = get_effective_balance(state, index) // WHISTLEBLOWER_REWARD_QUOTIENT +// state.validator_balances[whistleblower_index] += whistleblower_reward +// state.validator_balances[index] -= whistleblower_reward +// validator.penalized_slot = state.slot +func PenalizeValidator(state *pb.BeaconState, index uint32) (*pb.BeaconState, error) { + validator := state.ValidatorRegistry[index] + state, err := ExitValidator(state, index) + if err != nil { + return nil, fmt.Errorf("could not exit penalized validator: %v", err) + } + + penalizedDuration := (state.Slot / params.BeaconConfig().EpochLength) % + params.BeaconConfig().LatestPenalizedExitLength + state.LatestPenalizedExitBalances[penalizedDuration] += + EffectiveBalance(state, index) + + whistleblowerIndex, err := BeaconProposerIndex(state, state.Slot) + if err != nil { + return nil, fmt.Errorf("could not get proposer index: %v", err) + } + whistleblowerReward := EffectiveBalance(state, index) / + params.BeaconConfig().WhistlerBlowerRewardQuotient + + state.ValidatorBalances[whistleblowerIndex] += whistleblowerReward + state.ValidatorBalances[index] -= whistleblowerReward + + validator.PenalizedSlot = state.Slot + return state, nil +} + +// PrepareValidatorForWithdrawal sets validator's status flag to +// WITHDRAWABLE. +// +// Spec pseudocode definition: +// def prepare_validator_for_withdrawal(state: BeaconState, index: int) -> None: +// validator = state.validator_registry[index] +// validator.status_flags |= WITHDRAWABLE +func PrepareValidatorForWithdrawal(state *pb.BeaconState, index uint32) *pb.BeaconState { + state.ValidatorRegistry[index].StatusFlags |= + pb.ValidatorRecord_WITHDRAWABLE + return state +} diff --git a/beacon-chain/core/validators/validator_test.go b/beacon-chain/core/validators/validator_test.go index eb20ab35aa..d841884b9a 100644 --- a/beacon-chain/core/validators/validator_test.go +++ b/beacon-chain/core/validators/validator_test.go @@ -7,7 +7,6 @@ import ( "testing" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" - "github.com/prysmaticlabs/prysm/proto/common" "github.com/prysmaticlabs/prysm/shared/bitutil" "github.com/prysmaticlabs/prysm/shared/params" ) @@ -51,9 +50,9 @@ func TestHasVoted(t *testing.T) { func TestInitialValidatorRegistry(t *testing.T) { validators := InitialValidatorRegistry() - for _, validator := range validators { - if validator.Status != pb.ValidatorRecord_ACTIVE { - t.Errorf("validator status is not active: %d", validator.Status) + for index, validator := range validators { + if !isActiveValidator(validator, 1) { + t.Errorf("validator %d status is not active", index) } } } @@ -93,7 +92,7 @@ func TestProposerShardAndIndex(t *testing.T) { func TestValidatorIndex(t *testing.T) { var validators []*pb.ValidatorRecord for i := 0; i < 10; i++ { - validators = append(validators, &pb.ValidatorRecord{Pubkey: []byte{}, Status: pb.ValidatorRecord_ACTIVE}) + validators = append(validators, &pb.ValidatorRecord{Pubkey: []byte{}, ExitSlot: params.BeaconConfig().FarFutureSlot}) } if _, err := ValidatorIndex([]byte("100"), validators); err == nil { t.Fatalf("ValidatorIndex should have failed, there's no validator with pubkey 100") @@ -111,7 +110,7 @@ func TestValidatorIndex(t *testing.T) { func TestValidatorShard(t *testing.T) { var validators []*pb.ValidatorRecord for i := 0; i < 21; i++ { - validators = append(validators, &pb.ValidatorRecord{Pubkey: []byte{}, Status: pb.ValidatorRecord_ACTIVE}) + validators = append(validators, &pb.ValidatorRecord{Pubkey: []byte{}, ExitSlot: params.BeaconConfig().FarFutureSlot}) } shardCommittees := []*pb.ShardAndCommitteeArray{ {ArrayShardAndCommittee: []*pb.ShardAndCommittee{ @@ -143,7 +142,7 @@ func TestValidatorShard(t *testing.T) { func TestValidatorSlotAndResponsibility(t *testing.T) { var validators []*pb.ValidatorRecord for i := 0; i < 61; i++ { - validators = append(validators, &pb.ValidatorRecord{Pubkey: []byte{}, Status: pb.ValidatorRecord_ACTIVE}) + validators = append(validators, &pb.ValidatorRecord{Pubkey: []byte{}, ExitSlot: params.BeaconConfig().FarFutureSlot}) } shardCommittees := []*pb.ShardAndCommitteeArray{ {ArrayShardAndCommittee: []*pb.ShardAndCommittee{ @@ -315,19 +314,20 @@ func TestTotalEffectiveBalance(t *testing.T) { func TestIsActiveValidator(t *testing.T) { tests := []struct { - a pb.ValidatorRecord_StatusCodes + a uint64 b bool }{ - {a: pb.ValidatorRecord_PENDING_ACTIVATION, b: false}, - {a: pb.ValidatorRecord_ACTIVE, b: true}, - {a: pb.ValidatorRecord_ACTIVE_PENDING_EXIT, b: true}, - {a: pb.ValidatorRecord_EXITED_WITHOUT_PENALTY + 1, b: false}, - {a: pb.ValidatorRecord_EXITED_WITH_PENALTY * 100, b: false}, + {a: 0, b: false}, + {a: 10, b: true}, + {a: 100, b: false}, + {a: 1000, b: false}, + {a: 64, b: true}, } for _, test := range tests { - validator := &pb.ValidatorRecord{Status: test.a} - if isActiveValidator(validator) != test.b { - t.Errorf("isActiveValidator(%d) = %v, want = %v", validator.Status, isActiveValidator(validator), test.b) + validator := &pb.ValidatorRecord{ActivationSlot: 10, ExitSlot: 100} + if isActiveValidator(validator, test.a) != test.b { + t.Errorf("isActiveValidator(%d) = %v, want = %v", + test.a, isActiveValidator(validator, test.a), test.b) } } } @@ -616,13 +616,14 @@ func TestNewRegistryDeltaChainTip(t *testing.T) { []byte{35, 123, 149, 41, 92, 226, 26, 73, 96, 40, 4, 219, 59, 254, 27, 38, 220, 125, 83, 177, 78, 12, 187, 74, 72, 115, 64, 91, 16, 144, 37, 245}}, {2, 64, []byte{'Y'}, []byte{'Z'}, - []byte{105, 155, 218, 237, 2, 246, 129, 117, 122, 234, 129, 145, 140, - 42, 123, 133, 57, 241, 58, 237, 43, 180, 158, 123, 236, 47, 141, 21, 71, 150, 237, 246}}, + []byte{69, 192, 214, 2, 37, 19, 40, 60, 179, 83, 79, 158, 211, 247, 151, + 7, 240, 82, 41, 37, 251, 149, 221, 37, 22, 151, 204, 234, 64, 69, 7, 166}}, } for _, tt := range tests { newChainTip, err := NewRegistryDeltaChainTip( pb.ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags(tt.flag), tt.index, + 0, tt.pubKey, tt.currentRegistryDeltaChainTip, ) @@ -642,8 +643,8 @@ func TestProcessDeposit_PublicKeyExistsBadWithdrawalCredentials(t *testing.T) { Pubkey: []byte{1, 2, 3}, }, { - Pubkey: []byte{4, 5, 6}, - WithdrawalCredentials: []byte{0}, + Pubkey: []byte{4, 5, 6}, + WithdrawalCredentialsHash32: []byte{0}, }, } beaconState := &pb.BeaconState{ @@ -657,7 +658,7 @@ func TestProcessDeposit_PublicKeyExistsBadWithdrawalCredentials(t *testing.T) { pocCommitment := []byte{} want := "expected withdrawal credentials to match" - if _, _, err := ProcessDeposit( + if _, err := ProcessDeposit( beaconState, pubkey, deposit, @@ -676,8 +677,8 @@ func TestProcessDeposit_PublicKeyExistsGoodWithdrawalCredentials(t *testing.T) { Pubkey: []byte{1, 2, 3}, }, { - Pubkey: []byte{4, 5, 6}, - WithdrawalCredentials: []byte{1}, + Pubkey: []byte{4, 5, 6}, + WithdrawalCredentialsHash32: []byte{1}, }, } balances := []uint64{0, 0} @@ -692,7 +693,7 @@ func TestProcessDeposit_PublicKeyExistsGoodWithdrawalCredentials(t *testing.T) { randaoCommitment := []byte{} pocCommitment := []byte{} - newState, _, err := ProcessDeposit( + newState, err := ProcessDeposit( beaconState, pubkey, deposit, @@ -712,12 +713,12 @@ func TestProcessDeposit_PublicKeyExistsGoodWithdrawalCredentials(t *testing.T) { func TestProcessDeposit_PublicKeyDoesNotExistNoEmptyValidator(t *testing.T) { registry := []*pb.ValidatorRecord{ { - Pubkey: []byte{1, 2, 3}, - WithdrawalCredentials: []byte{2}, + Pubkey: []byte{1, 2, 3}, + WithdrawalCredentialsHash32: []byte{2}, }, { - Pubkey: []byte{4, 5, 6}, - WithdrawalCredentials: []byte{1}, + Pubkey: []byte{4, 5, 6}, + WithdrawalCredentialsHash32: []byte{1}, }, } balances := []uint64{1000, 1000} @@ -732,7 +733,7 @@ func TestProcessDeposit_PublicKeyDoesNotExistNoEmptyValidator(t *testing.T) { randaoCommitment := []byte{} pocCommitment := []byte{} - newState, _, err := ProcessDeposit( + newState, err := ProcessDeposit( beaconState, pubkey, deposit, @@ -755,19 +756,17 @@ func TestProcessDeposit_PublicKeyDoesNotExistNoEmptyValidator(t *testing.T) { func TestProcessDeposit_PublicKeyDoesNotExistEmptyValidatorExists(t *testing.T) { registry := []*pb.ValidatorRecord{ { - Pubkey: []byte{1, 2, 3}, - WithdrawalCredentials: []byte{2}, - LatestStatusChangeSlot: 0, + Pubkey: []byte{1, 2, 3}, + WithdrawalCredentialsHash32: []byte{2}, }, { - Pubkey: []byte{4, 5, 6}, - WithdrawalCredentials: []byte{1}, - LatestStatusChangeSlot: 0, + Pubkey: []byte{4, 5, 6}, + WithdrawalCredentialsHash32: []byte{1}, }, } balances := []uint64{0, 1000} beaconState := &pb.BeaconState{ - Slot: 0 + params.BeaconConfig().ZeroBalanceValidatorTTL, + Slot: params.BeaconConfig().EpochLength, ValidatorBalances: balances, ValidatorRegistry: registry, } @@ -778,7 +777,7 @@ func TestProcessDeposit_PublicKeyDoesNotExistEmptyValidatorExists(t *testing.T) randaoCommitment := []byte{} pocCommitment := []byte{} - newState, _, err := ProcessDeposit( + newState, err := ProcessDeposit( beaconState, pubkey, deposit, @@ -790,11 +789,28 @@ func TestProcessDeposit_PublicKeyDoesNotExistEmptyValidatorExists(t *testing.T) if err != nil { t.Fatalf("Process deposit failed: %v", err) } - if len(newState.ValidatorBalances) != 2 { - t.Errorf("Expected validator balances list to stay the same, received len %d", len(newState.ValidatorBalances)) + if len(newState.ValidatorBalances) != 3 { + t.Errorf("Expected validator balances list to be 3, received len %d", len(newState.ValidatorBalances)) } - if newState.ValidatorBalances[0] != 2000 { - t.Errorf("Expected validator at index 0 to have balance of %d, received %d", 2000, newState.ValidatorBalances[0]) + if newState.ValidatorBalances[len(newState.ValidatorBalances)-1] != 2000 { + t.Errorf("Expected validator at last index to have balance of %d, received %d", 2000, newState.ValidatorBalances[0]) + } +} + +func TestActivateValidatorGenesis_Ok(t *testing.T) { + state := &pb.BeaconState{ + ValidatorRegistryDeltaChainTipHash32: []byte{'A'}, + ValidatorRegistry: []*pb.ValidatorRecord{ + {Pubkey: []byte{'A'}}, + }, + } + newState, err := ActivateValidator(state, 0, true) + if err != nil { + t.Fatalf("Could not execute activateValidator:%v", err) + } + if newState.ValidatorRegistry[0].ActivationSlot != params.BeaconConfig().GenesisSlot { + t.Errorf("Wanted activation slot = genesis slot, got %d", + newState.ValidatorRegistry[0].ActivationSlot) } } @@ -803,180 +819,65 @@ func TestActivateValidator_Ok(t *testing.T) { Slot: 100, ValidatorRegistryDeltaChainTipHash32: []byte{'A'}, ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_PENDING_ACTIVATION, Pubkey: []byte{'B'}}, + {Pubkey: []byte{'A'}}, }, } - newState, err := activateValidator(state, 0) + newState, err := ActivateValidator(state, 0, false) if err != nil { t.Fatalf("Could not execute activateValidator:%v", err) } - if newState.ValidatorRegistry[0].Status != pb.ValidatorRecord_ACTIVE { - t.Errorf("Wanted status ACTIVE, got %v", newState.ValidatorRegistry[0].Status) - } - if newState.ValidatorRegistry[0].LatestStatusChangeSlot != state.Slot { - t.Errorf("Wanted last change slot %d, got %v", - state.Slot, newState.ValidatorRegistry[0].LatestStatusChangeSlot) - } -} - -func TestActivateValidator_BadStatus(t *testing.T) { - state := &pb.BeaconState{ - ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - }, - } - if _, err := activateValidator(state, 0); err == nil { - t.Fatal("activateValidator should have failed with incorrect status") + if newState.ValidatorRegistry[0].ActivationSlot != + state.Slot+params.BeaconConfig().EntryExitDelay { + t.Errorf("Wanted activation slot = %d, got %d", + state.Slot+params.BeaconConfig().EntryExitDelay, + newState.ValidatorRegistry[0].ActivationSlot) } } func TestInitiateValidatorExit_Ok(t *testing.T) { - state := &pb.BeaconState{ - Slot: 200, - ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE}, - }, + state := &pb.BeaconState{ValidatorRegistry: []*pb.ValidatorRecord{{}, {}, {}}} + newState := InitiateValidatorExit(state, 2) + if newState.ValidatorRegistry[0].StatusFlags != pb.ValidatorRecord_INITIAL { + t.Errorf("Wanted flag INITIAL, got %v", newState.ValidatorRegistry[0].StatusFlags) } - newState, err := initiateValidatorExit(state, 0) - if err != nil { - t.Fatalf("Could not execute initiateValidatorExit:%v", err) - } - if newState.ValidatorRegistry[0].Status != pb.ValidatorRecord_ACTIVE_PENDING_EXIT { - t.Errorf("Wanted status ACTIVE_PENDING_EXIT, got %v", newState.ValidatorRegistry[0].Status) - } - if newState.ValidatorRegistry[0].LatestStatusChangeSlot != state.Slot { - t.Errorf("Wanted last change slot %d, got %v", - state.Slot, newState.ValidatorRegistry[0].LatestStatusChangeSlot) + if newState.ValidatorRegistry[2].StatusFlags != pb.ValidatorRecord_INITIATED_EXIT { + t.Errorf("Wanted flag ACTIVE_PENDING_EXIT, got %v", newState.ValidatorRegistry[0].StatusFlags) } } -func TestInitiateValidatorExit_BadStatus(t *testing.T) { +func TestExitValidator_Ok(t *testing.T) { state := &pb.BeaconState{ - ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - }, - } - if _, err := initiateValidatorExit(state, 0); err == nil { - t.Fatal("initiateValidatorExit should have failed with incorrect status") - } -} - -func TestExitValidatorWithPenalty_Ok(t *testing.T) { - var shardAndCommittees []*pb.ShardAndCommitteeArray - for i := uint64(0); i < params.BeaconConfig().EpochLength*2; i++ { - shardAndCommittees = append(shardAndCommittees, &pb.ShardAndCommitteeArray{ - ArrayShardAndCommittee: []*pb.ShardAndCommittee{ - {Committee: []uint32{0, 1, 2, 3, 4, 5, 6, 7}}, - }, - }) - } - state := &pb.BeaconState{ - Slot: 100, - ShardAndCommitteesAtSlots: shardAndCommittees, - ValidatorBalances: []uint64{params.BeaconConfig().MaxDepositInGwei, params.BeaconConfig().MaxDepositInGwei, - params.BeaconConfig().MaxDepositInGwei, params.BeaconConfig().MaxDepositInGwei, params.BeaconConfig().MaxDepositInGwei}, + Slot: 100, ValidatorRegistryDeltaChainTipHash32: []byte{'A'}, LatestPenalizedExitBalances: []uint64{0}, ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_ACTIVE, Pubkey: []byte{'B'}}, - }, - PersistentCommittees: []*common.Uint32List{ - {List: []uint32{1, 2, 0, 4, 6}}, + {ExitSlot: params.BeaconConfig().FarFutureSlot, Pubkey: []byte{'B'}}, }, } - newStatus := pb.ValidatorRecord_EXITED_WITH_PENALTY - newState, err := exitValidator(state, 0, newStatus) + newState, err := ExitValidator(state, 0) if err != nil { - t.Fatalf("Could not execute exitValidator:%v", err) + t.Fatalf("Could not execute ExitValidator:%v", err) } - if newState.ValidatorRegistry[0].Status != newStatus { - t.Errorf("Wanted status %v, got %v", newStatus, newState.ValidatorRegistry[0].Status) - } - if newState.ValidatorRegistry[0].LatestStatusChangeSlot != state.Slot { - t.Errorf("Wanted last change slot %d, got %v", - state.Slot, newState.ValidatorRegistry[0].LatestStatusChangeSlot) + if newState.ValidatorRegistry[0].ExitSlot != + state.Slot+params.BeaconConfig().EntryExitDelay { + t.Errorf("Wanted exit slot %d, got %d", + state.Slot+params.BeaconConfig().EntryExitDelay, + newState.ValidatorRegistry[0].ExitSlot) } if newState.ValidatorRegistry[0].ExitCount != 1 { t.Errorf("Wanted exit count 1, got %d", newState.ValidatorRegistry[0].ExitCount) } - if newState.ValidatorBalances[0] != 0 { - t.Errorf("Wanted validator balance 0, got %d", newState.ValidatorBalances[0]) - } - if newState.ValidatorBalances[4] != 2*params.BeaconConfig().MaxDepositInGwei { - t.Errorf("Wanted validator balance %d, got %d", - 2*params.BeaconConfig().MaxDepositInGwei, newState.ValidatorBalances[4]) - } - for _, i := range newState.PersistentCommittees[0].List { - if i == 0 { - t.Errorf("Validator index 0 should be removed from persistent committee. Got: %v", - newState.PersistentCommittees[0].List) - } - } } -func TestExitValidator_AlreadyExitedWithPenalty(t *testing.T) { +func TestExitValidator_AlreadyExited(t *testing.T) { state := &pb.BeaconState{ + Slot: 1, ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_EXITED_WITH_PENALTY}, + {ExitSlot: params.BeaconConfig().EntryExitDelay}, }, } - if _, err := exitValidator(state, 0, pb.ValidatorRecord_EXITED_WITH_PENALTY); err == nil { - t.Fatal("exitValidator should have failed with incorrect status") - } -} - -func TestExitValidator_AlreadyExitedWithOutPenalty(t *testing.T) { - state := &pb.BeaconState{ - ValidatorRegistry: []*pb.ValidatorRecord{ - {Status: pb.ValidatorRecord_EXITED_WITHOUT_PENALTY}, - }, - } - if _, err := exitValidator(state, 0, pb.ValidatorRecord_EXITED_WITHOUT_PENALTY); err == nil { - t.Fatal("exitValidator should have failed with incorrect status") - } -} - -func TestUpdateValidatorStatus_Ok(t *testing.T) { - var shardAndCommittees []*pb.ShardAndCommitteeArray - for i := uint64(0); i < params.BeaconConfig().EpochLength*2; i++ { - shardAndCommittees = append(shardAndCommittees, &pb.ShardAndCommitteeArray{ - ArrayShardAndCommittee: []*pb.ShardAndCommittee{ - {Committee: []uint32{0, 1, 2, 3, 4, 5, 6, 7}}, - }, - }) - } - state := &pb.BeaconState{ - ShardAndCommitteesAtSlots: shardAndCommittees, - ValidatorBalances: []uint64{params.BeaconConfig().MaxDepositInGwei}, - LatestPenalizedExitBalances: []uint64{0}, - ValidatorRegistry: []*pb.ValidatorRecord{{}}, - } - tests := []struct { - currentStatus pb.ValidatorRecord_StatusCodes - newStatus pb.ValidatorRecord_StatusCodes - }{ - {pb.ValidatorRecord_PENDING_ACTIVATION, pb.ValidatorRecord_ACTIVE}, - {pb.ValidatorRecord_ACTIVE, pb.ValidatorRecord_ACTIVE_PENDING_EXIT}, - {pb.ValidatorRecord_ACTIVE, pb.ValidatorRecord_EXITED_WITH_PENALTY}, - {pb.ValidatorRecord_ACTIVE, pb.ValidatorRecord_EXITED_WITHOUT_PENALTY}, - } - for _, tt := range tests { - state.ValidatorRegistry[0].Status = tt.currentStatus - newState, err := UpdateStatus(state, 0, tt.newStatus) - if err != nil { - t.Fatalf("Could not execute UpdateStatus: %v", err) - } - if newState.ValidatorRegistry[0].Status != tt.newStatus { - t.Errorf("Expected status:%v, got:%v", - tt.newStatus, newState.ValidatorRegistry[0].Status) - } - } -} - -func TestUpdateValidatorStatus_IncorrectStatus(t *testing.T) { - if _, err := UpdateStatus( - &pb.BeaconState{}, 0, pb.ValidatorRecord_PENDING_ACTIVATION); err == nil { - t.Fatal("UpdateStatus should have failed with incorrect status") + if _, err := ExitValidator(state, 0); err == nil { + t.Fatal("exitValidator should have failed with exiting again") } } diff --git a/beacon-chain/rpc/service_test.go b/beacon-chain/rpc/service_test.go index b241915f53..c82b4d0a1a 100644 --- a/beacon-chain/rpc/service_test.go +++ b/beacon-chain/rpc/service_test.go @@ -341,6 +341,7 @@ func TestValidatorSlotAndResponsibility(t *testing.T) { if err := db.SaveBlock(genesis); err != nil { t.Fatalf("Could not save genesis block: %v", err) } + depositData, err := b.EncodeDepositData( &pbp2p.DepositInput{ Pubkey: []byte{'A'}, @@ -386,6 +387,7 @@ func TestValidatorIndex(t *testing.T) { if err := db.SaveBlock(genesis); err != nil { t.Fatalf("Could not save genesis block: %v", err) } + depositData, err := b.EncodeDepositData( &pbp2p.DepositInput{ Pubkey: []byte{'A'}, @@ -430,6 +432,7 @@ func TestValidatorShardID(t *testing.T) { if err := db.SaveBlock(genesis); err != nil { t.Fatalf("Could not save genesis block: %v", err) } + depositData, err := b.EncodeDepositData( &pbp2p.DepositInput{ Pubkey: []byte{'A'}, @@ -475,6 +478,7 @@ func TestValidatorAssignments(t *testing.T) { if err := db.SaveBlock(genesis); err != nil { t.Fatalf("Could not save genesis block: %v", err) } + depositData, err := b.EncodeDepositData( &pbp2p.DepositInput{ Pubkey: []byte{'A'}, diff --git a/beacon-chain/utils/genesis_json_test.go b/beacon-chain/utils/genesis_json_test.go index 5bec29ed99..f91adc17c8 100644 --- a/beacon-chain/utils/genesis_json_test.go +++ b/beacon-chain/utils/genesis_json_test.go @@ -37,7 +37,7 @@ func TestInitGenesisJson(t *testing.T) { params.UseDemoBeaconConfig() state := &pb.BeaconState{ ValidatorRegistry: []*pb.ValidatorRecord{ - {Pubkey: []byte("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), Balance: 32000000000, Status: pb.ValidatorRecord_ACTIVE}, + {Pubkey: []byte("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), Balance: 32000000000}, }, } diff --git a/genesis.json b/genesis.json index 715e58974f..99ae9af13d 100644 --- a/genesis.json +++ b/genesis.json @@ -2,43 +2,35 @@ "validatorRegistry": [ { "pubkey": "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "QkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJC", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "Q0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ND", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "RERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "RUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVF", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "RkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZG", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "R0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dH", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" }, { "pubkey": "SEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhI", - "balance": "32000000000", - "status": "ACTIVE" + "balance": "32000000000" } ] } diff --git a/proto/beacon/p2p/v1/types.pb.go b/proto/beacon/p2p/v1/types.pb.go index 0b9996a92f..a0c6b877f9 100755 --- a/proto/beacon/p2p/v1/types.pb.go +++ b/proto/beacon/p2p/v1/types.pb.go @@ -6,7 +6,6 @@ package v1 import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/types" import common "github.com/prysmaticlabs/prysm/proto/common" import io "io" @@ -22,36 +21,30 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package -type ValidatorRecord_StatusCodes int32 +type ValidatorRecord_StatusFlags int32 const ( - ValidatorRecord_PENDING_ACTIVATION ValidatorRecord_StatusCodes = 0 - ValidatorRecord_ACTIVE ValidatorRecord_StatusCodes = 1 - ValidatorRecord_ACTIVE_PENDING_EXIT ValidatorRecord_StatusCodes = 2 - ValidatorRecord_EXITED_WITHOUT_PENALTY ValidatorRecord_StatusCodes = 3 - ValidatorRecord_EXITED_WITH_PENALTY ValidatorRecord_StatusCodes = 4 + ValidatorRecord_INITIAL ValidatorRecord_StatusFlags = 0 + ValidatorRecord_INITIATED_EXIT ValidatorRecord_StatusFlags = 1 + ValidatorRecord_WITHDRAWABLE ValidatorRecord_StatusFlags = 2 ) -var ValidatorRecord_StatusCodes_name = map[int32]string{ - 0: "PENDING_ACTIVATION", - 1: "ACTIVE", - 2: "ACTIVE_PENDING_EXIT", - 3: "EXITED_WITHOUT_PENALTY", - 4: "EXITED_WITH_PENALTY", +var ValidatorRecord_StatusFlags_name = map[int32]string{ + 0: "INITIAL", + 1: "INITIATED_EXIT", + 2: "WITHDRAWABLE", } -var ValidatorRecord_StatusCodes_value = map[string]int32{ - "PENDING_ACTIVATION": 0, - "ACTIVE": 1, - "ACTIVE_PENDING_EXIT": 2, - "EXITED_WITHOUT_PENALTY": 3, - "EXITED_WITH_PENALTY": 4, +var ValidatorRecord_StatusFlags_value = map[string]int32{ + "INITIAL": 0, + "INITIATED_EXIT": 1, + "WITHDRAWABLE": 2, } -func (x ValidatorRecord_StatusCodes) String() string { - return proto.EnumName(ValidatorRecord_StatusCodes_name, int32(x)) +func (x ValidatorRecord_StatusFlags) String() string { + return proto.EnumName(ValidatorRecord_StatusFlags_name, int32(x)) } -func (ValidatorRecord_StatusCodes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{6, 0} +func (ValidatorRecord_StatusFlags) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_types_11bf700a8e6d5306, []int{6, 0} } type ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags int32 @@ -74,7 +67,7 @@ func (x ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags) String() string return proto.EnumName(ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags_name, int32(x)) } func (ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{21, 0} + return fileDescriptor_types_11bf700a8e6d5306, []int{21, 0} } type BeaconState struct { @@ -114,7 +107,7 @@ func (m *BeaconState) Reset() { *m = BeaconState{} } func (m *BeaconState) String() string { return proto.CompactTextString(m) } func (*BeaconState) ProtoMessage() {} func (*BeaconState) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{0} + return fileDescriptor_types_11bf700a8e6d5306, []int{0} } func (m *BeaconState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -345,7 +338,7 @@ func (m *ForkData) Reset() { *m = ForkData{} } func (m *ForkData) String() string { return proto.CompactTextString(m) } func (*ForkData) ProtoMessage() {} func (*ForkData) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{1} + return fileDescriptor_types_11bf700a8e6d5306, []int{1} } func (m *ForkData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -407,7 +400,7 @@ func (m *CandidatePoWReceiptRootRecord) Reset() { *m = CandidatePoWRecei func (m *CandidatePoWReceiptRootRecord) String() string { return proto.CompactTextString(m) } func (*CandidatePoWReceiptRootRecord) ProtoMessage() {} func (*CandidatePoWReceiptRootRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{2} + return fileDescriptor_types_11bf700a8e6d5306, []int{2} } func (m *CandidatePoWReceiptRootRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -464,7 +457,7 @@ func (m *PendingAttestationRecord) Reset() { *m = PendingAttestationReco func (m *PendingAttestationRecord) String() string { return proto.CompactTextString(m) } func (*PendingAttestationRecord) ProtoMessage() {} func (*PendingAttestationRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{3} + return fileDescriptor_types_11bf700a8e6d5306, []int{3} } func (m *PendingAttestationRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -535,7 +528,7 @@ func (m *Attestation) Reset() { *m = Attestation{} } func (m *Attestation) String() string { return proto.CompactTextString(m) } func (*Attestation) ProtoMessage() {} func (*Attestation) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{4} + return fileDescriptor_types_11bf700a8e6d5306, []int{4} } func (m *Attestation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -610,7 +603,7 @@ func (m *AttestationData) Reset() { *m = AttestationData{} } func (m *AttestationData) String() string { return proto.CompactTextString(m) } func (*AttestationData) ProtoMessage() {} func (*AttestationData) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{5} + return fileDescriptor_types_11bf700a8e6d5306, []int{5} } func (m *AttestationData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -696,27 +689,30 @@ func (m *AttestationData) GetJustifiedBlockRootHash32() []byte { } type ValidatorRecord struct { - Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` - WithdrawalCredentials []byte `protobuf:"bytes,2,opt,name=withdrawal_credentials,json=withdrawalCredentials,proto3" json:"withdrawal_credentials,omitempty"` - RandaoCommitmentHash32 []byte `protobuf:"bytes,3,opt,name=randao_commitment_hash32,json=randaoCommitmentHash32,proto3" json:"randao_commitment_hash32,omitempty"` - RandaoLayers uint64 `protobuf:"varint,4,opt,name=randao_layers,json=randaoLayers,proto3" json:"randao_layers,omitempty"` - Status ValidatorRecord_StatusCodes `protobuf:"varint,5,opt,name=status,proto3,enum=ethereum.beacon.p2p.v1.ValidatorRecord_StatusCodes" json:"status,omitempty"` - LatestStatusChangeSlot uint64 `protobuf:"varint,6,opt,name=latest_status_change_slot,json=latestStatusChangeSlot,proto3" json:"latest_status_change_slot,omitempty"` - ExitCount uint64 `protobuf:"varint,7,opt,name=exit_count,json=exitCount,proto3" json:"exit_count,omitempty"` - PocCommitmentHash32 []byte `protobuf:"bytes,8,opt,name=poc_commitment_hash32,json=pocCommitmentHash32,proto3" json:"poc_commitment_hash32,omitempty"` - LastPocChangeSlot uint64 `protobuf:"varint,9,opt,name=last_poc_change_slot,json=lastPocChangeSlot,proto3" json:"last_poc_change_slot,omitempty"` - SecondLastPocChangeSlot uint64 `protobuf:"varint,10,opt,name=second_last_poc_change_slot,json=secondLastPocChangeSlot,proto3" json:"second_last_poc_change_slot,omitempty"` - Balance uint64 `protobuf:"varint,1000,opt,name=balance,proto3" json:"balance,omitempty"` // Deprecated: Do not use. - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` + WithdrawalCredentialsHash32 []byte `protobuf:"bytes,2,opt,name=withdrawal_credentials_hash32,json=withdrawalCredentialsHash32,proto3" json:"withdrawal_credentials_hash32,omitempty"` + RandaoCommitmentHash32 []byte `protobuf:"bytes,3,opt,name=randao_commitment_hash32,json=randaoCommitmentHash32,proto3" json:"randao_commitment_hash32,omitempty"` + RandaoLayers uint64 `protobuf:"varint,4,opt,name=randao_layers,json=randaoLayers,proto3" json:"randao_layers,omitempty"` + ActivationSlot uint64 `protobuf:"varint,5,opt,name=activation_slot,json=activationSlot,proto3" json:"activation_slot,omitempty"` + ExitSlot uint64 `protobuf:"varint,6,opt,name=exit_slot,json=exitSlot,proto3" json:"exit_slot,omitempty"` + WithdrawalSlot uint64 `protobuf:"varint,7,opt,name=withdrawal_slot,json=withdrawalSlot,proto3" json:"withdrawal_slot,omitempty"` + PenalizedSlot uint64 `protobuf:"varint,8,opt,name=penalized_slot,json=penalizedSlot,proto3" json:"penalized_slot,omitempty"` + ExitCount uint64 `protobuf:"varint,9,opt,name=exit_count,json=exitCount,proto3" json:"exit_count,omitempty"` + StatusFlags ValidatorRecord_StatusFlags `protobuf:"varint,10,opt,name=status_flags,json=statusFlags,proto3,enum=ethereum.beacon.p2p.v1.ValidatorRecord_StatusFlags" json:"status_flags,omitempty"` + PocCommitmentHash32 []byte `protobuf:"bytes,11,opt,name=poc_commitment_hash32,json=pocCommitmentHash32,proto3" json:"poc_commitment_hash32,omitempty"` + LastPocChangeSlot uint64 `protobuf:"varint,12,opt,name=last_poc_change_slot,json=lastPocChangeSlot,proto3" json:"last_poc_change_slot,omitempty"` + SecondLastPocChangeSlot uint64 `protobuf:"varint,13,opt,name=second_last_poc_change_slot,json=secondLastPocChangeSlot,proto3" json:"second_last_poc_change_slot,omitempty"` + Balance uint64 `protobuf:"varint,1000,opt,name=balance,proto3" json:"balance,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ValidatorRecord) Reset() { *m = ValidatorRecord{} } func (m *ValidatorRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorRecord) ProtoMessage() {} func (*ValidatorRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{6} + return fileDescriptor_types_11bf700a8e6d5306, []int{6} } func (m *ValidatorRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -752,9 +748,9 @@ func (m *ValidatorRecord) GetPubkey() []byte { return nil } -func (m *ValidatorRecord) GetWithdrawalCredentials() []byte { +func (m *ValidatorRecord) GetWithdrawalCredentialsHash32() []byte { if m != nil { - return m.WithdrawalCredentials + return m.WithdrawalCredentialsHash32 } return nil } @@ -773,16 +769,30 @@ func (m *ValidatorRecord) GetRandaoLayers() uint64 { return 0 } -func (m *ValidatorRecord) GetStatus() ValidatorRecord_StatusCodes { +func (m *ValidatorRecord) GetActivationSlot() uint64 { if m != nil { - return m.Status + return m.ActivationSlot } - return ValidatorRecord_PENDING_ACTIVATION + return 0 } -func (m *ValidatorRecord) GetLatestStatusChangeSlot() uint64 { +func (m *ValidatorRecord) GetExitSlot() uint64 { if m != nil { - return m.LatestStatusChangeSlot + return m.ExitSlot + } + return 0 +} + +func (m *ValidatorRecord) GetWithdrawalSlot() uint64 { + if m != nil { + return m.WithdrawalSlot + } + return 0 +} + +func (m *ValidatorRecord) GetPenalizedSlot() uint64 { + if m != nil { + return m.PenalizedSlot } return 0 } @@ -794,6 +804,13 @@ func (m *ValidatorRecord) GetExitCount() uint64 { return 0 } +func (m *ValidatorRecord) GetStatusFlags() ValidatorRecord_StatusFlags { + if m != nil { + return m.StatusFlags + } + return ValidatorRecord_INITIAL +} + func (m *ValidatorRecord) GetPocCommitmentHash32() []byte { if m != nil { return m.PocCommitmentHash32 @@ -836,7 +853,7 @@ 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_types_0d51d13371de9b52, []int{7} + return fileDescriptor_types_11bf700a8e6d5306, []int{7} } func (m *ShardReassignmentRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -898,7 +915,7 @@ func (m *CrosslinkRecord) Reset() { *m = CrosslinkRecord{} } func (m *CrosslinkRecord) String() string { return proto.CompactTextString(m) } func (*CrosslinkRecord) ProtoMessage() {} func (*CrosslinkRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{8} + return fileDescriptor_types_11bf700a8e6d5306, []int{8} } func (m *CrosslinkRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -952,7 +969,7 @@ func (m *ShardAndCommitteeArray) Reset() { *m = ShardAndCommitteeArray{} func (m *ShardAndCommitteeArray) String() string { return proto.CompactTextString(m) } func (*ShardAndCommitteeArray) ProtoMessage() {} func (*ShardAndCommitteeArray) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{9} + return fileDescriptor_types_11bf700a8e6d5306, []int{9} } func (m *ShardAndCommitteeArray) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1001,7 +1018,7 @@ func (m *ShardAndCommittee) Reset() { *m = ShardAndCommittee{} } func (m *ShardAndCommittee) String() string { return proto.CompactTextString(m) } func (*ShardAndCommittee) ProtoMessage() {} func (*ShardAndCommittee) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{10} + return fileDescriptor_types_11bf700a8e6d5306, []int{10} } func (m *ShardAndCommittee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1068,7 +1085,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_types_0d51d13371de9b52, []int{11} + return fileDescriptor_types_11bf700a8e6d5306, []int{11} } func (m *BeaconBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1161,7 +1178,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_types_0d51d13371de9b52, []int{12} + return fileDescriptor_types_11bf700a8e6d5306, []int{12} } func (m *BeaconBlockBody) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1240,7 +1257,7 @@ func (m *DepositInput) Reset() { *m = DepositInput{} } func (m *DepositInput) String() string { return proto.CompactTextString(m) } func (*DepositInput) ProtoMessage() {} func (*DepositInput) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{13} + return fileDescriptor_types_11bf700a8e6d5306, []int{13} } func (m *DepositInput) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1317,7 +1334,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_types_0d51d13371de9b52, []int{14} + return fileDescriptor_types_11bf700a8e6d5306, []int{14} } func (m *ProposalSignedData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1381,7 +1398,7 @@ func (m *SlashableVoteData) Reset() { *m = SlashableVoteData{} } func (m *SlashableVoteData) String() string { return proto.CompactTextString(m) } func (*SlashableVoteData) ProtoMessage() {} func (*SlashableVoteData) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{15} + return fileDescriptor_types_11bf700a8e6d5306, []int{15} } func (m *SlashableVoteData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1440,7 +1457,7 @@ func (m *SlashableVoteData) GetAggregateSignature() []byte { type DepositData struct { DepositInput *DepositInput `protobuf:"bytes,1,opt,name=deposit_input,json=depositInput" json:"deposit_input,omitempty"` - Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1451,7 +1468,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_types_0d51d13371de9b52, []int{16} + return fileDescriptor_types_11bf700a8e6d5306, []int{16} } func (m *DepositData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1487,9 +1504,9 @@ func (m *DepositData) GetDepositInput() *DepositInput { return nil } -func (m *DepositData) GetValue() uint64 { +func (m *DepositData) GetAmount() uint64 { if m != nil { - return m.Value + return m.Amount } return 0 } @@ -1516,7 +1533,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_types_0d51d13371de9b52, []int{17} + return fileDescriptor_types_11bf700a8e6d5306, []int{17} } func (m *ProposerSlashing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1592,7 +1609,7 @@ func (m *CasperSlashing) Reset() { *m = CasperSlashing{} } func (m *CasperSlashing) String() string { return proto.CompactTextString(m) } func (*CasperSlashing) ProtoMessage() {} func (*CasperSlashing) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{18} + return fileDescriptor_types_11bf700a8e6d5306, []int{18} } func (m *CasperSlashing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1648,7 +1665,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_types_0d51d13371de9b52, []int{19} + return fileDescriptor_types_11bf700a8e6d5306, []int{19} } func (m *Deposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1700,7 +1717,7 @@ func (m *Deposit) GetDepositData() []byte { type Exit struct { Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` - ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + ValidatorIndex uint32 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1711,7 +1728,7 @@ func (m *Exit) Reset() { *m = Exit{} } func (m *Exit) String() string { return proto.CompactTextString(m) } func (*Exit) ProtoMessage() {} func (*Exit) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{20} + return fileDescriptor_types_11bf700a8e6d5306, []int{20} } func (m *Exit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1747,7 +1764,7 @@ func (m *Exit) GetSlot() uint64 { return 0 } -func (m *Exit) GetValidatorIndex() uint64 { +func (m *Exit) GetValidatorIndex() uint32 { if m != nil { return m.ValidatorIndex } @@ -1765,7 +1782,8 @@ type ValidatorRegistryDeltaBlock struct { LatestRegistryDeltaRootHash32 []byte `protobuf:"bytes,1,opt,name=latest_registry_delta_root_hash32,json=latestRegistryDeltaRootHash32,proto3" json:"latest_registry_delta_root_hash32,omitempty"` ValidatorIndex uint32 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` Pubkey []byte `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"` - Flag ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags `protobuf:"varint,4,opt,name=flag,proto3,enum=ethereum.beacon.p2p.v1.ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags" json:"flag,omitempty"` + Slot uint64 `protobuf:"varint,4,opt,name=slot,proto3" json:"slot,omitempty"` + Flag ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags `protobuf:"varint,5,opt,name=flag,proto3,enum=ethereum.beacon.p2p.v1.ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags" json:"flag,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1775,7 +1793,7 @@ func (m *ValidatorRegistryDeltaBlock) Reset() { *m = ValidatorRegistryDe func (m *ValidatorRegistryDeltaBlock) String() string { return proto.CompactTextString(m) } func (*ValidatorRegistryDeltaBlock) ProtoMessage() {} func (*ValidatorRegistryDeltaBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{21} + return fileDescriptor_types_11bf700a8e6d5306, []int{21} } func (m *ValidatorRegistryDeltaBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1825,6 +1843,13 @@ func (m *ValidatorRegistryDeltaBlock) GetPubkey() []byte { return nil } +func (m *ValidatorRegistryDeltaBlock) GetSlot() uint64 { + if m != nil { + return m.Slot + } + return 0 +} + func (m *ValidatorRegistryDeltaBlock) GetFlag() ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags { if m != nil { return m.Flag @@ -1842,7 +1867,7 @@ func (m *ProofOfCustodyChallenge) Reset() { *m = ProofOfCustodyChallenge func (m *ProofOfCustodyChallenge) String() string { return proto.CompactTextString(m) } func (*ProofOfCustodyChallenge) ProtoMessage() {} func (*ProofOfCustodyChallenge) Descriptor() ([]byte, []int) { - return fileDescriptor_types_0d51d13371de9b52, []int{22} + return fileDescriptor_types_11bf700a8e6d5306, []int{22} } func (m *ProofOfCustodyChallenge) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1895,7 +1920,7 @@ func init() { proto.RegisterType((*Exit)(nil), "ethereum.beacon.p2p.v1.Exit") proto.RegisterType((*ValidatorRegistryDeltaBlock)(nil), "ethereum.beacon.p2p.v1.ValidatorRegistryDeltaBlock") proto.RegisterType((*ProofOfCustodyChallenge)(nil), "ethereum.beacon.p2p.v1.ProofOfCustodyChallenge") - proto.RegisterEnum("ethereum.beacon.p2p.v1.ValidatorRecord_StatusCodes", ValidatorRecord_StatusCodes_name, ValidatorRecord_StatusCodes_value) + proto.RegisterEnum("ethereum.beacon.p2p.v1.ValidatorRecord_StatusFlags", ValidatorRecord_StatusFlags_name, ValidatorRecord_StatusFlags_value) proto.RegisterEnum("ethereum.beacon.p2p.v1.ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags", ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags_name, ValidatorRegistryDeltaBlock_ValidatorRegistryDeltaFlags_value) } func (m *BeaconState) Marshal() (dAtA []byte, err error) { @@ -2474,11 +2499,11 @@ func (m *ValidatorRecord) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(len(m.Pubkey))) i += copy(dAtA[i:], m.Pubkey) } - if len(m.WithdrawalCredentials) > 0 { + if len(m.WithdrawalCredentialsHash32) > 0 { dAtA[i] = 0x12 i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.WithdrawalCredentials))) - i += copy(dAtA[i:], m.WithdrawalCredentials) + i = encodeVarintTypes(dAtA, i, uint64(len(m.WithdrawalCredentialsHash32))) + i += copy(dAtA[i:], m.WithdrawalCredentialsHash32) } if len(m.RandaoCommitmentHash32) > 0 { dAtA[i] = 0x1a @@ -2491,34 +2516,49 @@ func (m *ValidatorRecord) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintTypes(dAtA, i, uint64(m.RandaoLayers)) } - if m.Status != 0 { + if m.ActivationSlot != 0 { dAtA[i] = 0x28 i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Status)) + i = encodeVarintTypes(dAtA, i, uint64(m.ActivationSlot)) } - if m.LatestStatusChangeSlot != 0 { + if m.ExitSlot != 0 { dAtA[i] = 0x30 i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LatestStatusChangeSlot)) + i = encodeVarintTypes(dAtA, i, uint64(m.ExitSlot)) + } + if m.WithdrawalSlot != 0 { + dAtA[i] = 0x38 + i++ + i = encodeVarintTypes(dAtA, i, uint64(m.WithdrawalSlot)) + } + if m.PenalizedSlot != 0 { + dAtA[i] = 0x40 + i++ + i = encodeVarintTypes(dAtA, i, uint64(m.PenalizedSlot)) } if m.ExitCount != 0 { - dAtA[i] = 0x38 + dAtA[i] = 0x48 i++ i = encodeVarintTypes(dAtA, i, uint64(m.ExitCount)) } + if m.StatusFlags != 0 { + dAtA[i] = 0x50 + i++ + i = encodeVarintTypes(dAtA, i, uint64(m.StatusFlags)) + } if len(m.PocCommitmentHash32) > 0 { - dAtA[i] = 0x42 + dAtA[i] = 0x5a i++ i = encodeVarintTypes(dAtA, i, uint64(len(m.PocCommitmentHash32))) i += copy(dAtA[i:], m.PocCommitmentHash32) } if m.LastPocChangeSlot != 0 { - dAtA[i] = 0x48 + dAtA[i] = 0x60 i++ i = encodeVarintTypes(dAtA, i, uint64(m.LastPocChangeSlot)) } if m.SecondLastPocChangeSlot != 0 { - dAtA[i] = 0x50 + dAtA[i] = 0x68 i++ i = encodeVarintTypes(dAtA, i, uint64(m.SecondLastPocChangeSlot)) } @@ -3017,10 +3057,10 @@ func (m *DepositData) MarshalTo(dAtA []byte) (int, error) { } i += n16 } - if m.Value != 0 { + if m.Amount != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i = encodeVarintTypes(dAtA, i, uint64(m.Amount)) } if m.Timestamp != 0 { dAtA[i] = 0x18 @@ -3241,9 +3281,14 @@ func (m *ValidatorRegistryDeltaBlock) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(len(m.Pubkey))) i += copy(dAtA[i:], m.Pubkey) } - if m.Flag != 0 { + if m.Slot != 0 { dAtA[i] = 0x20 i++ + i = encodeVarintTypes(dAtA, i, uint64(m.Slot)) + } + if m.Flag != 0 { + dAtA[i] = 0x28 + i++ i = encodeVarintTypes(dAtA, i, uint64(m.Flag)) } if m.XXX_unrecognized != nil { @@ -3548,7 +3593,7 @@ func (m *ValidatorRecord) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - l = len(m.WithdrawalCredentials) + l = len(m.WithdrawalCredentialsHash32) if l > 0 { n += 1 + l + sovTypes(uint64(l)) } @@ -3559,15 +3604,24 @@ func (m *ValidatorRecord) Size() (n int) { if m.RandaoLayers != 0 { n += 1 + sovTypes(uint64(m.RandaoLayers)) } - if m.Status != 0 { - n += 1 + sovTypes(uint64(m.Status)) + if m.ActivationSlot != 0 { + n += 1 + sovTypes(uint64(m.ActivationSlot)) } - if m.LatestStatusChangeSlot != 0 { - n += 1 + sovTypes(uint64(m.LatestStatusChangeSlot)) + if m.ExitSlot != 0 { + n += 1 + sovTypes(uint64(m.ExitSlot)) + } + if m.WithdrawalSlot != 0 { + n += 1 + sovTypes(uint64(m.WithdrawalSlot)) + } + if m.PenalizedSlot != 0 { + n += 1 + sovTypes(uint64(m.PenalizedSlot)) } if m.ExitCount != 0 { n += 1 + sovTypes(uint64(m.ExitCount)) } + if m.StatusFlags != 0 { + n += 1 + sovTypes(uint64(m.StatusFlags)) + } l = len(m.PocCommitmentHash32) if l > 0 { n += 1 + l + sovTypes(uint64(l)) @@ -3821,8 +3875,8 @@ func (m *DepositData) Size() (n int) { l = m.DepositInput.Size() n += 1 + l + sovTypes(uint64(l)) } - if m.Value != 0 { - n += 1 + sovTypes(uint64(m.Value)) + if m.Amount != 0 { + n += 1 + sovTypes(uint64(m.Amount)) } if m.Timestamp != 0 { n += 1 + sovTypes(uint64(m.Timestamp)) @@ -3933,6 +3987,9 @@ func (m *ValidatorRegistryDeltaBlock) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if m.Slot != 0 { + n += 1 + sovTypes(uint64(m.Slot)) + } if m.Flag != 0 { n += 1 + sovTypes(uint64(m.Flag)) } @@ -5676,7 +5733,7 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawalCredentials", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawalCredentialsHash32", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -5700,9 +5757,9 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WithdrawalCredentials = append(m.WithdrawalCredentials[:0], dAtA[iNdEx:postIndex]...) - if m.WithdrawalCredentials == nil { - m.WithdrawalCredentials = []byte{} + m.WithdrawalCredentialsHash32 = append(m.WithdrawalCredentialsHash32[:0], dAtA[iNdEx:postIndex]...) + if m.WithdrawalCredentialsHash32 == nil { + m.WithdrawalCredentialsHash32 = []byte{} } iNdEx = postIndex case 3: @@ -5757,9 +5814,9 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ActivationSlot", wireType) } - m.Status = 0 + m.ActivationSlot = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5769,16 +5826,16 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= (ValidatorRecord_StatusCodes(b) & 0x7F) << shift + m.ActivationSlot |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestStatusChangeSlot", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExitSlot", wireType) } - m.LatestStatusChangeSlot = 0 + m.ExitSlot = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5788,12 +5845,50 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LatestStatusChangeSlot |= (uint64(b) & 0x7F) << shift + m.ExitSlot |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawalSlot", wireType) + } + m.WithdrawalSlot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WithdrawalSlot |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PenalizedSlot", wireType) + } + m.PenalizedSlot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PenalizedSlot |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ExitCount", wireType) } @@ -5812,7 +5907,26 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { break } } - case 8: + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusFlags", wireType) + } + m.StatusFlags = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StatusFlags |= (ValidatorRecord_StatusFlags(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PocCommitmentHash32", wireType) } @@ -5843,7 +5957,7 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { m.PocCommitmentHash32 = []byte{} } iNdEx = postIndex - case 9: + case 12: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LastPocChangeSlot", wireType) } @@ -5862,7 +5976,7 @@ func (m *ValidatorRecord) Unmarshal(dAtA []byte) error { break } } - case 10: + case 13: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SecondLastPocChangeSlot", wireType) } @@ -7455,9 +7569,9 @@ func (m *DepositData) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - m.Value = 0 + m.Amount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -7467,7 +7581,7 @@ func (m *DepositData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= (uint64(b) & 0x7F) << shift + m.Amount |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } @@ -8020,7 +8134,7 @@ func (m *Exit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ValidatorIndex |= (uint64(b) & 0x7F) << shift + m.ValidatorIndex |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } @@ -8189,6 +8303,25 @@ func (m *ValidatorRegistryDeltaBlock) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: + 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 + } + } + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Flag", wireType) } @@ -8386,160 +8519,160 @@ var ( ) func init() { - proto.RegisterFile("proto/beacon/p2p/v1/types.proto", fileDescriptor_types_0d51d13371de9b52) + proto.RegisterFile("proto/beacon/p2p/v1/types.proto", fileDescriptor_types_11bf700a8e6d5306) } -var fileDescriptor_types_0d51d13371de9b52 = []byte{ - // 2408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xc9, 0x6f, 0x1c, 0x5b, - 0xd5, 0xff, 0xaa, 0x3d, 0xc5, 0xc7, 0x43, 0xdb, 0xd7, 0x8e, 0xbb, 0x62, 0xc7, 0xb1, 0x53, 0x79, - 0x83, 0x13, 0x7d, 0xd8, 0x71, 0x47, 0x21, 0x40, 0x1e, 0x0f, 0xb9, 0xdb, 0x79, 0x2f, 0x0d, 0x26, - 0xf1, 0x2b, 0x3b, 0x0e, 0x48, 0x48, 0xa5, 0xdb, 0x55, 0xb7, 0xdb, 0x15, 0x97, 0xeb, 0x16, 0x75, - 0x6f, 0x3b, 0x31, 0x88, 0xc7, 0x96, 0x49, 0x62, 0x85, 0xc4, 0x16, 0x76, 0xfc, 0x09, 0x8c, 0x3b, - 0x10, 0x4b, 0x78, 0xb0, 0x05, 0xa1, 0xac, 0x10, 0xa3, 0x60, 0xc3, 0x82, 0x0d, 0xba, 0x43, 0x0d, - 0x3d, 0x54, 0xe3, 0xc0, 0x86, 0x95, 0xbb, 0xce, 0xf0, 0xbb, 0xa7, 0xce, 0x39, 0xf7, 0x0c, 0x65, - 0x58, 0x8b, 0x62, 0xca, 0xe9, 0x56, 0x93, 0x60, 0x97, 0x86, 0x5b, 0x51, 0x35, 0xda, 0x3a, 0xdb, - 0xde, 0xe2, 0xe7, 0x11, 0x61, 0x9b, 0x92, 0x83, 0x96, 0x08, 0x3f, 0x26, 0x31, 0xe9, 0x9c, 0x6e, - 0x2a, 0x99, 0xcd, 0xa8, 0x1a, 0x6d, 0x9e, 0x6d, 0x2f, 0xaf, 0xb5, 0x29, 0x6d, 0x07, 0x64, 0x4b, - 0x4a, 0x35, 0x3b, 0xad, 0x2d, 0xee, 0x9f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x67, 0x74, 0x1f, 0x46, 0x65, 0x3c, 0x0d, 0x19, 0xce, 0xc2, 0x5a, 0x93, 0x53, - 0x94, 0x51, 0x95, 0x4a, 0xe8, 0x2e, 0x2c, 0x45, 0x38, 0xe6, 0xbe, 0xeb, 0x47, 0x3d, 0x65, 0xb1, - 0x24, 0xed, 0xbe, 0xdc, 0xc5, 0x4d, 0xab, 0xe2, 0x4d, 0x98, 0x73, 0x55, 0xf4, 0x32, 0x85, 0x11, - 0xa9, 0x50, 0xd6, 0xf4, 0x54, 0xf4, 0x06, 0xcc, 0x08, 0xf7, 0x3a, 0x7e, 0xe8, 0x06, 0x1d, 0x8f, - 0x78, 0x72, 0x4a, 0x18, 0xb5, 0xa7, 0x05, 0xb1, 0xa1, 0x69, 0xd6, 0x6f, 0x0c, 0x98, 0xca, 0x19, - 0xf8, 0xbf, 0xfe, 0x4e, 0x5b, 0xb0, 0x80, 0xdb, 0xed, 0x98, 0xb4, 0x45, 0xe0, 0x45, 0xcf, 0xc4, - 0xbc, 0x13, 0x13, 0x3d, 0xff, 0xa0, 0x94, 0x75, 0x90, 0x70, 0xac, 0x6f, 0x8e, 0x40, 0xb9, 0xc7, - 0x58, 0x84, 0xf4, 0x65, 0x32, 0x72, 0x77, 0x69, 0x11, 0xc6, 0xe4, 0x94, 0xa1, 0x53, 0x40, 0x3d, - 0xa0, 0x7b, 0x60, 0xaa, 0xf7, 0xee, 0xaf, 0xc1, 0xda, 0xc2, 0xcb, 0x8a, 0xdf, 0x53, 0x80, 0xd1, - 0x7d, 0x58, 0x26, 0x11, 0x75, 0x8f, 0x9d, 0x26, 0xed, 0x84, 0x1e, 0x8e, 0xcf, 0xbb, 0x54, 0x95, - 0xb9, 0x15, 0x29, 0x51, 0xd3, 0x02, 0x39, 0xe5, 0xbb, 0x50, 0x51, 0x73, 0x54, 0xff, 0xa1, 0x63, - 0x52, 0x73, 0x51, 0xb2, 0x7b, 0xcf, 0xfc, 0x04, 0x5c, 0xed, 0x6d, 0x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, 0x54, 0x83, 0x09, 0xb1, - 0x0f, 0x33, 0x67, 0x5b, 0xc7, 0xb4, 0x78, 0x16, 0xe8, 0xbd, 0x27, 0xf6, 0xb8, 0xd4, 0xdc, 0xce, - 0x30, 0xaa, 0xda, 0xb5, 0xaf, 0x8c, 0x51, 0x15, 0x19, 0x37, 0xa1, 0xb3, 0x46, 0x8c, 0x00, 0xa7, - 0x24, 0x3e, 0x09, 0x88, 0xd3, 0x8c, 0x71, 0xe8, 0x1e, 0xa7, 0xdf, 0xc5, 0x0c, 0xd9, 0xe0, 0x16, - 0x14, 0xb3, 0x26, 0x79, 0xc9, 0x27, 0xb1, 0x5b, 0x30, 0xaf, 0x75, 0x78, 0x4c, 0x88, 0x4e, 0x08, - 0xfd, 0x79, 0x42, 0x31, 0x0e, 0x63, 0x42, 0x54, 0x4a, 0x5c, 0x87, 0x24, 0x25, 0x9d, 0xf4, 0x4e, - 0x4d, 0xdb, 0x53, 0x5e, 0x96, 0xf0, 0x16, 0x86, 0x51, 0x51, 0x91, 0x07, 0x96, 0x9d, 0x01, 0xb3, - 0xa1, 0x3a, 0xa8, 0x77, 0x36, 0xec, 0x6a, 0xce, 0xea, 0x90, 0x8c, 0x60, 0xfd, 0xac, 0x04, 0x2b, - 0x47, 0x03, 0x3f, 0xe9, 0xab, 0x21, 0xe6, 0x21, 0x5c, 0x4f, 0xbe, 0x14, 0x77, 0xff, 0x7f, 0x60, - 0xc0, 0x57, 0x10, 0xfd, 0xb9, 0x38, 0x0f, 0x92, 0x1b, 0x12, 0x0a, 0x0c, 0xee, 0x1f, 0x66, 0xb3, - 0x3e, 0x33, 0xd2, 0xd5, 0x67, 0x5c, 0x18, 0x6d, 0x05, 0xb8, 0x2d, 0x53, 0x76, 0xb6, 0xfa, 0xf8, - 0x02, 0x0b, 0x51, 0xef, 0xdb, 0x14, 0xf0, 0xde, 0x09, 0x70, 0x9b, 0xd9, 0x12, 0xdc, 0xba, 0x57, - 0xe4, 0x0e, 0x29, 0x84, 0x66, 0x01, 0xba, 0xd6, 0x82, 0x4b, 0x30, 0x2a, 0x67, 0x7f, 0xc3, 0xba, - 0x02, 0x95, 0x82, 0x2f, 0x5f, 0xb5, 0xe9, 0x9f, 0xbf, 0xbc, 0x66, 0xfc, 0xe2, 0xe5, 0x35, 0xe3, - 0x77, 0x2f, 0xaf, 0x19, 0xcd, 0x71, 0xf9, 0x4f, 0xa7, 0x3b, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, - 0x21, 0xab, 0x33, 0x3c, 0xed, 0x1a, 0x00, 0x00, +var fileDescriptor_types_11bf700a8e6d5306 = []byte{ + // 2406 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcb, 0x6f, 0x1c, 0x59, + 0xd5, 0x9f, 0x6a, 0xbf, 0x4f, 0xb7, 0xbb, 0xdb, 0xd7, 0x89, 0x5d, 0x89, 0xe3, 0xc4, 0xa9, 0xcc, + 0x4c, 0x9c, 0xe8, 0xfb, 0xec, 0xb8, 0xa3, 0x21, 0x88, 0x0c, 0x03, 0x6e, 0x3b, 0x43, 0x1a, 0x99, + 0x89, 0xa7, 0xec, 0xb1, 0x59, 0x20, 0x95, 0x6e, 0x57, 0xdd, 0x6e, 0x57, 0x5c, 0x5d, 0xb7, 0xa8, + 0x7b, 0xdb, 0x89, 0x41, 0xcc, 0x9a, 0x97, 0x60, 0x85, 0xc4, 0x16, 0xfe, 0x0b, 0x9e, 0x3b, 0x24, + 0x96, 0x30, 0xb0, 0x42, 0x1a, 0x84, 0xb2, 0x42, 0x3c, 0x05, 0x1b, 0x16, 0x6c, 0xd0, 0x7d, 0xd4, + 0xa3, 0x9f, 0xe3, 0x30, 0x1b, 0x56, 0x76, 0x9d, 0xf3, 0x3b, 0xe7, 0x9e, 0x3a, 0xe7, 0xdc, 0xf3, + 0xa8, 0x86, 0x1b, 0x51, 0x4c, 0x39, 0xdd, 0x6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 0xa1, 0x72, 0x66, 0x44, 0xdc, 0x74, 0xce, 0xac, 0x02, 0x9c, 0x51, + 0x4e, 0x74, 0x5b, 0x56, 0xd6, 0xce, 0x09, 0x8a, 0xec, 0xc2, 0xd6, 0xef, 0x0d, 0x30, 0x47, 0xa5, + 0x33, 0x7a, 0x08, 0x93, 0x32, 0x9e, 0x86, 0x0c, 0xe7, 0xc8, 0x5a, 0x93, 0x13, 0x94, 0x51, 0x95, + 0x42, 0xe8, 0x0d, 0x58, 0x8a, 0x70, 0xcc, 0x7d, 0xd7, 0x8f, 0xfa, 0xca, 0x62, 0x41, 0xda, 0x7d, + 0xb9, 0x87, 0x9b, 0x56, 0xc5, 0x3b, 0x50, 0x75, 0x55, 0xf4, 0x32, 0x81, 0x09, 0x29, 0x50, 0xd1, + 0xf4, 0x14, 0x7a, 0x0b, 0xe6, 0x85, 0x7b, 0x1d, 0x3f, 0x74, 0x83, 0xae, 0x47, 0x3c, 0x39, 0x25, + 0x4c, 0xda, 0x25, 0x41, 0x6c, 0x68, 0x9a, 0xf5, 0xa1, 0x01, 0xc5, 0x9c, 0x81, 0xff, 0xeb, 0xef, + 0xb4, 0x09, 0x8b, 0xb8, 0xdd, 0x8e, 0x49, 0x5b, 0x04, 0x5e, 0xf4, 0x4c, 0xcc, 0xbb, 0x31, 0xd1, + 0xf3, 0x0f, 0x4a, 0x59, 0x07, 0x09, 0xc7, 0xfa, 0xee, 0x04, 0x54, 0xfa, 0x8c, 0x45, 0x48, 0x5f, + 0x26, 0x23, 0x77, 0x97, 0x2e, 0xc1, 0x94, 0x9c, 0x32, 0x74, 0x0a, 0xa8, 0x07, 0xf4, 0x00, 0x4c, + 0xf5, 0xde, 0x83, 0x35, 0x58, 0x5b, 0x78, 0x59, 0xf1, 0xfb, 0x0a, 0x30, 0x7a, 0x08, 0x57, 0x49, + 0x44, 0xdd, 0x13, 0xa7, 0x49, 0xbb, 0xa1, 0x87, 0xe3, 0xf3, 0x1e, 0x51, 0x65, 0xee,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3d, 0xbd, 0xc6, 0x7a, 0x0a, 0x48, 0x05, 0x1a, 0x07, + 0x62, 0x38, 0x24, 0xde, 0x4b, 0x4e, 0x82, 0x77, 0x61, 0x61, 0xd4, 0x08, 0x58, 0x69, 0xf6, 0x55, + 0xcd, 0xef, 0x15, 0x60, 0x41, 0x06, 0x1a, 0x37, 0x03, 0x72, 0x44, 0x39, 0x91, 0x67, 0x3d, 0x86, + 0x9b, 0x43, 0x46, 0x57, 0xd9, 0xbe, 0xee, 0x89, 0x66, 0xe0, 0x8b, 0xad, 0xdc, 0x90, 0x85, 0x6b, + 0x75, 0x70, 0x90, 0xdd, 0xa7, 0xee, 0xbd, 0x86, 0x02, 0x8d, 0xd3, 0xb4, 0x95, 0x6a, 0x2a, 0x8c, + 0xd1, 0xb4, 0x95, 0x68, 0x4a, 0xa6, 0xfd, 0x89, 0xff, 0x66, 0xda, 0x7f, 0xe9, 0x59, 0xfc, 0x3b, + 0x06, 0x14, 0x75, 0x06, 0x4a, 0x8f, 0x34, 0x60, 0x5e, 0x67, 0xb4, 0xe3, 0x8b, 0x8c, 0xd4, 0x4b, + 0xc7, 0xab, 0x1f, 0x71, 0x0f, 0x64, 0xf6, 0xda, 0x25, 0xaf, 0x2f, 0x97, 0x71, 0x27, 0xb7, 0xc2, + 0xe9, 0x27, 0x51, 0xc9, 0xc4, 0x4e, 0xce, 0x38, 0xee, 0x44, 0xba, 0xd6, 0x67, 0x04, 0xeb, 0x17, + 0x05, 0xa8, 0xf6, 0x5f, 0x7f, 0x99, 0x50, 0x49, 0x11, 0xc9, 0xf7, 0xe8, 0xf9, 0x84, 0xaa, 0x5a, + 0xb4, 0x0d, 0x95, 0x48, 0x27, 0x94, 0xdc, 0xea, 0x9d, 0x2d, 0x79, 0x74, 0xb1, 0x76, 0x77, 0x7c, + 0xa1, 0xc9, 0xe7, 0x5f, 0xa2, 0x13, 0x07, 0xe2, 0x69, 0x4b, 0xd4, 0xfc, 0x54, 0x67, 0x16, 0xd7, + 0x2d, 0x9d, 0x67, 0x28, 0xca, 0x29, 0x90, 0xac, 0xad, 0x41, 0x2b, 0xd4, 0x75, 0xf9, 0x18, 0x56, + 0xd4, 0x46, 0x58, 0x91, 0xb4, 0x8e, 0x41, 0x2b, 0x6a, 0xd6, 0xf7, 0x0d, 0x28, 0xf7, 0xd6, 0x3b, + 0x54, 0x87, 0x19, 0xb1, 0x45, 0x33, 0x67, 0x4b, 0x47, 0x75, 0xf4, 0x34, 0xd0, 0x7f, 0x53, 0xec, + 0x69, 0x29, 0xb9, 0x95, 0xe9, 0xa8, 0x69, 0xd7, 0xbe, 0xb4, 0x8e, 0x9a, 0xf5, 0x6d, 0x03, 0x66, + 0x74, 0xde, 0x88, 0x21, 0xa0, 0x43, 0xe2, 0xd3, 0x80, 0x38, 0xcd, 0x18, 0x87, 0xee, 0x49, 0xfa, + 0x35, 0xcd, 0x90, 0x2d, 0x6e, 0x51, 0x31, 0xeb, 0x92, 0x97, 0x7c, 0x48, 0xbb, 0x0b, 0x0b, 0x5a, + 0x86, 0xc7, 0x84, 0xe8, 0x84, 0xd0, 0x1f, 0x35, 0x14, 0xe3, 0x30, 0x26, 0x44, 0xa5, 0xc4, 0x4d, + 0x48, 0x92, 0xd2, 0x49, 0x6f, 0x55, 0xc9, 0x2e, 0x7a, 0x59, 0xca, 0x5b, 0x18, 0x26, 0x45, 0x4d, + 0x1e, 0x5a, 0x78, 0x86, 0x4c, 0x87, 0x85, 0xa1, 0xd3, 0x61, 0x4f, 0x7b, 0x56, 0x87, 0x64, 0x04, + 0xeb, 0x77, 0x05, 0x58, 0x39, 0x1a, 0xfa, 0x43, 0x80, 0x1a, 0x63, 0x1e, 0xc3, 0xcd, 0xe4, 0xfb, + 0x72, 0xef, 0xaf, 0x0a, 0x43, 0xbe, 0x9d, 0xe8, 0x8f, 0xcc, 0x79, 0x25, 0xb9, 0x31, 0xe1, 0xc2, + 0x06, 0x67, 0x9d, 0x66, 0xa2, 0xa7, 0xd3, 0x24, 0x5e, 0x98, 0xcc, 0x79, 0xc1, 0x85, 0x49, 0xb1, + 0x93, 0xc8, 0x6c, 0x2b, 0xd7, 0x9e, 0x5c, 0x60, 0x25, 0xe9, 0x7f, 0xc3, 0x11, 0x3c, 0xb5, 0xae, + 0x48, 0xe5, 0xd6, 0x83, 0x51, 0x2e, 0x52, 0x53, 0x7f, 0x19, 0x60, 0x7b, 0xe7, 0xb0, 0x71, 0xb4, + 0x7d, 0xd8, 0x78, 0xf2, 0x4e, 0xf5, 0x15, 0x34, 0x0b, 0x93, 0x6a, 0xdc, 0xb7, 0xae, 0xc0, 0xf2, + 0x88, 0x6f, 0x68, 0xf5, 0xd2, 0x2f, 0x5f, 0x5c, 0x37, 0x7e, 0xf5, 0xe2, 0xba, 0xf1, 0x87, 0x17, + 0xd7, 0x8d, 0xe6, 0xb4, 0xfc, 0xf9, 0xea, 0xfe, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x09, + 0x17, 0xbc, 0x16, 0x1b, 0x00, 0x00, } diff --git a/proto/beacon/p2p/v1/types.proto b/proto/beacon/p2p/v1/types.proto index 392d3028d6..8bdf92408a 100644 --- a/proto/beacon/p2p/v1/types.proto +++ b/proto/beacon/p2p/v1/types.proto @@ -2,8 +2,6 @@ syntax = "proto3"; package ethereum.beacon.p2p.v1; -import "google/protobuf/timestamp.proto"; - import "proto/common/messages.proto"; message BeaconState { @@ -90,24 +88,25 @@ message AttestationData { message ValidatorRecord { bytes pubkey = 1; // TODO(781): The usage of withdrawal_credentials is not defined in spec. Not used in Prysm yet. - bytes withdrawal_credentials = 2; // TODO(781): this is hash32, rename with suffix _hash32 + bytes withdrawal_credentials_hash32 = 2; bytes randao_commitment_hash32 = 3; uint64 randao_layers = 4; + uint64 activation_slot = 5; + uint64 exit_slot = 6; + uint64 withdrawal_slot = 7; + uint64 penalized_slot = 8; + uint64 exit_count = 9; // Possible validator status code: // https://github.com/ethereum/eth2.0-specs/blob/master/specs/core/0_beacon-chain.md#constants - enum StatusCodes { - PENDING_ACTIVATION = 0; // validator is queued and waiting to be active. - ACTIVE = 1; // validator is participating validator duties. - ACTIVE_PENDING_EXIT = 2; // validator is waiting to exit. - EXITED_WITHOUT_PENALTY = 3; // validator has successfully withdrawn its balance. - EXITED_WITH_PENALTY = 4; // validator got slashed and kicked out of validator pool. + enum StatusFlags { + INITIAL = 0; // validator status initial value. + INITIATED_EXIT = 1; // validator initiated exit. + WITHDRAWABLE = 2; // validator is participating validator duties. } - StatusCodes status = 5; - uint64 latest_status_change_slot = 6; - uint64 exit_count = 7; - bytes poc_commitment_hash32 = 8; - uint64 last_poc_change_slot = 9; - uint64 second_last_poc_change_slot = 10; + StatusFlags status_flags = 10; + bytes poc_commitment_hash32 = 11; + uint64 last_poc_change_slot = 12; + uint64 second_last_poc_change_slot = 13; // Deprecated fields // All fields must be annotated with [deprecated=true]; @@ -180,7 +179,7 @@ message SlashableVoteData { message DepositData { DepositInput deposit_input = 1; - uint64 value = 2; + uint64 amount = 2; // Amount in Gwei uint64 timestamp = 3; } @@ -205,7 +204,7 @@ message Deposit { message Exit { uint64 slot = 1; - uint64 validator_index = 2; + uint32 validator_index = 2; bytes signature = 3; // Type of [uint384]? } @@ -213,11 +212,12 @@ message ValidatorRegistryDeltaBlock { bytes latest_registry_delta_root_hash32 = 1; uint32 validator_index = 2; bytes pubkey = 3; + uint64 slot = 4; enum ValidatorRegistryDeltaFlags { ACTIVATION = 0; EXIT = 1; } - ValidatorRegistryDeltaFlags flag = 4; + ValidatorRegistryDeltaFlags flag = 5; } message ProofOfCustodyChallenge {} // Empty until phase 1 diff --git a/shared/params/config.go b/shared/params/config.go index 0f85a2b5cb..5b67694f8c 100644 --- a/shared/params/config.go +++ b/shared/params/config.go @@ -61,9 +61,9 @@ type BeaconChainConfig struct { IncluderRewardQuotient uint64 // IncluderRewardQuotient defines the reward quotient of proposer for including attestations.. MaxValidatorChurnQuotient uint64 // MaxValidatorChurnQuotient defines the quotient how many validators can change each time. POWContractMerkleTreeDepth uint64 // POWContractMerkleTreeDepth defines the depth of PoW contract merkle tree. - InitialForkVersion uint64 // InitialForkVersion is used to track fork version between state transitions. + GenesisForkVersion uint64 // GenesisForkVersion is used to track fork version between state transitions. InitialForkSlot uint64 // InitialForkSlot is used to initialize the fork slot in the initial Beacon state. - InitialSlotNumber uint64 // InitialSlotNumber is used to initialize the slot number of the genesis block. + GenesisSlot uint64 // GenesisSlot is used to initialize the slot number of the genesis block. SimulatedBlockRandao [32]byte // SimulatedBlockRandao is a RANDAO seed stubbed in side simulated block to advance local beacon chain. RandBytes uint64 // RandBytes is the number of bytes used as entropy to shuffle validators. BootstrappedValidatorsCount uint64 // BootstrappedValidatorsCount is the number of validators we seed to start beacon chain. @@ -76,7 +76,11 @@ type BeaconChainConfig struct { EjectionBalanceInGwei uint64 // EjectionBalanceInGwei is the minimal balance in Gwei a validator needs before ejected. ZeroHash [32]byte // ZeroHash is used to represent a zeroed out 32 byte array. EmptySignature [][]byte // EmptySignature is used to represent a zeroed out BLS Signature. - + FarFutureSlot uint64 // FarFutureSlot is the last slot based on uint64 type. + EntryExitDelay uint64 // EntryExitDelay is the duration of the day for entry exit. + LatestPenalizedExitLength uint64 // LatestPenalizedExitLength represents withdrawal time when a validator is penalized. + WhistlerBlowerRewardQuotient uint64 // WhistlerBlowerRewardQuotient defines how the reward denominator of whistler blower. + SeedLookahead uint64 // SeedLookahead is the duration of the look ahead seed. } // ShardChainConfig contains configs for node to participate in shard chains. @@ -113,9 +117,9 @@ var defaultBeaconConfig = &BeaconChainConfig{ WithdrawalsPerCycle: uint64(4), BaseRewardQuotient: uint64(1024), MaxValidatorChurnQuotient: uint64(32), - InitialForkVersion: 0, + GenesisForkVersion: 0, InitialForkSlot: 0, - InitialSlotNumber: 0, + GenesisSlot: 0, RandBytes: 3, BootstrappedValidatorsCount: 16384, SyncPollingInterval: 16 * 4, // Query nodes over the network every 4 slots for sync status. @@ -130,50 +134,55 @@ var defaultBeaconConfig = &BeaconChainConfig{ IncluderRewardQuotient: 8, EjectionBalance: 16, EjectionBalanceInGwei: 16 * 1e9, + FarFutureSlot: 1<<64 - 1, + EntryExitDelay: 256, + LatestPenalizedExitLength: 8192, + WhistlerBlowerRewardQuotient: 512, + SeedLookahead: 64, } var demoBeaconConfig = &BeaconChainConfig{ - ZeroBalanceValidatorTTL: defaultBeaconConfig.ZeroBalanceValidatorTTL, - LatestRandaoMixesLength: defaultBeaconConfig.LatestRandaoMixesLength, - LatestBlockRootsLength: defaultBeaconConfig.LatestBlockRootsLength, - MaxExits: defaultBeaconConfig.MaxExits, - MaxAttestations: defaultBeaconConfig.MaxAttestations, - MaxProposerSlashings: defaultBeaconConfig.MaxProposerSlashings, - MaxCasperSlashings: defaultBeaconConfig.MaxCasperSlashings, - ShardCount: 5, - MaxDeposit: defaultBeaconConfig.MaxDeposit, - MinTopUpSize: defaultBeaconConfig.MinTopUpSize, - MinOnlineDepositSize: defaultBeaconConfig.MinOnlineDepositSize, - Gwei: defaultBeaconConfig.Gwei, - MaxDepositInGwei: defaultBeaconConfig.MaxDepositInGwei, - DepositsForChainStart: defaultBeaconConfig.DepositsForChainStart, - TargetCommitteeSize: uint64(3), - SlotDuration: uint64(2), - CycleLength: uint64(5), - MinValidatorSetChangeInterval: uint64(15), - MinAttestationInclusionDelay: defaultBeaconConfig.MinAttestationInclusionDelay, - SqrtExpDropTime: defaultBeaconConfig.SqrtExpDropTime, - MinWithdrawalPeriod: uint64(20), - WithdrawalsPerCycle: uint64(2), - BaseRewardQuotient: defaultBeaconConfig.BaseRewardQuotient, - MaxValidatorChurnQuotient: defaultBeaconConfig.MaxValidatorChurnQuotient, - InitialForkVersion: defaultBeaconConfig.InitialForkVersion, - InitialSlotNumber: defaultBeaconConfig.InitialSlotNumber, - RandBytes: defaultBeaconConfig.RandBytes, - InitialForkSlot: defaultBeaconConfig.InitialForkSlot, - SimulatedBlockRandao: [32]byte{'S', 'I', 'M', 'U', 'L', 'A', 'T', 'E', 'R'}, - SyncPollingInterval: 2 * 4, // Query nodes over the network every 4 slots for sync status. - GenesisTime: time.Now(), - MaxNumLog2Validators: defaultBeaconConfig.MaxNumLog2Validators, - EpochLength: defaultBeaconConfig.EpochLength, - PowReceiptRootVotingPeriod: defaultBeaconConfig.PowReceiptRootVotingPeriod, - InactivityPenaltyQuotient: defaultBeaconConfig.InactivityPenaltyQuotient, - ZeroHash: defaultBeaconConfig.ZeroHash, - EmptySignature: makeEmptySignature(), - CollectivePenaltyCalculationPeriod: defaultBeaconConfig.CollectivePenaltyCalculationPeriod, - IncluderRewardQuotient: defaultBeaconConfig.IncluderRewardQuotient, - EjectionBalance: defaultBeaconConfig.EjectionBalance, - EjectionBalanceInGwei: defaultBeaconConfig.EjectionBalanceInGwei, + LatestRandaoMixesLength: defaultBeaconConfig.LatestRandaoMixesLength, + LatestBlockRootsLength: defaultBeaconConfig.LatestBlockRootsLength, + MaxExits: defaultBeaconConfig.MaxExits, + MaxAttestations: defaultBeaconConfig.MaxAttestations, + MaxProposerSlashings: defaultBeaconConfig.MaxProposerSlashings, + MaxCasperSlashings: defaultBeaconConfig.MaxCasperSlashings, + ShardCount: 5, + MaxDeposit: defaultBeaconConfig.MaxDeposit, + MinTopUpSize: defaultBeaconConfig.MinTopUpSize, + MinOnlineDepositSize: defaultBeaconConfig.MinOnlineDepositSize, + Gwei: defaultBeaconConfig.Gwei, + MaxDepositInGwei: defaultBeaconConfig.MaxDepositInGwei, + DepositsForChainStart: defaultBeaconConfig.DepositsForChainStart, + TargetCommitteeSize: uint64(3), + SlotDuration: uint64(2), + CycleLength: uint64(5), + MinValidatorSetChangeInterval: uint64(15), + MinAttestationInclusionDelay: defaultBeaconConfig.MinAttestationInclusionDelay, + SqrtExpDropTime: defaultBeaconConfig.SqrtExpDropTime, + MinWithdrawalPeriod: uint64(20), + WithdrawalsPerCycle: uint64(2), + BaseRewardQuotient: defaultBeaconConfig.BaseRewardQuotient, + MaxValidatorChurnQuotient: defaultBeaconConfig.MaxValidatorChurnQuotient, + GenesisForkVersion: defaultBeaconConfig.GenesisForkVersion, + GenesisSlot: defaultBeaconConfig.GenesisSlot, + RandBytes: defaultBeaconConfig.RandBytes, + InitialForkSlot: defaultBeaconConfig.InitialForkSlot, + SimulatedBlockRandao: [32]byte{'S', 'I', 'M', 'U', 'L', 'A', 'T', 'E', 'R'}, + SyncPollingInterval: 2 * 4, // Query nodes over the network every 4 slots for sync status. + GenesisTime: time.Now(), + MaxNumLog2Validators: defaultBeaconConfig.MaxNumLog2Validators, + EpochLength: defaultBeaconConfig.EpochLength, + PowReceiptRootVotingPeriod: defaultBeaconConfig.PowReceiptRootVotingPeriod, + InactivityPenaltyQuotient: defaultBeaconConfig.InactivityPenaltyQuotient, + ZeroHash: defaultBeaconConfig.ZeroHash, + EmptySignature: makeEmptySignature(), + IncluderRewardQuotient: defaultBeaconConfig.IncluderRewardQuotient, + EjectionBalance: defaultBeaconConfig.EjectionBalance, + EjectionBalanceInGwei: defaultBeaconConfig.EjectionBalanceInGwei, + LatestPenalizedExitLength: defaultBeaconConfig.LatestPenalizedExitLength, + WhistlerBlowerRewardQuotient: defaultBeaconConfig.WhistlerBlowerRewardQuotient, } var defaultShardConfig = &ShardChainConfig{