-
Notifications
You must be signed in to change notification settings - Fork 91
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
convert calldatacopy test #1056
base: main
Are you sure you want to change the base?
Conversation
8442fde
to
26070d9
Compare
ada2d17
to
a8cb99b
Compare
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.
Thanks for this! I've left some comments to make the code more readable, I can fully review once these are applied 👍
Op.PUSH1[0x2] | ||
+ Op.PUSH1[0x1] | ||
+ Op.PUSH1[0x0] | ||
+ Op.CALLDATACOPY |
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 be rewritten as:
Op.PUSH1[0x2] | |
+ Op.PUSH1[0x1] | |
+ Op.PUSH1[0x0] | |
+ Op.CALLDATACOPY | |
Op.CALLDATACOPY(dest_offset=0, offset=1, size=2) |
Improves readability a bit IMO.
+ Op.MSIZE | ||
+ Op.PUSH1[0x0] | ||
+ Op.RETURN |
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.
+ Op.MSIZE | |
+ Op.PUSH1[0x0] | |
+ Op.RETURN | |
+ Op.RETURN(offset=0, size=Op.MSIZE) |
Also here and for the rest of the bytecodes.
+ Op.MSIZE | ||
+ Op.PUSH1[0x0] | ||
+ Op.RETURN | ||
+ Op.STOP |
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.
This can be removed because RETURN
is a terminating opcode, and if the test gets automatically converted to EOF it could be annoying.
+ Op.STOP |
tx_data: bytes, | ||
pre: Alloc, | ||
code_address_storage: Account, | ||
to_address_storage: Account, |
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.
to_address_storage: Account, | |
to_address_storage: Account | None, |
From some of the parametrized values.
+ Op.PUSH2[0x1000] | ||
+ Op.ADD | ||
+ Op.PUSH3[0xFFFFFF] | ||
+ Op.CALL |
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.
I think this and most if not all lines above can be rewritten using parentheses like Op.CALL(0xFFFFFF, Op.ADD( ...
.
+ Op.STOP | ||
), | ||
nonce=0, | ||
balance=0x0BA1A9CE0BA1A9CE, |
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.
I think this amount of balance might be unnecessary.
A bit of background is that this value was common in ethereum/tests, but now we can use the execute
command to send these transactions to a live network, and if we use this amount the pre-deploy account has to be funded with this. So it's better to keep it to the minimum necessary.
data=tx_data, | ||
gas_limit=0x04C4B400, | ||
gas_price=0x0A, | ||
nonce=0x00, |
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.
nonce=0x00, |
Can be removed since the sender that is returned by pre.fund_eoa()
has a nonce counter that is automatically increased and used for each transaction that is generated with it.
|
||
tx = Transaction( | ||
data=tx_data, | ||
gas_limit=0x04C4B400, |
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.
I think this also can be reduced due to similar reason as the balance of the contract.
gas_limit=0x04C4B400, | |
gas_limit=100_000, |
This could potentially be due to the
We could use the permalink to the file: https://github.com/ethereum/tests/blob/ae4791077e8fcf716136e70fe8392f1a1f1495fb/src/GeneralStateTestsFiller/VMTests/vmTests/calldatacopyFiller.yml
This might be because of the way the code is compiled for the ethereum/tests version of the test, so there's a difference between the opcodes used, but we could analyze the result and if deemed unimportant we can merge as is, no problem. |
c5aa077
to
1f652aa
Compare
🗒️ Description
Converts
calldatacopy
tests from hereQuestions:
ethereum/tests
, how should I reference the source in the docstring?🔗 Related Issues
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.