diff --git a/Cargo.lock b/Cargo.lock index 646e6786a..1dbe65c13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1693,6 +1693,7 @@ dependencies = [ "error-stack", "goldie", "integration-tests", + "itertools 0.11.0", "msgs-derive", "multisig", "report", diff --git a/contracts/coordinator/Cargo.toml b/contracts/coordinator/Cargo.toml index c88841e2a..f4a79d2bd 100644 --- a/contracts/coordinator/Cargo.toml +++ b/contracts/coordinator/Cargo.toml @@ -39,6 +39,7 @@ cosmwasm-std = { workspace = true } cw-storage-plus = { workspace = true } cw2 = { workspace = true } error-stack = { workspace = true } +itertools = { workspace = true } msgs-derive = { workspace = true } multisig = { workspace = true, features = ["library"] } report = { workspace = true } diff --git a/contracts/coordinator/src/client.rs b/contracts/coordinator/src/client.rs index e3a7b756a..a26be69b8 100644 --- a/contracts/coordinator/src/client.rs +++ b/contracts/coordinator/src/client.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; -use cosmwasm_std::{Addr, CosmosMsg}; +use cosmwasm_std::CosmosMsg; use error_stack::{Result, ResultExt}; use router_api::ChainName; @@ -8,14 +8,16 @@ use crate::msg::{ExecuteMsg, QueryMsg}; #[derive(thiserror::Error, Debug, PartialEq)] pub enum Error { - #[error("failed to execute ReadyToUnbond query at coordinator contract. worker_address: {0}")] - ReadyToUnbond(Addr), + #[error( + "failed to execute ReadyToUnbond query at coordinator contract. verifier_address: {0}" + )] + ReadyToUnbond(String), } impl From for Error { fn from(value: QueryMsg) -> Self { match value { - QueryMsg::ReadyToUnbond { worker_address } => Error::ReadyToUnbond(worker_address), + QueryMsg::ReadyToUnbond { verifier_address } => Error::ReadyToUnbond(verifier_address), } } } @@ -34,7 +36,7 @@ impl<'a> Client<'a> { pub fn register_prover_contract( &self, chain_name: ChainName, - new_prover_addr: Addr, + new_prover_addr: String, ) -> CosmosMsg { self.client.execute(&ExecuteMsg::RegisterProverContract { chain_name, @@ -42,13 +44,13 @@ impl<'a> Client<'a> { }) } - pub fn set_active_verifiers(&self, verifiers: HashSet) -> CosmosMsg { + pub fn set_active_verifiers(&self, verifiers: HashSet) -> CosmosMsg { self.client .execute(&ExecuteMsg::SetActiveVerifiers { verifiers }) } - pub fn ready_to_unbond(&self, worker_address: Addr) -> Result { - let msg = QueryMsg::ReadyToUnbond { worker_address }; + pub fn ready_to_unbond(&self, verifier_address: String) -> Result { + let msg = QueryMsg::ReadyToUnbond { verifier_address }; self.client.query(&msg).change_context_lazy(|| msg.into()) } } @@ -67,7 +69,7 @@ mod test { let (querier, addr) = setup_queries_to_fail(); let client: Client = client::ContractClient::new(QuerierWrapper::new(&querier), &addr).into(); - let res = client.ready_to_unbond(Addr::unchecked("worker")); + let res = client.ready_to_unbond(Addr::unchecked("verifier").to_string()); assert!(res.is_err()); goldie::assert!(res.unwrap_err().to_string()); @@ -78,7 +80,7 @@ mod test { let (querier, addr) = setup_queries_to_succeed(); let client: Client = client::ContractClient::new(QuerierWrapper::new(&querier), &addr).into(); - let res = client.ready_to_unbond(Addr::unchecked("worker")); + let res = client.ready_to_unbond(Addr::unchecked("verifier").to_string()); assert!(res.is_ok()); goldie::assert_json!(res.unwrap()); @@ -109,9 +111,9 @@ mod test { WasmQuery::Smart { contract_addr, msg } if contract_addr == addr => { let msg = from_json::(msg).unwrap(); match msg { - QueryMsg::ReadyToUnbond { worker_address: _ } => { - Ok(to_json_binary(&true).into()).into() - } + QueryMsg::ReadyToUnbond { + verifier_address: _, + } => Ok(to_json_binary(&true).into()).into(), } } _ => panic!("unexpected query: {:?}", msg), diff --git a/contracts/coordinator/src/contract.rs b/contracts/coordinator/src/contract.rs index 99f994074..a2e5bce57 100644 --- a/contracts/coordinator/src/contract.rs +++ b/contracts/coordinator/src/contract.rs @@ -2,6 +2,7 @@ mod execute; mod migrations; mod query; +use axelar_wasm_std::address::validate_cosmwasm_address; use axelar_wasm_std::{address, permission_control, FnExt}; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; @@ -9,8 +10,8 @@ use cosmwasm_std::{ to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, Storage, }; use error_stack::report; +use itertools::Itertools; -use crate::contract::migrations::v0_2_0; use crate::error::ContractError; use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; use crate::state::is_prover_registered; @@ -24,8 +25,6 @@ pub fn migrate( _env: Env, _msg: Empty, ) -> Result { - v0_2_0::migrate(deps.storage)?; - // this needs to be the last thing to do during migration, // because previous migration steps should check the old version cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; @@ -63,8 +62,15 @@ pub fn execute( ExecuteMsg::RegisterProverContract { chain_name, new_prover_addr, - } => execute::register_prover(deps, chain_name, new_prover_addr), + } => { + let new_prover_addr = validate_cosmwasm_address(deps.api, &new_prover_addr)?; + execute::register_prover(deps, chain_name, new_prover_addr) + } ExecuteMsg::SetActiveVerifiers { verifiers } => { + let verifiers = verifiers + .iter() + .map(|v| validate_cosmwasm_address(deps.api, v)) + .try_collect()?; execute::set_active_verifier_set(deps, info, verifiers) } }? @@ -84,11 +90,21 @@ fn find_prover_address( } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { +pub fn query( + deps: Deps, + _env: Env, + msg: QueryMsg, +) -> Result { match msg { - QueryMsg::ReadyToUnbond { worker_address } => to_json_binary( - &query::check_verifier_ready_to_unbond(deps, worker_address)?, - )?, + QueryMsg::ReadyToUnbond { + verifier_address: worker_address, + } => { + let worker_address = validate_cosmwasm_address(deps.api, &worker_address)?; + to_json_binary(&query::check_verifier_ready_to_unbond( + deps, + worker_address, + )?)? + } } .then(Ok) } @@ -150,7 +166,7 @@ mod tests { mock_info("not_governance", &[]), ExecuteMsg::RegisterProverContract { chain_name: test_setup.chain_name.clone(), - new_prover_addr: test_setup.prover.clone(), + new_prover_addr: test_setup.prover.to_string(), } ) .is_err()); @@ -161,7 +177,7 @@ mod tests { mock_info(governance, &[]), ExecuteMsg::RegisterProverContract { chain_name: test_setup.chain_name.clone(), - new_prover_addr: test_setup.prover.clone(), + new_prover_addr: test_setup.prover.to_string(), } ) .is_ok()); @@ -178,7 +194,7 @@ mod tests { mock_info(governance, &[]), ExecuteMsg::RegisterProverContract { chain_name: test_setup.chain_name.clone(), - new_prover_addr: test_setup.prover.clone(), + new_prover_addr: test_setup.prover.to_string(), }, ) .unwrap(); @@ -202,7 +218,7 @@ mod tests { mock_info("random_address", &[]), ExecuteMsg::RegisterProverContract { chain_name: test_setup.chain_name.clone(), - new_prover_addr: test_setup.prover.clone(), + new_prover_addr: test_setup.prover.to_string(), }, ); assert_eq!( @@ -228,7 +244,7 @@ mod tests { mock_info(governance, &[]), ExecuteMsg::RegisterProverContract { chain_name: test_setup.chain_name.clone(), - new_prover_addr: test_setup.prover.clone(), + new_prover_addr: test_setup.prover.to_string(), }, ) .unwrap(); diff --git a/contracts/coordinator/src/contract/migrations/mod.rs b/contracts/coordinator/src/contract/migrations/mod.rs index 693d0ab24..8b1378917 100644 --- a/contracts/coordinator/src/contract/migrations/mod.rs +++ b/contracts/coordinator/src/contract/migrations/mod.rs @@ -1,2 +1 @@ -#[allow(deprecated)] -pub mod v0_2_0; + diff --git a/contracts/coordinator/src/contract/migrations/v0_2_0.rs b/contracts/coordinator/src/contract/migrations/v0_2_0.rs deleted file mode 100644 index 1e5dba106..000000000 --- a/contracts/coordinator/src/contract/migrations/v0_2_0.rs +++ /dev/null @@ -1,181 +0,0 @@ -use axelar_wasm_std::permission_control; -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, Storage}; -use cw_storage_plus::{Item, Map}; -use router_api::ChainName; - -use crate::contract::CONTRACT_NAME; -use crate::error::ContractError; -use crate::state::save_prover_for_chain; - -const BASE_VERSION: &str = "0.2.0"; - -pub fn migrate(storage: &mut dyn Storage) -> Result<(), ContractError> { - cw2::assert_contract_version(storage, CONTRACT_NAME, BASE_VERSION)?; - - migrate_config_to_permission_control(storage)?; - migrate_registered_provers(storage)?; - Ok(()) -} - -fn migrate_config_to_permission_control(storage: &mut dyn Storage) -> Result<(), ContractError> { - let config = CONFIG.load(storage).map_err(ContractError::from)?; - permission_control::set_governance(storage, &config.governance).map_err(ContractError::from)?; - CONFIG.remove(storage); - Ok(()) -} - -fn migrate_registered_provers(storage: &mut dyn Storage) -> Result<(), ContractError> { - PROVER_PER_CHAIN - .range(storage, None, None, cosmwasm_std::Order::Ascending) - .collect::, _>>()? - .into_iter() - .try_for_each(|(chain, prover)| save_prover_for_chain(storage, chain, prover))?; - - PROVER_PER_CHAIN.clear(storage); - Ok(()) -} - -#[cw_serde] -#[deprecated(since = "0.2.0", note = "only used to test the migration")] -struct Config { - pub governance: Addr, -} - -#[deprecated(since = "0.2.0", note = "only used to test the migration")] -const CONFIG: Item = Item::new("config"); - -#[deprecated(since = "0.2.0", note = "only used to test the migration")] -const PROVER_PER_CHAIN: Map = Map::new("prover_per_chain"); - -#[cfg(test)] -mod tests { - use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; - use cosmwasm_std::{Addr, DepsMut, Env, MessageInfo, Response}; - use router_api::ChainName; - - use super::PROVER_PER_CHAIN; - use crate::contract::migrations::v0_2_0; - use crate::contract::migrations::v0_2_0::BASE_VERSION; - use crate::contract::{execute, CONTRACT_NAME}; - use crate::error::ContractError; - use crate::msg::{ExecuteMsg, InstantiateMsg}; - use crate::state::{is_prover_registered, load_prover_by_chain}; - - #[test] - fn migrate_checks_contract_version() { - let mut deps = mock_dependencies(); - let _ = instantiate_0_2_0_contract(deps.as_mut()).unwrap(); - cw2::set_contract_version(deps.as_mut().storage, CONTRACT_NAME, "something wrong").unwrap(); - - assert!(v0_2_0::migrate(deps.as_mut().storage).is_err()); - - cw2::set_contract_version(deps.as_mut().storage, CONTRACT_NAME, BASE_VERSION).unwrap(); - - assert!(v0_2_0::migrate(deps.as_mut().storage).is_ok()); - } - - #[test] - fn ensure_governance_is_migrated_to_permission_control() { - let mut deps = mock_dependencies(); - - let msg = instantiate_0_2_0_contract(deps.as_mut()).unwrap(); - - assert!(v0_2_0::CONFIG.may_load(&deps.storage).unwrap().is_some()); - - assert!(v0_2_0::migrate(deps.as_mut().storage).is_ok()); - - assert!(execute( - deps.as_mut(), - mock_env(), - mock_info("anyone", &[]), - ExecuteMsg::RegisterProverContract { - chain_name: "chain".parse().unwrap(), - new_prover_addr: Addr::unchecked("any_addr"), - }, - ) - .is_err()); - - assert!(execute( - deps.as_mut(), - mock_env(), - mock_info(&msg.governance_address, &[]), - ExecuteMsg::RegisterProverContract { - chain_name: "chain".parse().unwrap(), - new_prover_addr: Addr::unchecked("any_addr"), - }, - ) - .is_ok()); - - assert!(v0_2_0::CONFIG.may_load(&deps.storage).unwrap().is_none()) - } - - #[test] - fn ensure_registered_provers_are_migrated() { - let mut deps = mock_dependencies(); - instantiate_0_2_0_contract(deps.as_mut()).unwrap(); - - let provers: Vec<(ChainName, Addr)> = vec![ - ("chain1".parse().unwrap(), Addr::unchecked("addr1")), - ("chain2".parse().unwrap(), Addr::unchecked("addr2")), - ]; - - for (chain, prover) in &provers { - register_prover_0_2_0(deps.as_mut(), chain.clone(), prover.clone()).unwrap(); - } - - assert!(v0_2_0::migrate(deps.as_mut().storage).is_ok()); - - for (chain, prover) in provers { - assert_eq!( - load_prover_by_chain(deps.as_ref().storage, chain).unwrap(), - prover.clone() - ); - - // check index is working as well - assert!(is_prover_registered(deps.as_ref().storage, prover).unwrap()); - } - - assert!(PROVER_PER_CHAIN.is_empty(deps.as_ref().storage)); - } - - fn instantiate_0_2_0_contract( - deps: DepsMut, - ) -> Result { - let governance = "governance"; - - let msg = InstantiateMsg { - governance_address: governance.to_string(), - }; - instantiate_0_2_0(deps, mock_env(), mock_info("sender", &[]), msg.clone())?; - Ok(msg) - } - - #[deprecated(since = "0.2.0", note = "only used to test the migration")] - fn instantiate_0_2_0( - deps: DepsMut, - _env: Env, - _info: MessageInfo, - msg: InstantiateMsg, - ) -> Result { - cw2::set_contract_version(deps.storage, CONTRACT_NAME, BASE_VERSION)?; - - v0_2_0::CONFIG.save( - deps.storage, - &v0_2_0::Config { - governance: deps.api.addr_validate(&msg.governance_address)?, - }, - )?; - Ok(Response::default()) - } - - #[deprecated(since = "0.2.0", note = "only used to test the migration")] - fn register_prover_0_2_0( - deps: DepsMut, - chain_name: ChainName, - new_prover_addr: Addr, - ) -> Result { - PROVER_PER_CHAIN.save(deps.storage, chain_name.clone(), &(new_prover_addr))?; - Ok(Response::new()) - } -} diff --git a/contracts/coordinator/src/msg.rs b/contracts/coordinator/src/msg.rs index b0e95f90f..546835c24 100644 --- a/contracts/coordinator/src/msg.rs +++ b/contracts/coordinator/src/msg.rs @@ -1,7 +1,6 @@ use std::collections::HashSet; use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::Addr; use msgs_derive::EnsurePermissions; use router_api::ChainName; @@ -16,15 +15,15 @@ pub enum ExecuteMsg { #[permission(Governance)] RegisterProverContract { chain_name: ChainName, - new_prover_addr: Addr, + new_prover_addr: String, }, #[permission(Specific(prover))] - SetActiveVerifiers { verifiers: HashSet }, + SetActiveVerifiers { verifiers: HashSet }, } #[cw_serde] #[derive(QueryResponses)] pub enum QueryMsg { #[returns(bool)] - ReadyToUnbond { worker_address: Addr }, + ReadyToUnbond { verifier_address: String }, } diff --git a/contracts/coordinator/src/testdata/query_ready_to_unbond_returns_error_when_query_fails.golden b/contracts/coordinator/src/testdata/query_ready_to_unbond_returns_error_when_query_fails.golden index ebbed5149..8272dea6b 100644 --- a/contracts/coordinator/src/testdata/query_ready_to_unbond_returns_error_when_query_fails.golden +++ b/contracts/coordinator/src/testdata/query_ready_to_unbond_returns_error_when_query_fails.golden @@ -1 +1 @@ -failed to execute ReadyToUnbond query at coordinator contract. worker_address: worker \ No newline at end of file +failed to execute ReadyToUnbond query at coordinator contract. verifier_address: verifier \ No newline at end of file diff --git a/contracts/multisig-prover/src/contract/execute.rs b/contracts/multisig-prover/src/contract/execute.rs index 086d5c518..a32a6ec04 100644 --- a/contracts/multisig-prover/src/contract/execute.rs +++ b/contracts/multisig-prover/src/contract/execute.rs @@ -280,7 +280,7 @@ pub fn update_verifier_set( wasm_execute( config.coordinator, &coordinator::msg::ExecuteMsg::SetActiveVerifiers { - verifiers: verifier_union_set, + verifiers: verifier_union_set.iter().map(|v| v.to_string()).collect(), }, vec![], ) @@ -337,7 +337,10 @@ pub fn confirm_verifier_set(deps: DepsMut, sender: Addr) -> Result Result, ContractError> { diff --git a/contracts/service-registry/src/contract.rs b/contracts/service-registry/src/contract.rs index 13cee8105..efdee7519 100644 --- a/contracts/service-registry/src/contract.rs +++ b/contracts/service-registry/src/contract.rs @@ -50,17 +50,20 @@ pub fn execute( bond_denom, unbonding_period_days, description, - } => execute::register_service( - deps, - service_name, - coordinator_contract, - min_num_verifiers, - max_num_verifiers, - min_verifier_bond, - bond_denom, - unbonding_period_days, - description, - ), + } => { + let coordinator_contract = deps.api.addr_validate(&coordinator_contract)?; + execute::register_service( + deps, + service_name, + coordinator_contract, + min_num_verifiers, + max_num_verifiers, + min_verifier_bond, + bond_denom, + unbonding_period_days, + description, + ) + } ExecuteMsg::AuthorizeVerifiers { verifiers, service_name, @@ -238,7 +241,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: "validators".into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: Uint128::one().try_into().unwrap(), @@ -255,7 +258,7 @@ mod test { mock_info(UNAUTHORIZED_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: "validators".into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: Uint128::one().try_into().unwrap(), @@ -283,7 +286,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: Uint128::one().try_into().unwrap(), @@ -334,7 +337,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: min_verifier_bond.try_into().unwrap(), @@ -382,7 +385,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: min_verifier_bond.try_into().unwrap(), @@ -427,7 +430,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: min_verifier_bond.try_into().unwrap(), @@ -530,7 +533,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked("nowhere"), + coordinator_contract: Addr::unchecked("nowhere").to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: min_verifier_bond.try_into().unwrap(), @@ -617,7 +620,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: min_verifier_bond.try_into().unwrap(), @@ -711,7 +714,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond: min_verifier_bond.try_into().unwrap(), @@ -836,7 +839,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -938,7 +941,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1050,7 +1053,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1126,7 +1129,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1200,7 +1203,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1282,7 +1285,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1366,7 +1369,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1409,7 +1412,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1472,7 +1475,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1546,7 +1549,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1633,7 +1636,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1742,7 +1745,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -1864,7 +1867,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers, max_num_verifiers: Some(100), min_verifier_bond, @@ -1975,7 +1978,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -2129,7 +2132,7 @@ mod test { mock_info(GOVERNANCE_ADDRESS, &[]), ExecuteMsg::RegisterService { service_name: service_name.into(), - coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS), + coordinator_contract: Addr::unchecked(COORDINATOR_ADDRESS).to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, diff --git a/contracts/service-registry/src/contract/execute.rs b/contracts/service-registry/src/contract/execute.rs index 5e9fa1b88..35d8e2c04 100644 --- a/contracts/service-registry/src/contract/execute.rs +++ b/contracts/service-registry/src/contract/execute.rs @@ -180,7 +180,7 @@ pub fn unbond_verifier( client::ContractClient::new(deps.querier, &service.coordinator_contract).into(); let ready_to_unbond = coordinator - .ready_to_unbond(verifier.address.clone()) + .ready_to_unbond(verifier.address.to_string()) .change_context(ContractError::FailedToUnbondVerifier)?; let verifier = verifier.unbond(ready_to_unbond, env.block.time)?; diff --git a/contracts/service-registry/src/msg.rs b/contracts/service-registry/src/msg.rs index b6a289cba..f3279c4a1 100644 --- a/contracts/service-registry/src/msg.rs +++ b/contracts/service-registry/src/msg.rs @@ -20,7 +20,7 @@ pub enum ExecuteMsg { #[permission(Governance)] RegisterService { service_name: String, - coordinator_contract: Addr, + coordinator_contract: String, min_num_verifiers: u16, max_num_verifiers: Option, min_verifier_bond: nonempty::Uint128, diff --git a/integration-tests/tests/test_utils/mod.rs b/integration-tests/tests/test_utils/mod.rs index d11fd0c12..bc610edce 100644 --- a/integration-tests/tests/test_utils/mod.rs +++ b/integration-tests/tests/test_utils/mod.rs @@ -259,7 +259,7 @@ pub fn register_service( protocol.governance_address.clone(), &ExecuteMsg::RegisterService { service_name: protocol.service_name.to_string(), - coordinator_contract: protocol.coordinator.contract_addr.clone(), + coordinator_contract: protocol.coordinator.contract_addr.to_string(), min_num_verifiers: 0, max_num_verifiers: Some(100), min_verifier_bond, @@ -757,7 +757,7 @@ pub fn setup_chain( protocol.governance_address.clone(), &CoordinatorExecuteMsg::RegisterProverContract { chain_name: chain_name.clone(), - new_prover_addr: multisig_prover.contract_addr.clone(), + new_prover_addr: multisig_prover.contract_addr.to_string(), }, ); assert!(response.is_ok()); @@ -768,7 +768,7 @@ pub fn setup_chain( &mut protocol.app, multisig_prover.contract_addr.clone(), &coordinator::msg::ExecuteMsg::SetActiveVerifiers { - verifiers: verifier_union_set, + verifiers: verifier_union_set.iter().map(|v| v.to_string()).collect(), }, ); assert!(response.is_ok());