Skip to content

Commit

Permalink
fix calculation for finding a stale pod
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrower95 committed Sep 25, 2024
1 parent 88e56bf commit 4b2f932
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cli/core/findStalePods.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,20 @@ func FindStaleEigenpods(ctx context.Context, eth *ethclient.Client, nodeUrl stri
// - native ETH in the pod
// - any active validators and their associated balances
// )
allValidatorsForEigenpod := utils.Filter(allValidatorsWithIndices, func(v ValidatorWithIndex) bool {
allActiveValidatorsForEigenpod := utils.Filter(allValidatorsWithIndices, func(v ValidatorWithIndex) bool {
if allValidatorInfo[v.Index].Status != 1 {
return false
}

withdrawal := executionWithdrawalAddress(v.Validator.WithdrawalCredentials)
return withdrawal != nil && strings.EqualFold(*withdrawal, eigenpod)
})

allValidatorBalancesSummedGwei := utils.Reduce(allValidatorsForEigenpod, func(accum phase0.Gwei, validator ValidatorWithIndex) phase0.Gwei {
allActiveValidatorBalancesSummedGwei := utils.Reduce(allActiveValidatorsForEigenpod, func(accum phase0.Gwei, validator ValidatorWithIndex) phase0.Gwei {
return accum + allValidatorBalances[validator.Index]
}, phase0.Gwei(0))
// converting gwei to wei
allBalances[eigenpod] = cache.PodOwnerShares[eigenpod].ExecutionLayerBalanceWei + (uint64(allValidatorBalancesSummedGwei) * params.GWei)
allBalances[eigenpod] = cache.PodOwnerShares[eigenpod].ExecutionLayerBalanceWei + (uint64(allActiveValidatorBalancesSummedGwei) * params.GWei)
return allBalances
}, map[string]uint64{})

Expand Down

0 comments on commit 4b2f932

Please sign in to comment.