From 81ed68159d0d9782d06852e18889bd1b4b22f57e Mon Sep 17 00:00:00 2001 From: Peter White Date: Fri, 13 Dec 2024 10:52:15 -0700 Subject: [PATCH] fix(up-contract): test compilation after rebase --- crates/pop-contracts/src/up.rs | 85 ---------------------------------- 1 file changed, 85 deletions(-) diff --git a/crates/pop-contracts/src/up.rs b/crates/pop-contracts/src/up.rs index 668d6b1e..45233f22 100644 --- a/crates/pop-contracts/src/up.rs +++ b/crates/pop-contracts/src/up.rs @@ -438,26 +438,6 @@ mod tests { Ok(()) } - #[tokio::test] - async fn get_payload_works() -> Result<()> { - let temp_dir = generate_smart_contract_test_environment()?; - mock_build_process(temp_dir.path().join("testing"))?; - let up_opts = UpOpts { - path: Some(temp_dir.path().join("testing")), - constructor: "new".to_string(), - args: ["false".to_string()].to_vec(), - value: "1000".to_string(), - gas_limit: None, - proof_size: None, - salt: None, - url: Url::parse(CONTRACTS_NETWORK_URL)?, - suri: "//Alice".to_string(), - }; - let call_data = get_upload_payload(up_opts).await?; - // println!("{:?}", call_data); - Ok(()) - } - #[tokio::test] async fn dry_run_gas_estimate_instantiate_works() -> Result<()> { let temp_dir = new_environment("testing")?; @@ -612,69 +592,4 @@ mod tests { Ok(()) } - - #[tokio::test] - async fn get_instantiate_payload_works() -> Result<()> { - const LOCALHOST_URL: &str = "ws://127.0.0.1:9944"; - let temp_dir = generate_smart_contract_test_environment()?; - mock_build_process(temp_dir.path().join("testing"))?; - - let cache = temp_dir.path().join(""); - - let binary = contracts_node_generator(cache.clone(), None).await?; - binary.source(false, &(), true).await?; - let process = run_contracts_node(binary.path(), None).await?; - - let upload_exec = set_up_upload(UpOpts { - path: Some(temp_dir.path().join("testing")), - constructor: "new".to_string(), - args: [].to_vec(), - value: "1000".to_string(), - gas_limit: None, - proof_size: None, - salt: None, - url: Url::parse(LOCALHOST_URL)?, - suri: "//Alice".to_string(), - }) - .await?; - - // Only upload a Smart Contract - let upload_result = upload_smart_contract(&upload_exec).await?; - assert!(!upload_result.starts_with("0x0x")); - assert!(upload_result.starts_with("0x")); - //Error when Smart Contract has been already uploaded - assert!(matches!( - upload_smart_contract(&upload_exec).await, - Err(Error::UploadContractError(..)) - )); - - // Instantiate a Smart Contract - let instantiate_exec = set_up_deployment(UpOpts { - path: Some(temp_dir.path().join("testing")), - constructor: "new".to_string(), - args: ["false".to_string()].to_vec(), - value: "0".to_string(), - gas_limit: None, - proof_size: None, - salt: Some(Bytes::from(vec![0x00])), - url: Url::parse(LOCALHOST_URL)?, - suri: "//Alice".to_string(), - }) - .await?; - // First gas estimation - let weight = dry_run_gas_estimate_instantiate(&instantiate_exec).await?; - assert!(weight.ref_time() > 0); - assert!(weight.proof_size() > 0); - - let call_data = get_instantiate_payload(instantiate_exec, weight).await?; - println!("{:?}", to_hex(call_data)); - - //Stop the process contracts-node - Command::new("kill") - .args(["-s", "TERM", &process.id().to_string()]) - .spawn()? - .wait()?; - - Ok(()) - } }