Skip to content

Commit

Permalink
feat: implement EIP-4844 (bluealloy#668)
Browse files Browse the repository at this point in the history
* feat: point evaluation precompile

* feat: BLOBHASH opcode

* refactor: revme runner

* renames

* export global kzg settings

* feat: include kzg settings bytes with `include_bytes!`

* build.rs: remove second option, update docs

* revme: remove unused files and dead code

* feat: implement remaining block and tx env fields

* Add tests for helper functions, update constants

* Add EIP-4844 EF tests to CI, skip outdated ones

* chore: make skip_test more readable

* Fix tests

* Fix fmt

* Fix lints, review

* fix: validate new tx, block fields; add to balance check

* Restore `load_access_list`

* chore: drop c-kzg fork

* test: update tests from Geth

See: <ethereum/go-ethereum#28026>

* chore: revert `is_create` change

* chore: fmt toml

* chore: unnecessary import

* remove unsafe from fake_exponential

* Remove kzg global settings, and move it to CfgEnv

* enable kzg only in std. main README updated

* fmt and clippy

* Update README.md

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* nits and docs

* disable exception eip4844 tests, small refactor

* revert back last commit refactor

---------

Co-authored-by: rakita <dragan0rakita@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Waylon Jepsen <57912727+0xJepsen@users.noreply.github.com>
  • Loading branch information
4 people authored and tonyke-bot committed Sep 19, 2023
1 parent 07b9ab6 commit 70ac321
Show file tree
Hide file tree
Showing 40 changed files with 5,606 additions and 454 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ethereum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:

- name: Run Ethereum tests
run: |
cargo run --profile ${{ matrix.profile }} -p revme -- \
statetest \
ethtests/GeneralStateTests/ \
ethtests/LegacyTests/Constantinople/GeneralStateTests/ \
tests/EIPTests/StateTests/stEIP5656-MCOPY/ \
tests/EIPTests/StateTests/stEIP1153-transientStorage/
cargo run --profile ${{ matrix.profile }} -p revme -- statetest \
ethtests/GeneralStateTests/ \
ethtests/LegacyTests/Constantinople/GeneralStateTests/ \
ethtests/EIPTests/StateTests/stEIP1153-transientStorage/ \
ethtests/EIPTests/StateTests/stEIP4844-blobtransactions/ \
ethtests/EIPTests/StateTests/stEIP5656-MCOPY/
157 changes: 157 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ Here is a list of things that I would like to use as guide in this project:

# Project

structure:
Structure:
* crates
* revm -> main EVM library.
* revm-primitives -> Primitive data types.
* revm-interpreter -> Execution loop with instructions
* revm-precompile -> EVM precompiles
* bins:
* revme: cli binary, used for running state test json
* revm-test: test binaries with contracts, used mostly to check performance
* revme: cli binary, used for running state test jsons

Last checked revm requires rust v1.65 or higher for `core::error::Error`
This project tends to use the newest rust version, so if you're encountering a build error try running `rustup update` first.

There were some big efforts on optimization of revm:
* Optimizing interpreter loop: https://github.com/bluealloy/revm/issues/7
Expand All @@ -40,6 +39,8 @@ run tests with command: `cargo run --release -- statetest tests/GeneralStateTest

## Running benchmarks

TODO needs to be updated. Benches can now be found inside `crates/revm/benches`

```shell
cargo run --package revm-test --release --bin snailtracer
```
Expand All @@ -56,18 +57,23 @@ cargo run -p revm --features ethersdb --example fork_ref_transact

# Used by:

* Foundry: https://github.com/foundry-rs/foundry
* Helios: https://github.com/a16z/helios
* Hardhat (transitioning to it): https://github.com/NomicFoundation/hardhat/tree/rethnet/main
* Reth: https://github.com/paradigmxyz/reth
* Arbiter: https://github.com/primitivefinance/arbiter
* [Foundry](https://github.com/foundry-rs/foundry) is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
* [Helios](https://github.com/a16z/helios) is a fully trustless, efficient, and portable Ethereum light client written in Rust.
* [Reth](https://github.com/paradigmxyz/reth) Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol
* [Arbiter](https://github.com/primitivefinance/arbiter) is a framework for stateful Ethereum smart-contract simulation
* [Zeth](https://github.com/risc0/zeth) is an open-source ZK block prover for Ethereum built on the RISC Zero zkVM.
* ...

(If you want to add your project to the list, ping me or open the PR)
(If you want to add project to the list, ping me or open the PR)


# Documentation

To serve the mdbook documentation, ensure you have mdbook installed (if not install it with cargo) and then run:
The book can be found at github page here: https://bluealloy.github.io/revm/

The documentation (alas needs some love) can be found here: https://bluealloy.github.io/revm/docs/

To serve the mdbook documentation in a local environment, ensure you have mdbook installed (if not install it with cargo) and then run:

```shell
mdbook serve documentation
Expand Down
16 changes: 5 additions & 11 deletions bins/revme/src/cmd.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
use crate::{runner, statetest};
use crate::statetest;
use structopt::{clap::AppSettings, StructOpt};

#[derive(StructOpt, Debug)]
#[structopt(setting = AppSettings::InferSubcommands)]
#[allow(clippy::large_enum_variant)]
pub enum MainCmd {
Statetest(statetest::Cmd),
Run(runner::Cmd),
}

use thiserror::Error as ThisError;

#[derive(Debug, ThisError)]
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Statetest: {0}")]
Statetest(statetest::Error),
#[error("Generic system error")]
SystemError,
#[error(transparent)]
Statetest(#[from] statetest::Error),
}

impl MainCmd {
pub fn run(&self) -> Result<(), Error> {
match self {
Self::Statetest(cmd) => cmd.run().map_err(Error::Statetest),
_ => Ok(()),
Self::Statetest(cmd) => cmd.run().map_err(Into::into),
}
}
}
Loading

0 comments on commit 70ac321

Please sign in to comment.