fix(pipe): use checked_add to prevent overflow in gas limit#331
Merged
nekomoto911 merged 1 commit intoGalxe:mainfrom Apr 21, 2026
Merged
fix(pipe): use checked_add to prevent overflow in gas limit#331nekomoto911 merged 1 commit intoGalxe:mainfrom
nekomoto911 merged 1 commit intoGalxe:mainfrom
Conversation
nekomoto911
approved these changes
Apr 21, 2026
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.
Fixes gravity-audit#584 — integer overflow in
filter_invalid_txsgas-limit accumulator.Problem
tx_gas_limit_sum + tx_gas_limit > gas_limitatcrates/pipe-exec-layer-ext-v2/execute/src/lib.rs:1249is plainu64 +with no overflow check. Release builds wrap silently (nooverflow-checks), so a byzantine proposer packing:tx₀.gas_limit = block.gas_limit(e.g.1e9)tx₁.gas_limit = u64::MAX - tx₀.gas_limit + 1makes
sum + tx₁.gas_limitwrap to0, the> gas_limitcheck returns false, andtx₁slips past the filter. Downstream revm rejectstx₁withCallerGasLimitMoreThanBlock,executor.execute(&block).unwrap_or_else(\|err\| panic!(...))fires, and every honest validator panics at the same block → network-wide liveness halt.Fix
Replace
+withchecked_add; treat both overflow and "sum exceedsgas_limit" as the same truncation case (samebreakpath):Semantics unchanged on all non-overflow inputs. Overflow now produces the same truncation result as a legitimately-too-large tx instead of being silently admitted.