diff --git a/beacon-chain/core/epoch/precompute/reward_penalty.go b/beacon-chain/core/epoch/precompute/reward_penalty.go index 07868da4f..8e1e108fd 100644 --- a/beacon-chain/core/epoch/precompute/reward_penalty.go +++ b/beacon-chain/core/epoch/precompute/reward_penalty.go @@ -162,7 +162,7 @@ func ProposersDelta(state *stateTrie.BeaconState, pBal *Balance, vp []*Validator baseRewardsPerEpoch := params.BeaconConfig().BaseRewardsPerEpoch proposerRewardQuotient := params.BeaconConfig().ProposerRewardQuotient for _, v := range vp { - if v.ProposerIndex > uint64(len(rewards)) { + if v.ProposerIndex >= uint64(len(rewards)) { // This should never happen with a valid state / validator. return nil, errors.New("proposer index out of range") } diff --git a/beacon-chain/core/epoch/precompute/reward_penalty_test.go b/beacon-chain/core/epoch/precompute/reward_penalty_test.go index 3df1ddddb..726263e77 100644 --- a/beacon-chain/core/epoch/precompute/reward_penalty_test.go +++ b/beacon-chain/core/epoch/precompute/reward_penalty_test.go @@ -368,7 +368,7 @@ func TestProposerDeltaPrecompute_ValidatorIndexOutOfRange(t *testing.T) { t.Fatal(err) } - proposerIndex := validatorCount + 1 + proposerIndex := validatorCount b := &Balance{ActiveCurrentEpoch: 1000} v := []*Validator{ {IsPrevEpochAttester: true, CurrentEpochEffectiveBalance: 32, ProposerIndex: proposerIndex},