Bug
crates/execution-payload/src/payload.rs still panics on two cumulative-gas accounting paths via:
checked_add(...).expect("total gas shouldn't overflow")
- Pre-execution capacity check (
pool_tx.gas_limit())
- Post-execution cumulative update (
gas_used)
If either checked_add returns None, the payload builder aborts instead of failing with a structured PayloadBuilderError / invalid-tx path.
Why this is a bug (not a refactor)
Impact
In production the overflow is extremely unlikely (gas_used / gas_limit are bounded by the block gas limit, far below u64::MAX). The bug is still real: an unreachable panic is the wrong failure mode for block building, and it is inconsistent with the error-propagation pattern already required for this code.
Proposed fix
- Pre-execution: treat add overflow like “does not fit” (
ExceedsGasLimit / mark invalid), do not panic.
- Post-execution: return
PayloadBuilderError on overflow and fail the build cleanly.
No hardfork gate: builder-local error handling only.
Acceptance criteria
Bug
crates/execution-payload/src/payload.rsstill panics on two cumulative-gas accounting paths via:pool_tx.gas_limit())gas_used)If either
checked_addreturnsNone, the payload builder aborts instead of failing with a structuredPayloadBuilderError/ invalid-tx path.Why this is a bug (not a refactor)
checked_addbut left both.expect(...)sites in place, so the panic path remains.Closes: #…/ assignment), not because the change was rejected on technical grounds.Impact
In production the overflow is extremely unlikely (
gas_used/gas_limitare bounded by the block gas limit, far belowu64::MAX). The bug is still real: an unreachable panic is the wrong failure mode for block building, and it is inconsistent with the error-propagation pattern already required for this code.Proposed fix
ExceedsGasLimit/ mark invalid), do not panic.PayloadBuilderErroron overflow and fail the build cleanly.No hardfork gate: builder-local error handling only.
Acceptance criteria
.expect("total gas shouldn't overflow")call sites inpayload.rsare removedcargo test -p arc-execution-payloadpasses