test(e2e): regression for BLS PoP precompile missing gas-limit check (audit #678)#740
test(e2e): regression for BLS PoP precompile missing gas-limit check (audit #678)#740keanji-x wants to merge 2 commits into
Conversation
…(audit #678) Adds a single-node e2e suite that exercises the BLS proof-of-possession precompile at 0x00000000000000000000000000000001625f5001. The precompile returns a flat gas_used=110_000 with no comparison against the forwarded gas, so a call that forwards <110_000 gas hits an unconditional assert!(record_cost(...)) in alloy-evm and panics the node deterministically ("Gas underflow is not possible") instead of a normal out-of-gas revert. The test asserts the CORRECT (post-fix) behavior — the node survives a low-gas precompile call and keeps producing blocks — and is marked xfail referencing gravity-audit #678 so CI stays green until the gas-limit guard lands, then flips to xpass to prompt removal of the marker. A benign control call first proves the precompile is reached (gasUsed == 131576 = 21000 + 576 + 110000). Reproduced locally: control mines at gasUsed=131576; the low-gas call kills the node (process exits, RPC unresponsive, panic "Gas underflow is not possible" in debug.log) -> reported XFAIL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Closing per maintainer — the BLS PoP precompile gas-limit fix (#678) has just been merged, so this xfail regression suite is superseded. For the record, the bug was reproduced deterministically against pre-fix builds: a call forwarding < 110_000 gas to 0x..1625f5001 made the precompile return a flat If useful, the precompile-level e2e suite (well-gassed control proving reachability + low-gas killer) could be re-added as a passing regression alongside the fix to lock it in; happy to open that against the post-fix commit if wanted. |
What
Adds an end-to-end regression suite
gravity_e2e/cluster_test_cases/bls_precompile_halt/for the BLS proof-of-possession precompile (0x00000000000000000000000000000001625f5001).Why (gravity-audit #678)
The precompile (
gravity-reth … bls_precompile.rs) returns a flatgas_used = 110_000with no check against the forwarded gas. When a normal transaction calls it forwarding< 110_000gas, the EVM dispatcher hits an unconditionalassert!(record_cost(...))(alloy-evmprecompiles.rs:425) and the node panics deterministically —"Gas underflow is not possible"— instead of an ordinary out-of-gas revert. Because the panic is in the deterministic block-execution path, every validator that executes the block dies (and re-dies on replay), i.e. a one-transaction, any-funded-account chain halt.The test
gas=300000) must mine withgasUsed == 131576(21000intrinsic +576calldata +110000precompile) — proving the precompile is reached and charges the flat 110k.gas=30000) must be a normal out-of-gas revert — the node must stay alive, keep producing blocks, keep the RPC responsive, and log no panic.The regression assertion is marked
@pytest.mark.xfail(reason="gravity-audit #678 …", strict=False), so:xfail(the node panics) → CI stays green while documenting the bug;xpass→ remove thexfailmarker to make it a hard regression guard.Reproduction evidence (local single-node)
Suggested fix (separate change)
Guard the cost before work in the precompile handler:
(and the same pattern for the mint precompile). Once merged, this test flips to
xpass.Scope
Adds 3 files under one new suite dir; no production code changed. Generated
artifacts/are gitignored and regenerated by the runner (same convention assingle_node).Authorized security-audit deliverable. Tracking issue: Galxe/gravity-audit#678.
🤖 Generated with Claude Code