From 0d2cf986b352e4ad92d33b1d077fcc6470f43f8e Mon Sep 17 00:00:00 2001 From: gcranju Date: Fri, 5 Jul 2024 15:09:34 +0545 Subject: [PATCH] fix: patch valid source check --- contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs | 8 ++++++-- contracts/cosmwasm-vm/cw-xcall/src/types/request.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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 80cb2a8e2..e5ae04f99 100644 --- a/contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs +++ b/contracts/cosmwasm-vm/cw-xcall/src/handle_call_message.rs @@ -223,8 +223,12 @@ impl<'a> CwCallService<'a> { if protocols.contains(source) { return Ok(true); } - let default_conn = self.get_default_connection(store, src_net)?; - Ok(source.clone() == default_conn) + if protocols.len() == 0 { + let default_conn = self.get_default_connection(store, src_net)?; + Ok(source.clone() == default_conn) + } else { + Ok(false) + } } pub fn handle_error( diff --git a/contracts/cosmwasm-vm/cw-xcall/src/types/request.rs b/contracts/cosmwasm-vm/cw-xcall/src/types/request.rs index b5597c2ab..2ecb0b21c 100644 --- a/contracts/cosmwasm-vm/cw-xcall/src/types/request.rs +++ b/contracts/cosmwasm-vm/cw-xcall/src/types/request.rs @@ -76,7 +76,7 @@ impl CSMessageRequest { } pub fn as_bytes(&self) -> Vec { - rlp::encode(self.clone()).to_vec() + rlp::encode(self).to_vec() } }