-
Notifications
You must be signed in to change notification settings - Fork 107
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 docstrings to all opcodes in the Opcodes
Enum
#383
Comments
hey ! can I work on this issue? |
Of course! |
please lmk if this format looks okay-ish or something needs to be changed(so I can replicate this with every opcode)
|
I took a look at how vscode renders the docstrings, and made some changes: ADD = Opcode(0x01, popped_stack_items=2, pushed_stack_items=1)
"""
ADD(a, b) = c
----
Description
----
Addition operation
Inputs
----
- a: first integer value to add
- b: second integer value to add
Outputs
----
- c: integer result of the addition modulo 2**256
Fork
----
Frontier
Gas
----
3
""" I think for other opcodes that are not arithmetic, e.g. CREATE, we can name the inputs and outputs edit: Added hyphens to the inputs and outputs for it to better render in the documentation |
Thanks a lot for the feedback! making a PR as soon as I'm done :) |
Hey @ThreeHrSleep! Nice to have you here. If you're keen, I wondered if a script could do a one-time pull of the doc from https://www.evm.codes? Here's the doc for After a quick check, it seems that if an opcode's functionality was modified in a subsequent fork, the additional information is documented in a a sub-folder, e.g., checkout https://github.com/smlxl/evm.codes/tree/main/docs/opcodes/55 (a complicated example). The additional info relevant for the latest fork could be added manually though. We could also add a link at the bottom of the docstring directly to the opcode on evm.codes, e.g. (as above in #383 (comment)), but with:
|
Thank you so much for the suggestion @danceratopz ! |
update: almost done,will make a PR by tonight |
It would be nice to have some docstrings with descriptions of each Opcode in the
Opcodes
Enum.The docstring could have some nicely formatted description that includes at least the following information:
The docstrings are normally picked up by the IDE, such as vscode, and it's a nice and handy way to have the parameters show up when going through the code as a reminder of the parameters and whatnot.
The text was updated successfully, but these errors were encountered: