Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PARTIALLY_DEPOSITED status #7071

Merged
merged 15 commits into from
Aug 27, 2020
Prev Previous commit
Next Next commit
Fixup
michaelhly committed Aug 22, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9122e94f0beaf616131c2f4054135e358b072e9a
29 changes: 23 additions & 6 deletions beacon-chain/rpc/validator/status.go
Original file line number Diff line number Diff line change
@@ -194,6 +194,20 @@ func (vs *Server) validatorStatus(
return resp, nonExistentIndex
// 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:
if resp.Status == ethpb.ValidatorStatus_PENDING {
if vs.DepositFetcher == nil {
log.Warn("Not connected to ETH1. Cannot determine validator ETH1 deposit.")
} else {
// Check if there was a deposit deposit.
deposit, eth1BlockNumBigInt := vs.DepositFetcher.DepositByPubkey(ctx, pubKey)
if eth1BlockNumBigInt != nil && deposit.Data.Amount >= params.BeaconConfig().MaxEffectiveBalance {
resp.Status = ethpb.ValidatorStatus_DEPOSITED
} else if eth1BlockNumBigInt != nil && deposit.Data.Amount > 0 {
resp.Status = ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
}
}
}

var lastActivatedValidatorIdx uint64
for j := headState.NumValidators() - 1; j >= 0; j-- {
val, err := headState.ValidatorAtIndexReadOnly(uint64(j))
@@ -239,16 +253,19 @@ func assignmentStatus(beaconState *stateTrie.BeaconState, validatorIdx uint64) e
return ethpb.ValidatorStatus_UNKNOWN_STATUS
}
if currentEpoch < validator.ActivationEligibilityEpoch() {
if validatorBalance < params.BeaconConfig().MaxEffectiveBalance {
return ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
if validatorBalance == 0 {
return ethpb.ValidatorStatus_PENDING
}
if validatorBalance >= params.BeaconConfig().MaxEffectiveBalance {
return ethpb.ValidatorStatus_DEPOSITED
}
return ethpb.ValidatorStatus_DEPOSITED
return ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
}
if currentEpoch < validator.ActivationEpoch() {
if validatorBalance > 0 && validatorBalance < params.BeaconConfig().MaxEffectiveBalance {
return ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
if validatorBalance == 0 {
return ethpb.ValidatorStatus_PENDING
}
return ethpb.ValidatorStatus_PENDING
return ethpb.ValidatorStatus_PARTIALLY_DEPOSITED
}
if validator.ExitEpoch() == farFutureEpoch {
return ethpb.ValidatorStatus_ACTIVE