---
eip: 8483
title: Post-Quantum Material Registration
description: Execution layer triggered registration of post-quantum material for validators and builders
author: Potuz (@potuz), Justin Traglia (@jtraglia), Ignacio Hagopian (@jsign)
discussions-to: https://ethereum-magicians.org/t/eip-8483-post-quantum-material-registration/30186
status: Draft
type: Standards Track
category: Core
created: 2026-11-02
requires: 7002, 7251, 7685, 7732
---

## Abstract

This EIP adds an [EIP-7685](./eip-7685.md) request type and a predeploy contract with which the execution address in a validator's withdrawal credentials can commit 64 bytes of post-quantum (PQ) material for that validator. The consensus layer records the registered material. How it validates requests and records that material is specified in the consensus-specs repository. A second request type and predeploy contract let the execution address of an [EIP-7732](./eip-7732.md) builder commit 32 bytes of PQ material for that builder in the same way. For a validator the first 32 bytes, and for a builder all 32 bytes, are a lean eXtended Merkle Signature Scheme (leanXMSS) public key. The contract accepts a registration only with a proof of possession of that key. This EIP gives a validator's other 32 bytes no meaning. A future fork that migrates Ethereum consensus to post-quantum signatures will define how they are used. The intended use of those 32 bytes is verifiable random function (VRF) data, which together with the public key is enough to verify messages signed with that key.

## Motivation

The BLS signatures used by Ethereum consensus are not secure against a sufficiently capable quantum computer. Once such an adversary is credible, a BLS signature no longer proves that a message came from the validator's owner. That includes any message that would announce a new post-quantum key. A migration is only safe if every validator has committed to its post-quantum material *before* BLS is considered broken, through a channel whose authenticity does not depend on BLS.

The execution address in a validator's withdrawal credentials provides such a channel today. It is the owner of the validator's funds, and [EIP-7002](./eip-7002.md) and [EIP-7251](./eip-7251.md) already let it act on the validator through execution layer requests. This EIP adds one more such request. [EIP-7732](./eip-7732.md) builders also sign their bids with BLS keys and face the same problem. Their execution address, set from the withdrawal credentials of the builder deposit and already used to authorize [EIP-8282](./eip-8282.md) builder exits, provides the same kind of channel, so builders get an equivalent request. This EIP lets owners start registering post-quantum commitments now, long before the migration fork, while leaving the design of that fork completely open.

## Specification

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119) and [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174).

### Constants

#### Execution layer

##### Shared

The validator and builder contracts both use the following constants.

| Name | Value | Comment |
| - | - | - |
| `SYSTEM_ADDRESS` | `0xfffffffffffffffffffffffffffffffffffffffe` | Address used to invoke system operation on contract |
| `EXCESS_PQ_REGISTRATION_REQUESTS_STORAGE_SLOT` | `0` | |
| `PQ_REGISTRATION_REQUEST_COUNT_STORAGE_SLOT` | `1` | Number of requests added since the last system call |
| `PQ_REGISTRATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT` | `2` | Pointer to the head of the PQ registration request message queue |
| `PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT` | `3` | Pointer to the tail of the PQ registration request message queue |
| `PQ_REGISTRATION_REQUEST_QUEUE_STORAGE_OFFSET` | `4` | The start memory slot of the in-state PQ registration request message queue |
| `MIN_PQ_REGISTRATION_REQUEST_FEE` | `1` | |
| `PQ_REGISTRATION_REQUEST_FEE_UPDATE_FRACTION` | `17` | |
| `PRE_FORK_PQ_REGISTRATION_REQUEST_FEE` | `500000000000000` | Fixed fee, in wei (0.0005 ETH), charged until the first system call (provisional) |
| `EXCESS_INHIBITOR` | `2**256-1` | Excess value that blocks requests while the queue is disabled |
| `EXCESS_PRE_FORK` | `2**256-2` | Excess value that the constructor stores, which selects the fixed fee until the first system call |

##### Validators

| Name | Value | Comment |
| - | - | - |
| `PQ_VALIDATOR_REGISTRATION_REQUEST_TYPE` | `0x06` | The [EIP-7685](./eip-7685.md) type prefix for validator PQ registration requests (provisional, see below) |
| `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` | `TBD` | Where to call and store relevant details about the validator PQ registration request mechanism |
| `MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK` | `1024` | Maximum number of validator PQ registration requests that can be dequeued into a block |
| `TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK` | `512` | Number of validator requests added per block above which the fee rises |

##### Builders

| Name | Value | Comment |
| - | - | - |
| `PQ_BUILDER_REGISTRATION_REQUEST_TYPE` | `0x07` | The [EIP-7685](./eip-7685.md) type prefix for builder PQ registration requests (provisional, see below) |
| `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` | `TBD` | Where to call and store relevant details about the builder PQ registration request mechanism |
| `MAX_PQ_BUILDER_REGISTRATION_REQUESTS_PER_BLOCK` | `1024` | Maximum number of builder PQ registration requests that can be dequeued into a block |
| `TARGET_PQ_BUILDER_REGISTRATION_REQUESTS_PER_BLOCK` | `2` | Number of builder requests added per block above which the fee rises |

The request type value MUST be unique across all active [EIP-7685](./eip-7685.md) request types. `0x00` through `0x02` are used by Electra. `0x03` and `0x04` are the builder request types of [EIP-8282](./eip-8282.md). `0x05` is claimed by the draft proposals [EIP-8148](./eip-8148.md) and [EIP-8205](./eip-8205.md). `0x06` and `0x07` are the first values not claimed by any proposal. The final values are coordinated in the consensus-specs repository together with any other request types scheduled for the same fork.

#### Consensus layer

| Name | Value |
| - | - |
| `PQ_VALIDATOR_REGISTRATION_REQUEST_TYPE` | `Bytes1("0x06")` |
| `MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_PAYLOAD` | `Uint64(2**10)` (= 1,024) |
| `PQ_BUILDER_REGISTRATION_REQUEST_TYPE` | `Bytes1("0x07")` |
| `MAX_PQ_BUILDER_REGISTRATION_REQUESTS_PER_PAYLOAD` | `Uint64(2**10)` (= 1,024) |

### Execution layer

#### PQ registration request

The new PQ registration request is an [EIP-7685](./eip-7685.md) request with type `PQ_VALIDATOR_REGISTRATION_REQUEST_TYPE` consisting of the following fields:

1. `source_address`: `Bytes20`
2. `validator_pubkey`: `Bytes48`
3. `pq_data`: `Bytes64`

The [EIP-7685](./eip-7685.md) encoding of a PQ registration request is as follows. The encoded request value is exactly what the contract returns.

```python
request_type = PQ_VALIDATOR_REGISTRATION_REQUEST_TYPE
request_data = dequeue_pq_registration_requests()
```

Each record is 132 bytes (`source_address ++ validator_pubkey ++ pq_data`), and `request_data` is the concatenation of all dequeued records in queue order.

#### PQ registration request contract

The contract has the same queue design as the [EIP-7251](./eip-7251.md) consolidation request contract, with one more storage slot per queued request to hold the larger record. Its fee and system call follow the [EIP-8282](./eip-8282.md) builder exit contract: the fee charged on each write already accounts for the requests added earlier in the same block, the system call updates the excess and resets the request count, and a system call with non-empty calldata disables the queue. It differs in one respect: it accepts registrations before the fork that starts the system call. The constructor stores `EXCESS_PRE_FORK` in the excess slot, and while it is there every request pays the fixed `PRE_FORK_PQ_REGISTRATION_REQUEST_FEE`. The first system call replaces it with a zero excess, and from then on requests pay the dynamic fee. There is no Solidity-compatible ABI. The contract dispatches on the caller and on `calldatasize` alone, through three code paths:

1. Add PQ registration request: a call from any address other than `SYSTEM_ADDRESS` with exactly `2516` bytes of calldata.
2. Fee getter: a call from any address other than `SYSTEM_ADDRESS` with empty calldata returns the current fee.
3. System process: a call from `SYSTEM_ADDRESS` dequeues the PQ registration requests for the current block.

Calls that match none of these cases MUST revert.

The `2516` byte input of a PQ registration request is:

| Bytes | Field | Description |
| - | - | - |
| `0:48` | `validator_pubkey` | 48-byte BLS public key of the validator |
| `48:112` | `pq_data` | 64 bytes of post-quantum material |
| `112:2516` | `signature` | 2404-byte leanXMSS proof of possession |

A request whose proof of possession does not verify MUST revert.

The contract records `msg.sender` as `source_address`. It does not check that the BLS public key belongs to a validator or that `msg.sender` controls it.

##### Add PQ registration request

If the call data input to the contract is exactly `2516` bytes, perform the following:

1. Ensure the queue is not disabled and enough ETH was sent to cover the current PQ registration request fee (`msg.value >= get_fee()`)
2. Ensure the trailing signature is a valid leanXMSS proof of possession, as defined below
3. Increase the PQ registration request count by `1`
4. Insert a PQ registration request into the queue for the source address, validator public key and PQ data. The signature is not stored
5. Emit the accepted 132-byte record as an anonymous log (`LOG0`)

The proof of possession is a leanXMSS signature at leaf index `0` by the public key in `pq_data[0:32]`. The signed message is `keccak256(POP_DOMAIN ++ chain_id.to_bytes(32, 'big') ++ validator_pubkey ++ pq_data[0:32])`, where `POP_DOMAIN` is `keccak256("leanXMSS registration proof of possession v1")`. Verification is specified by the contract bytecode below.

Specifically, the functionality is defined in pseudocode as the function `add_pq_registration_request()`:

```python
POP_DOMAIN = keccak256("leanXMSS registration proof of possession v1")

def valid_proof_of_possession(Bytes48: bls_pubkey, Bytes32: xmss_pubkey, Bytes2404: signature) -> bool:
    """
    A leanXMSS signature at leaf 0 by xmss_pubkey over
    keccak256(POP_DOMAIN ++ chain_id.to_bytes(32, 'big') ++ bls_pubkey ++ xmss_pubkey).
    """
    message = keccak256(POP_DOMAIN ++ uint256(chain_id).to_bytes(32, 'big') ++ bls_pubkey ++ xmss_pubkey)
    return signature_index(signature) == 0 and leanxmss_verify(xmss_pubkey, message, signature)

def add_pq_registration_request(Bytes48: validator_pubkey, Bytes64: pq_data, Bytes2404: signature):
    """
    Add PQ registration request adds a new request to the PQ registration request queue,
    so long as a sufficient fee is provided and the proof of possession verifies.
    """

    # Verify sufficient fee was provided.
    fee = get_fee()
    require(msg.value >= fee, 'Insufficient value for fee')

    # The signature binds the XMSS key to this BLS key on this chain. It is not stored.
    require(
        valid_proof_of_possession(validator_pubkey, pq_data[0:32], signature),
        'Invalid proof of possession'
    )

    # Increment the PQ registration request count.
    count = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_COUNT_STORAGE_SLOT)
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_COUNT_STORAGE_SLOT, count + 1)

    # Insert into queue.
    queue_tail_index = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT)
    queue_storage_slot = PQ_REGISTRATION_REQUEST_QUEUE_STORAGE_OFFSET + queue_tail_index * 5
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot, msg.sender)
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 1, validator_pubkey[0:32])
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 2, validator_pubkey[32:48] ++ pq_data[0:16])
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 3, pq_data[16:48])
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 4, pq_data[48:64])
    log0(msg.sender ++ validator_pubkey ++ pq_data)
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT, queue_tail_index + 1)
```

###### Fee calculation

The following pseudocode computes the cost of an individual PQ registration request from the stored excess and request count.

```python
def get_fee() -> int:
    excess = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, EXCESS_PQ_REGISTRATION_REQUESTS_STORAGE_SLOT)
    require(excess != EXCESS_INHIBITOR, 'Inhibitor active')

    # Until the first system call, the fee is fixed.
    if excess == EXCESS_PRE_FORK:
        return PRE_FORK_PQ_REGISTRATION_REQUEST_FEE

    # Account for the requests already added in the current block.
    count = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_COUNT_STORAGE_SLOT)
    if count > TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK:
        excess += count - TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK

    return fake_exponential(
        MIN_PQ_REGISTRATION_REQUEST_FEE,
        excess,
        PQ_REGISTRATION_REQUEST_FEE_UPDATE_FRACTION
    )

def fake_exponential(factor: int, numerator: int, denominator: int) -> int:
    i = 1
    output = 0
    numerator_accum = factor * denominator
    while numerator_accum > 0:
        output += numerator_accum
        numerator_accum = (numerator_accum * numerator) // (denominator * i)
        i += 1
    return output // denominator
```

Before the first system call, the excess slot holds `EXCESS_PRE_FORK` and every request pays `PRE_FORK_PQ_REGISTRATION_REQUEST_FEE`. The requests added then are counted, but the first system call discards that count, so they do not raise the dynamic fee. After it, the fee is that of [EIP-8282](./eip-8282.md): `get_fee()` adds the requests submitted earlier in the current block above `TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK`, so the fee rises within a block as soon as the target is exceeded, and the system call folds the block's count into the excess. The fee, and any value sent above it, is left locked in the contract.

##### Fee getter

When the input to the contract is length zero and the caller is not `SYSTEM_ADDRESS`, interpret this as a get request for the current fee, i.e. the contract returns the result of `get_fee()`. The call MUST carry no value. A value-bearing fee getter call reverts.

##### System call

At the end of processing any execution block where this EIP is active (i.e. after processing all transactions), call `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` as `SYSTEM_ADDRESS` with no calldata. The invocation triggers the following:

* The contract's queue is updated based on the PQ registration requests dequeued, and the queue head/tail are reset if the queue has been cleared (`dequeue_pq_registration_requests()`)
* The contract's excess is updated based on usage in the current block, or set to `EXCESS_INHIBITOR` if the call carries calldata (`update_excess()`)
* The contract's PQ registration request count is reset to `0` (`reset_pq_registration_requests_count()`)

As in [EIP-8282](./eip-8282.md), the system call updates the excess and resets the request count. The first system call finds `EXCESS_PRE_FORK` in the excess slot and replaces it with a zero excess, so the requests added before it do not count toward the dynamic fee.

Each PQ registration request MUST appear in the [EIP-7685](./eip-7685.md) requests list in the exact order returned by `dequeue_pq_registration_requests()`.

A system call with non-empty calldata dequeues requests as usual but then stores `EXCESS_INHIBITOR` into the excess slot, disabling the queue: subsequent PQ registration requests and fee getter calls revert. The next system call with empty calldata resets the excess to zero and re-enables the queue. Under this EIP the system call is always made with empty calldata, so this path is unused. It is reserved for the future fork that consumes the registered material, which can use it to stop accepting registrations.

Additionally, the system call and the processing of that block MUST conform to the following:

* The call has a dedicated gas limit of `30_000_000`. Dequeuing `MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK` requests uses about 11,000,000 gas.
* Gas consumed by this call does not count against the block's overall gas usage.
* Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block's gas limit.
* The call does not follow [EIP-1559](./eip-1559.md) fee burn semantics: no value is transferred as part of this call.
* If there is no code at `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS`, the corresponding block **MUST** be marked invalid.
* If the call to the contract fails or returns an error, the block **MUST** be invalidated.

The functionality triggered by the system call is defined in pseudocode as the function `process_pq_registration_requests()`:

```python
###################
# Public function #
###################

def process_pq_registration_requests(calldata: bytes):
    reqs = dequeue_pq_registration_requests()
    update_excess(calldata)
    reset_pq_registration_requests_count()
    return ssz.serialize(reqs)

###########
# Helpers #
###########

class PQRegistrationRequest(object):
    source_address: Bytes20
    validator_pubkey: Bytes48
    pq_data: Bytes64

def dequeue_pq_registration_requests():
    queue_head_index = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT)
    queue_tail_index = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT)
    num_in_queue = queue_tail_index - queue_head_index
    num_dequeued = min(num_in_queue, MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK)

    reqs = []
    for i in range(num_dequeued):
        queue_storage_slot = PQ_REGISTRATION_REQUEST_QUEUE_STORAGE_OFFSET + (queue_head_index + i) * 5
        source_address = address(sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot)[0:20])
        validator_pubkey = (
            sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 1)[0:32]
            + sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 2)[0:16]
        )
        pq_data = (
            sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 2)[16:32]
            + sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 3)[0:32]
            + sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 4)[0:16]
        )
        req = PQRegistrationRequest(
            source_address=Bytes20(source_address),
            validator_pubkey=Bytes48(validator_pubkey),
            pq_data=Bytes64(pq_data)
        )
        reqs.append(req)

    new_queue_head_index = queue_head_index + num_dequeued
    if new_queue_head_index == queue_tail_index:
        # Queue is empty, reset queue pointers
        sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT, 0)
        sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT, 0)
    else:
        sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT, new_queue_head_index)

    return reqs

def update_excess(calldata: bytes):
    # Any calldata disables the queue
    if len(calldata) > 0:
        sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, EXCESS_PQ_REGISTRATION_REQUESTS_STORAGE_SLOT, EXCESS_INHIBITOR)
        return

    previous_excess = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, EXCESS_PQ_REGISTRATION_REQUESTS_STORAGE_SLOT)
    count = sload(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_COUNT_STORAGE_SLOT)

    new_excess = 0
    # The first system call, and the first one after the queue was disabled,
    # start from a zero excess. Otherwise apply the EIP-7002 update.
    if previous_excess != EXCESS_PRE_FORK and previous_excess != EXCESS_INHIBITOR:
        if previous_excess + count > TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK:
            new_excess = previous_excess + count - TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK

    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, EXCESS_PQ_REGISTRATION_REQUESTS_STORAGE_SLOT, new_excess)

def reset_pq_registration_requests_count():
    sstore(PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_COUNT_STORAGE_SLOT, 0)
```

##### Bytecode

Runtime bytecode:

```
0x3373fffffffffffffffffffffffffffffffffffffffe14610559575f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461065957807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1460b3576001546102008111607957506080565b6102009003015b601190600182026001905f5b5f82111560a75781019083028483029004916001019190608c565b909390049250505060bd565b506601c6bf526340005b366109d41460d657366106595734610659575f5260205ff35b3410610659577f2fe199f0484c92004a7143682fc0a7d76126031eb8591245f6db46fed85894975f524660205260505f60403760905f2060703560e01c6104f65760303560801b6104b060746105803780680c0000000000000000175f52906020526105805160405260505f205b8060801c8061f0ff166104f6576f333333333333333333333333333333338160021c81169116016f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f8160041c81169116016f010101010101010101010101010101010260101a606a14156104f6578168410000000000000000175f5281682100000000000000001760805281680100000000000000001761010052816802000000000000000017610180525f5b818160061c1a8060011c8116918061059001518360011661023e578260021661022f578260011661021f57610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836004166102975782600816610288578260041661027857610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806103a01461036357806105900151836010166102f957826020166102ea57826010166102da57610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836040166103525782608016610343578260401661033357610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a001526010019150506101e1565b505050506103c0610180208168030000000000000000175f5260016014536020526109305160305260405f2060026014536020526109405160305260405f2060036014536020526109505160305260405f2060046014536020526109605160305260405f2060056014536020526109705160305260405f2060066014536020526109805160305260405f2060076014536020526109905160305260405f2060086014536020526109a05160305260405f2060096014536020526109b05160305260405f20600a6014536020526109c05160305260405f20600b6014536020526109d05160305260405f20600c6014536020526109e05160305260405f20600d6014536020526109f05160305260405f20600e601453602052610a005160305260405f20600f601453602052610a105160305260405f206010601453602052610a205160305260405f20816980000000000000000000166104fa57906980000000000000000000176104b06105246105803780680c0000000000000000175f52906020526105805160305260405f20610144565b5f5ffd5b6030351860801c6104f65750600154600101600155600354806005026004013381556001015f3581556001016020358155600101604035815560010160603560801c60801b90553360601b5f5260705f60143760845fa0600101600355005b600354600254808203806104001161057057506104005b5f5b8181146105bd5782810160050260040181608402815460601b815260140181600101548152602001816002015481526020018160030154815260200190600401549052600101610572565b91018092146105cf57906002556105da565b90505f6002555f6003555b3661062b575f54600154817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe11156106185761020082820111610620575b50505f61064d565b01610200900361064d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b5f555f6001556084025ff35b5f5ffd
```

Init code (stores `EXCESS_PRE_FORK` in the excess slot and deploys the runtime code):

```
0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe5f5561065d80602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe14610559575f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461065957807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1460b3576001546102008111607957506080565b6102009003015b601190600182026001905f5b5f82111560a75781019083028483029004916001019190608c565b909390049250505060bd565b506601c6bf526340005b366109d41460d657366106595734610659575f5260205ff35b3410610659577f2fe199f0484c92004a7143682fc0a7d76126031eb8591245f6db46fed85894975f524660205260505f60403760905f2060703560e01c6104f65760303560801b6104b060746105803780680c0000000000000000175f52906020526105805160405260505f205b8060801c8061f0ff166104f6576f333333333333333333333333333333338160021c81169116016f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f8160041c81169116016f010101010101010101010101010101010260101a606a14156104f6578168410000000000000000175f5281682100000000000000001760805281680100000000000000001761010052816802000000000000000017610180525f5b818160061c1a8060011c8116918061059001518360011661023e578260021661022f578260011661021f57610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836004166102975782600816610288578260041661027857610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806103a01461036357806105900151836010166102f957826020166102ea57826010166102da57610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836040166103525782608016610343578260401661033357610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a001526010019150506101e1565b505050506103c0610180208168030000000000000000175f5260016014536020526109305160305260405f2060026014536020526109405160305260405f2060036014536020526109505160305260405f2060046014536020526109605160305260405f2060056014536020526109705160305260405f2060066014536020526109805160305260405f2060076014536020526109905160305260405f2060086014536020526109a05160305260405f2060096014536020526109b05160305260405f20600a6014536020526109c05160305260405f20600b6014536020526109d05160305260405f20600c6014536020526109e05160305260405f20600d6014536020526109f05160305260405f20600e601453602052610a005160305260405f20600f601453602052610a105160305260405f206010601453602052610a205160305260405f20816980000000000000000000166104fa57906980000000000000000000176104b06105246105803780680c0000000000000000175f52906020526105805160305260405f20610144565b5f5ffd5b6030351860801c6104f65750600154600101600155600354806005026004013381556001015f3581556001016020358155600101604035815560010160603560801c60801b90553360601b5f5260705f60143760845fa0600101600355005b600354600254808203806104001161057057506104005b5f5b8181146105bd5782810160050260040181608402815460601b815260140181600101548152602001816002015481526020018160030154815260200190600401549052600101610572565b91018092146105cf57906002556105da565b90505f6002555f6003555b3661062b575f54600154817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe11156106185761020082820111610620575b50505f61064d565b01610200900361064d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b5f555f6001556084025ff35b5f5ffd
```

##### Deployment

TBD. The contract will be deployed through the [EIP-7997](./eip-7997.md) `CREATE2` factory, and `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` will be fixed once the salt is chosen. The contract can be deployed well before the fork that activates this EIP. Its constructor stores `EXCESS_PRE_FORK` rather than `EXCESS_INHIBITOR`, so requests can be queued, for the fixed fee, as soon as it is deployed. They are dequeued, and processed by the consensus layer, once this EIP activates. If there is no code at `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` once this EIP is active, every block from activation onward MUST be invalid.

#### Builder PQ registration request

The new builder PQ registration request is an [EIP-7685](./eip-7685.md) request with type `PQ_BUILDER_REGISTRATION_REQUEST_TYPE` consisting of the following fields:

1. `source_address`: `Bytes20`
2. `builder_pubkey`: `Bytes48`
3. `pq_data`: `Bytes32`

```python
request_type = PQ_BUILDER_REGISTRATION_REQUEST_TYPE
request_data = dequeue_pq_builder_registration_requests()
```

Each record is 100 bytes (`source_address ++ builder_pubkey ++ pq_data`), and `request_data` is the concatenation of all dequeued records in queue order.

#### Builder PQ registration request contract

The builder contract at `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` behaves exactly like the validator contract above, with the following differences:

* Its constants are `MAX_PQ_BUILDER_REGISTRATION_REQUESTS_PER_BLOCK` and `TARGET_PQ_BUILDER_REGISTRATION_REQUESTS_PER_BLOCK` instead of the validator ones.
* A request is exactly `2484` bytes of calldata, laid out below. `pq_data` is the XMSS public key, so the proof of possession is over `builder_pubkey ++ pq_data`. Each queued request occupies four storage slots instead of five.

| Bytes | Field | Description |
| - | - | - |
| `0:48` | `builder_pubkey` | 48-byte BLS public key of the builder |
| `48:80` | `pq_data` | 32-byte leanXMSS public key |
| `80:2484` | `signature` | 2404-byte leanXMSS proof of possession |

The contract checks the signature and then discards it. The signature is not stored.

The queue insertion and removal differ from the validator contract only in the storage layout of each request:

```python
def insert_pq_builder_registration_request(Bytes48: builder_pubkey, Bytes32: pq_data):
    queue_tail_index = sload(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT)
    queue_storage_slot = PQ_REGISTRATION_REQUEST_QUEUE_STORAGE_OFFSET + queue_tail_index * 4
    sstore(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot, msg.sender)
    sstore(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 1, builder_pubkey[0:32])
    sstore(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 2, builder_pubkey[32:48] ++ pq_data[0:16])
    sstore(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 3, pq_data[16:32])
    log0(msg.sender ++ builder_pubkey ++ pq_data)
    sstore(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, PQ_REGISTRATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT, queue_tail_index + 1)

def read_pq_builder_registration_request(queue_index: int) -> PQBuilderRegistrationRequest:
    queue_storage_slot = PQ_REGISTRATION_REQUEST_QUEUE_STORAGE_OFFSET + queue_index * 4
    source_address = address(sload(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot)[0:20])
    builder_pubkey = (
        sload(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 1)[0:32]
        + sload(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 2)[0:16]
    )
    pq_data = (
        sload(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 2)[16:32]
        + sload(PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS, queue_storage_slot + 3)[0:16]
    )
    return PQBuilderRegistrationRequest(
        source_address=Bytes20(source_address),
        builder_pubkey=Bytes48(builder_pubkey),
        pq_data=Bytes32(pq_data)
    )
```

At the end of processing any execution block where this EIP is active, after the system call to `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS`, call `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` as `SYSTEM_ADDRESS` with no calldata, under the same rules as the validator contract's system call. Each builder PQ registration request MUST appear in the [EIP-7685](./eip-7685.md) requests list in the exact order returned by `dequeue_pq_builder_registration_requests()`.

##### Builder contract bytecode

Runtime bytecode:

```
0x3373fffffffffffffffffffffffffffffffffffffffe1461054f575f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461064357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1460b1576001546002811160785750607e565b60029003015b601190600182026001905f5b5f82111560a55781019083028483029004916001019190608a565b909390049250505060bb565b506601c6bf526340005b366109b41460d457366106435734610643575f5260205ff35b3410610643577f2fe199f0484c92004a7143682fc0a7d76126031eb8591245f6db46fed85894975f524660205260505f60403760905f2060503560e01c6104f45760303560801b6104b060546105803780680c0000000000000000175f52906020526105805160405260505f205b8060801c8061f0ff166104f4576f333333333333333333333333333333338160021c81169116016f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f8160041c81169116016f010101010101010101010101010101010260101a606a14156104f4578168410000000000000000175f5281682100000000000000001760805281680100000000000000001761010052816802000000000000000017610180525f5b818160061c1a8060011c8116918061059001518360011661023c578260021661022d578260011661021d57610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836004166102955782600816610286578260041661027657610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806103a01461036157806105900151836010166102f757826020166102e857826010166102d857610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836040166103505782608016610341578260401661033157610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a001526010019150506101df565b505050506103c0610180208168030000000000000000175f5260016014536020526109305160305260405f2060026014536020526109405160305260405f2060036014536020526109505160305260405f2060046014536020526109605160305260405f2060056014536020526109705160305260405f2060066014536020526109805160305260405f2060076014536020526109905160305260405f2060086014536020526109a05160305260405f2060096014536020526109b05160305260405f20600a6014536020526109c05160305260405f20600b6014536020526109d05160305260405f20600c6014536020526109e05160305260405f20600d6014536020526109f05160305260405f20600e601453602052610a005160305260405f20600f601453602052610a105160305260405f206010601453602052610a205160305260405f20816980000000000000000000166104f857906980000000000000000000176104b06105046105803780680c0000000000000000175f52906020526105805160305260405f20610142565b5f5ffd5b6030351860801c6104f45750600154600101600155600354806004026004013381556001015f358155600101602035815560010160403560801c60801b90553360601b5f5260505f60143760645fa0600101600355005b600354600254808203806104001161056657506104005b5f5b8181146105a95782810160040260040181606402815460601b8152601401816001015481526020018160020154815260200190600301549052600101610568565b91018092146105bb57906002556105c6565b90505f6002555f6003555b36610615575f54600154817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe11156106035760028282011161060b575b50505f610637565b0160029003610637565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b5f555f6001556064025ff35b5f5ffd
```

Init code (stores `EXCESS_PRE_FORK` in the excess slot and deploys the runtime code):

```
0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe5f5561064780602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1461054f575f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461064357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1460b1576001546002811160785750607e565b60029003015b601190600182026001905f5b5f82111560a55781019083028483029004916001019190608a565b909390049250505060bb565b506601c6bf526340005b366109b41460d457366106435734610643575f5260205ff35b3410610643577f2fe199f0484c92004a7143682fc0a7d76126031eb8591245f6db46fed85894975f524660205260505f60403760905f2060503560e01c6104f45760303560801b6104b060546105803780680c0000000000000000175f52906020526105805160405260505f205b8060801c8061f0ff166104f4576f333333333333333333333333333333338160021c81169116016f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f8160041c81169116016f010101010101010101010101010101010260101a606a14156104f4578168410000000000000000175f5281682100000000000000001760805281680100000000000000001761010052816802000000000000000017610180525f5b818160061c1a8060011c8116918061059001518360011661023c578260021661022d578260011661021d57610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836004166102955782600816610286578260041661027657610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806103a01461036157806105900151836010166102f757826020166102e857826010166102d857610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a00152601001806105900151836040166103505782608016610341578260401661033157610120528060f41b610130526040610100205b60a0528060f41b60b05260406080205b6020528060f41b60305260405f205b816101a001526010019150506101df565b505050506103c0610180208168030000000000000000175f5260016014536020526109305160305260405f2060026014536020526109405160305260405f2060036014536020526109505160305260405f2060046014536020526109605160305260405f2060056014536020526109705160305260405f2060066014536020526109805160305260405f2060076014536020526109905160305260405f2060086014536020526109a05160305260405f2060096014536020526109b05160305260405f20600a6014536020526109c05160305260405f20600b6014536020526109d05160305260405f20600c6014536020526109e05160305260405f20600d6014536020526109f05160305260405f20600e601453602052610a005160305260405f20600f601453602052610a105160305260405f206010601453602052610a205160305260405f20816980000000000000000000166104f857906980000000000000000000176104b06105046105803780680c0000000000000000175f52906020526105805160305260405f20610142565b5f5ffd5b6030351860801c6104f45750600154600101600155600354806004026004013381556001015f358155600101602035815560010160403560801c60801b90553360601b5f5260505f60143760645fa0600101600355005b600354600254808203806104001161056657506104005b5f5b8181146105a95782810160040260040181606402815460601b8152601401816001015481526020018160020154815260200190600301549052600101610568565b91018092146105bb57906002556105c6565b90505f6002555f6003555b36610615575f54600154817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe11156106035760028282011161060b575b50505f610637565b0160029003610637565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b5f555f6001556064025ff35b5f5ffd
```

##### Builder contract deployment

TBD. The builder contract is deployed in the same way as the validator contract, and `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` will be fixed once its salt is chosen. If there is no code at `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` once this EIP is active, every block from activation onward MUST be invalid.

### Consensus layer

The consensus-specs repository specifies how these requests are validated and how the registered material is recorded.

## Rationale

### The registered key is checked, and the rest stays open

The contract checks a leanXMSS proof of possession of the public key in the first 32 bytes. It does not specify how a later fork uses that key, or what a validator's other 32 bytes mean. The 64 bytes only need to be enough to later authenticate a message signed by the owner of the PQ key.
Two 32-byte words let the signing key and the VRF data be registered separately, so neither has to be folded into a single hash with the other. Choosing the scheme, the parameters and the activation flow is left to the fork that actually needs them, when research on post-quantum signature aggregation, VRFs and key formats will have progressed.

### Builder registrations

Builders sign bids and execution payload envelopes with BLS keys, so they need a post-quantum migration path as much as validators do. They do not take part in proposer selection or RANDAO, so they need no VRF data. A builder registration therefore carries 32 bytes, the leanXMSS public key, rather than 64.

Builders get their own request type and contract rather than a flag in the validator request. A separate contract gives builders their own fee market and queue: a rush of validator registrations ahead of the migration fork cannot price out or delay the comparatively few builders, and the smaller builder target matches the much smaller builder set.

### Execution layer requests instead of a BLS-signed consensus layer message

A consensus layer operation signed with the validator's BLS key could carry the same data. This EIP uses an execution layer request instead, for the following reasons:

* **Built-in DoS protection.** Every request pays gas and a fee, fixed until this EIP activates and then the [EIP-7002](./eip-7002.md) style dynamic fee, and the per-block maximum bounds the work in each block. A consensus layer operation would need its own gossip validation, inclusion limits and anti-spam rules.
* **Already implemented.** Consensus layer clients already process [EIP-7002](./eip-7002.md), [EIP-7251](./eip-7251.md) and [EIP-8282](./eip-8282.md) requests, and execution layer clients already run their system calls. The contract reuses the [EIP-7251](./eip-7251.md) queue and the [EIP-8282](./eip-8282.md) fee and inhibitor logic, adding only a fixed fee before the first system call.
* **The owner of the funds is the right authority.** The withdrawal address owns the stake. The BLS key is often held by a node operator rather than the owner, and it is exactly the key that becomes untrustworthy once quantum attacks are credible. Binding the PQ material to the withdrawal address puts it under the control of the party who stands to lose the funds.
* **Simplicity.** No new consensus signing domain, gossip topic or beacon block operation is needed. The proof of possession is checked by the execution layer contract, and the request travels in the existing `ExecutionRequests` container.
* **Flexibility.** Smart contract withdrawal addresses, such as those used by staking pools, can register material for many validators under arbitrary custom logic, including multisig or governance approval.

### Storing the data on the consensus layer instead of an execution layer contract

The contract could simply keep the latest registration per validator in its own storage. However, the consumer of this data at the migration fork will be the consensus layer. Storing it there means the consensus layer will have everything it needs at that fork without proofs against execution layer state or new cross-layer reads.

### Proof of possession, with the rest left unspecified

The contract requires a leanXMSS proof of possession of the public key in the first 32 bytes of `pq_data`, which is all of a builder's `pq_data`. The proof stops a registration from naming a key the registrant cannot sign with, and it binds that key to one BLS public key on one chain. It does not decide how a later fork uses the key. A validator's other 32 bytes stay opaque, so the migration fork can still choose any scheme that fits in those bytes. Validators who registered early can overwrite their registration if the scheme changes.

### Replacing instead of dropping existing registrations

A later valid request for the same validator overwrites the earlier registration instead of being ignored. This lets owners correct mistakes, such as a wrong commitment or a lost PQ secret key, and rotate their PQ material before the migration fork. The authority to overwrite is the same as the authority to register, so allowing replacement does not weaken the authorization model.

### Validators with BLS withdrawal credentials

Validators with `0x00` (BLS) withdrawal credentials have no execution address and cannot register. They must first change to execution withdrawal credentials with a `BLSToExecutionChange`. This is the same requirement as in [EIP-7002](./eip-7002.md).

### Fee mechanism

In [EIP-7002](./eip-7002.md), [EIP-7251](./eip-7251.md) and [EIP-8282](./eip-8282.md) the excess and the per-block count are updated only by the system call at the end of each block. This contract is meant to be deployed, and to accept registrations, well before the fork that starts the system call. With the inherited design alone, nothing would reset the count or decay the excess before that fork. The fee would grow as `fake_exponential` of the total number of registrations ever made, exceeding 1 ETH after about 1,200 of them, far short of the hundreds of thousands of validators expected to register.

The contract therefore charges a fixed fee, `PRE_FORK_PQ_REGISTRATION_REQUEST_FEE`, until the first system call. The constructor stores `EXCESS_PRE_FORK` in the excess slot. The first system call replaces it with a zero excess and discards the count of the requests added before it, which already paid the fixed fee. From then on the fee is exactly that of [EIP-8282](./eip-8282.md), and the system call and storage layout are those of the existing request contracts. Before the fork the fee does not respond to demand, so the fixed fee and the block gas limit are what bound the queue (see [Requests queued before activation](#requests-queued-before-activation)). The value of `PRE_FORK_PQ_REGISTRATION_REQUEST_FEE` is provisional.

The contract keeps the two modifications that [EIP-8282](./eip-8282.md) makes to the [EIP-7251](./eip-7251.md) design. Charging each write for the requests already added in the same block makes the fee respond immediately to a burst of submissions, instead of letting a single block absorb many requests at the previous block's price. The calldata-triggered inhibitor gives the migration fork a way to stop accepting registrations with no new predeploy and no change to the execution layer, by passing calldata to the existing system call. Unlike those contracts, the constructor stores `EXCESS_PRE_FORK` instead of the inhibitor, so the queue is open from deployment.

### Parameter choices

Every validator is expected to register before the migration fork, and most registrations are expected to be queued before this EIP activates, so throughput matters more than for consolidations. With `TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK = 512`, about 3,700,000 registrations can be added per day (at 7,200 blocks per day) at close to the minimum fee. Each request above the target in a block raises the fee by a factor of `e**(1/17)`, so the long-run add rate stays near the target. The target is half of `MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK`, so once this EIP is active the queue shrinks whenever requests arrive at or below the target.

`MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK = 1024` is the drain rate. It is set above the target so that the backlog queued before activation drains quickly: a queue of one million registrations drains in about a thousand blocks, a few hours, with no new requests, and in about two thousand blocks, under seven hours, with new requests arriving at the target rate. The contract checks the proof of possession when the request is queued, so processing a request on the consensus layer requires no signature verification, only a public key lookup and a write. 1,024 requests add little block processing cost. They add at most 1,024 × 132 bytes, about 135 KB, to the execution requests of a payload, and dequeuing them uses about 11,000,000 gas of the system call's 30,000,000 gas limit.

The builder contract uses `TARGET_PQ_BUILDER_REGISTRATION_REQUESTS_PER_BLOCK = 2`, like the [EIP-8282](./eip-8282.md) builder exit contract. That allows about 14,400 builder registrations per day at the minimum fee, far more than the size of the builder set. Its `MAX_PQ_BUILDER_REGISTRATION_REQUESTS_PER_BLOCK` is the validator contract's 1,024, far above the target. Before this EIP activates nothing is dequeued and a block can fit hundreds of requests at the fixed fee, so the backlog has to drain faster than it can be filled. 1,024 builder requests add at most 1,024 × 100 bytes, about 100 KB, to a payload, and dequeuing them uses about 8,800,000 gas.

## Backwards Compatibility

This EIP introduces backward incompatible changes to the block validation rule set and must be accompanied by a hard fork. On the execution layer it introduces two new contracts at previously empty addresses and two new request types. The consensus layer changes are specified in the consensus-specs repository. Existing request types and validator flows are unchanged.

## Test Cases

TBD

## Security Considerations

### Authorization by source address

The contract records `msg.sender` as `source_address` and checks a leanXMSS proof of possession of the key being registered. The proof binds that key to the BLS public key and to this chain. It does not authorize the caller: the signature is not over `source_address`. Authorization is a consensus layer check on `source_address`, specified in the consensus-specs repository, as in [EIP-7002](./eip-7002.md) and, for builders, [EIP-8282](./eip-8282.md). Without that check, an arbitrary caller could overwrite any validator's PQ material by replaying an observed proof.

### Ignored requests

The fee is not refunded when the consensus layer does not apply a request. The consensus-specs repository defines which requests are ignored.

### Public PQ material

The `pq_data` and the proof of possession are public: they appear in calldata, and `pq_data` appears in the contract log. `pq_data` MUST therefore be a public value, such as a public key and a commitment to related public data, and never secret key material. A third party can resubmit calldata it observed. The resubmission carries the third party's own address as `source_address` and is ignored by the consensus layer.

### Requests queued before activation

Requests can be queued as soon as the contract is deployed. The consensus layer processes them only after this EIP activates. The consensus-specs repository defines the checks made at processing time.

Until the first system call, every request pays the fixed `PRE_FORK_PQ_REGISTRATION_REQUEST_FEE` and nothing is dequeued, so the fee does not rise with demand. The fixed fee and the block gas limit are then the only bounds on the queue. Anyone can create a leanXMSS key and a valid proof of possession for any BLS public key, so an attacker can fill the queue with requests that the consensus layer will ignore. Those requests are dequeued in order with honest ones, so they delay the honest requests behind them but cannot prevent them from being processed. At 0.0005 ETH per request, one million such requests cost 500 ETH plus gas and delay the requests behind them by about a thousand blocks.

### Compromised withdrawal address

Whoever controls the withdrawal address can register or overwrite the PQ material of its validators. This gives no new power to an attacker who controls the withdrawal address, since that attacker can already withdraw the entire stake. Owners SHOULD check their registered material before the migration fork.

### Overwriting before the migration fork

Because registrations can be replaced, the material that counts is the material registered when the migration fork activates. The future fork MAY decide to ignore requests processed after a certain point, for example to stop a withdrawal address that is compromised late from replacing the material.

### Fee overpayment

Calls to the system contract require a fee payment defined by the current contract state. Overpaid fees are not returned to the caller. It is not generally possible to compute the exact required fee ahead of time. When adding a PQ registration request from a contract, the contract can read the current fee first and then pay exactly that amount, as described in [EIP-7251](./eip-7251.md). Note that the system contract uses the `CALLER` opcode, so the address that calls it must be the execution address in the validator's withdrawal credentials.

### State growth

The execution layer queue grows while requests are added before this EIP activates, or faster than `MAX_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK` once it is active. Before activation, its growth is bounded only by the fixed fee and the block gas limit. After activation, the dynamic fee keeps the add rate near `TARGET_PQ_VALIDATOR_REGISTRATION_REQUESTS_PER_BLOCK`, below the drain rate. Each queued request occupies five storage slots in the contract, paid for by the gas of the add call.

### System call failure

Although the likelihood of a failed system call to `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` or `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` is extremely low, the behavior in such cases is well-defined: the block is marked as invalid. This follows [EIP-7002](./eip-7002.md#system-call-failure).

### Empty code failure

This EIP should not be activated if there is no code at `PQ_VALIDATOR_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS` or `PQ_BUILDER_REGISTRATION_REQUEST_PREDEPLOY_ADDRESS`. This is similar to the consideration in [EIP-7002](./eip-7002.md#empty-code-failure).

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).
