owned this note
owned this note
Published
Linked with GitHub
## PEPE Gas Savings
[TOC]
### What are Withdrawal Sweeps?
As your validator performs tasks on the beacon chain, it accumulates rewards. Occasionally, the beacon chain moves these rewards, sending them to your EigenPod. This is referred to as a ["withdrawal sweep,"](https://ethereum.org/en/staking/withdrawals/#validator-sweeping) and is something that happens automatically as part of the beacon chain's normal operations.
*Note that the beacon chain uses withdrawal sweeps both for regular validator yield processing, as well as validator exit processing ("partial" vs "full" withdrawals).*
The beacon chain processes a sweep for up to 16 validators per block, meaning the more validators there are on the beacon chain, the longer it will take before your specific validator is swept.
Currently, with just over 1 million validators active on the beacon chain, an individual validator can expect a withdrawal sweep every ~9 days. Here's a helpful website that will show you the current state of the sweep delay: https://www.validatorqueue.com/
It's anticipated that this delay will decrease after the upcoming Pectra fork, as the introduction of validator consolidation will validators to combine, reducing the overall number of validators.
### M2 EigenPods
So your validator has received a withdrawal sweep, moving ETH from the beacon chain into your EigenPod. What now?
---
**First,** it's not possible to immediately withdraw this yield. You need to _update_ your EigenPod's accounting by submitting "withdrawal proofs" that show the system that this yield was earned by you, and that it's not being restaked. This is an important step that helps ensure funds only leave the system when they're supposed to.
However, withdrawal proofs are large and expensive. M2 withdrawal proofs cost ~220k gas, and a transaction can fit ~20 of these proofs before the transaction gets too big to submit to the network. Depending on network gas prices, these proofs can eat a significant portion of your validator's yield. For example, at 10 gwei, withdrawal proofs could cost you roughly 10% of the yield you're claiming by submitting them. At 15 gwei, costs start to approach 20% of your yield. (Source: [this transaction containing 21 withdrawal proofs](https://etherscan.io/tx/0x9c1e2656c885e053286c2999e6132fa48a24fc3c6866358c7df5da369c04ecdc))
---
**Second,** every time your EigenPod receives a withdrawal sweep, you will need to submit a proof of that sweep in order to do anything with the swept ETH. For example:
* If you have one validator restaked through your pod, every ~9 days you will need to submit a proof to access your yield. If you wait 18 days, you'll need to submit 2 proofs - one for each withdrawal sweep your validator accrued.
* If you have 10 validators restaked, every ~9 days you will need to submit 10 proofs, because each of these validators is swept individually. If you wait 18 days, you need to submit 20 proofs (2 sweeps * 10 validators).
The current mainnet release has no way to claim these sweeps in bulk - an individual proof is needed for each sweep!
---
**Third,** in the M2 system, once you submit proof of one of these withdrawal sweeps, one of two things happens:
* **If your validator fully exited from the beacon chain:** the ETH remains restaked in your EigenPod for the time being. In order to withdraw this ETH, you need to initiate a withdrawal via the `DelegationManager`, wait out a 7 day escrow period, then complete the withdrawal to receive your funds.
* **If the sweep just contained yield and your validator is still active on the beacon chain:** the withdrawal proof will move this yield to the `DelayedWithdrawalRouter`, where you can claim it after a 7 day escrow period.
This distinction can be confusing, as we support 2 different withdrawal queues depending on the circumstances.
### PEPE
With the new PEPE upgrade, we're changing all of this.
---
**First,** PEPE's new checkpoint proofs are significantly smaller than M2 withdrawal proofs - from 69 proof elements in M2 down to 39 in PEPE (*a 45% reduction*)!
This reduction in size makes it possible to fit way more proofs in a transaction - from 20 proofs in M2 up to 80 in PEPE (*a 4x increase*)!
For pod owners that were having to sign dozens of transactions to claim withdrawals, **you can expect to sign far fewer transactions once PEPE releases**.
---
**Second,** in addition to being smaller, PEPE's checkpoint proofs are far cheaper and are able to claim partial withdrawals in bulk. While M2's withdrawal proofs cost ~220k gas per proof, PEPE's checkpoint proofs cost less the more you submit:
![image](https://hackmd.io/_uploads/SyNaIy-i0.png)
Additionally, instead of requiring *one proof per withdrawal sweep* to claim M2 withdrawals, PEPE only requires *one proof per validator* to claim ALL prior withdrawals.
To get an idea of what this means, consider the following scenarios:
**1. Small Restaker**
As a small restaker, you have a handful of validators (5) pointed at your EigenPod. You're currently claiming partial withdrawals roughly once per month - which, given a withdrawal sweep of ~9 days means you're claiming about 3 withdrawal sweeps worth for each validator (for a total of 15 withdrawal sweeps):
| # Val | # Sweeps Per Val | Total proofs (M2) | # Txns Needed | Total Gas |
| -------- | -------- | -------- | -------- | -------- |
| 5 | 3 | 15 | 1 | 3.3 M |
Post-PEPE, the same process requires only 1 proof per validator, and each proof is significantly cheaper. Using the table above, 5 validators costs ~77k gas per proof:
| # Val | # Sweeps Per Val | Total proofs (PEPE) | # Txns Needed | Total Gas |
| -------- | -------- | -------- | -------- | -------- |
| 5 | 3 | 5 | 1 | 385 K |
For this small restaker doing monthly claims, *PEPE represents a gas savings of 88%!*
**2. Large Restaker**
As a large restaker, you have tons of validators (1000) pointed at your EigenPod. You're currently claiming partial withdrawals roughly once every 20 days - which, given a withdrawal sweep of ~9 days means you're claiming about 2 withdrawal sweeps worth for each validator (for a total of 2000 withdrawal sweeps):
| # Val | # Sweeps Per Val | Total proofs (M2) | # Txns Needed | Total Gas |
| -------- | -------- | -------- | -------- | -------- |
| 1000 | 2 | 2000 | 100 | 440 M |
Post-PEPE, the same process requires only 1 proof per validator, and each proof is significantly cheaper. Using the table above, 1000 validators batched into groups of 80 costs ~58k gas per proof:
| # Val | # Sweeps Per Val | Total proofs (PEPE) | # Txns Needed | Total Gas |
| -------- | -------- | -------- | -------- | -------- |
| 1000 | 2 | 1000 | 13 | 58.4 M |
For this large restaker doing claims every 20 days, *PEPE represents a gas savings of 86%!* Additionally, rather than having to sign around 100 transactions, this restaker will only need to sign 13.
---
**Third,** while M2 has two different ways to withdraw native ETH from EigenLayer, PEPE has only one. This is because, starting with PEPE, your EigenPods will be able to _restake your beacon chain yield!_ The claims process mentioned above not only allows you to claim your beacon chain yield, it also awards restaking shares to this yield, enabling you to earn additional rewards by delegating this yield to operators.
All native restaked ETH will be treated identically within the system - backed by shares, and withdrawable via the `DelegationManager` like any other asset in the system.