-
Notifications
You must be signed in to change notification settings - Fork 318
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
Test(s) wanted #942
Comments
Why would CREATE2 overwrite the return data? It doesn't have an output buffer the way the CALL opcode family does. |
https://eips.ethereum.org/EIPS/eip-211:
I think the actual reason for this 'quirk' is this:
|
Thanks for sending this in. I just pinged the testing discord channel about this test and came here and saw it was already added. Just as an fyi, the changes has for py-evm for this have been merged, just not yet on a release. PR with the changes here: ethereum/py-evm#2023 |
I found something interesting and unexpected. When
But when
I wonder if other clients behave the same way. (1) Granted, not an event you can engineer without a hash collision. |
In geth, the collision is checked prior to executing the initcode. Therefore, there should be no |
Ok, found the test in your PR. Running the test(s), I see this:
So there are 4 legacy |
Oops, you're right, thank you for finding it. Consider it fixed, and the weird phenomena to have disappeared. |
Checked this in EthereumJS - we do not have this bug. |
Bug report by @guidovranken, concerning py-evm:
Report
When there is insufficient funds for a CREATE/CREATE2 call, Create::call aborts here:
https://github.com/ethereum/py-evm/blob/efa07f743db4437a2762dfcd05535177046507e7/eth/vm/logic/system.py#L162-L164
That way, it never reaches the call to apply_create_message():
https://github.com/ethereum/py-evm/blob/efa07f743db4437a2762dfcd05535177046507e7/eth/vm/logic/system.py#L195
which in turn would call apply_child_computation():
https://github.com/ethereum/py-evm/blob/efa07f743db4437a2762dfcd05535177046507e7/eth/vm/logic/system.py#L198
which in turn would reset the return data:
https://github.com/ethereum/py-evm/blob/efa07f743db4437a2762dfcd05535177046507e7/eth/vm/computation.py#L386
This way, any return data present before the CREATE/CREATE2 call is retained, whereas Geth always resets it.
Bytecode that may be used to reproduce the issue (this uses the RIPEMD160 precompile to set the initial return data and then runs a CREATE2. The difference in stack state after the subsequent RETURNDATASIZE can be observed to confirm the issue).
{
0x5b, 0x59, 0x59, 0x58, 0x33, 0x3d, 0x58, 0x59, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0xf1, 0x95, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x84, 0x85, 0x85, 0x85, 0x85, 0xf1, 0x95, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0xf1, 0xf5, 0x3d, 0x30
}
__
This also happens when there is a collision:
https://github.com/ethereum/py-evm/blob/efa07f743db4437a2762dfcd05535177046507e7/eth/vm/logic/system.py#L184-L185
__
Reference to py-evm ticket: ethereum/py-evm#2023
The text was updated successfully, but these errors were encountered: