feat(tests): EIP-8037 reject when calldata_floor > TX_MAX_GAS_LIMIT#2898
feat(tests): EIP-8037 reject when calldata_floor > TX_MAX_GAS_LIMIT#2898chfast wants to merge 2 commits into
Conversation
marioevz
left a comment
There was a problem hiding this comment.
The test looks solid, just some minor comments.
|
@chfast I changed the base because EIP-8037 is now merged to forks/amsterdam but git didn't take it so well. Could you rebase please? |
EIP-8037 requires max(intrinsic_regular, calldata_floor) <= TX_MAX_GAS_LIMIT. The existing `tx.gas_limit < total_intrinsic` check already covers the intrinsic-regular arm, so only the calldata_floor arm is observably untested. Parametrize types 1 and 2 over floor_binds, intrinsic_binds, and neither_binds. evmone amsterdam/main without fd35d839 fails the floor_binds rows; geth bal-devnet-7 and EELS pass all.
c83f348 to
cbf96d8
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2898 +/- ##
===================================================
- Coverage 90.53% 89.00% -1.53%
===================================================
Files 535 496 -39
Lines 32897 30100 -2797
Branches 3021 2725 -296
===================================================
- Hits 29782 26790 -2992
- Misses 2596 2835 +239
+ Partials 519 475 -44
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
spencer-tb
left a comment
There was a problem hiding this comment.
Nice test additions! I don't think these fully hit the correct checks in EELS yet.
EELS validates intrinsic > tx.gas, floor > tx.gas in that order and then the two 8037 checks: intrinsic.regular > TX_MAX_GAS_LIMIT, intrinsic.calldata_floor > TX_MAX_GAS_LIMIT. With the tx gas_limit = cap + 1 both tx cases are rejected by the first 2 checks that we had originally.
I attached a suggestion below to target the intrinsic.regular > TX_MAX_GAS_LIMIT, intrinsic.calldata_floor > TX_MAX_GAS_LIMIT checks respectively. Let me know if it makes sense!
Additionally I think we could have a different exception type for these cases to distinguish the difference. The latter can be a follow up or feel free if it makes sense, would require an EELS spec change.
| if scenario == "floor_binds": | ||
| data = b"\x01" * ((cap - gas_costs.TX_BASE) // floor_per_byte + 1) | ||
| access_list = [] | ||
| elif scenario == "intrinsic_binds": | ||
| data = b"" | ||
| n = (cap - gas_costs.TX_BASE) // gas_costs.TX_ACCESS_LIST_ADDRESS + 1 | ||
| access_list = [ | ||
| AccessList(address=Address(i + 1), storage_keys=[]) | ||
| for i in range(n) | ||
| ] |
There was a problem hiding this comment.
| if scenario == "floor_binds": | |
| data = b"\x01" * ((cap - gas_costs.TX_BASE) // floor_per_byte + 1) | |
| access_list = [] | |
| elif scenario == "intrinsic_binds": | |
| data = b"" | |
| n = (cap - gas_costs.TX_BASE) // gas_costs.TX_ACCESS_LIST_ADDRESS + 1 | |
| access_list = [ | |
| AccessList(address=Address(i + 1), storage_keys=[]) | |
| for i in range(n) | |
| ] | |
| gas_limit = cap + 1 | |
| if scenario == "floor_binds": | |
| data = b"\x01" * ((cap - gas_costs.TX_BASE) // floor_per_byte + 1) | |
| access_list = [] | |
| gas_limit = fork.transaction_data_floor_cost_calculator()( | |
| data=data, access_list=access_list | |
| ) | |
| elif scenario == "intrinsic_binds": | |
| data = b"" | |
| n = (cap - gas_costs.TX_BASE) // gas_costs.TX_ACCESS_LIST_ADDRESS + 1 | |
| access_list = [ | |
| AccessList(address=Address(i + 1), storage_keys=[]) | |
| for i in range(n) | |
| ] | |
| gas_limit = fork.transaction_intrinsic_cost_calculator()( | |
| calldata=data, access_list=access_list | |
| ) |
| [ | ||
| pytest.param( | ||
| "floor_binds", | ||
| TransactionException.INTRINSIC_GAS_TOO_LOW, |
There was a problem hiding this comment.
| TransactionException.INTRINSIC_GAS_TOO_LOW, | |
| TransactionException.FLOOR_GAS_EXCEEDS_MAXIMUM, |
| ), | ||
| pytest.param( | ||
| "intrinsic_binds", | ||
| TransactionException.INTRINSIC_GAS_TOO_LOW, |
There was a problem hiding this comment.
| TransactionException.INTRINSIC_GAS_TOO_LOW, | |
| TransactionException.INTRINSIC_GAS_COST_EXCEEDS_MAXIMUM, |
… over cap Per review: EELS raised a single InsufficientTransactionGasError for both `intrinsic.regular > TX_MAX_GAS_LIMIT` and `intrinsic.calldata_floor > TX_MAX_GAS_LIMIT`, conflating the EIP-8037/7825 cap rule with the generic gas-too-low check. Add distinct exceptions: - EELS amsterdam: IntrinsicGasCostExceedsMaximumError, FloorGasExceedsMaximumError; validate_transaction raises them. - Framework: TransactionException.INTRINSIC_GAS_COST_EXCEEDS_MAXIMUM, FLOOR_GAS_EXCEEDS_MAXIMUM, mapped in the execution-specs CLI. - test_intrinsic_or_floor_cap_at_validation: expect the distinct errors and size gas_limit to the exact floor/intrinsic cost so the rejection is pinned to the cap rule, not gas_limit < intrinsic.
|
Thanks, moving this to #2915 as will have spec change! :) |
🗒️ Description
EIP-8037 requires max(intrinsic_regular, calldata_floor) <= TX_MAX_GAS_LIMIT. The existing
tx.gas_limit < total_intrinsiccheck already covers the intrinsic-regular arm, so only the calldata_floor arm is observably untested.Parametrize types 1 and 2 over floor_binds, intrinsic_binds, and neither_binds.
🔗 Related Issues or PRs
N/A.
✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.