diff --git a/Cargo.toml b/Cargo.toml index 215c19daf..d78a9da48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,7 @@ members = [ "packages/cw-orch-core", "packages/cw-orch-mock", "packages/cw-orch-networks", - # TODO: clone-cw-multi-test depends on cw-orch, so needs to be bumped first - # "packages/clone-testing", + "packages/clone-testing", # TODO: release those after *-std reaches to prost 0.13 # "packages/cw-orch-osmosis-test-tube", # "packages/cw-orch-neutron-test-tube", diff --git a/packages/clone-testing/Cargo.toml b/packages/clone-testing/Cargo.toml index ca4fb5ae7..6f55cd9d8 100644 --- a/packages/clone-testing/Cargo.toml +++ b/packages/clone-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cw-orch-clone-testing" -version = "0.6.4" +version = "0.7.0" authors.workspace = true edition.workspace = true license.workspace = true @@ -11,10 +11,13 @@ description = "Adapter for interacting with cw-multi-test via the cw-orchestrato [dependencies] cosmwasm-std = { workspace = true } -cw-orch-daemon = { workspace = true } + cw-orch-core = { workspace = true } cw-orch-mock = { workspace = true } -clone-cw-multi-test = { version = "0.5", features = ["cosmwasm_1_2"] } +cw-orch-daemon = { workspace = true } + +clone-cw-multi-test = { version = "0.6.0" } + cw-utils = { workspace = true } serde = { workspace = true } log = { workspace = true } @@ -27,8 +30,9 @@ tonic = { workspace = true } [dev-dependencies] cosmwasm-schema = "2.0.0" speculoos = { workspace = true } -cw20 = { workspace = true } -cw20-base = { workspace = true } + +cw20 = { version = "2.0.0" } +cw20-base = { version = "2.0.0" } env_logger = "0.10.0" counter-contract = { path = "../../contracts-ws/contracts/counter" } diff --git a/packages/clone-testing/src/core.rs b/packages/clone-testing/src/core.rs index f51f05b40..bd7781a7d 100644 --- a/packages/clone-testing/src/core.rs +++ b/packages/clone-testing/src/core.rs @@ -2,11 +2,7 @@ use std::{cell::RefCell, fmt::Debug, io::Read, rc::Rc}; use clone_cw_multi_test::{ addons::{MockAddressGenerator, MockApiBech32}, - wasm_emulation::{ - channel::RemoteChannel, - contract::{LocalWasmContract, WasmContract}, - storage::analyzer::StorageAnalyzer, - }, + wasm_emulation::{channel::RemoteChannel, storage::analyzer::StorageAnalyzer}, App, AppBuilder, BankKeeper, Contract, Executor, WasmKeeper, }; use cosmwasm_std::{to_json_binary, WasmMsg}; @@ -155,10 +151,7 @@ impl CloneTesting { let mut file = std::fs::File::open(T::wasm(&self.chain).path())?; let mut wasm = Vec::::new(); file.read_to_end(&mut wasm)?; - let code_id = self - .app - .borrow_mut() - .store_wasm_code(WasmContract::Local(LocalWasmContract { code: wasm })); + let code_id = self.app.borrow_mut().store_wasm_code(wasm); contract.set_code_id(code_id); @@ -224,8 +217,17 @@ impl CloneTesting { let state = Rc::new(RefCell::new(custom_state)); let pub_address_prefix = chain.network_info.pub_address_prefix.clone(); - let remote_channel = - RemoteChannel::new(rt, chain.clone(), pub_address_prefix.clone()).unwrap(); + let remote_channel = RemoteChannel::new( + rt, + &chain + .grpc_urls + .iter() + .map(|s| s.as_str()) + .collect::>(), + &chain.chain_id, + &chain.network_info.pub_address_prefix, + ) + .unwrap(); let wasm = WasmKeeper::::new() .with_remote(remote_channel.clone()) @@ -278,8 +280,8 @@ impl TxHandler for CloneTesting { type ContractSource = Box>; type Sender = Addr; - fn sender(&self) -> Addr { - self.sender_addr() + fn sender(&self) -> &cosmwasm_std::Addr { + &self.sender } fn sender_addr(&self) -> Addr { @@ -602,8 +604,7 @@ mod test { .that(&query_res.balance) .is_equal_to(Uint128::from(100u128)); - let migration_res = - chain.migrate(&cw20_base::msg::MigrateMsg {}, code_id, &contract_address); + let migration_res = chain.migrate(&Empty {}, code_id, &contract_address); asserting("that migration passed on correctly") .that(&migration_res) .is_ok(); diff --git a/packages/clone-testing/src/queriers/bank.rs b/packages/clone-testing/src/queriers/bank.rs index 388e5085b..c59ead350 100644 --- a/packages/clone-testing/src/queriers/bank.rs +++ b/packages/clone-testing/src/queriers/bank.rs @@ -1,6 +1,6 @@ use std::{cell::RefCell, rc::Rc}; -use cosmwasm_std::Coin; +use cosmwasm_std::{Addr, Coin}; use cw_orch_core::{ environment::{BankQuerier, Querier, QuerierGetter, StateInterface}, CwEnvError, diff --git a/packages/clone-testing/src/queriers/wasm.rs b/packages/clone-testing/src/queriers/wasm.rs index 6d15f67b7..c928c07e6 100644 --- a/packages/clone-testing/src/queriers/wasm.rs +++ b/packages/clone-testing/src/queriers/wasm.rs @@ -4,7 +4,7 @@ use std::{cell::RefCell, rc::Rc}; use crate::{core::CloneTestingApp, CloneTesting}; use clone_cw_multi_test::AddressGenerator; use clone_cw_multi_test::CosmosRouter; -use cosmwasm_std::{instantiate2_address, Api, Checksum, ContractInfoResponse}; +use cosmwasm_std::{instantiate2_address, Addr, Api, Checksum, ContractInfoResponse}; use cw_orch_core::{ contract::interface_traits::{ContractInstance, Uploadable}, environment::{Querier, QuerierGetter, StateInterface, WasmQuerier}, @@ -88,7 +88,7 @@ impl WasmQuerier for CloneWasmQuerier { .app .borrow() .wrap() - .query_wasm_smart(address.into(), query_data)?) + .query_wasm_smart(address, query_data)?) } fn code(&self, code_id: u64) -> Result { @@ -109,7 +109,11 @@ impl WasmQuerier for CloneWasmQuerier { ) -> Result { // Clone Testing needs mock let checksum = self.code_id_hash(code_id)?; - let canon_creator = self.app.borrow().api().addr_canonicalize(&creator.into())?; + let canon_creator = self + .app + .borrow() + .api() + .addr_canonicalize(creator.as_str())?; let canonical_addr = instantiate2_address(checksum.as_slice(), &canon_creator, &salt)?; Ok(self .app diff --git a/packages/clone-testing/tests/clone-testing.rs b/packages/clone-testing/tests/clone-testing.rs index 01d46336a..aed4664e4 100644 --- a/packages/clone-testing/tests/clone-testing.rs +++ b/packages/clone-testing/tests/clone-testing.rs @@ -57,7 +57,7 @@ pub fn cavern_integration_test() -> cw_orch::anyhow::Result<()> { // 0. We start by saving some useful information for later (admin for migration (1.) + code id for remigration (3.)) - let contract_info = app.wasm_querier().contract_info(market_addr.to_string())?; + let contract_info = app.wasm_querier().contract_info(&market_addr)?; let money_market_admin = Addr::unchecked(contract_info.admin.unwrap()); let money_market_code_id = contract_info.code_id; @@ -183,6 +183,6 @@ fn query_contract_info() -> cw_orch::anyhow::Result<()> { let market_addr = Addr::unchecked(MARKET_ADDR); market.set_address(&market_addr); - app.wasm_querier().contract_info(market.address()?)?; + app.wasm_querier().contract_info(&market.address()?)?; Ok(()) } diff --git a/packages/clone-testing/tests/wasm-upload.rs b/packages/clone-testing/tests/wasm-upload.rs index f86e66473..a48e0a8cb 100644 --- a/packages/clone-testing/tests/wasm-upload.rs +++ b/packages/clone-testing/tests/wasm-upload.rs @@ -1,12 +1,12 @@ use counter_contract::CounterContract; use cw_orch::prelude::*; use cw_orch_clone_testing::CloneTesting; -use cw_orch_daemon::networks::ARCHWAY_1; +use cw_orch_daemon::networks::JUNO_1; #[test] fn multiple_upload() -> anyhow::Result<()> { // ANCHOR: clone_testing_setup - let chain = CloneTesting::new(ARCHWAY_1)?; + let chain = CloneTesting::new(JUNO_1)?; // ANCHOR_END: clone_testing_setup // ANCHOR: counter_contract_setup let contract = CounterContract::new(chain.clone());