Skip to content

Commit 9374ffc

Browse files
authored
feat(clis/ethrex): add support for ethrex client (#1607)
* feat: add support for ethrex client * fix lint errors * apply ruff format * fix * fix: move mappings to regex * fix mapping for INVALID_DEPOSIT_EVENT_LAYOUT
1 parent 7249e22 commit 9374ffc

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

src/ethereum_clis/clis/ethrex.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"""Ethrex execution client transition tool."""
2+
3+
from ethereum_test_exceptions import BlockException, ExceptionMapper, TransactionException
4+
5+
6+
class EthrexExceptionMapper(ExceptionMapper):
7+
"""Ethrex exception mapper."""
8+
9+
mapping_substring = {
10+
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
11+
"Exceeded MAX_BLOB_GAS_PER_BLOCK"
12+
),
13+
TransactionException.INVALID_DEPOSIT_EVENT_LAYOUT: ("Invalid deposit request layout"),
14+
BlockException.INVALID_REQUESTS: (
15+
"Requests hash does not match the one in the header after executing"
16+
),
17+
BlockException.INVALID_RECEIPTS_ROOT: (
18+
"Receipts Root does not match the one in the header after executing"
19+
),
20+
BlockException.INVALID_STATE_ROOT: (
21+
"World State Root does not match the one in the header after executing"
22+
),
23+
BlockException.INVALID_GAS_USED: "Gas used doesn't match value in header",
24+
BlockException.INCORRECT_BLOB_GAS_USED: "Blob gas used doesn't match value in header",
25+
}
26+
mapping_regex = {
27+
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
28+
r"(?i)priority fee is greater than max fee"
29+
),
30+
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: r"(?i)empty authorization list",
31+
TransactionException.SENDER_NOT_EOA: (
32+
r"reject transactions from senders with deployed code|"
33+
r"Sender account should not have bytecode"
34+
),
35+
TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+",
36+
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
37+
r"blob gas used \d+ exceeds maximum allowance \d+"
38+
),
39+
TransactionException.TYPE_3_TX_ZERO_BLOBS: (
40+
r"blob transactions present in pre-cancun payload|empty blobs|"
41+
r"Type 3 transaction without blobs"
42+
),
43+
TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
44+
r"blob version not supported|Invalid blob versioned hash"
45+
),
46+
TransactionException.TYPE_3_TX_PRE_FORK: (
47+
r"blob versioned hashes not supported|"
48+
r"Type 3 transactions are not supported before the Cancun fork"
49+
),
50+
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
51+
r"unexpected length|Contract creation in type 4 transaction"
52+
),
53+
TransactionException.TYPE_4_TX_PRE_FORK: (
54+
r"eip 7702 transactions present in pre-prague payload|"
55+
r"Type 4 transactions are not supported before the Prague fork"
56+
),
57+
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
58+
r"lack of funds \(\d+\) for max fee \(\d+\)|Insufficient account founds"
59+
),
60+
TransactionException.INTRINSIC_GAS_TOO_LOW: (
61+
r"gas floor exceeds the gas limit|call gas cost exceeds the gas limit|"
62+
r"Intrinsic gas too low"
63+
),
64+
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
65+
r"gas price is less than basefee|Insufficient max fee per gas"
66+
),
67+
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
68+
r"blob gas price is greater than max fee per blob gas|"
69+
r"Insufficient max fee per blob gas"
70+
),
71+
TransactionException.INITCODE_SIZE_EXCEEDED: (
72+
r"create initcode size limit|Initcode size exceeded"
73+
),
74+
BlockException.SYSTEM_CONTRACT_CALL_FAILED: (r"failed to apply .* requests contract call"),
75+
BlockException.INCORRECT_BLOB_GAS_USED: (r"Blob gas used doesn't match value in header"),
76+
BlockException.RLP_STRUCTURES_ENCODING: (r"Error decoding field '\D+' of type \w+.*"),
77+
BlockException.INCORRECT_EXCESS_BLOB_GAS: (r".* Excess blob gas is incorrect"),
78+
BlockException.INVALID_BLOCK_HASH: (r"Invalid block hash. Expected \w+, got \w+"),
79+
}

src/pytest_plugins/consume/hive_simulators/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ethereum_clis.clis.besu import BesuExceptionMapper
77
from ethereum_clis.clis.erigon import ErigonExceptionMapper
88
from ethereum_clis.clis.ethereumjs import EthereumJSExceptionMapper
9+
from ethereum_clis.clis.ethrex import EthrexExceptionMapper
910
from ethereum_clis.clis.geth import GethExceptionMapper
1011
from ethereum_clis.clis.nethermind import NethermindExceptionMapper
1112
from ethereum_clis.clis.nimbus import NimbusExceptionMapper
@@ -70,4 +71,5 @@ def compare_models(expected: FixtureHeader, got: FixtureHeader) -> Tuple[Dict, L
7071
"reth": RethExceptionMapper(),
7172
"nimbus": NimbusExceptionMapper(),
7273
"ethereumjs": EthereumJSExceptionMapper(),
74+
"ethrex": EthrexExceptionMapper(),
7375
}

0 commit comments

Comments
 (0)