foundry-rs/foundry

Coverage Error: could not find anchor: no matching instruction in range

0x0scion opened this issue · 2 comments

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (5279f69 2022-06-29T00:09:16.192779Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Intel)

Describe the bug

Getting an error when trying to run coverage:
(ERC20Upgradeable is an OZ contract)
all test run without issues

Analysing contracts...
Error: 
could not find anchor: no matching instruction in range ERC20Upgradeable:2193:91:3

Some additional info:
same error when running forge coverage in this example repo: https://github.com/devanonon/ERC4626Votes (from this blog post)

Error is gone when reverting to a slightly earlier version of foundry - forge 0.2.0 (5385486 2022-06-27T00:03:53.397337486Z)

This is a known issue, abstract contracts do not work right now. forge coverage is not production ready yet! Thank you for your report 😄 See #1965

The reason it works on a previous version is that the previous version used a different system to figure out what opcodes mark source ranges as covered, but that system is not super accurate.