Skip to content

Commit

Permalink
feat(executor): New static test harness (#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby authored Jan 22, 2025
1 parent f4d4e23 commit a59f643
Show file tree
Hide file tree
Showing 84 changed files with 6,361 additions and 5 deletions.
50 changes: 50 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ lto = "fat"

[workspace.dependencies]
# Workspace
kona-mpt = { path = "crates/mpt", version = "0.1.2", default-features = false }
kona-host = { path = "bin/host", version = "0.1.0", default-features = false }
kona-client = { path = "bin/client", version = "0.1.0", default-features = false }
kona-mpt = { path = "crates/mpt", version = "0.1.2", default-features = false }
kona-derive = { path = "crates/derive", version = "0.2.3", default-features = false }
kona-driver = { path = "crates/driver", version = "0.2.3", default-features = false }
kona-executor = { path = "crates/executor", version = "0.2.3", default-features = false }
Expand Down Expand Up @@ -113,6 +114,7 @@ cfg-if = "1.0.0"
reqwest = "0.12.12"
async-trait = "0.1.85"
linked_list_allocator = "0.10.5"
rstest = "0.24.0"

# General
sha2 = { version = "0.10.8", default-features = false }
Expand Down
12 changes: 8 additions & 4 deletions crates/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ alloy-rpc-types-engine.workspace = true
serde = { workspace = true, features = ["derive"] }
criterion = { workspace = true, features = ["html_reports"] }
pprof = { workspace = true, features = ["criterion", "flamegraph", "frame-pointer"] }

[[bench]]
name = "execution"
harness = false
tokio = { workspace = true, features = ["full"] }
rstest.workspace = true
maili-registry.workspace = true
alloy-provider = { workspace = true, features = ["reqwest"] }
alloy-rpc-client.workspace = true
alloy-transport.workspace = true
alloy-transport-http.workspace = true
kona-host.workspace = true
35 changes: 35 additions & 0 deletions crates/executor/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,38 @@ where
ordered_trie_with_encoder(transactions, |tx, buf| buf.put_slice(tx.as_ref())).root()
}
}

#[cfg(test)]
mod test {
use crate::test_utils::run_test_fixture;
use rstest::rstest;
use std::path::PathBuf;

// To create new test fixtures, uncomment the following test and run it with parameters filled.
//
// #[tokio::test(flavor = "multi_thread")]
// async fn create_fixture() {
// let fixture_creator = crate::test_utils::ExecutorTestFixtureCreator::new(
// "<l2_archive_el_rpc_url>",
// <block_number>,
// PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata"),
// );
// fixture_creator.create_static_fixture().await;
// }

#[rstest]
#[case::small_block(22884230)]
#[case::small_block_2(22880574)]
#[case::small_block_3(22887258)]
#[case::medium_block(22886464)]
#[case::medium_block_2(22886311)]
#[case::medium_block_3(22880944)]
#[tokio::test]
async fn test_statelessly_execute_block(#[case] block_number: u64) {
let fixture_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("testdata")
.join(format!("block-{block_number}"));

run_test_fixture(fixture_dir).await;
}
}
3 changes: 3 additions & 0 deletions crates/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ pub use db::{NoopTrieDBProvider, TrieAccount, TrieDB, TrieDBProvider};

mod constants;
mod syscalls;

#[cfg(test)]
mod test_utils;
Loading

0 comments on commit a59f643

Please sign in to comment.