Skip to content

Commit

Permalink
account for withdrawals after exit
Browse files Browse the repository at this point in the history
  • Loading branch information
haloooloolo committed Nov 23, 2024
1 parent e76ed8e commit d7eb71d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/rpip-62/rewards-calculation-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,14 @@ If the range is empty (`eligibleStartTime >= eligibleEndTime`), award a `minipoo
rewardStartBcSlot := math.Ceil((eligibleStartTime - genesisTime) / secondsPerSlot)
rewardEndBcSlot := math.Ceil((eligibleEndTime - genesisTime) / secondsPerSlot)
```
For each slot in the reward interval, get the list of validator withdrawals (e.g. `/eth/v2/beacon/blocks/<slotIndex>`). Note the `address` and `amount` for withdrawals that correspond to an eligible minipool and add them to the minipool's total. Withdrawals that do not occur in `(rewardStartBcSlot, rewardEndBcSlot]` should be ignored.
For each slot in the reward interval, get the list of validator withdrawals (e.g. `/eth/v2/beacon/blocks/<slotIndex>`). Note the `address` and `amount` for withdrawals that correspond to an eligible minipool and add them to the minipool's total. Withdrawals that do not occur in `(rewardStartBcSlot, rewardEndBcSlot]` should be ignored. If the slot is ahead of the validator's `withdrawable_epoch` (e.g. `/eth/v1/beacon/states/<targetBcSlot>/validators?id=0x<pubkey>`), credit the full withdrawal amount.
```go
minipoolWithdrawals[address] += amount
```
Otherwise, only credit what is in excess of the maximum effective balance.
```go
minipoolWithdrawals[address] += max(0, amount - 32 Eth)
```
Use the cumulative withdrawals to calculate the minipool's eligible consensus income and corresponding bonus.
```go
consensusIncome := minipoolWithdrawals[minipool.Address]
Expand Down

0 comments on commit d7eb71d

Please sign in to comment.