-
Notifications
You must be signed in to change notification settings - Fork 773
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
EIP3540 run EOF code correctly #2368
Conversation
9ef66ca
to
e914ac5
Compare
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
packages/evm/src/evm.ts
Outdated
@@ -858,6 +858,9 @@ export class EVM implements EVMInterface { | |||
} else { | |||
message.code = await this.eei.getContractCode(message.codeAddress) | |||
message.isCompiled = false | |||
if (this._common.isActivatedEIP(3540)) { | |||
message.code = getEOFCode(message.code) |
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.
Do we really need this? runInterpreter
checks the code passed in as part of the message for the EOF header and sets the PC to the correct position based on the sections header.
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 see that more tests fail when I comment it out but from how we handle code in the interpreter, it seems like they shouldn't be failing. I looked back at the original PR and the idea was that we handled all the bits about defining the code section inside interpreter.run
so this theoretically should be duplicative.
643ed03
to
438b9fa
Compare
438b9fa
to
06206b5
Compare
Now have 4 tests failing. This is due to CODECOPY and likely also CODESIZE. If you run these if you |
See my latest commit. I think this relatively cleanly solves it by adding a new |
Cool! Why the hell didn't we pack this in the hotfix releases? 😋 |
Never too late 🙃 |
I added a test for the new |
I think in general we also want another client (i.e. Geth) to run alongside our Shangdong testnet (we should run this ourselves) so we can quickly figure out if there is a consensus bug. @acolytec3 can you confirm that the current EIP3540 tests pass? |
I need to run the state tests but all of the Blockchain tests pass except for that over where I raised the question about the container length which appears to be invalid. I'll check the state tests today and see if there are any remaining failures. |
I believe Nethermind is planning to join and they have implemented EIP3540/3670 as well. I'm not sure if Geth has it integrated in their master branch yet |
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.
LGTM!
@acolytec3 has this been confirmed (e.g. by the test authors on ethereum/tests or similar) that this test is invalid? Can you provide a reference here? |
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2022 EthereumJS Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
I wonder if we should also prepare a quick EVM-only bugfix release on this? Could do this tomorrow morning. |
After the new updates in ethereum/tests#847, we have many failing tests, and one of the causes is that we do not run the actual EOF code, but we run the entire container (so EOF code immediately runs into 0xEF, which is the invalid opcode).
Also thanks to @pk910 who discovered this on Shangdong testnet :)
To run:
Run tests;
Current: