foundry: forge coverage: could not find anchors for branches

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:03:58.834625889Z)

What command(s) is the bug in?

forge coverage

Operating System

Linux

Describe the bug

This used to work with yesterday build but after foundryup coverage started to fail with

Analysing contracts...
Error: 
could not find anchors for branches: we do not have the bytecode for MyContract

Same in GH Actions CI

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

Also seeing this on our code.

git clone git@github.com:ethereum-optimism/optimism.git
cd packages/contracts-bedrock
yarn
forge coverage

could not find anchor: no matching instruction in range ResourceMetering:2511:173:4

Most likely you hadn’t updated in a week or two since coverage has not had any change yesterday

Apologies, on the wrong issue - deleted the comment

I have the same issue with my contract:

What version of Foundry are you on?

forge 0.2.0 (a5ea746 2022-07-03T00:12:33.358047Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS 12.4

Error:

Analysing contracts...
Error:
could not find anchor: no matching instruction in range PermissionControl:1159:172:7

Contract source code:

https://gist.github.com/VeryCB/ad1623b7c5850d0459ed0f8f793a56ff

More information

I believe It was working before this PR been merged https://github.com/foundry-rs/foundry/pull/2133

All functions in contract are external