-
Notifications
You must be signed in to change notification settings - Fork 111
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
feat(cli): evm_bytes
rename + print asm
#844
Conversation
73cf968
to
3a5d898
Compare
@danceratopz this is the output of the assembly version: uv run evm_bytes binary-file ./src/ethereum_test_forks/forks/contracts/withdrawal_request.bin --assembly
caller
push20 0xfffffffffffffffffffffffffffffffffffffffe
eq
push1 0x90
jumpi
... Don't really know where we could fit this example though. |
I asked our old collaborator gpt to put the example in the docstrings with google docstring style - then we get some nice online docs. The parameter table isn't quite right (from a cli user perspective, it is from an api perspective), but perhaps we can incrementally improve this over time. I do like the examples though. |
@marioevz I broke tox -e docs in multiple ways, will get back to this! |
No worries, super simple fixes, loved the way the docstrings were formatted, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition! LGTM!
cda244b
to
e48ce61
Compare
I'm trying to use If the square brackets in the output is used only for visual representation, can we please replace them with parenthesis? I'd be happy to PR this change. execution-spec-tests/src/cli/evm_bytes.py Line 42 in 295879d
|
Maybe I don't understand the question? It should be valid 🙂 It was added to help testing EOF. For example: execution-spec-tests/tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py Lines 73 to 81 in ac615f6
This is achieved by implementing a execution-spec-tests/src/ethereum_test_vm/opcode.py Lines 149 to 152 in ac615f6
Ah, does |
For legacy opcodes, both approach seems to be equivalent. In [1]: (Op.PUSH1[0x81] + Op.PUSH1[0x81]).hex()
Out[1]: '60816081'
In [2]: (Op.PUSH1(0x81) + Op.PUSH1(0x81)).hex()
Out[2]: '60816081' When writing this manually, is there a convention to be followed? |
🗒️ Description
Changes included:
Module Renaming and Refactoring:
evm_bytes_to_python
module toevm_bytes
and refactored the code to improve readability and functionality. (pyproject.toml
,src/cli/evm_bytes.py
,src/cli/evm_bytes_to_python.py
) [1] [2] [3]Test Updates:
evm_bytes_to_python
toevm_bytes
. (src/cli/tests/test_evm_bytes.py
) [1] [2]--assembly
flag:--assembly
flag which allows printing the bytecode in assembly format (e.g. see format used in EIP-7002 or EIP-7251).🔗 Related Issues
None
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.