Skip to content

Commit 1bd04a9

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 8180a5b commit 1bd04a9

File tree

17 files changed

+625
-154
lines changed

17 files changed

+625
-154
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Users can select any of the artifacts depending on their testing needs for their
7171
-[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)).
7272
-[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).
7373
- ✨ Introduce blockchain tests for ZKEVM to cover the scenario of pure ether transfers [#1742](https://github.com/ethereum/execution-spec-tests/pull/1742).
74+
-[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)).
7475

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

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
@@ -262,6 +262,10 @@ class BesuExceptionMapper(ExceptionMapper):
262262
"Payload BlobGasUsed does not match calculated BlobGasUsed"
263263
),
264264
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: "Header validation failed (FULL)",
265+
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
266+
# TODO:
267+
""
268+
),
265269
# TODO EVMONE needs to differentiate when the section is missing in the header or body
266270
EOFException.MISSING_STOP_OPCODE: "err: no_terminating_instruction",
267271
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
@@ -343,6 +343,12 @@ def transaction_gas_limit_cap(cls, block_number: int = 0, timestamp: int = 0) ->
343343
"""Return the transaction gas limit cap, or None if no limit is imposed."""
344344
pass
345345

346+
@classmethod
347+
@abstractmethod
348+
def block_rlp_size_limit(cls, block_number: int = 0, timestamp: int = 0) -> int | None:
349+
"""Return the maximum RLP size of a block in bytes, or None if no limit is imposed."""
350+
pass
351+
346352
@classmethod
347353
@abstractmethod
348354
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."""
@@ -1354,6 +1359,13 @@ def transaction_gas_limit_cap(cls, block_number: int = 0, timestamp: int = 0) ->
13541359
"""At Osaka, transaction gas limit is capped at 30 million."""
13551360
return 30_000_000
13561361

1362+
@classmethod
1363+
def block_rlp_size_limit(cls, block_number: int = 0, timestamp: int = 0) -> int | None:
1364+
"""From Osaka, block RLP size is limited as specified in EIP-7934."""
1365+
max_block_size = 10_485_760
1366+
safety_margin = 2_097_152
1367+
return max_block_size - safety_margin
1368+
13571369
@classmethod
13581370
def is_deployed(cls) -> bool:
13591371
"""

0 commit comments

Comments
 (0)