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

[bugfix] calculation for finding a stale pod #156

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading