Justin Traglia e44bcfa90b
Make necessary changes for EIP7594 spec
Previous to this commit, the max blob count for EIP7594 was 8. Now that we have
raised the target/max to 6/9 for Electra, the max blob count for EIP7594 no
longer makes sense. I've raised the target/max for it to 9/12 as a placeholder.
This also serves as an example of what changes are necessary to increase the
blob count in the future.
2024-12-05 12:57:06 -06:00

3.3 KiB

EIP7594 -- The Beacon Chain

Notice: This document is a work-in-progress for researchers and implementers.

Table of contents

Introduction

Note: This specification is built upon Electra and is under active development.

Configuration

Execution

Name Value Description
TARGET_BLOBS_PER_BLOCK_EIP7594 uint64(9) [New in EIP7594] Target number of blobs in a single block limited by MAX_BLOBS_PER_BLOCK_EIP7594
MAX_BLOBS_PER_BLOCK_EIP7594 uint64(12) [New in EIP7594] Maximum number of blobs in a single block limited by MAX_BLOB_COMMITMENTS_PER_BLOCK

Execution payload

Modified process_execution_payload
def process_execution_payload(state: BeaconState, body: BeaconBlockBody, execution_engine: ExecutionEngine) -> None:
    payload = body.execution_payload

    # Verify consistency of the parent hash with respect to the previous execution payload header
    assert payload.parent_hash == state.latest_execution_payload_header.block_hash
    # Verify prev_randao
    assert payload.prev_randao == get_randao_mix(state, get_current_epoch(state))
    # Verify timestamp
    assert payload.timestamp == compute_timestamp_at_slot(state, state.slot)
    # Verify commitments are under limit
    assert len(body.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK_EIP7594  # [Modified in EIP7594]
    # Verify the execution payload is valid
    versioned_hashes = [kzg_commitment_to_versioned_hash(commitment) for commitment in body.blob_kzg_commitments]
    assert execution_engine.verify_and_notify_new_payload(
        NewPayloadRequest(
            execution_payload=payload,
            versioned_hashes=versioned_hashes,
            parent_beacon_block_root=state.latest_block_header.parent_root,
            execution_requests=body.execution_requests,
            target_blobs_per_block=TARGET_BLOBS_PER_BLOCK_EIP7594,  # [Modified in EIP7594]
        )
    )
    # Cache execution payload header
    state.latest_execution_payload_header = ExecutionPayloadHeader(
        parent_hash=payload.parent_hash,
        fee_recipient=payload.fee_recipient,
        state_root=payload.state_root,
        receipts_root=payload.receipts_root,
        logs_bloom=payload.logs_bloom,
        prev_randao=payload.prev_randao,
        block_number=payload.block_number,
        gas_limit=payload.gas_limit,
        gas_used=payload.gas_used,
        timestamp=payload.timestamp,
        extra_data=payload.extra_data,
        base_fee_per_gas=payload.base_fee_per_gas,
        block_hash=payload.block_hash,
        transactions_root=hash_tree_root(payload.transactions),
        withdrawals_root=hash_tree_root(payload.withdrawals),
        blob_gas_used=payload.blob_gas_used,
        excess_blob_gas=payload.excess_blob_gas,
    )