Skip to content

Commit f1a4409

Browse files
feat: handle grouped execution requests (#152)
This adds supports for grouped execution requests. For example, according to EIP-7685, deposit requests may be encoded like this: 0x00 || deposit_request1 || deposit_request2 || deposit_request3 instead of 0x00 || deposit_request1 0x00 || deposit_request2 0x00 || deposit_request3 The same is true for all other execution requests.
1 parent 3baf57d commit f1a4409

6 files changed

Lines changed: 848 additions & 185 deletions

File tree

docs/deposits-and-withdrawals.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ If signature verification fails, a refund withdrawal is created immediately. No
4444

4545
## Withdrawal Flow
4646

47-
Withdrawals are parsed in `parse_execution_requests` and processed when included in a block.
47+
Withdrawals are parsed in `parse_execution_requests` and processed when included in a block, unless
48+
they are deferred at an epoch boundary and retried from `pending_execution_requests` in the next
49+
epoch.
4850

4951
### Withdrawal Scenarios
5052

@@ -96,12 +98,16 @@ User-initiated withdrawals are still limited to one at a time via the `has_pendi
9698

9799
Withdrawal requests for active validators received on the **last block of an epoch** are deferred to the next epoch. This ensures that `removed_validators` in the finalized header accurately reflects all validator exits, since the header is created at the penultimate block.
98100

99-
Deferred requests are stored in `pending_execution_requests` and processed at the start of the next epoch.
101+
Deferred requests are stored in `pending_execution_requests` and processed at the start of the next
102+
epoch. Deferred withdrawals are re-queued individually.
100103

101104
## Invariants
102105

103106
- A validator will join the committee `VALIDATOR_NUM_WARM_UP_EPOCHS` epochs after submitting a valid deposit request. The phase after submitting the deposit request, and before joining the committee is called the `onboarding phase`.
104-
- If a withdrawal request is submitted in epoch `n`, then the validator will be removed from the committee at the end of epoch `n`. The withdrawal will be processed in epoch `n + VALIDATOR_WITHDRAWAL_NUM_EPOCHS`.
107+
- If a withdrawal request is submitted in epoch `n`, then it is normally handled in epoch `n`, and
108+
the withdrawal will be processed in epoch `n + VALIDATOR_WITHDRAWAL_NUM_EPOCHS`. Exception:
109+
requests received on the last block of epoch `n` are deferred to the next epoch before being
110+
scheduled.
105111
- There are two parameters that govern the staking amount: `validator_min_stake` and `validator_max_stake`. The balance of a validator must always be in range `[validator_min_stake, validator_max_stake]`.
106112
- Any deposit request with resulting balance outside `[validator_min_stake, validator_max_stake]` will be rejected and refunded.
107113
- A validator can only have one pending deposit request at a time. Subsequent deposit requests will be ignored.

0 commit comments

Comments
 (0)