|
1 | | -use foundry_test_utils::{forgetest_async, util, TestProject}; |
2 | | - |
3 | 1 | use crate::test_helpers::{deploy_zk_contract, run_zk_script_test}; |
| 2 | +use foundry_test_utils::{forgetest_async, util, TestProject}; |
4 | 3 |
|
5 | 4 | // TODO(zk): add test that actually does the deployment |
6 | 5 | // of the unlinked contract via script, once recursive linking is supported |
@@ -53,3 +52,49 @@ fn setup_libs_prj(prj: &mut TestProject) { |
53 | 52 | ) |
54 | 53 | .unwrap(); |
55 | 54 | } |
| 55 | + |
| 56 | +// test that checks that you have to recompile the project if the zksolc version changes (the |
| 57 | +// cache is invalidated) |
| 58 | +// step 1, create a config with a specific zksolc version i.e 1.5.6 |
| 59 | +// step 2, create a project with the config |
| 60 | +// compile the project |
| 61 | +// check that output contains the zksolc version 1.5.6 |
| 62 | +// step 3, create a new config with a different zksolc version i.e 1.5.7 |
| 63 | +// step 4, create a project with the new config |
| 64 | +// compile the project |
| 65 | +// check that output contains the zksolc version 1.5.7 (demonstrating that the cache was |
| 66 | +// invalidated, and the project was recompiled) compile the project again, |
| 67 | +// check the output once more it should say that the cache is ok |
| 68 | +// forgetest_async!( |
| 69 | +// zksync_project_has_zksync_solc_when_solc_req_is_a_version_and_zksolc_version_changes, |
| 70 | +// |prj, cmd| { |
| 71 | +// let mut zk_config = ForgeTestProfile::Default.zk_config(); |
| 72 | + |
| 73 | +// let project = config_create_project(&zk_config, false, true).unwrap(); |
| 74 | + |
| 75 | +// let version = get_solc_version_info(&path.solc).unwrap(); |
| 76 | +// assert!(version.zksync_version.is_some()); |
| 77 | +// assert_eq!(version.zksync_version.unwrap(), Version::new(1, 5, 6)); |
| 78 | + |
| 79 | +// zk_config.zksync.zksolc = Some(SolcReq::Version(Version::new(1, 5, 7))); |
| 80 | +// let project = config_create_project(&zk_config, false, true).unwrap(); |
| 81 | +// let solc_compiler = project.compiler.solc; |
| 82 | +// if let SolcCompiler::Specific(path) = solc_compiler { |
| 83 | +// let version = get_solc_version_info(&path.solc).unwrap(); |
| 84 | +// assert!(version.zksync_version.is_some()); |
| 85 | +// assert_eq!(version.zksync_version.unwrap(), Version::new(1, 5, 7)); |
| 86 | +// } else { |
| 87 | +// panic!("Expected SolcCompiler::Specific"); |
| 88 | +// } |
| 89 | + |
| 90 | +// let project = config_create_project(&zk_config, false, true).unwrap(); |
| 91 | +// let solc_compiler = project.compiler.solc; |
| 92 | +// if let SolcCompiler::Specific(path) = solc_compiler { |
| 93 | +// let version = get_solc_version_info(&path.solc).unwrap(); |
| 94 | +// assert!(version.zksync_version.is_some()); |
| 95 | +// assert_eq!(version.zksync_version.unwrap(), Version::new(1, 5, 7)); |
| 96 | +// } else { |
| 97 | +// panic!("Expected SolcCompiler::Specific"); |
| 98 | +// } |
| 99 | +// } |
| 100 | +// ); |
0 commit comments