fix: propagate cumulative gas overflow in block executor (#42 follow-up)#193
Open
crazywriter1 wants to merge 1 commit into
Open
fix: propagate cumulative gas overflow in block executor (#42 follow-up)#193crazywriter1 wants to merge 1 commit into
crazywriter1 wants to merge 1 commit into
Conversation
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
Completes the defensive gas accounting started in #42 and extended in #135.
ArcBlockExecutor::commit_transactionstill usedchecked_add(...).expect("cumulative gas overflow"), which would abort block execution if cumulative gas accounting ever overflowed.Although this overflow is theoretically unreachable in production (
gas_usedis bounded by the block gas limit, far belowu64::MAX), propagating the error is consistent with the project's existing overflow-handling strategy and removes an unnecessary panic path.Changes
crates/evm/src/executor.rsERR_CUMULATIVE_GAS_OVERFLOW.checked_add(...).expect("cumulative gas overflow")withok_or_else(|| BlockExecutionError::msg(ERR_CUMULATIVE_GAS_OVERFLOW))?.BlockExecutionErrorinstead of panicking if cumulative gas accounting overflows.Context
.expect()with proper error propagation in the payload builder (complementary work).This PR applies the same defensive overflow handling to the block execution path, keeping overflow behavior consistent across the codebase.
Test Plan
cargo fmt -p arc-evm -- --checkcargo clippy -p arc-evm --all-targets -- -D warningscargo test -p arc-evm