Skip to content

Commit 1620a08

Browse files
authored
feat(exceptions,tests): Add TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST (#1582)
* fix(exceptions): Add `INTRINSIC_GAS_BELOW_FLOOR_GAS_COST` * fix(tests): EIP-7623: Update expected exception to account for data-floor exceptions * fix(clis/all): Update exception mappers * docs: CHANGELOG
1 parent 7abf18e commit 1620a08

File tree

12 files changed

+31
-6
lines changed

12 files changed

+31
-6
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ A new fork `EOFv1` has additionally been created to fill and consume EOF related
1919
### 🛠️ Framework
2020

2121
- ✨ Add an empty account function for usage within fill and execute ([#1482](https://github.com/ethereum/execution-spec-tests/pull/1482)).
22+
- ✨ Added `TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST` exception to specifically catch the case where the intrinsic gas cost is insufficient due to the data floor gas cost ([#1582](https://github.com/ethereum/execution-spec-tests/pull/1582)).
2223

2324
### 📋 Misc
2425

src/ethereum_clis/clis/besu.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ class BesuExceptionMapper(ExceptionMapper):
330330
TransactionException.INTRINSIC_GAS_TOO_LOW: (
331331
r"transaction invalid intrinsic gas cost \d+ exceeds gas limit \d+"
332332
),
333+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
334+
r"transaction invalid intrinsic gas cost \d+ exceeds gas limit \d+"
335+
),
333336
TransactionException.SENDER_NOT_EOA: (
334337
r"transaction invalid Sender 0x[0-9a-f]+ has deployed code and so is not authorized "
335338
r"to send transactions"

src/ethereum_clis/clis/erigon.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ErigonExceptionMapper(ExceptionMapper):
1414
),
1515
TransactionException.NONCE_IS_MAX: "nonce has max value",
1616
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
17+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
1718
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: "fee cap less than block base fee",
1819
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: "tip higher than fee cap",
1920
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: "max fee per blob gas too low",

src/ethereum_clis/clis/ethereumjs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ class EthereumJSExceptionMapper(ExceptionMapper):
7777
"Invalid EIP-7702 transaction: authorization list is empty"
7878
),
7979
TransactionException.INTRINSIC_GAS_TOO_LOW: "is lower than the minimum gas limit of",
80+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
81+
"is lower than the minimum gas limit of"
82+
),
8083
TransactionException.INITCODE_SIZE_EXCEEDED: (
8184
"the initcode size of this transaction is too large"
8285
),

src/ethereum_clis/clis/evmone.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class EvmoneExceptionMapper(ExceptionMapper):
6060
),
6161
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: "empty authorization list",
6262
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
63+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
6364
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: "blob gas limit exceeded",
6465
TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
6566
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (

src/ethereum_clis/clis/execution_specs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class ExecutionSpecsExceptionMapper(ExceptionMapper):
153153
TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: " transaction: ",
154154
TransactionException.TYPE_3_TX_ZERO_BLOBS: "transaction: ",
155155
TransactionException.INTRINSIC_GAS_TOO_LOW: "ransaction: ",
156+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "ransaction: ",
156157
TransactionException.INITCODE_SIZE_EXCEEDED: "ansaction: ",
157158
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: "nsaction: ",
158159
TransactionException.NONCE_MISMATCH_TOO_HIGH: "saction: ",

src/ethereum_clis/clis/geth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class GethExceptionMapper(ExceptionMapper):
3333
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
3434
"insufficient funds for gas * price + value"
3535
),
36+
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
37+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
38+
"insufficient gas for floor data gas cost"
39+
),
3640
TransactionException.NONCE_IS_MAX: "nonce has max value",
3741
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
3842
"would exceed maximum allowance"
@@ -118,9 +122,6 @@ class GethExceptionMapper(ExceptionMapper):
118122
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
119123
r"blob gas used \d+ exceeds maximum allowance \d+"
120124
),
121-
TransactionException.INTRINSIC_GAS_TOO_LOW: (
122-
r"intrinsic gas too low|insufficient gas for floor data gas cost"
123-
),
124125
BlockException.BLOB_GAS_USED_ABOVE_LIMIT: (
125126
r"blob gas used \d+ exceeds maximum allowance \d+"
126127
),

src/ethereum_clis/clis/nethermind.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ class NethermindExceptionMapper(ExceptionMapper):
324324
mapping_substring = {
325325
TransactionException.SENDER_NOT_EOA: "sender has deployed code",
326326
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
327+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
327328
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: "miner premium is negative",
328329
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
329330
"InvalidMaxPriorityFeePerGas: Cannot be higher than maxFeePerGas"

src/ethereum_clis/clis/nimbus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class NimbusExceptionMapper(ExceptionMapper):
8989
TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "exceeds maximum allowance",
9090
TransactionException.TYPE_3_TX_ZERO_BLOBS: "blob transaction missing blob hashes",
9191
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
92+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
9293
TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
9394
# TODO EVMONE needs to differentiate when the section is missing in the header or body
9495
EOFException.MISSING_STOP_OPCODE: "err: no_terminating_instruction",

src/ethereum_clis/clis/reth.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class RethExceptionMapper(ExceptionMapper):
4040
mapping_regex = {
4141
TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+",
4242
TransactionException.INTRINSIC_GAS_TOO_LOW: (
43-
r"(call gas cost|gas floor) \(\d+\) exceeds the gas limit \(\d+\)"
43+
r"call gas cost \(\d+\) exceeds the gas limit \(\d+\)"
44+
),
45+
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
46+
r"gas floor \(\d+\) exceeds the gas limit \(\d+\)"
4447
),
4548
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
4649
r"blob gas used \d+ exceeds maximum allowance \d+"

src/ethereum_test_exceptions/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ class TransactionException(ExceptionBase):
323323
"""
324324
Transaction's gas limit is too low.
325325
"""
326+
INTRINSIC_GAS_BELOW_FLOOR_GAS_COST = auto()
327+
"""
328+
Transaction's gas limit is below the floor gas cost.
329+
"""
326330
INITCODE_SIZE_EXCEEDED = auto()
327331
"""
328332
Transaction's initcode for a contract-creating transaction is too large.

tests/prague/eip7623_increase_calldata_cost/conftest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,14 @@ def tx_gas_limit(
302302

303303

304304
@pytest.fixture
305-
def tx_error(tx_gas_delta: int) -> TransactionException | None:
305+
def tx_error(tx_gas_delta: int, data_test_type: DataTestType) -> TransactionException | None:
306306
"""Transaction error, only expected if the gas delta is negative."""
307-
return TransactionException.INTRINSIC_GAS_TOO_LOW if tx_gas_delta < 0 else None
307+
if tx_gas_delta < 0:
308+
if data_test_type == DataTestType.FLOOR_GAS_COST_GREATER_THAN_INTRINSIC_GAS:
309+
return TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST
310+
else:
311+
return TransactionException.INTRINSIC_GAS_TOO_LOW
312+
return None
308313

309314

310315
@pytest.fixture

0 commit comments

Comments
 (0)