diff --git a/Cargo.lock b/Cargo.lock index c5e0b3d..0494ecd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -235,9 +235,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.6" +version = "4.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" +checksum = "2f3061d6db6d8fcbbd4b05e057f2acace52e64e96b498c08c2d7a4e65addd340" dependencies = [ "bitflags", "clap_derive", @@ -250,9 +250,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "34d122164198950ba84a918270a3bb3f7ededd25e15f7451673d986f55bd2667" dependencies = [ "heck", "proc-macro-error", @@ -263,9 +263,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" dependencies = [ "os_str_bytes", ] @@ -1035,9 +1035,9 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", @@ -1232,15 +1232,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom8" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" -dependencies = [ - "memchr", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1485,9 +1476,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "plonky2" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf672134f7f79739b0511f5abcfd110add584f2658d70be0cfb39ef0957d0a1" +checksum = "d2a3d3069fc716f2733c4bafeaf57c256e507f0a599fc206f41ef273568ca2b7" dependencies = [ "ahash", "anyhow", @@ -1509,7 +1500,6 @@ dependencies = [ [[package]] name = "plonky2_evm" version = "0.1.0" -source = "git+https://github.com/mir-protocol/plonky2.git?rev=6f2d99c7bce0728aff0374cf6bddff6c08b409ba#6f2d99c7bce0728aff0374cf6bddff6c08b409ba" dependencies = [ "anyhow", "blake2", @@ -1605,9 +1595,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", "toml_edit", @@ -1974,9 +1964,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2034,9 +2024,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ "itoa", "serde", @@ -2052,9 +2042,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a460aeb8de6dcb0f381e1ee05f1cd56fcf5a5f6eb8187ff3d8f0b11078d38b7c" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" dependencies = [ "time-core", ] @@ -2121,19 +2111,19 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" [[package]] name = "toml_edit" -version = "0.18.1" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" dependencies = [ "indexmap", - "nom8", "toml_datetime", + "winnow", ] [[package]] @@ -2369,6 +2359,15 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +[[package]] +name = "winnow" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" +dependencies = [ + "memchr", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/common/Cargo.toml b/common/Cargo.toml index 829b2fa..193af13 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -11,5 +11,6 @@ edition = "2021" ethereum-types = "0.14.0" eth_trie_utils = "0.4.1" flexi_logger = { version = "0.25.1", features = ["async"] } -plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "6f2d99c7bce0728aff0374cf6bddff6c08b409ba" } +#plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "6f2d99c7bce0728aff0374cf6bddff6c08b409ba" } +plonky2_evm = { path = "../../plonky2/evm" } serde = {version = "1.0.147", features = ["derive"] } diff --git a/eth_test_parser/Cargo.toml b/eth_test_parser/Cargo.toml index f2e5211..828f9a6 100644 --- a/eth_test_parser/Cargo.toml +++ b/eth_test_parser/Cargo.toml @@ -10,7 +10,8 @@ edition = "2021" [dependencies] common = { path = "../common" } eth_trie_utils = "0.4.1" -plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "6f2d99c7bce0728aff0374cf6bddff6c08b409ba" } +#plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "6f2d99c7bce0728aff0374cf6bddff6c08b409ba" } +plonky2_evm = { path = "../../plonky2/evm" } anyhow = { version = "1.0.66", features = ["backtrace"] } clap = {version = "4.0.19", features = ["derive"] } diff --git a/eth_test_parser/src/main.rs b/eth_test_parser/src/main.rs index a7e9971..af6d0c0 100644 --- a/eth_test_parser/src/main.rs +++ b/eth_test_parser/src/main.rs @@ -46,11 +46,14 @@ 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_body)) => Some(tokio::task::spawn_blocking(move || { + // TODO: For now if there are multiple txn variants, we're just going to pick + // the first one. Later we will switch to processing all txns in the test. + let state_trie_hash = test_body.post.merge[0].hash; ( test_dir_entry, serde_cbor::to_vec(&ParsedTest { plonky2_inputs: test_body.into_generation_inputs(), - expected_final_account_states: None, + expected_final_account_states: Some(state_trie_hash), }) .unwrap(), ) diff --git a/evm_test_runner/Cargo.toml b/evm_test_runner/Cargo.toml index ff75636..2d3f90f 100644 --- a/evm_test_runner/Cargo.toml +++ b/evm_test_runner/Cargo.toml @@ -9,8 +9,9 @@ edition = "2021" [dependencies] common = { path = "../common" } -plonky2 = { version = "0.1.1", features = ["timing"] } -plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "6f2d99c7bce0728aff0374cf6bddff6c08b409ba" } +plonky2 = { version = "0.1.3", features = ["timing"] } +#plonky2_evm = { git = "https://github.com/mir-protocol/plonky2.git", rev = "6f2d99c7bce0728aff0374cf6bddff6c08b409ba" } +plonky2_evm = { path = "../../plonky2/evm" } anyhow = { version = "1.0", features = ["backtrace"] } askama = "0.11.1" diff --git a/evm_test_runner/src/plonky2_runner.rs b/evm_test_runner/src/plonky2_runner.rs index 29ce960..82611ff 100644 --- a/evm_test_runner/src/plonky2_runner.rs +++ b/evm_test_runner/src/plonky2_runner.rs @@ -124,22 +124,22 @@ pub(crate) fn run_plonky2_tests(parsed_tests: Vec) -> Vec TestRunResult { /// Run a test against `plonky2` and output a result based on what happens. fn run_test_and_get_test_result(test: ParsedTest) -> TestStatus { - let proof_run_res = panic::catch_unwind(|| { + let proof_run_res: Result<_, anyhow::Error> = Ok({ let timing = TimingTree::new("prove", log::Level::Debug); let res = prove::( @@ -197,26 +197,42 @@ fn run_test_and_get_test_result(test: ParsedTest) -> TestStatus { timing.filter(Duration::from_millis(100)).print(); res }); + //let proof_run_res = panic::catch_unwind(|| { + // let timing = TimingTree::new("prove", log::Level::Debug); + + // let res = prove::( + // &AllStark::default(), + // &StarkConfig::standard_fast_config(), + // test.plonky2_inputs, + // &mut TimingTree::default(), + // ); + + // timing.filter(Duration::from_millis(100)).print(); + // res + //}); let proof_run_output = match proof_run_res { Ok(Ok(res)) => res, Ok(Err(err)) => return TestStatus::EvmErr(err.to_string()), Err(err) => { - let panic_str = match err.downcast::() { - Ok(panic_str) => *panic_str, - Err(_) => "Unknown panic reason.".to_string(), - }; + panic!("oops"); + //let panic_str = match err.downcast::() { + // Ok(panic_str) => *panic_str, + // Err(_) => "Unknown panic reason.".to_string(), + //}; - let panic_backtrace = BACKTRACE.with(|b| b.borrow_mut().take()).unwrap(); - let panic_with_backtrace_str = - format!("panic: {}\nBacktrace: {:?}", panic_str, panic_backtrace); + //let panic_backtrace = BACKTRACE.with(|b| b.borrow_mut().take()).unwrap(); + //let panic_with_backtrace_str = + // format!("panic: {}\nBacktrace: {:?}", panic_str, panic_backtrace); - return TestStatus::EvmPanic(panic_with_backtrace_str); + //return TestStatus::EvmPanic(panic_with_backtrace_str); } }; let actual_state_trie_hash = proof_run_output.public_values.trie_roots_after.state_root; + log::info!("Expected {:?}", &test.expected_final_account_states); + log::info!("Actual {:?}", &actual_state_trie_hash); if let Some(expected_state_trie_hash) = test.expected_final_account_states && actual_state_trie_hash != expected_state_trie_hash { let trie_diff = TrieFinalStateDiff { state: TrieComparisonResult::Difference(actual_state_trie_hash, expected_state_trie_hash),