-
Notifications
You must be signed in to change notification settings - Fork 155
feat(tests): add call operation test case for CLZ #1829
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
base: main
Are you sure you want to change the base?
Conversation
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.
Fantastic test, just a few minor comments. Thanks!
callee_address = pre.deploy_contract(code=callee_code) | ||
|
||
caller_code = opcode(gas=0xFFFF, address=callee_address, ret_offset=0, ret_size=0x20) | ||
caller_code += Op.RETURNDATACOPY(dest=0, offset=0, size=Op.RETURNDATASIZE) |
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.
caller_code += Op.RETURNDATACOPY(dest=0, offset=0, size=Op.RETURNDATASIZE) |
Return data is already in memory thanks to ret_size=0x20
;)
callee_code = Op.PUSH32(1 << bits) + Op.DUP1 | ||
|
||
if context != CallingContext.no_context: | ||
callee_code += Op.CLZ + Op.PUSH0 + Op.SSTORE | ||
|
||
callee_code += Op.CLZ + Op.PUSH0 + Op.MSTORE + Op.RETURN(0, 32) |
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.
callee_code = Op.PUSH32(1 << bits) + Op.DUP1 | |
if context != CallingContext.no_context: | |
callee_code += Op.CLZ + Op.PUSH0 + Op.SSTORE | |
callee_code += Op.CLZ + Op.PUSH0 + Op.MSTORE + Op.RETURN(0, 32) | |
callee_code = Op.PUSH32(1 << bits) + Op.CLZ | |
if context != CallingContext.no_context: | |
callee_code += Op.DUP1 + Op.PUSH0 + Op.SSTORE | |
callee_code += Op.PUSH0 + Op.MSTORE + Op.RETURN(0, 32) |
I feel like this is a tiny bit more readable (do the CLZ operation then duplicate the result, instead of redoing the operation).
e22135a
to
1cadd86
Compare
@marioevz Thanks for review! I've updated accordingly |
🗒️ Description
Add
CALL
/DELEGATECALL
/STATICCALL
/CODECALL
opcode interaction with CLZ🔗 Related Issues or PRs
Issue #1795
✅ Checklist
tox
checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlint
type(scope):
.mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_from
marker.