EIP-7684 Returning deposits with mismatched withdrawal credentials (Return deposits for distinct credentials)

No call decision · Consensus & staking · EIP status Stagnant · created 2024-04-12

A proposal that automatically returns a deposit if it arrives with withdrawal credentials different from the existing validator record, reducing the damage from front-running attacks in delegated staking.

Why it is needed

In delegated staking, the party paying the deposit and the party operating the validator key can be separate. If the depositor sends the full stake amount to the operator's validator key, the operator can front-run it with a deposit carrying their own withdrawal credentials first, turning the full amount into a top-up they own. Avoiding this previously required cumbersome procedures such as using distributed key generation (DKG) or sending 1 ETH first to confirm inclusion before sending the rest, procedures that make it hard to run a trustless, automated staking protocol. This proposal aims to limit losses from a front-running attack to the RETURN_DEPOSIT_PENALTY level rather than the full deposit amount.

What changes

Today

After EIP-7684

Who is affected

In depth

Problem scenario: front-running attack

In staking operations, the party funding the stake and the party operating the validator key can be separate. If the funder submits a single deposit carrying the full stake amount to the operator's validator key, the operator can front-run it with a second deposit carrying their own withdrawal credentials. As a result, the full-amount deposit gets treated as a top-up owned by the operator. Existing workarounds include using a DKG protocol so the deposit only finalizes with both parties' consent, or sending 1 ETH first to confirm inclusion before sending the rest, capping the maximum loss at 1 ETH.

Specification: handling pending withdrawals

apply_deposit is modified so that a deposit whose withdrawal credentials differ from the existing validator record is not applied immediately but placed on the withdrawal queue. get_expected_withdrawals is modified to return this pending withdrawal first. process_withdrawals clears the pending withdrawal queue after processing. No execution layer changes are needed.

Why it is processed in the next slot

A rejected deposit cannot be withdrawn immediately within the same slot N. Under the EIP-6110 scheme, the execution client must know the full withdrawal list before building slot N's payload, while conversely the consensus client must know the full execution payload before building slot N's beacon block, creating a circular dependency. So rejected deposits are processed in the next slot. For simplicity, all pending withdrawals are processed at once, but if DoS concerns arise, they could instead be queued and processed incrementally.

Security considerations: increase in withdrawal count

Previously the number of withdrawals per slot was fixed at 16, but this proposal could raise that to up to 1,271 in the worst case for a 30M gas block. Accounting for the future gas efficiency gains EIP-6110 would bring, this could rise to up to 1,916. Each withdrawal changes an address balance once, and there is no separate gas pricing for this operation, but assuming a worst case of 6,900 gas per withdrawal, total block gas could increase by about 30%.

The role of RETURN_DEPOSIT_PENALTY

RETURN_DEPOSIT_PENALTY is a mechanism to discourage submitting deposits that will be rejected. Assuming 6,900 gas per withdrawal, this penalty effectively imposes a cost equivalent to 144,927 Gwei/gas. In other words, even if a front-running attack is attempted, the attacker's gain is capped at this penalty level, which reduces the incentive to repeatedly submit deposits that will be indiscriminately rejected.

Hard fork necessity and current status

This change is backward-incompatible at the consensus layer, so it can only be scheduled and applied via a hard fork. There are no forward or backward compatibility issues at the execution layer. Test cases are still work-in-progress within the consensus layer standard test suite. This EIP's original status is Stagnant, with no active discussion underway for fork inclusion, and whether it will actually be adopted remains uncertain.

Original EIP · ← EIPs