From c69b91b96cb7332ecc0d20cdcb501589570cbe74 Mon Sep 17 00:00:00 2001 From: elfedy Date: Thu, 8 Aug 2024 14:35:09 -0300 Subject: [PATCH] test: add zk fust tests --- crates/forge/tests/it/zk/fuzz.rs | 13 +++++++++++++ crates/forge/tests/it/zk/mod.rs | 1 + testdata/zk/Fuzz.t.sol | 10 ++++++++++ 3 files changed, 24 insertions(+) create mode 100644 crates/forge/tests/it/zk/fuzz.rs create mode 100644 testdata/zk/Fuzz.t.sol diff --git a/crates/forge/tests/it/zk/fuzz.rs b/crates/forge/tests/it/zk/fuzz.rs new file mode 100644 index 000000000..e75dcb9ff --- /dev/null +++ b/crates/forge/tests/it/zk/fuzz.rs @@ -0,0 +1,13 @@ +//! Fuzz tests. + +use crate::{config::*, test_helpers::TEST_DATA_DEFAULT}; +use forge::revm::primitives::SpecId; +use foundry_test_utils::Filter; + +#[tokio::test(flavor = "multi_thread")] +async fn test_zk_fuzz_avoid_system_addresses() { + let runner = TEST_DATA_DEFAULT.runner_zksync(); + let filter = Filter::new("testZkFuzzAvoidSystemAddresses", "ZkFuzzTest", ".*"); + + TestConfig::with_filter(runner, filter).evm_spec(SpecId::SHANGHAI).run().await; +} diff --git a/crates/forge/tests/it/zk/mod.rs b/crates/forge/tests/it/zk/mod.rs index 6ee05dc63..117e853fe 100644 --- a/crates/forge/tests/it/zk/mod.rs +++ b/crates/forge/tests/it/zk/mod.rs @@ -2,5 +2,6 @@ mod basic; mod cheats; mod contracts; +mod fuzz; mod issues; mod logs; diff --git a/testdata/zk/Fuzz.t.sol b/testdata/zk/Fuzz.t.sol new file mode 100644 index 000000000..2242d5b07 --- /dev/null +++ b/testdata/zk/Fuzz.t.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import "ds-test/test.sol"; + +contract ZkFuzzTest is DSTest { + function testZkFuzzAvoidSystemAddresses(address addr) public pure { + assert(addr > address(65535)); + } +}