-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(zk): add large factory deps test
- Loading branch information
Showing
4 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//! Forge tests for zksync factory contracts. | ||
use super::test_zk; | ||
|
||
test_zk!( | ||
#[ignore] //FIXME | ||
can_deploy_large_factory_deps, | ||
".*", | ||
"ZkLargeFactoryDependenciesTest" | ||
); | ||
|
||
foundry_test_utils::forgetest_async!( | ||
#[ignore] //FIXME | ||
script_zk_can_deploy_large_factory_deps, | ||
|prj, cmd| { | ||
foundry_test_utils::util::initialize(prj.root()); | ||
|
||
prj.add_source( | ||
"LargeContracts.sol", | ||
include_str!("../../../../../testdata/zk/LargeContracts.sol"), | ||
) | ||
.unwrap(); | ||
prj.add_script( | ||
"LargeContracts.s.sol", | ||
r#" | ||
import "forge-std/Script.sol"; | ||
import "../src/LargeContracts.sol"; | ||
contract ZkLargeFactoryDependenciesScript is Script { | ||
function run() external { | ||
vm.broadcast(); | ||
new LargeContract(); | ||
} | ||
} | ||
"#, | ||
) | ||
.unwrap(); | ||
|
||
let node = foundry_test_utils::ZkSyncNode::start(); | ||
|
||
cmd.arg("script").args([ | ||
"--zk-startup", | ||
"./script/LargeContracts.s.sol", | ||
"--broadcast", | ||
"--private-key", | ||
"0x3d3cbc973389cb26f657686445bcc75662b415b656078503592ac8c1abb8810e", | ||
"--chain", | ||
"260", | ||
"--gas-estimate-multiplier", | ||
"310", | ||
"--rpc-url", | ||
node.url().as_str(), | ||
"--slow", | ||
"--evm-version", | ||
"shanghai", | ||
]); | ||
assert!(cmd.stdout_lossy().contains("ONCHAIN EXECUTION COMPLETE & SUCCESSFUL")); | ||
|
||
let run_latest = foundry_common::fs::json_files(prj.root().join("broadcast").as_path()) | ||
.find(|file| file.ends_with("run-latest.json")) | ||
.expect("No broadcast artifacts"); | ||
|
||
let content = foundry_common::fs::read_to_string(run_latest).unwrap(); | ||
|
||
let json: serde_json::Value = serde_json::from_str(&content).unwrap(); | ||
assert_eq!(json["transactions"].as_array().expect("broadcastable txs").len(), 1); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ mod basic; | |
mod cheats; | ||
mod contracts; | ||
mod factory; | ||
mod factory_deps; | ||
mod fuzz; | ||
mod logs; | ||
mod repros; | ||
|
Oops, something went wrong.