fix(EL): payload builder no longer panics on cumulative-gas checked_add overflow - #461
Closed
UzairRehman4 wants to merge 1 commit into
Closed
UzairRehman4 wants to merge 1 commit into
UzairRehman4 wants to merge 1 commit into
Conversation
…dd overflow
Both cumulative-gas accounting sites in the payload builder used
checked_add(...).expect("total gas shouldn't overflow"), which aborts
the process if the addition overflows u64 instead of failing through
the structured error path already used elsewhere in this function.
- Pre-execution capacity check: an overflowing add can never fit in a
bounded block, so treat it the same as "doesn't fit" (mark the tx
invalid via ExceedsGasLimit, evict if permanently un-includable,
continue) instead of panicking.
- Post-execution cumulative update: return a PayloadBuilderError
(wrapping a new CumulativeGasOverflowError) instead of panicking, so
the build fails cleanly through the existing Result-based path.
No hardfork gate; this is builder-local error handling only.
Fixes circlefin#452
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
UzairRehman4
requested review from
ZhiyuCircle,
ancazamfir,
romac and
sergio-mena
as code owners
September 23, 2026 09:18
Contributor
|
Contributor
|
Hi @UzairRehman4, Thank you for your interest in contributing to Arc Node. This PR has been automatically closed because you are not assigned to issue #452. We require contributors to be explicitly assigned to an issue before submitting a PR. To contribute properly:
Please see our CONTRIBUTING.md for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both cumulative-gas accounting sites in
crates/execution-payload/src/payload.rsusedchecked_add(...).expect("total gas shouldn't overflow"), which aborts the process on overflow instead of failing through the structured error path this function already uses everywhere else.cumulative_gas_used + pool_tx.gas_limit()can never fit in a bounded block, so it's now treated the same as "doesn't fit" — the tx is marked invalid viaExceedsGasLimit, evicted from the pool if permanently un-includable, and the loop continues. No panic.PayloadBuilderError(wrapping a newCumulativeGasOverflowError, following the existingUnprocessableTransactionErrorpattern inbuilder.rs) via?instead of panicking, so the build fails cleanly through the existingResultpath.No hardfork gate — this is builder-local error handling only, as scoped in the issue.
Fixes #452
Acceptance criteria (from the issue)
.expect("total gas shouldn't overflow")call sites inpayload.rsare removedcargo test -p arc-execution-payloadpasses — I was not able to run this locally (no Rust toolchain available in my environment). I reviewed the change carefully against the existing code patterns (theExceedsGasLimitbranch is reused unchanged, andCumulativeGasOverflowErrormirrorsUnprocessableTransactionErrorexactly), but please run the test suite / CI before merging and let me know if anything needs adjusting.Test plan
cargo test -p arc-execution-payloadshould be run by a maintainer or CI, since I couldn't run it locally