diff --git a/crates/forge/tests/it/zk/fork.rs b/crates/forge/tests/it/zk/fork.rs new file mode 100644 index 000000000..5fed33832 --- /dev/null +++ b/crates/forge/tests/it/zk/fork.rs @@ -0,0 +1,14 @@ +//! Fork 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_setup_fork_failure() { + let runner = TEST_DATA_DEFAULT.runner_zksync(); + let filter = + Filter::new("testFail_ZkSetupForkFailureExecutesTest", "ZkSetupForkFailureTest", ".*"); + + 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 8ae4641f2..82ba6829a 100644 --- a/crates/forge/tests/it/zk/mod.rs +++ b/crates/forge/tests/it/zk/mod.rs @@ -3,6 +3,7 @@ mod basic; mod cheats; mod contracts; mod factory; +mod fork; mod fuzz; mod invariant; mod logs; diff --git a/testdata/zk/SetupForkFailure.t.sol b/testdata/zk/SetupForkFailure.t.sol new file mode 100644 index 000000000..6bff31afd --- /dev/null +++ b/testdata/zk/SetupForkFailure.t.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import "ds-test/test.sol"; +import "../cheats/Vm.sol"; + +contract ZkSetupForkFailureTest is DSTest { + Vm constant vm = Vm(HEVM_ADDRESS); + uint256 constant ETH_FORK_BLOCK = 18993187; + + function setUp() public { + vm.createSelectFork("https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf", ETH_FORK_BLOCK); // trufflehog:ignore + } + + // We test that the following function is called after EVM fork from zk context + function testFail_ZkSetupForkFailureExecutesTest() public pure { + assert(false); + } +}