Skip to content

Foundry: Deployment fail without --slow flag when sending multiple transactions sequentially #19

@zsystm

Description

@zsystm

Reproduction Steps

  1. Run a local evmd node (Reference: GUIDE.md)
  2. Attempt to deploy multiple contracts in a single script without using the --slow flag
forge script script/DeployUniswapV3.s.sol --rpc-url $RPC_URL --broadcast --chain-id $CHAIN_ID

Observed Behavior

  • Without the --slow flag, the deployment fails with a nonce mismatch error.
  • Transactions are sent too quickly without waiting for previous transactions to be mined and confirmed.
  • As a result, the nonces in subsequent transactions are not aligned properly.

Logs

Error: Failed to send transaction

Context:
- server returned an error response: error code -32000: invalid nonce; got 50, expected 49: invalid sequence: invalid sequence

Additional Information

  • The --slow flag ensures that each transaction is only sent after the previous one has been confirmed and succeeded.

  • From forge --help:

    --slow
      Makes sure a transaction is sent, only after its previous one has been confirmed and succeeded

Notes

  • When sending multiple transactions in a single script (such as deploying Uniswap V3 contracts), the --slow flag is mandatory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions