Skip to content

chore: check for gas used at boundary#331

Merged
rakita merged 2 commits into
alloy-rs:bal-devnet3from
Soubhik-10:8037-refactor
Apr 7, 2026
Merged

chore: check for gas used at boundary#331
rakita merged 2 commits into
alloy-rs:bal-devnet3from
Soubhik-10:8037-refactor

Conversation

@Rimeeeeee
Copy link
Copy Markdown
Contributor

  • minus block_regular_gas_used from block_available_gas if amsterdam is enabled.
  • perform boundary checking during commit transaction i.e. max(block_regular_gas_used, block_state_gas_used) donot exceed block gas limit.

cc: @rakita

@Rimeeeeee Rimeeeeee requested review from klkvr and mattsse as code owners April 6, 2026 13:05
Comment thread crates/evm/src/eth/block.rs Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to do min( tx.tx().gas_limit() ,MAX_TX_LIMIT) here? @rakita

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not here but on line 174

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gas limit on line 174???

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, gas_limit for pre amsteram can't be more than MAX_TX_LIMIT so technically it is okay to do min (tx.tx().gas_limit() ,MAX_TX_LIMIT) but i would saparate this, and be explicit about it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And check if you can access revm cfg.tx_gas_limit_cap() function

Comment thread crates/evm/src/eth/block.rs
// EIP-8037.
if amsterdam_active && self.max_block_gas_used() > self.evm.block().gas_limit() {
return Err(BlockValidationError::BlockGasExceeded.into());
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@klkvr is this a good place for this check? After state gas this got moved at after tx exec

@rakita rakita merged commit c45bf2c into alloy-rs:bal-devnet3 Apr 7, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants