foundry-rs / foundry-rs/foundry
feat: attach a `CoverageInspector` to the `Executor`
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 16h 38m
- Merged PRs (30d)
- 511
Description
### Component
Other (please describe)
### Describe the feature you would like
Feature: Getting coverage information from anywhere by attaching a `CoverageInspector` to the `Executor`.
I'm trying to find coverage during a run of a transaction, so I tried adding a `Coverage` Inspector to the `ExecutorBuilder`. I'm able to see that the `coverage` bool is set in the `Executor`, but after I run a transaction on the `Executor` and I run `collect` on the `InspectorStack` I get an empty `HitMap`.
I'm thinking that this is happening because the Analyzer is never called on the source contracts, so there are no `Anchors` but I'm not sure.
Let me know if this is out of scope or if it's already possible and I've missed something.
Thanks!
### Additional context
_No response_
Contributor guide
Research direction
Start by tracing how ExecutorBuilder attaches inspectors to Executor, then follow InspectorStack::collect and the Analyzer, Anchors, and HitMap flow described in the issue. Reproduce coverage collection during a transaction and determine where source contracts are analyzed; done means a CoverageInspector attached to an Executor produces coverage data rather than an empty HitMap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, solidity
- Domain
- blockchain, testing, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100