Skip to content
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

Replace difficulty with prevrandao #180

Merged
merged 21 commits into from
Oct 21, 2022
Merged

Conversation

thevaizman
Copy link
Contributor

This PR contains quite a lot of code that had to be refactored in order to use the latest ethereumjs library (which supports the merge).
In addition a hacky prebuild script was added to the build process. Details for why we did that are here.

Please review this thoroughly :)

Update ethereumjs version of all packages (contains breaking changes)
Refactor areas of the code that broke due to changes in ethereumjs
Added "merge" HF to the HF selection menu
Added workaround logic to change "difficulty" opcode to "prevrandao" if "merge" is the chosen HF (still WIP - will probably change this in a future commit before merging)
Replaced the unsustainable method overriding in _setupStateManager() to a much more robust Proxy API implementation.
We now create a proxified EVMEEI object that allows us to intercept putContractStorage and clearContractStorage without ever overriding them.
This guarantees us to be compliant with future changes in @ethereumjs/evm and still be able to capture storage clear/put operations.

Also, unrelated, this commit contains a fix to getTargetEvmVersion() in order to correctly get the target evmVersion for compilation.

Lastly, this commit contains a lint fix in DocRow.tsx
Added a very hacky `prebuild.sh` script to allow build to successfully finish when using the latest ethereumjs version.
The script basically uses `sed` in order to replace 2 faulty lines that won't compile for us because we use ESM and ethereumjs migrated to CommonJS.
Please refer to this issue for mor details:
ethereumjs/ethereumjs-monorepo#2295
@thevaizman thevaizman requested review from dorlevi and peroket October 12, 2022 00:21
@vercel
Copy link

vercel bot commented Oct 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
evm-codes ✅ Ready (Inspect) Visit Preview Oct 21, 2022 at 5:10PM (UTC)

darkdarkdragon
darkdarkdragon previously approved these changes Oct 17, 2022
Copy link
Contributor

@darkdarkdragon darkdarkdragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't test everything manually, but changes themselves looks good 😄

Copy link
Contributor

@assimovt assimovt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @thevaizman thx for the PR and for going down the rabbit hole with the ethereumjs/TS issues. I left a few comments, mainly on the code styling, but otherwise LGTM. If there is an existing branch for properly fixing the issue, so that we can get rid of the build script, we could already create another issue in this repo to track it and update to the latest. Cheers ✌🏽

@dorlevi dorlevi removed the request for review from assimovt October 21, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants