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

feat: merge revm official pre-v37 version and add Haber spec to opBNB #25

Closed
wants to merge 108 commits into from

Conversation

j75689
Copy link
Collaborator

@j75689 j75689 commented Jun 3, 2024

Description

This PR is intended to support the opBNB Haber fork.

secp256k1(P256) verify has been implemented by official revm, but has not been officially released, so merge to the latest commit.

Rationale

bnb-chain/op-geth#112
https://github.com/bluealloy/revm/pull/1436/files

Example

n/a

Changes

  1. merge upstream v37 version
  2. support opBNB Haber Fork

Notable changes:

  • secp256r1 verify supported on opBNB Haber fork.

Potential Impacts

  • no

rakita and others added 30 commits June 3, 2024 15:18
Bumps [secp256k1](https://github.com/rust-bitcoin/rust-secp256k1) from 0.28.2 to 0.29.0.
- [Changelog](https://github.com/rust-bitcoin/rust-secp256k1/blob/master/CHANGELOG.md)
- [Commits](rust-bitcoin/rust-secp256k1@secp256k1-0.28.2...secp256k1-0.29.0)

---
updated-dependencies:
- dependency-name: secp256k1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… (#1243)

* feat(interpreter): remove SPEC generic from gas calculation functions

* feat(interpreter): make most gas cost calculation functions `const`

* set_final_refund

* unused

* fix: optimism

* chore: use `is_london: bool` instead of `SpecId` in `Gas::set_final_refund`
* feat: alloydb

* chore: turn on needed deps for test

* derive

* correct address

* chore: remove arc

* feat: actually make Transport and Network generic to accept any transport or network

* chore: condense markers into one, more idiomatic
* fix typo

* fix typo
* check without microbench
* cleanup
* feat: add modifies_memory macro

* refactor
* fix examples->generate_block_traces reuse TracerEip3155.gas_inspector issue

* fmt code

* clear the eip3155 tracer state so that it can be used in next transaction

* print summary and clean state when create_end

* update documentation

* fix left nits

* add cancun upgrade block number

* remove outdated doc

* remove outdated doc

* remove empty file

* TS is unit used to trigger the hardork

---------

Co-authored-by: rakita <rakita@users.noreply.github.com>
* eof

* feat(EOF): Header decoder

* EofBody decode

* disable eof deprecated opcodes

* add eof instructions

* temp tests

* rjump instructions

* eof rjump with tests

* EOF bytecode

* callf, retf, jumpf

* tests for callf,retf,jumpf

* small rename

* add dataload, dataloadn and datacopy opcodes

* refactor calls

* blueprint for creates

* eof create inputs

* some wip

* add eofcreate structs and exccall flow

* wip eofcreate code flow and handlers

* fix tests

* eof creates

* refactor eofcreate a little

* some work on extcall

* feat: refactor simplify CallInput, eof extcalls

* feat: restructure OpCode and add stack input/output num

* add flags for stack_io and not_eof

* wip eof verification

* wip validation

* EOF Bytecode validity

* insturction and jump validation seems good

* merged eof validate function

* EOP test runner, fex fixes

* RETURNDATALOAD, fix call bugs, refactor gas warm/cold calc

* debug session, rjumpv imm fix

* fixing validation bugs, bytecode decoder for EOF in revme

* pass most of validation tests

* bounds check moved to decode

* Fix merge compilation, fmt

* TXCREATE work

* remove training wheels, panic on eof

* test fix and std

* std

* fix test

* fix valgrind

* fix tests

* clippy

* removed checked logic

* small change

* no std revm-test

* check pending TODOs

* build check no_std

* doc

* chore: move some files. cleanup comments

* fix fmt,clippy and compile error
* feat: add flag to force hashbrown usage

* misc: propagate hashbrown feature flag
* feat(revm): make `FrameOrResult` serializable

This commit make all structs under `FrameOrResult` serializable, which
is useful when trying to save execution state inside an inspector during
transaction execution.

The modified structs include:

* revm: `FrameOrResult`, `FrameResult`, `Frame`, `FrameData`,
  `CallFrame`, `CreateFrame`, `JournalCheckpoint`
* interpreter: `BytecodeLocked`, `Contract`, `Gas`, `CreateOutcome`,
  `CallOutcome`, `Interpreter`

* style(interpreter): make clippy happy

* fix(interpreter): fix missing conflict

* style(interpreter): make clippy happy
* fix: correct some stack IO

* chore: remove dead code
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](dtolnay/anyhow@1.0.81...1.0.82)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Implement with_chain_id for CfgEnv

* cargo fmt

* fix comments
Pana and others added 23 commits June 3, 2024 15:24
* feat: load account should return db error

* simplify
* chore: cargo update

* chore: skip tests with storage check and return error

* return println and clippy

* revert to previous println
* feat(revm): revert EIP-2935 BLOCKHASH opcode changes

* fix lint

* bump time

* return previous impl mod prague branch

* remove unused imports
* feat(optimism): Add secp256r1 precompile for Fjord

* Fix docs

* Fix nostd build

* Load fjord precompiles via optimism handler register

* Remove outdated fjord() precompile spec constructor

* Document the secp256r1 feature

* Address feedback

* Handle invalid signatures

* Update crates/precompile/src/secp256r1.rs

* Update crates/precompile/src/secp256r1.rs

* Blank return on failed signature verification

* Add test case for invalid (zero) pubkey

---------

Co-authored-by: rakita <rakita@users.noreply.github.com>
* fix: check canonical field elements

* chore: more cleanups

* remove hex, update comments

* fix more docs

* small refactor and check if fp is canonical

* doc fix
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.202 to 1.0.203.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.202...v1.0.203)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…me (#1461)

conflict

Co-authored-by: Eric Bogard <ebo@testmachine.ai>
* Implement new L1 cost function for Fjord

* Add fastlz test

* Adds a second, more faithful adaptation of solady fastlz for fuzzing

* Fix bounds check

* Remove some unnecessary constants

* Fix some linting issues

* Add tests for parity with evm bytecode implementation of fastlz

* Replace ethers abi encode/decode with alloy

* Use rstest for parameterized testcases

* Revert change to examples

* Remove duplicate solady flz implementation

* Remove direct alloy-sol-macro dependency

* Remove unnecessary flag check

* Undo dependency reordering
* fix(Interpreter): wrong block number used

* chore(primitives): rename State to PlainState

* Restructure StorageSlot and rename PlainState to EvmState

* doc
* bug(EOF): returncontract immediate is one byte

* rm dependency
* feat(EOF): Add EOF to inspector handle register

* add comments, remove TODO
* feat: implement precompile contract for opBNB

* fix: unused import warning in test

* ci: add develop branch to the list of branches to run

* chore: fmt codes

* chore: fix no default feature importing

* chore: cargo clippy fix

* ci: disable checks on riscv32imac-unknown-none-elf

* chore: setup vec with capacity

* fix: cometbft_light_block_validate input conversion

* chore: fix fmt

* fix: add opbnb feature to ECOTONE

* fix: sepc definition

* chore: fix opBNB feature tags

* chore(ci): bump action/deploy (#1372)

* fix: light block header validation in cometbft

* chore: fix fmt

* fix: BLS_SIGNATURE_VALIDATION_BASE to 1000

* update greenfield-cometbft-rs version

---------

Co-authored-by: rakita <rakita@users.noreply.github.com>
Co-authored-by: Keefe Liu <keefe.l@users.noreply.github.com>
@j75689 j75689 changed the title feat: rebase revm to official pre-v37 version, and add Haber spec to opBNB feat: merge revm official pre-v37 version and add Haber spec to opBNB Jun 3, 2024
Copy link
Contributor

github-actions bot commented Jun 3, 2024

Valgrind Results:

==5366== Cachegrind, a cache and branch-prediction profiler
==5366== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==5366== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==5366== Command: target/release/snailtracer
==5366== 
--5366-- warning: L3 cache found, using its data for the LL simulation.
Running snailtracer example!
elapsed: 1.789101365s
==5366== 
==5366== I   refs:      429,371,953
==5366== I1  misses:          3,228
==5366== LLi misses:          2,816
==5366== I1  miss rate:        0.00%
==5366== LLi miss rate:        0.00%
==5366== 
==5366== D   refs:      206,205,209  (133,650,709 rd   + 72,554,500 wr)
==5366== D1  misses:        344,888  (    204,850 rd   +    140,038 wr)
==5366== LLd misses:        137,611  (      4,262 rd   +    133,349 wr)
==5366== D1  miss rate:         0.2% (        0.2%     +        0.2%  )
==5366== LLd miss rate:         0.1% (        0.0%     +        0.2%  )
==5366== 
==5366== LL refs:           348,116  (    208,078 rd   +    140,038 wr)
==5366== LL misses:         140,427  (      7,078 rd   +    133,349 wr)
==5366== LL miss rate:          0.0% (        0.0%     +        0.2%  )

@j75689 j75689 closed this Jun 3, 2024
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.