Skip to content

Commit 38d7612

Browse files
spencer-tbmarioevzfselmo
committed
feat(tests): block rlp size limit eip-7934 test cases.
Co-authored-by: Mario Vega <[email protected]> Co-authored-by: felipe <[email protected]>
1 parent 78dfecf commit 38d7612

File tree

17 files changed

+646
-154
lines changed

17 files changed

+646
-154
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Users can select any of the artifacts depending on their testing needs for their
6868
-[EIP-7825](https://eips.ethereum.org/EIPS/eip-7825): Add test cases for the transaction gas limit of 30M gas ([#1711](https://github.com/ethereum/execution-spec-tests/pull/1711)).
6969
-[EIP-7918](https://eips.ethereum.org/EIPS/eip-7918): Blob base fee bounded by execution cost test cases (initial), includes some adjustments to [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) tests ([#1685](https://github.com/ethereum/execution-spec-tests/pull/1685)).
7070
-[EIP-7951](https://eips.ethereum.org/EIPS/eip-7951): add test cases for `P256VERIFY` precompile to support secp256r1 curve [#1670](https://github.com/ethereum/execution-spec-tests/pull/1670)
71+
-[EIP-7934](https://eips.ethereum.org/EIPS/eip-7934): Add test cases for the block RLP max limit of 10MiB ([#1730](https://github.com/ethereum/execution-spec-tests/pull/1730)).
7172

7273
## [v4.5.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.5.0) - 2025-05-14
7374

src/ethereum_clis/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010
from .ethereum_cli import CLINotFoundInPathError, UnknownCLIError
1111
from .fixture_consumer_tool import FixtureConsumerTool
1212
from .transition_tool import TransitionTool
13-
from .types import Result, TransitionToolOutput
13+
from .types import (
14+
BlockExceptionWithMessage,
15+
Result,
16+
TransactionExceptionWithMessage,
17+
TransitionToolOutput,
18+
)
1419

1520
TransitionTool.set_default_tool(ExecutionSpecsTransitionTool)
1621
FixtureConsumerTool.set_default_tool(GethFixtureConsumer)
1722

1823
__all__ = (
1924
"BesuTransitionTool",
25+
"BlockExceptionWithMessage",
2026
"CLINotFoundInPathError",
2127
"EthereumJSTransitionTool",
2228
"EvmoneExceptionMapper",
@@ -29,6 +35,7 @@
2935
"NethtestFixtureConsumer",
3036
"NimbusTransitionTool",
3137
"Result",
38+
"TransactionExceptionWithMessage",
3239
"TransitionTool",
3340
"TransitionToolOutput",
3441
"UnknownCLIError",

src/ethereum_clis/clis/besu.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ class BesuExceptionMapper(ExceptionMapper):
265265
"Payload BlobGasUsed does not match calculated BlobGasUsed"
266266
),
267267
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: "Header validation failed (FULL)",
268+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
269+
# TODO:
270+
""
271+
),
268272
# TODO EVMONE needs to differentiate when the section is missing in the header or body
269273
EOFException.MISSING_STOP_OPCODE: "err: no_terminating_instruction",
270274
EOFException.MISSING_CODE_HEADER: "err: code_section_missing",

src/ethereum_clis/clis/erigon.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class ErigonExceptionMapper(ExceptionMapper):
4040
BlockException.SYSTEM_CONTRACT_CALL_FAILED: "Unprecedented Syscall failure",
4141
BlockException.INVALID_REQUESTS: "invalid requests root hash in header",
4242
BlockException.INVALID_BLOCK_HASH: "invalid block hash",
43+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
44+
# TODO:
45+
""
46+
),
4347
}
4448
mapping_regex = {
4549
TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (

src/ethereum_clis/clis/geth.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ class GethExceptionMapper(ExceptionMapper):
8080
BlockException.INVALID_REQUESTS: "invalid requests hash",
8181
BlockException.SYSTEM_CONTRACT_CALL_FAILED: "system call failed to execute:",
8282
BlockException.INVALID_BLOCK_HASH: "blockhash mismatch",
83+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
84+
# TODO:
85+
""
86+
),
8387
# TODO EVMONE needs to differentiate when the section is missing in the header or body
8488
EOFException.MISSING_STOP_OPCODE: "err: no_terminating_instruction",
8589
EOFException.MISSING_CODE_HEADER: "err: code_section_missing",

src/ethereum_clis/clis/nethermind.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ class NethermindExceptionMapper(ExceptionMapper):
360360
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
361361
"ExceededGasLimit: Gas used exceeds gas limit."
362362
),
363+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
364+
# TODO:
365+
""
366+
),
363367
TransactionException.INVALID_DEPOSIT_EVENT_LAYOUT: (
364368
"DepositsInvalid: Invalid deposit event layout:"
365369
),

src/ethereum_clis/clis/nimbus.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import ClassVar, Dict, Optional
77

88
from ethereum_test_exceptions import (
9+
BlockException,
910
EOFException,
1011
ExceptionBase,
1112
ExceptionMapper,
@@ -93,6 +94,10 @@ class NimbusExceptionMapper(ExceptionMapper):
9394
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
9495
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
9596
TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
97+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
98+
# TODO:
99+
""
100+
),
96101
# TODO EVMONE needs to differentiate when the section is missing in the header or body
97102
EOFException.MISSING_STOP_OPCODE: "err: no_terminating_instruction",
98103
EOFException.MISSING_CODE_HEADER: "err: code_section_missing",

src/ethereum_clis/clis/reth.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class RethExceptionMapper(ExceptionMapper):
3737
BlockException.INVALID_STATE_ROOT: "mismatched block state root",
3838
BlockException.INVALID_BLOCK_HASH: "block hash mismatch",
3939
BlockException.INVALID_GAS_USED: "block gas used mismatch",
40+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
41+
# TODO:
42+
""
43+
),
4044
}
4145
mapping_regex = {
4246
TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+",

src/ethereum_test_exceptions/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,10 @@ class BlockException(ExceptionBase):
548548
"""
549549
Block withdrawals address is rlp of invalid address != 20 bytes.
550550
"""
551+
RLP_BLOCK_LIMIT_EXCEEDED = auto()
552+
"""
553+
Block's rlp encoding is larger than the allowed limit.
554+
"""
551555
INVALID_REQUESTS = auto()
552556
"""
553557
Block's requests are invalid.

src/ethereum_test_forks/base_fork.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ def transaction_gas_limit_cap(cls, block_number: int = 0, timestamp: int = 0) ->
344344
"""Return the transaction gas limit cap, or None if no limit is imposed."""
345345
pass
346346

347+
@classmethod
348+
@abstractmethod
349+
def block_rlp_size_limit(cls, block_number: int = 0, timestamp: int = 0) -> int | None:
350+
"""Return the maximum RLP size of a block in bytes, or None if no limit is imposed."""
351+
pass
352+
347353
@classmethod
348354
@abstractmethod
349355
def precompiles(cls, block_number: int = 0, timestamp: int = 0) -> List[Address]:

src/ethereum_test_forks/forks/forks.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ def transaction_gas_limit_cap(cls, block_number: int = 0, timestamp: int = 0) ->
359359
"""At Genesis, no transaction gas limit cap is imposed."""
360360
return None
361361

362+
@classmethod
363+
def block_rlp_size_limit(cls, block_number: int = 0, timestamp: int = 0) -> int | None:
364+
"""At Genesis, no RLP block size limit is imposed."""
365+
return None
366+
362367
@classmethod
363368
def precompiles(cls, block_number: int = 0, timestamp: int = 0) -> List[Address]:
364369
"""At Genesis, no pre-compiles are present."""
@@ -1350,6 +1355,13 @@ def transaction_gas_limit_cap(cls, block_number: int = 0, timestamp: int = 0) ->
13501355
"""At Osaka, transaction gas limit is capped at 30 million."""
13511356
return 30_000_000
13521357

1358+
@classmethod
1359+
def block_rlp_size_limit(cls, block_number: int = 0, timestamp: int = 0) -> int | None:
1360+
"""From Osaka, block RLP size is limited as specified in EIP-7934."""
1361+
max_block_size = 10_485_760
1362+
safety_margin = 2_097_152
1363+
return max_block_size - safety_margin
1364+
13531365
@classmethod
13541366
def is_deployed(cls) -> bool:
13551367
"""

0 commit comments

Comments
 (0)