Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"evm",
"evm-tests"
]
exclude = ["zk-evm"]

[workspace.package]
authors = ["Aurora Labs <hello@aurora.dev>"]
Expand Down
2 changes: 1 addition & 1 deletion evm-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aurora-engine-precompiles = "2.1.0"
aurora-evm.workspace = true
bytecount = "0.6"
clap = { version = "4.5", features = ["cargo"] }
c-kzg = "1.0"
#c-kzg = { version = "1.0", default-features = false, features = ["generate-bindings", "portable", "serde"] }
derive_more = { version = "2", features = ["full"] }
ethereum = "0.18"
hex = "0.4"
Expand Down
2 changes: 2 additions & 0 deletions evm-tests/src/assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ pub fn assert_vicinity_validation(

/// Check Exit Reason of EVM execution
#[allow(clippy::too_many_lines)]
#[must_use]
pub fn check_validate_exit_reason(
reason: &InvalidTxReason,
expect_exception: Option<&String>,
Expand Down Expand Up @@ -361,6 +362,7 @@ pub fn assert_call_exit_exception(expect_exception: Option<&String>, name: &str)
}

/// Check Exit Reason of EVM execution
#[must_use]
pub fn check_create_exit_reason(
reason: &ExitReason,
expect_exception: Option<&String>,
Expand Down
5 changes: 5 additions & 0 deletions evm-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#![allow(clippy::too_long_first_doc_paragraph, clippy::missing_panics_doc)]
pub mod assertions;
pub mod config;
pub mod precompiles;
pub mod types;
16 changes: 11 additions & 5 deletions evm-tests/src/precompiles.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod kzg;
// mod kzg;

use crate::precompiles::kzg::Kzg;
// use crate::precompiles::kzg::Kzg;
use crate::types::Spec;
use aurora_engine_precompiles::modexp::AuroraModExp;
use aurora_engine_precompiles::{
Expand Down Expand Up @@ -40,6 +40,7 @@ impl PrecompileSet for Precompiles {
}

impl Precompiles {
#[must_use]
pub fn new(spec: &Spec) -> Self {
match *spec {
Spec::Frontier
Expand All @@ -57,6 +58,7 @@ impl Precompiles {
}
}

#[must_use]
pub fn new_istanbul() -> Self {
let mut map = BTreeMap::new();
map.insert(
Expand Down Expand Up @@ -86,6 +88,7 @@ impl Precompiles {
Self(map)
}

#[must_use]
pub fn new_berlin() -> Self {
let mut map = BTreeMap::new();
map.insert(
Expand Down Expand Up @@ -115,12 +118,14 @@ impl Precompiles {
Self(map)
}

#[must_use]
pub fn new_cancun() -> Self {
let mut map = Self::new_berlin().0;
map.insert(Kzg::ADDRESS, Box::new(Kzg));
let map = Self::new_berlin().0;
// map.insert(Kzg::ADDRESS, Box::new(Kzg));
Self(map)
}

#[must_use]
pub fn new_prague() -> Self {
let mut map = Self::new_cancun().0;
map.insert(BlsG1Add::ADDRESS.raw(), Box::new(BlsG1Add));
Expand All @@ -133,6 +138,7 @@ impl Precompiles {
Self(map)
}

#[must_use]
pub fn new_osaka() -> Self {
let mut map = BTreeMap::new();
map.insert(
Expand Down Expand Up @@ -160,7 +166,7 @@ impl Precompiles {
);
map.insert(Blake2F::ADDRESS.raw(), Box::new(Blake2F));

map.insert(Kzg::ADDRESS, Box::new(Kzg));
// map.insert(Kzg::ADDRESS, Box::new(Kzg));
map.insert(BlsG1Add::ADDRESS.raw(), Box::new(BlsG1Add));
map.insert(BlsG1Msm::ADDRESS.raw(), Box::new(BlsG1Msm));
map.insert(BlsG2Add::ADDRESS.raw(), Box::new(BlsG2Add));
Expand Down
4 changes: 2 additions & 2 deletions evm-tests/src/types/account_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ impl From<StateAccount> for MemoryAccount {
/// corresponding state (`StateAccount`).
/// It uses a `BTreeMap` to ensure a consistent order for serialization.
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Clone)]
pub struct AccountsState(BTreeMap<H160, StateAccount>);
pub struct AccountsState(pub BTreeMap<H160, StateAccount>);

impl AccountsState {
/// Converts the `AccountsState` into a `BTreeMap` of `H160` addresses to `MemoryAccount`.
/// Converts the `AccountsState` into a `BTreeMap` of `H160` addresses to `MemoryAccount`.
#[must_use]
pub fn to_memory_accounts_state(&self) -> MemoryAccountsState {
MemoryAccountsState(
Expand Down
4 changes: 2 additions & 2 deletions evm-tests/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod blob;
pub mod eip_4844;
pub mod eip_7623;
pub mod eip_7702;
mod info;
pub mod info;
mod json_utils;
pub mod spec;
pub mod transaction;
Expand Down Expand Up @@ -208,7 +208,7 @@ impl From<StateEnv> for MemoryVicinity {
/// corresponding state (`StateAccount`).
/// Represents vis `AccountsState`.
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Clone, Deserialize)]
pub struct PreState(AccountsState);
pub struct PreState(pub AccountsState);

impl AsRef<AccountsState> for PreState {
fn as_ref(&self) -> &AccountsState {
Expand Down
2 changes: 1 addition & 1 deletion evm-tests/src/types/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Spec {
}

#[must_use]
pub(crate) const fn get_gasometer_config(&self) -> Option<Config> {
pub const fn get_gasometer_config(&self) -> Option<Config> {
match self {
Self::Istanbul => Some(Config::istanbul()),
Self::Berlin => Some(Config::berlin()),
Expand Down
2 changes: 1 addition & 1 deletion evm/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Runtime {
pub fn run<H: Handler + InterpreterHandler>(
&mut self,
handler: &mut H,
) -> Capture<ExitReason, Resolve<H>> {
) -> Capture<ExitReason, Resolve<'_, H>> {
loop {
let result = self.machine.step(handler, &self.context.address);
match result {
Expand Down
4 changes: 4 additions & 0 deletions zk-evm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
Cargo.lock
methods/guest/Cargo.lock
target/
13 changes: 13 additions & 0 deletions zk-evm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "aurora-zk-evm"
version = "0.1.0"
edition = "2021"

[dependencies]
aurora-evm-jsontests = { path = "../evm-tests" }
clap = { version = "4.5", features = ["cargo"] }
methods = { path = "methods" }
risc0-zkvm = { version = "^3.0.4" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
serde = "1.0"
serde_json = "1.0"
3 changes: 3 additions & 0 deletions zk-evm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
run:
@cargo run --release -- ../../../ethereum/fixtures_static-v4.5.0/fixtures/state_tests/static/state_tests/stStaticCall/static_log_Caller.json
# @cargo run --release -- ../../../ethereum/ethtests-17.0/GeneralStateTests/stInitCodeTest/StackUnderFlowContractCreation.json
10 changes: 10 additions & 0 deletions zk-evm/methods/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "methods"
version = "0.1.0"
edition = "2021"

[build-dependencies]
risc0-build = { version = "^3.0.4" }

[package.metadata.risc0]
methods = ["guest"]
3 changes: 3 additions & 0 deletions zk-evm/methods/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
risc0_build::embed_methods();
}
13 changes: 13 additions & 0 deletions zk-evm/methods/guest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "zk_evm"
version = "0.1.0"
edition = "2021"

[workspace]

[dependencies]
aurora-evm = { path = "../../../evm" }
aurora-evm-jsontests = { path = "../../../evm-tests" }
risc0-zkvm = { version = "^3.0.4", default-features = false, features = ['std'] }
serde_json = "1"
serde = { version = "1.0.228", features = ["derive"] }
Loading
Loading