Skip to content

Commit 9ee8c91

Browse files
authored
Merge pull request #156 from Layr-Labs/jb/fix-find
[bugfix] calculation for finding a stale pod
2 parents 88e56bf + 4b2f932 commit 9ee8c91

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cli/core/findStalePods.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,20 @@ func FindStaleEigenpods(ctx context.Context, eth *ethclient.Client, nodeUrl stri
230230
// - native ETH in the pod
231231
// - any active validators and their associated balances
232232
// )
233-
allValidatorsForEigenpod := utils.Filter(allValidatorsWithIndices, func(v ValidatorWithIndex) bool {
233+
allActiveValidatorsForEigenpod := utils.Filter(allValidatorsWithIndices, func(v ValidatorWithIndex) bool {
234+
if allValidatorInfo[v.Index].Status != 1 {
235+
return false
236+
}
237+
234238
withdrawal := executionWithdrawalAddress(v.Validator.WithdrawalCredentials)
235239
return withdrawal != nil && strings.EqualFold(*withdrawal, eigenpod)
236240
})
237241

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

0 commit comments

Comments
 (0)