Skip to content

Commit bff0f2e

Browse files
pdobaczmarioevz
andauthored
feat(tests): additional tests for header validation rules (#1702)
* feat(tests): additional tests for header validation rules * Update docs/CHANGELOG.md --------- Co-authored-by: Mario Vega <[email protected]>
1 parent a03a7b8 commit bff0f2e

File tree

11 files changed

+82
-0
lines changed

11 files changed

+82
-0
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Test fixtures for use by clients are available for each release on the [Github r
3030
- ✨ Expand EIP-6110 modified contract tests, where the extra event log has no topics at all ([#1693](https://github.com/ethereum/execution-specs/pull/1693)).
3131
- ✨ Add a CREATE/2 test cases for when it runs OOG on code deposit ([#1705](https://github.com/ethereum/execution-specs/pull/1705)).
3232
- ✨ Expand cases to test *CALL opcodes causing OOG ([#1703](https://github.com/ethereum/execution-specs/pull/1703)).
33+
- ✨ Add a test case for base fee in block check after London ([#1702](https://github.com/ethereum/execution-specs/pull/1702)).
3334
- ✨ Add tests for `modexp` and `ripemd` precompiled contracts ([#1691](https://github.com/ethereum/execution-specs/pull/1691)).
3435
- ✨ Add `ecrecover` precompile tests originating form `evmone` unittests ([#1685](https://github.com/ethereum/execution-specs/pull/1685)).
3536
- ✨ Add stack overflow tests and expand `BLOCKHASH` tests ([#1728](https://github.com/ethereum/execution-specs/pull/1728)).

packages/testing/src/execution_testing/client_clis/clis/besu.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ class BesuExceptionMapper(ExceptionMapper):
272272
"Payload BlobGasUsed does not match calculated BlobGasUsed"
273273
),
274274
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: "Header validation failed (FULL)",
275+
BlockException.INVALID_GASLIMIT: "Header validation failed (FULL)",
276+
BlockException.EXTRA_DATA_TOO_BIG: "Header validation failed (FULL)",
277+
BlockException.INVALID_BLOCK_NUMBER: "Header validation failed (FULL)",
278+
BlockException.INVALID_BASEFEE_PER_GAS: "Header validation failed (FULL)",
279+
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "block timestamp not greater than parent",
275280
}
276281
mapping_regex = {
277282
BlockException.INVALID_REQUESTS: (

packages/testing/src/execution_testing/client_clis/clis/erigon.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class ErigonExceptionMapper(ExceptionMapper):
4646
BlockException.INVALID_REQUESTS: "invalid requests root hash in header",
4747
BlockException.INVALID_BLOCK_HASH: "invalid block hash",
4848
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: "block exceeds max rlp size",
49+
BlockException.INVALID_BASEFEE_PER_GAS: "invalid block: invalid baseFee",
50+
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "invalid block: timestamp older than parent",
51+
BlockException.INVALID_BLOCK_NUMBER: "invalid block number",
52+
BlockException.EXTRA_DATA_TOO_BIG: "invalid block: extra-data longer than 32 bytes",
53+
BlockException.INVALID_GASLIMIT: "invalid block: invalid gas limit",
4954
}
5055
mapping_regex = {
5156
TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (

packages/testing/src/execution_testing/client_clis/clis/ethrex.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class EthrexExceptionMapper(ExceptionMapper):
2828
),
2929
BlockException.INVALID_GAS_USED: "Gas used doesn't match value in header",
3030
BlockException.INCORRECT_BLOB_GAS_USED: "Blob gas used doesn't match value in header",
31+
BlockException.INVALID_BASEFEE_PER_GAS: "Base fee per gas is incorrect",
3132
}
3233
mapping_regex = {
3334
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (

packages/testing/src/execution_testing/client_clis/clis/geth.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ class GethExceptionMapper(ExceptionMapper):
8787
BlockException.SYSTEM_CONTRACT_CALL_FAILED: "system call failed to execute:",
8888
BlockException.INVALID_BLOCK_HASH: "blockhash mismatch",
8989
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: "block RLP-encoded size exceeds maximum",
90+
BlockException.INVALID_BAL_EXTRA_ACCOUNT: "BAL change not reported in computed",
91+
BlockException.INVALID_BAL_MISSING_ACCOUNT: "additional mutations compared to BAL",
92+
BlockException.INVALID_BLOCK_ACCESS_LIST: "unequal",
93+
BlockException.INVALID_BASEFEE_PER_GAS: "invalid baseFee",
94+
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "invalid timestamp",
95+
BlockException.INVALID_GASLIMIT: "invalid gas limit",
96+
BlockException.INVALID_BLOCK_NUMBER: "invalid block number",
97+
BlockException.EXTRA_DATA_TOO_BIG: "invalid extradata length",
9098
}
9199
mapping_regex: ClassVar[Dict[ExceptionBase, str]] = {
92100
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (

packages/testing/src/execution_testing/client_clis/clis/nethermind.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ class NethermindExceptionMapper(ExceptionMapper):
425425
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
426426
"DepositsInvalid: Invalid deposit event layout:"
427427
),
428+
BlockException.INVALID_BASEFEE_PER_GAS: "InvalidBaseFeePerGas: Does not match calculated",
429+
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "InvalidTimestamp: Timestamp in header cannot be lower than ancestor",
430+
BlockException.INVALID_BLOCK_NUMBER: "InvalidBlockNumber: Block number does not match the parent",
431+
BlockException.EXTRA_DATA_TOO_BIG: "InvalidExtraData: Extra data in header is not valid",
432+
BlockException.INVALID_GASLIMIT: "InvalidGasLimit: Gas limit is not correct",
428433
}
429434
mapping_regex = {
430435
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (

packages/testing/src/execution_testing/client_clis/clis/nimbus.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,11 @@ class NimbusExceptionMapper(ExceptionMapper):
108108
# TODO:
109109
"ExceededBlockSizeLimit: Exceeded block size limit"
110110
),
111+
BlockException.INVALID_BASEFEE_PER_GAS: "invalid baseFee",
112+
BlockException.INVALID_BLOCK_NUMBER: "Blocks must be numbered consecutively",
113+
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "Invalid timestamp",
114+
BlockException.INVALID_GASLIMIT: "invalid gas limit",
115+
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: "gasUsed should be non negative and smaller or equal gasLimit",
116+
BlockException.INVALID_BLOCK_HASH: "blockhash mismatch",
111117
}
112118
mapping_regex: ClassVar[Dict[ExceptionBase, str]] = {}

packages/testing/src/execution_testing/client_clis/clis/reth.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class RethExceptionMapper(ExceptionMapper):
3939
BlockException.INVALID_BLOCK_HASH: "block hash mismatch",
4040
BlockException.INVALID_GAS_USED: "block gas used mismatch",
4141
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: "block is too large: ",
42+
BlockException.INVALID_BASEFEE_PER_GAS: "block base fee mismatch",
43+
BlockException.EXTRA_DATA_TOO_BIG: "invalid payload extra data",
4244
}
4345
mapping_regex = {
4446
TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+",
@@ -88,4 +90,11 @@ class RethExceptionMapper(ExceptionMapper):
8890
BlockException.INCORRECT_BLOCK_FORMAT: (
8991
r"Block's access list is invalid."
9092
),
93+
BlockException.INVALID_GASLIMIT: (r"child gas_limit \d+ max .* is .*"),
94+
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
95+
r"block timestamp \d+ is in the past compared to the parent timestamp \d+"
96+
),
97+
BlockException.INVALID_BLOCK_NUMBER: (
98+
r"block number \d+ does not match parent block number \d+"
99+
),
91100
}

tests/london/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Test cases for EVM functionality introduced in London."""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Test for validation rules that apply for all forks starting from London.
3+
"""

0 commit comments

Comments
 (0)