From 94543434b401513e383dc34bf34bf196f3a48c03 Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Fri, 14 Jun 2024 14:33:02 -0400 Subject: [PATCH 1/4] Fix Shanghai tests parsing --- common/src/config.rs | 2 +- eth_test_parser/src/config.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/config.rs b/common/src/config.rs index 9a66b2e..ca7bf4a 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -1,4 +1,4 @@ pub const GENERATION_INPUTS_DEFAULT_OUTPUT_DIR: &str = "generation_inputs"; -pub const MAIN_TEST_DIR: &str = "BlockchainTests"; +pub const MAIN_TEST_DIR: &str = "Cancun/BlockchainTests"; pub const MATIC_CHAIN_ID: u64 = 137; pub const ETHEREUM_CHAIN_ID: u64 = 1; diff --git a/eth_test_parser/src/config.rs b/eth_test_parser/src/config.rs index ea383ac..850cc15 100644 --- a/eth_test_parser/src/config.rs +++ b/eth_test_parser/src/config.rs @@ -1,6 +1,10 @@ -pub(crate) const ETH_TESTS_REPO_URL: &str = "https://github.com/ethereum/tests.git"; +use common::config::MAIN_TEST_DIR; + +// The PR moved all test versions prior Cancun HF +// to the `LegacyTests` folder instead. +pub(crate) const ETH_TESTS_REPO_URL: &str = "https://github.com/ethereum/legacytests.git"; pub(crate) const ETH_TESTS_REPO_LOCAL_PATH: &str = "eth_tests"; -pub(crate) const GENERAL_GROUP: &str = "BlockchainTests"; +pub(crate) const GENERAL_GROUP: &str = MAIN_TEST_DIR; pub(crate) const TEST_GROUPS: [&str; 1] = ["GeneralStateTests"]; // The following subgroups contain subfolders unlike the other test folders. -pub(crate) const SPECIAL_TEST_SUBGROUPS: [&str; 3] = ["Cancun", "Shanghai", "VMTests"]; +pub(crate) const SPECIAL_TEST_SUBGROUPS: [&str; 2] = ["Shanghai", "VMTests"]; From 0d3bb4b4b2f78ab3952f03ea0591188420b6f679 Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Sat, 15 Jun 2024 19:05:53 -0400 Subject: [PATCH 2/4] Blacklist unprovable transactions that go beyong 2^32 CPU cycles --- eth_test_parser/src/config.rs | 24 ++++++++++++++++++++++++ eth_test_parser/src/deserialize.rs | 6 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/eth_test_parser/src/config.rs b/eth_test_parser/src/config.rs index 850cc15..7ebbd12 100644 --- a/eth_test_parser/src/config.rs +++ b/eth_test_parser/src/config.rs @@ -8,3 +8,27 @@ pub(crate) const GENERAL_GROUP: &str = MAIN_TEST_DIR; pub(crate) const TEST_GROUPS: [&str; 1] = ["GeneralStateTests"]; // The following subgroups contain subfolders unlike the other test folders. pub(crate) const SPECIAL_TEST_SUBGROUPS: [&str; 2] = ["Shanghai", "VMTests"]; + +/// These test variants are used for stress testing. As such, they have +/// unrealistic scenarios that go beyond the provable bounds of the zkEVM. +/// Witness generation for these variants is still possible, but takes too +/// much time to be useful and usable in testing occuring regularly. +pub(crate) const UNPROVABLE_VARIANTS: [&str; 17] = [ + "CALLBlake2f_d9g0v0_Shanghai", + "CALLCODEBlake2f_d9g0v0_Shanghai", + "Call50000_d0g1v0_Shanghai", + "Callcode50000_d0g1v0_Shanghai", + "static_Call50000_d1g0v0_Shanghai", + "static_Call50000_ecrec_d0g0v0_Shanghai", + "static_Call50000_ecrec_d1g0v0_Shanghai", + "static_Call50000_identity2_d0g0v0_Shanghai", + "static_Call50000_identity2_d1g0v0_Shanghai", + "static_Call50000_identity_d0g0v0_Shanghai", + "static_Call50000_identity_d1g0v0_Shanghai", + "static_Call50000_rip160_d0g0v0_Shanghai", + "static_Call50000_sha256_d0g0v0_Shanghai", + "static_Call50000_sha256_d1g0v0_Shanghai", + "static_Return50000_2_d0g0v0_Shanghai", + "Return50000_d0g1v0_Shanghai", + "Return50000_2_d0g1v0_Shanghai", +]; diff --git a/eth_test_parser/src/deserialize.rs b/eth_test_parser/src/deserialize.rs index c3984ae..fc5e0a1 100644 --- a/eth_test_parser/src/deserialize.rs +++ b/eth_test_parser/src/deserialize.rs @@ -16,6 +16,8 @@ use serde::{ }; use serde_with::serde_as; +use crate::config::UNPROVABLE_VARIANTS; + #[derive(Deserialize, Debug, Clone)] // "self" just points to this module. pub(crate) struct ByteString(#[serde(with = "self")] pub(crate) Vec); @@ -339,7 +341,9 @@ impl<'de> Deserialize<'de> for TestFile { // While we are parsing many values, we only care about the ones containing // `Shanghai` in their key name. while let Some((key, value)) = access.next_entry::()? { - if key.contains("Shanghai") { + if key.contains("Shanghai") + && !UNPROVABLE_VARIANTS.iter().any(|v| key.contains(v)) + { if value.blocks[0].transaction_sequence.is_none() { let test_body = TestBody::from_parsed_json(&value, key.clone()); From 9549ce6e564b9082ba90b28a46134f02195940ca Mon Sep 17 00:00:00 2001 From: Robin Salen <30937548+Nashtare@users.noreply.github.com> Date: Tue, 18 Jun 2024 23:33:44 +0900 Subject: [PATCH 3/4] Apply suggestion Co-authored-by: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com> --- eth_test_parser/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth_test_parser/src/config.rs b/eth_test_parser/src/config.rs index 7ebbd12..f471392 100644 --- a/eth_test_parser/src/config.rs +++ b/eth_test_parser/src/config.rs @@ -1,7 +1,7 @@ use common::config::MAIN_TEST_DIR; // The PR moved all test versions prior Cancun HF -// to the `LegacyTests` folder instead. +// to the `LegacyTests` folder. pub(crate) const ETH_TESTS_REPO_URL: &str = "https://github.com/ethereum/legacytests.git"; pub(crate) const ETH_TESTS_REPO_LOCAL_PATH: &str = "eth_tests"; pub(crate) const GENERAL_GROUP: &str = MAIN_TEST_DIR; From b7c69b7a1450a6fa716c9273b810dea3f5a2d66c Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Tue, 18 Jun 2024 15:41:20 -0400 Subject: [PATCH 4/4] Add comment --- common/src/config.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/config.rs b/common/src/config.rs index ca7bf4a..2962d58 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -1,4 +1,7 @@ pub const GENERATION_INPUTS_DEFAULT_OUTPUT_DIR: &str = "generation_inputs"; +/// The source directory to look for tests to parse. +/// We use the `BlockchainTests` subdirectory of the `Cancun` folder +/// as it contains all hardfork variants up to this one. pub const MAIN_TEST_DIR: &str = "Cancun/BlockchainTests"; pub const MATIC_CHAIN_ID: u64 = 137; pub const ETHEREUM_CHAIN_ID: u64 = 1;