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

preparation for solidity v0.8.23 upgrade #452

Merged
merged 31 commits into from
Mar 1, 2024

Conversation

gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Feb 27, 2024

Proposed changes

Picked blow PR from ethereum to support solidity v0.8.23 later:

  • PR #20787: use uint256 in EVM implementation
  • PR #21336: use pointers to operations vs. copy by value
  • PR #21605: params: make 2200 in line with spec
  • PR #22774: replace repeated string with variable in tests
  • PR #22766: clean up contract creation error handling
  • PR #22797: fix interpreter comments
  • PR #22825: avoid duplicate log in json logger
  • PR #23092: e: remove unused methods ReturnGas
  • PR #23450: fix typo in comment
  • PR #23499: rework jumpdest analysis benchmarks
  • PR #23928: don't use iota for opcode definitions
  • PR #23967: use proper JumpTable type
  • PR #23956: remove unused unofficial opcodes
  • PR #23974: simplify op lookup in contract
  • PR #23952: Simplify error handling in interpreter loop
  • PR #23976: rename SHA3 instruction to KECCAK256
  • PR #23977: don't copy JumpTable when no EIP mods are needed
  • PR #23970: Move interpreter.ReadOnly check into the opcode implementations
  • PR #24022: rename opSuicide to opSelfdestruct
  • PR #24040: remove stack.pushN
  • PR #24031: fill gaps in jump table with opUndefined
  • PR #24026: move interpreter interruption check to jump instructions
  • PR #24066: remove no-recursion option from confi
  • PR #24085: remove unused code (IsStaticJump)
  • PR #24120: reverse bit order in bytes of code bitmap
  • PR #24017: make INVALID a defined opcode
  • PR #24851: clean up some dead functions
  • PR #24850: separate opcode group for 0x20 range
  • PR #24847: optimize Memory.Set32
  • PR #25131: better handle error on eip activation check
  • PR #28453: performance tweak of OpCode.String()

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@gzliudan gzliudan changed the title upgrade vm for solidity v0.8.x preparation for solidity v0.8.23 upgrade Feb 27, 2024
chfast and others added 22 commits March 1, 2024 14:13
* core/vm: use fixed uint256 library instead of big

* core/vm: remove intpools

* core/vm: upgrade uint256, fixes uint256.NewFromBig

* core/vm: use uint256.Int by value in Stack

* core/vm: upgrade uint256 to v1.0.0

* core/vm: don't preallocate space for 1024 stack items (only 16)

Co-authored-by: Martin Holst Swende <martin@swende.se>
Do not keep separate flag for "max code size exceeded" case, but instead
assign appropriate error for it sooner.
* Fix interpreter comment

* Fix comment
* core/vm: rework jumpdest analysis benchmarks

For BenchmarkJumpdestOpAnalysis use fixed code size of ~1.2MB
and classic benchmark loop.

* core/vm: clear bitvec in jumpdest analysis benchmark
* core/state/snapshot: remove wiper functionality

* core/vm: remove unused 'unofficial' opcodes
* core/vm: break loop on any error

* core/vm: move ErrExecutionReverted to opRevert()

* core/vm: use "stop token" to stop the loop

* core/vm: unconditionally pc++ in the loop

* core/vm: set return data in instruction impls
This was proposed in 2016, Solidity uses this since 2017, and evmone and other VMs use the keccak256 name. This brings geth in line with those.
…ons (ethereum#23970)

* core/vm: Move interpreter.ReadOnly check into the opcode implementations

Also remove the same check from the interpreter inner loop.

* core/vm: Remove obsolete operation.writes flag

* core/vm: Capture fault states in logger

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/vm: Remove panic added for testing

Co-authored-by: Martin Holst Swende <martin@swende.se>
The opcode was renamed in the codebase in 2017, but the functions were kept unchanged.
…hereum#24026)

* core/vm: Remove interpreter loop interruption check

* core/vm: Unit test for interpreter loop interruption

* core/vm: Check for interpreter loop abort on every jump
holiman and others added 9 commits March 1, 2024 14:13
* core/vm: reverse bit order in bytes of code bitmap

This bit order is more natural for bit manipulation operations and we
can eliminate some small number of CPU instructions.

* core/vm: drop lookup table
* core/vm: Define 0xfe opcode as INVALID

* core/vm: Remove opInvalid as opUndefined handles it

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
* core/vm: remove unnecessary memset for Memory.Set32

* core/vm: optimize Memory.Set32
* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor
make `opCodeToString` a `[256]string` array

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
@gzliudan gzliudan merged commit df2384e into XinFinOrg:dev-upgrade Mar 1, 2024
@gzliudan gzliudan deleted the new-vm branch March 1, 2024 07:03
@liam-lai liam-lai mentioned this pull request Mar 4, 2024
19 tasks
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.