Skip to content

Conversation

mablr
Copy link
Contributor

@mablr mablr commented Aug 8, 2025

Motivation

Close #11239

Solution

Add option to disable pool balance checks in EVM configuration.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@mablr mablr marked this pull request as ready for review August 8, 2025 09:40
@ngotchac
Copy link
Contributor

ngotchac commented Aug 9, 2025

Works great, thx!

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

looks good, ty! Minor nit, for clarity I suggest grouping these validations like

        if !self.disable_pool_balance_checks {
            if tx.gas_limit() < MIN_TRANSACTION_GAS as u64 {
...
            }

            // Check gas limit, iff block gas limit is set.
            if !env.evm_env.cfg_env.disable_block_gas_limit
                && tx.gas_limit() > env.evm_env.block_env.gas_limit
            {
...
            }

            if env.evm_env.cfg_env.spec >= SpecId::LONDON {
...  
            }

            let max_cost = tx.max_cost();
            let value = tx.value();

            match &tx.transaction {
                TypedTransaction::Deposit(deposit_tx) => {
...

or even extract them in a different fn and call smth like

if self.disable_pool_balance_checks {
    self.validate_balance(tx);
}

@mablr mablr force-pushed the feature/disable-pool-balance-checks branch from adcf5e2 to 0fb2377 Compare August 11, 2025 08:20
@mablr
Copy link
Contributor Author

mablr commented Aug 11, 2025

You are right, I grouped the balance checks for clarity 👍

@grandizzy grandizzy self-requested a review August 11, 2025 08:40
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

lgtm, thank you!

@grandizzy grandizzy enabled auto-merge (squash) August 11, 2025 08:43
@grandizzy grandizzy merged commit 2aa992a into foundry-rs:master Aug 11, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Aug 11, 2025
MerkleBoy pushed a commit to MerkleBoy/foundry that referenced this pull request Sep 17, 2025
…ration (foundry-rs#11242)

* feat(anvil): add option to disable pool balance checks in EVM configuration

* test(anvil): add test for transaction pool behavior with disabled balance checks

* fix: group pool balance checks for clarity

* fix: make clippy happy again :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Invalid validation of pending transactions
3 participants