Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forge debugger sometimes jumbles sourcemaps #7111

Closed
2 tasks done
emo-eth opened this issue Feb 13, 2024 · 1 comment
Closed
2 tasks done

Forge debugger sometimes jumbles sourcemaps #7111

emo-eth opened this issue Feb 13, 2024 · 1 comment
Labels
T-bug Type: bug

Comments

@emo-eth
Copy link
Contributor

emo-eth commented Feb 13, 2024

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 (79d2de6 2024-02-12T20:06:43.997810000Z)

What command(s) is the bug in?

forge test

Operating System

macOS (Apple Silicon)

Describe the bug

This is difficult to reproduce, especially minimally.

Sometimes, Forge sourcemaps are jumbled, ie, the highlighted code is not at all what is being executed.

This can lead to panics, I assume because it tries to look up a PC out of range for the sourcemap.

Usually this is the result of an incremental build, ie, tweaking a single file and then entering the debugger – in the Seaport repo especially, this results in jumbled sourcemaps for at least some contracts. forge clean and building from scratch often fixes the issue in this scenario.

I have a couple theories:

  • solc may be assigning fresh+duplicate sourceIds to build artifacts (seems unlikely, but I have heard that eg incremental builds with via-ir enabled result in different bytecode than from clean)
  • Contracts with the same name but different sourceIds are getting loaded in the "wrong" order after an incremental build, which has downstream effects
  • Some other unidentified upstream effect

Recently, I encountered a case where a clean build still resulted in a jumbled sourcemap. There were no duplicate contract names. I am unsure if it is the same issue.

@emo-eth emo-eth added the T-bug Type: bug label Feb 13, 2024
@gakonst gakonst added this to Foundry Feb 13, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Feb 13, 2024
@klkvr
Copy link
Member

klkvr commented Jun 13, 2024

Resolved by foundry-rs/compilers#140

@klkvr klkvr closed this as completed Jun 13, 2024
@jenpaff jenpaff moved this from Todo to Completed in Foundry Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

2 participants