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

Add support for bytecode source map #160

Open
elfedy opened this issue Oct 7, 2024 · 0 comments
Open

Add support for bytecode source map #160

elfedy opened this issue Oct 7, 2024 · 0 comments

Comments

@elfedy
Copy link

elfedy commented Oct 7, 2024

🌟 Feature Request

📝 Description

Beside the mapping given for the ast, solc provides bytecode source maps, that can be output by specifying the evm.bytecode.sourceMap/evm.deployedBytecode.sourceMap output selection options.

In that map, each opcode has the following information as a ; separated list:

  • source file
  • code region associated (source code byte offset + length)
  • jump metadata (indicates when a jump goes into a function or returns from a function)
  • modifier depth (associated to modifiers, entering the _ statement will increase the depth by 1, returning from it will decrease it)

A quick glance at the current outputs, the docs and supported output flags would indicate that this is not supported in zksolc still.

🤔 Rationale

This feature is needed for developers trying to implement debuggers or any tool that analyzes execution and needs to map an execution step back to a place in the source code that produced it.

📋 Additional Context

We are looking to support forge coverage in foundry zksync which outputs test coverage data for functions/statemens/branches/lines. In order to implement this we would need a way to map an instruction being executed on the Era VM to a corresponding part of the contract source code to check what was exactly hit during test execution.
Even though research needs to be done still, this will probably be a requirement to support the debugger as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant