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 instruction offsets to simplify source mapping #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RaoulSchaffranek
Copy link

Summary

Instructions can be addressed using either the program counter or instruction offsets. The source maps generated by the Solidity compiler use instruction offsets. This PR makes the offset an optional property of a disassembled instruction to simplify working with source maps.

Quoting from the linked docs:

The encoding in the source mapping for the bytecode is more complicated: It is a list of s:l:f:j:m separated by ;. Each of these elements corresponds to an instruction, i.e., you cannot use the byte offset but have to use the instruction offset (push instructions are longer than a single byte)

Background

We're developing a Solidity debugger that uses Pyevmasm as a disassembler. We heavily use source maps, and by adding support for instruction offsets directly to Pyevmasm, we can safely switch between the two addressing schemes. Other developer tools might also profit from this change.

@CLAassistant
Copy link

CLAassistant commented Sep 18, 2024

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

2 participants