-
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
new(tests): Identity precompile test #1047
base: main
Are you sure you want to change the base?
Conversation
@shemnon I was reviewing your memory expansion tests and remembered this case, so decided to add a test that can be filled for the |
post = { | ||
contract_address: Account( | ||
storage={ | ||
1: keccak256(bytes([1, 2, 3, 4, 4]).ljust(32, b"\0")), |
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.
can this benefit from leftpadding?
code = ( | ||
sum(Op.MSTORE8(offset=i, value=(i + 1)) for i in range(4)) # memory = [1, 2, 3, 4] | ||
+ call_opcode( | ||
address=4, |
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.
shall we have global space constants for the precompiles?
"""Test the return data of the identity precompile overwriting its input.""" | ||
env = Environment() | ||
code = ( | ||
sum(Op.MSTORE8(offset=i, value=(i + 1)) for i in range(4)) # memory = [1, 2, 3, 4] |
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.
if possible I prefer to have concrete looking memory input like
0x000102030405
because when reading the code we will have to stop and calculate or sometimes we don't see what exactly the result of a calculation and when its not obvious we can have a bug and difficulty to find it.
Tests look fine WRT EXTCALL vs CALL. The only twist may be to test for the "corrupted" version in the memory write version when the opcodes are the EOF variants to verify no memory writes occured. |
🗒️ Description
Adds a test for the identity precompile based on this https://github.com/ethereum/go-ethereum/blob/master/docs/postmortems/2021-08-22-split-postmortem.md
Also adds a new variant that can be filled for EOF
EXT*CALL
opcodes .🔗 Related Issues
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.