Skip to content

Spec

Documentation for tests/osaka/eip7934_block_rlp_limit/spec.py@cc5fc26a.

Defines EIP-7934 specification constants and functions.

Spec dataclass

Parameters from the EIP-7934 specifications as defined at https://eips.ethereum.org/EIPS/eip-7934#specification.

Source code in tests/osaka/eip7934_block_rlp_limit/spec.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@dataclass(frozen=True)
class Spec:
    """
    Parameters from the EIP-7934 specifications as defined at
    https://eips.ethereum.org/EIPS/eip-7934#specification.
    """

    MAX_BLOCK_SIZE = 10_485_760  # 10 MiB
    SAFETY_MARGIN = 2_097_152  # 2 MiB
    MAX_RLP_BLOCK_SIZE = MAX_BLOCK_SIZE - SAFETY_MARGIN  # 8_388_608 bytes

    @staticmethod
    def exceed_max_rlp_block_size(rlp_encoded_block: bytes) -> bool:
        """Check if an RLP encoded block exceeds the maximum allowed size."""
        return len(rlp_encoded_block) > Spec.MAX_RLP_BLOCK_SIZE