Skip to content

feat(cast): Add --skip-preverification flag to run command to allow user to bypass nonce verification etc.#10794

Closed
ckoopmann wants to merge 1 commit intofoundry-rs:masterfrom
ckoopmann:optional-skip-preverification-in-cast-run
Closed

feat(cast): Add --skip-preverification flag to run command to allow user to bypass nonce verification etc.#10794
ckoopmann wants to merge 1 commit intofoundry-rs:masterfrom
ckoopmann:optional-skip-preverification-in-cast-run

Conversation

@ckoopmann
Copy link
Contributor

@ckoopmann ckoopmann commented Jun 18, 2025

Motivation

When using cast run to debug a transaction on a local fork (usually hardhat) I regularily run into issues where the preverification of the transaction fails due to "nonce too high" or "insufficient balance for transaction fee" issues. Sometimes this is due to a corrupted cache (see #9968) however at other times resetting the cache does not fix the issue.
Often this happens when the local fork has been the target of test scripts that include hardhat_setBalance and related calls.

In these cases I am usually not interested in verifying wether a transaction has been legally included on chain but just want to simulate the evm operations inside that transaction. In the current state I am unable to do that.

Solution

Add an optional --skip-preverification flag to the cast run comamnd that skips all transaction preverification. (by running evm.transact_preverified instead of evm.transact).

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@ckoopmann ckoopmann marked this pull request as draft June 18, 2025 03:01
@ckoopmann ckoopmann marked this pull request as draft June 18, 2025 03:01
@ckoopmann ckoopmann marked this pull request as draft June 18, 2025 03:01
@ckoopmann
Copy link
Contributor Author

Note: After rebasing on the latest foundry master I noticed that the "transact_preverified" method is not available anymore on the revm / revm-inspector interface, so I'll have to find an alternative workaround.

@ckoopmann
Copy link
Contributor Author

Just found that there is a way to disable the nonce check specifically in revm so I will likely try to do that instead.

@ckoopmann ckoopmann closed this Jun 18, 2025
@github-project-automation github-project-automation bot moved this to Done in Foundry Jun 18, 2025
@ckoopmann
Copy link
Contributor Author

Note that the core issue I was facing here was the incorrect from address on impersonated transactions.
See: #10795

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.

1 participant