Skip to content

bug(EL): payload builder still panics on cumulative-gas checked_add overflow #452

Description

@crazywriter1

Bug

crates/execution-payload/src/payload.rs still panics on two cumulative-gas accounting paths via:

checked_add(...).expect("total gas shouldn't overflow")
  1. Pre-execution capacity check (pool_tx.gas_limit())
  2. 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

  • Both .expect("total gas shouldn't overflow") call sites in payload.rs are removed
  • Overflow / non-fit paths return errors (no panic)
  • cargo test -p arc-execution-payload passes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions