Skip to content

Commit

Permalink
Remove revm variants
Browse files Browse the repository at this point in the history
Not needed anymore
  • Loading branch information
Nashtare committed Sep 28, 2023
1 parent 9bb9281 commit 7887a60
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 809 deletions.
411 changes: 0 additions & 411 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ eth_trie_utils = { git = "https://github.com/mir-protocol/eth_trie_utils.git", r
flexi_logger = { version = "0.25.4", features = ["async"] }
plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "1ff6d4a2839a0cd16598a5db263568885a47e7c9" }
serde = {version = "1.0.163", features = ["derive"] }
revm = { version = "3.3.0", features = ["serde"] }
ruint = { version = "1.8.0", features = ["primitive-types"] }
1 change: 0 additions & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod config;
pub mod revm;
pub mod types;
pub mod utils;
135 changes: 0 additions & 135 deletions common/src/revm/cache_db.rs

This file was deleted.

40 changes: 0 additions & 40 deletions common/src/revm/mod.rs

This file was deleted.

20 changes: 1 addition & 19 deletions common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ use plonky2_evm::{
};
use serde::{Deserialize, Serialize};

use crate::revm::SerializableEVMInstance;

#[derive(Debug, Deserialize, Serialize)]
pub struct ParsedTestManifest {
pub plonky2_variants: Vec<Plonky2ParsedTest>,
pub revm_variants: Option<Vec<SerializableEVMInstance>>,
}

pub struct FilteredVariantsOutput {
Expand All @@ -31,31 +28,18 @@ impl ParsedTestManifest {
self,
v_filter: Option<VariantFilterType>,
) -> FilteredVariantsOutput {
// If `self.revm_variants` is None, the parser was unable to generate an `revm`
// instance for any test variant. This occurs when some shared test data was
// unable to be parsed (e.g. the `transaction` section). In this case, we
// generate a `None` for each test variant slot so that it can be zipped with
// plonky2 variants.
let revm_variants: Vec<Option<SerializableEVMInstance>> = match self.revm_variants {
// `revm_variants` will be parallel to `plonky2_variants`, given they are both
// generated from the same vec (`test.post.merge`).
None => (0..self.plonky2_variants.len()).map(|_| None).collect(),
Some(v) => v.into_iter().map(Some).collect(),
};

let tot_variants_without_filter = self.plonky2_variants.len();

let variants = self
.plonky2_variants
.into_iter()
.zip(revm_variants.into_iter())
.enumerate()
.filter(|(variant_idx, _)| match &v_filter {
Some(VariantFilterType::Single(v)) => variant_idx == v,
Some(VariantFilterType::Range(r)) => r.contains(variant_idx),
None => true,
})
.map(|(variant_idx, (t_var, revm_variant))| {
.map(|(variant_idx, t_var)| {
let trie_roots_after = TrieRoots {
state_root: t_var.final_roots.state_root_hash,
transactions_root: t_var.final_roots.txn_trie_root_hash,
Expand All @@ -80,7 +64,6 @@ impl ParsedTestManifest {
TestVariantRunInfo {
gen_inputs,
final_roots: t_var.final_roots,
revm_variant,
variant_idx,
}
})
Expand Down Expand Up @@ -109,7 +92,6 @@ pub struct Plonky2ParsedTest {
pub struct TestVariantRunInfo {
pub gen_inputs: GenerationInputs,
pub final_roots: ExpectedFinalRoots,
pub revm_variant: Option<SerializableEVMInstance>,
pub variant_idx: usize,
}

Expand Down
2 changes: 0 additions & 2 deletions eth_test_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ serde_with = "3.0.0"
serde_cbor = "0.11.2"
tokio = { version = "1.28.1", features = ["full"] }
futures = "0.3.28"
revm = { version = "3.3.0", features = ["serde"] }
ruint = { version = "1.8.0", features = ["primitive-types"] }
27 changes: 4 additions & 23 deletions eth_test_parser/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mod config;
mod deserialize;
mod eth_tests_fetching;
mod fs_scaffolding;
mod revm_builder;
mod trie_builder;
mod utils;

Expand Down Expand Up @@ -46,29 +45,11 @@ async fn run(ProgArgs { no_fetch, out_path }: ProgArgs) -> anyhow::Result<()> {
let generation_input_handles = get_deserialized_test_bodies()?.filter_map(|res| {
match res {
Ok((test_dir_entry, test_bodies)) => Some(tokio::task::spawn_blocking(move || {
let mut plonky2_variants = Vec::with_capacity(test_bodies.len());
let mut revm_variants = Vec::with_capacity(test_bodies.len());
for test_body in test_bodies.iter() {
let plonky2_variant = test_body.as_plonky2_test_inputs();
let revm_variant = match test_body.as_serializable_evm_instance() {
Ok(revm_variant) => Some(revm_variant),
Err(err) => {
warn!(
"Unable to generate evm instance for test {} due to error: {}. Skipping!",
test_dir_entry.path().display(),
err
);
None
}
};

plonky2_variants.push(plonky2_variant);
revm_variants.push(revm_variant);
}

let test_manifest = ParsedTestManifest {
plonky2_variants,
revm_variants: revm_variants.into_iter().collect(),
plonky2_variants: test_bodies
.iter()
.map(|t| t.as_plonky2_test_inputs())
.collect(),
};

(test_dir_entry, serde_cbor::to_vec(&test_manifest).unwrap())
Expand Down
43 changes: 0 additions & 43 deletions eth_test_parser/src/revm_builder/cache_db.rs

This file was deleted.

Loading

0 comments on commit 7887a60

Please sign in to comment.