diff --git a/contracts/cosmwasm-vm/cw-xcall/src/connection.rs b/contracts/cosmwasm-vm/cw-xcall/src/connection.rs index 8ce0be46..8395cc05 100644 --- a/contracts/cosmwasm-vm/cw-xcall/src/connection.rs +++ b/contracts/cosmwasm-vm/cw-xcall/src/connection.rs @@ -15,7 +15,7 @@ use crate::{ impl<'a> CwCallService<'a> { pub fn call_connection_send_message( &self, - address: &str, + address: &Addr, fee: Vec, to: NetId, sn: i64, @@ -71,6 +71,7 @@ impl<'a> CwCallService<'a> { address: Addr, ) -> Result { self.ensure_admin(deps.storage, info.sender)?; + deps.api.addr_validate(address.as_str())?; self.store_default_connection(deps.storage, nid, address)?; Ok(Response::new().add_attribute("method", "set_default_connection")) diff --git a/contracts/cosmwasm-vm/cw-xcall/src/execute_call.rs b/contracts/cosmwasm-vm/cw-xcall/src/execute_call.rs index a6987182..1946c2a0 100644 --- a/contracts/cosmwasm-vm/cw-xcall/src/execute_call.rs +++ b/contracts/cosmwasm-vm/cw-xcall/src/execute_call.rs @@ -108,7 +108,15 @@ impl<'a> CwCallService<'a> { } submsgs = reply_address .iter() - .map(|to| self.call_connection_send_message(to, vec![], from.nid(), sn, &message)) + .map(|to| { + self.call_connection_send_message( + &deps.api.addr_validate(to)?, + vec![], + from.nid(), + sn, + &message, + ) + }) .collect::, ContractError>>()?; } diff --git a/contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs b/contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs index a4c9b539..9385786a 100644 --- a/contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs +++ b/contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs @@ -43,7 +43,7 @@ impl<'a> CwCallService<'a> { return Err(ContractError::ProtocolsMismatch); } - let to = request.to(); + let to = deps.api.addr_validate(request.to().as_str())?; if request.protocols().len() > 1 { let key = keccak256(data).to_vec(); diff --git a/contracts/cosmwasm-vm/cw-xcall/src/send_call_message.rs b/contracts/cosmwasm-vm/cw-xcall/src/send_call_message.rs index b5e66497..a152f1ae 100644 --- a/contracts/cosmwasm-vm/cw-xcall/src/send_call_message.rs +++ b/contracts/cosmwasm-vm/cw-xcall/src/send_call_message.rs @@ -55,7 +55,7 @@ impl<'a> CwCallService<'a> { let call_request = CSMessageRequest::new( from, - to.account(), + deps.api.addr_validate(to.account().as_str())?, sequence_no, need_response, data.to_vec(), @@ -76,14 +76,9 @@ impl<'a> CwCallService<'a> { } else { vec![] }; + let address = deps.api.addr_validate(r)?; - self.call_connection_send_message( - &r.to_string(), - fund, - to.nid(), - sn, - &message, - ) + self.call_connection_send_message(&address, fund, to.nid(), sn, &message) }); }) .collect::, ContractError>>()?;