Skip to content

Commit

Permalink
Merge pull request #150 from Layr-Labs/jb/faster-status
Browse files Browse the repository at this point in the history
Remove a duplicate fetch in `status`
  • Loading branch information
jbrower95 authored Sep 6, 2024
2 parents fd4d0cd + cdd7e01 commit 60175b9
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions cli/core/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,17 @@ func GetStatus(ctx context.Context, eigenpodAddress string, eth *ethclient.Clien
PanicOnError("failed to calculate sum of onchain validator balances", err)
sumRestakedBalancesGwei := new(big.Float).SetUint64(uint64(sumRestakedBalancesU64))

for i := 0; i < len(allValidatorsForEigenpod); i++ {
validator := allValidatorsForEigenpod[i].Validator
validatorIndex := allValidatorsForEigenpod[i].Index

validatorInfo, err := eigenPod.ValidatorPubkeyToInfo(nil, validator.PublicKey[:])
PanicOnError("failed to fetch validator info", err)

validators[fmt.Sprintf("%d", validatorIndex)] = Validator{
Index: validatorIndex,
Status: int(validatorInfo.Status),
Slashed: validator.Slashed,
PublicKey: validator.PublicKey.String(),
IsAwaitingActivationQueue: validator.ActivationEpoch == FAR_FUTURE_EPOCH,
IsAwaitingWithdrawalCredentialProof: IsAwaitingWithdrawalCredentialProof(validatorInfo, validator),
EffectiveBalance: uint64(validator.EffectiveBalance),
CurrentBalance: uint64(allBeaconBalances[validatorIndex]),
for _, validator := range allValidatorsWithInfoForEigenpod {

validators[fmt.Sprintf("%d", validator.Index)] = Validator{
Index: validator.Index,
Status: int(validator.Info.Status),
Slashed: validator.Validator.Slashed,
PublicKey: validator.Validator.PublicKey.String(),
IsAwaitingActivationQueue: validator.Validator.ActivationEpoch == FAR_FUTURE_EPOCH,
IsAwaitingWithdrawalCredentialProof: IsAwaitingWithdrawalCredentialProof(validator.Info, validator.Validator),
EffectiveBalance: uint64(validator.Validator.EffectiveBalance),
CurrentBalance: uint64(allBeaconBalances[validator.Index]),
}
}

Expand Down

0 comments on commit 60175b9

Please sign in to comment.