foundry-rs / foundry-rs/foundry

feat(`forge script` + `anvil`): improve ability to run programmatic "tests" against Anvil

Open
#5,517 3 comments 15 reactions 0 assignees View on GitHub
A-reth-anvil C-anvil Cmd-forge-script T-feature
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### Component

Forge, Anvil

### Describe the feature you would like

### Background
When running tests using Foundry, it is possible to specify a `--rpc-url` to the `foundry test` command. When doing so, Foundry just queries and copies the state of the chain specified at the `--rpc-url` endpoint to the locally running testing node. Nevertheless, other Smart Contract development frameworks (hardhat) do provide a direct way to publish tests on an actual node, which can be tremendously useful for effective fork and staging testing.

### Proposal
Implement test transactions actually being published to anvil when specifying `--rpc-url` to a local anvil node. This would allow for more accurate fork-testing and external sources being able to use / query transaction data.

This feature could be used to effectively perform fork testing and integrate external sources into the testing environment.

### Additional context

### Discussed in https://github.com/foundry-rs/foundry/discussions/5421

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.