-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Labels
T-bugType: bugType: bugT-needs-triageType: this issue needs to be labelledType: this issue needs to be labelled
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
1.5.0
What version of Foundryup are you on?
i use foundry.nix
What command(s) is the bug in?
forge test -vvv
Operating System
Linux
Describe the bug
The forge test -vvv output is too slow. I git bisected through, the first commit with the problem is 824fd99. Which seems to make a bit of sense too, since it is change in tracing? anyway i can disable sourcify?
Details
Yes, there is a significant blocking issue in commit 824fd9975:
The problem is in crates/evm/traces/src/identifier/external.rs:162:
let fetched_identities = foundry_common::block_on(
futures::stream::select_all(fetchers)
.filter_map(|(address, value)| {
// ... processing ...
})
.collect::<Vec<IdentifiedAddress<'_>>>(),
);
The Issue:
1. Synchronous blocking in trace identification: Every time identify_addresses() is called during test execution, it makes a synchronous blocking
call (block_on) to fetch contract metadata from external sources (Sourcify and Etherscan).
2. Called for every trace: When you run forge test -vvv, traces are decoded and addresses are identified, which triggers this blocking call for every
unique contract address encountered in the traces.
3. Network I/O in the hot path: The fetchers make HTTP requests to:
- Sourcify API: https://sourcify.dev/server/v2/contract/{chainId}/{address}
- Etherscan API: contract source code endpoint
4. Serial processing per batch: Although it uses select_all to process multiple fetchers concurrently, it still blocks the entire test output/trace
rendering pipeline waiting for all network requests to complete.
Performance Impact:
- Each address lookup involves at least one HTTP request (Sourcify first, then Etherscan)
- With rate limiting (1 second timeout) and concurrency limits (5 concurrent requests per fetcher)
- If you have many unique contract addresses in your traces, this can cause significant delays
The files affected:
- crates/evm/traces/src/identifier/external.rs:162 - the blocking call
- crates/forge/src/cmd/test/mod.rs:531 - where the identifier is initialized with .with_external()
This would explain why forge test -vvv output appears to hang or become very slow when printing traces.
Metadata
Metadata
Assignees
Labels
T-bugType: bugType: bugT-needs-triageType: this issue needs to be labelledType: this issue needs to be labelled
Type
Projects
Status
Backlog