Skip to content

Commit

Permalink
Add PARTIALLY_DEPOSITED status
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhly committed Aug 20, 2020
1 parent 3394cce commit d2115ca
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions beacon-chain/rpc/validator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ func (vs *Server) validatorStatus(
}
// Mark a validator as DEPOSITED if their deposit is visible.
resp.Status = ethpb.ValidatorStatus_DEPOSITED

// Check if 32 ETH was deposited. If less assign PARTIALLY_DEPOSITED status.
if deposit.Data.Amount < params.BeaconConfig().MaxEffectiveBalance {
resp.Status = ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
}
resp.Eth1DepositBlockNumber = eth1BlockNumBigInt.Uint64()

depositBlockSlot, err := vs.depositBlockSlot(ctx, headState, eth1BlockNumBigInt)
Expand All @@ -189,8 +192,8 @@ func (vs *Server) validatorStatus(
}
resp.DepositInclusionSlot = depositBlockSlot
return resp, nonExistentIndex
// Deposited and Pending mean the validator has been put into the state.
case ethpb.ValidatorStatus_DEPOSITED, ethpb.ValidatorStatus_PENDING:
// Deposited, Pending or Partialy Deposited mean the validator has been put into the state.
case ethpb.ValidatorStatus_DEPOSITED, ethpb.ValidatorStatus_PENDING, ethpb.ValidatorStatus_PARTIALLY_DEPOSITED:
var lastActivatedValidatorIdx uint64
for j := headState.NumValidators() - 1; j >= 0; j-- {
val, err := headState.ValidatorAtIndexReadOnly(uint64(j))
Expand Down Expand Up @@ -238,6 +241,9 @@ func assignmentStatus(beaconState *stateTrie.BeaconState, validatorIdx uint64) e
return ethpb.ValidatorStatus_DEPOSITED
}
if currentEpoch < validator.ActivationEpoch() {
if validator.EffectiveBalance() < params.BeaconConfig().MaxEffectiveBalance {
return ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
}
return ethpb.ValidatorStatus_PENDING
}
if validator.ExitEpoch() == farFutureEpoch {
Expand Down

0 comments on commit d2115ca

Please sign in to comment.