diff --git a/Cargo.lock b/Cargo.lock index 08aeee577..a68d4c36a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -420,7 +420,7 @@ dependencies = [ [[package]] name = "cw-common" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bech32", "bytes", @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "cw-ibc-core" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "bytes", @@ -459,7 +459,7 @@ dependencies = [ "debug_print", "getrandom", "hex", - "hex-literal 0.4.1", + "hex-literal 0.3.4", "prost 0.11.9", "schemars 0.8.12", "serde", @@ -472,7 +472,7 @@ dependencies = [ [[package]] name = "cw-icon-light-client" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "common 0.1.0", @@ -486,7 +486,7 @@ dependencies = [ "debug_print", "getrandom", "hex", - "hex-literal 0.4.1", + "hex-literal 0.3.4", "prost 0.11.9", "schemars 0.8.12", "serde", @@ -499,7 +499,7 @@ dependencies = [ [[package]] name = "cw-integration" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "common 0.1.0", @@ -563,7 +563,7 @@ dependencies = [ [[package]] name = "cw-mock-ibc-connection" -version = "0.1.0" +version = "0.1.1" dependencies = [ "common 0.1.0", "cosmwasm", @@ -585,7 +585,7 @@ dependencies = [ [[package]] name = "cw-mock-ibc-core" -version = "0.1.0" +version = "0.1.1" dependencies = [ "common 0.1.0", "cosmwasm-schema", @@ -604,7 +604,7 @@ dependencies = [ [[package]] name = "cw-mock-ibc-dapp" -version = "0.1.0" +version = "0.1.1" dependencies = [ "common 0.1.0", "cosmwasm", @@ -715,7 +715,7 @@ dependencies = [ [[package]] name = "cw-xcall-ibc-connection" -version = "0.1.0" +version = "0.1.1" dependencies = [ "common 0.1.0", "cosmwasm", diff --git a/Cargo.toml b/Cargo.toml index 9db606564..44513da23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ exclude = ["contracts/cosmwasm-vm/archway"] [workspace.package] authors = ["Icon Foundation"] repository = "https://github.com/icon-project/ibc-integration.git" -version="0.1.0" +version="0.1.1" [workspace.dependencies] cosmwasm-std = {version="1.2.2",default-features = false,features = ["iterator", "ibc3","staking"]} diff --git a/contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/packet/receive_packet.rs b/contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/packet/receive_packet.rs index b33659fc9..5a6959c21 100644 --- a/contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/packet/receive_packet.rs +++ b/contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/packet/receive_packet.rs @@ -74,7 +74,9 @@ impl<'a> CwIbcCoreContext<'a> { packet_sequence, )?; if packet_already_received { - return Ok(Response::new().add_attribute("message", "Packet already received")); + return Err(ContractError::IbcPacketError { + error: PacketError::Other("Already Received".to_string()), + }); } let connection_id = &channel_end.connection_hops()[0]; diff --git a/contracts/cosmwasm-vm/cw-ibc-core/tests/channel/test_receive_packet.rs b/contracts/cosmwasm-vm/cw-ibc-core/tests/channel/test_receive_packet.rs index 21af1dd21..fb5e304c3 100644 --- a/contracts/cosmwasm-vm/cw-ibc-core/tests/channel/test_receive_packet.rs +++ b/contracts/cosmwasm-vm/cw-ibc-core/tests/channel/test_receive_packet.rs @@ -237,6 +237,7 @@ fn test_receive_packet_fails_on_invalid_counterparty() { ); } +#[should_panic(expected = "IbcPacketError { error: Other(\"Already Received\") }")] #[test] fn test_receive_packet_no_op_on_packet_already_received() { let contract = CwIbcCoreContext::default(); @@ -264,12 +265,9 @@ fn test_receive_packet_no_op_on_packet_already_received() { mock_lightclient_query(test_context.mock_queries, &mut deps); - let res = contract.validate_receive_packet(deps.as_mut(), info, env, &msg); - - assert_eq!( - res.unwrap().attributes[0].value, - "Packet already received".to_string() - ) + let _res = contract + .validate_receive_packet(deps.as_mut(), info, env, &msg) + .unwrap(); } #[test] fn execute_receive_packet() { diff --git a/contracts/cosmwasm-vm/cw-mock-ibc-connection/src/send_message.rs b/contracts/cosmwasm-vm/cw-mock-ibc-connection/src/send_message.rs index d7d3bffe7..84fff8bac 100644 --- a/contracts/cosmwasm-vm/cw-mock-ibc-connection/src/send_message.rs +++ b/contracts/cosmwasm-vm/cw-mock-ibc-connection/src/send_message.rs @@ -16,11 +16,11 @@ impl<'a> CwIbcConnection<'a> { self.ensure_xcall_handler(deps.as_ref().storage, info.sender.clone())?; println!("{LOG_PREFIX} Packet Validated"); - let network_fee = self.get_network_fees(deps.as_ref().storage, nid.clone()); + let network_fee = self.get_network_fees(deps.as_ref().storage, nid); let mut total_fee = network_fee.send_packet_fee; if sn > 0 { - total_fee = total_fee + network_fee.ack_fee; + total_fee += network_fee.ack_fee; } let config = self.get_config(deps.storage)?; diff --git a/contracts/cosmwasm-vm/cw-xcall-ibc-connection/src/contract.rs b/contracts/cosmwasm-vm/cw-xcall-ibc-connection/src/contract.rs index 5c20301c4..630f449cb 100644 --- a/contracts/cosmwasm-vm/cw-xcall-ibc-connection/src/contract.rs +++ b/contracts/cosmwasm-vm/cw-xcall-ibc-connection/src/contract.rs @@ -302,7 +302,7 @@ impl<'a> CwIbcConnection<'a> { info: MessageInfo, msg: InstantiateMsg, ) -> Result { - let owner = info.clone().sender; + let owner = info.sender; self.add_owner(store, owner.clone())?; self.update_admin(store, owner)?; diff --git a/contracts/cosmwasm-vm/cw-xcall-ibc-connection/tests/test_owner.rs b/contracts/cosmwasm-vm/cw-xcall-ibc-connection/tests/test_owner.rs index eb8f1b8de..2d4bb0257 100644 --- a/contracts/cosmwasm-vm/cw-xcall-ibc-connection/tests/test_owner.rs +++ b/contracts/cosmwasm-vm/cw-xcall-ibc-connection/tests/test_owner.rs @@ -2,7 +2,6 @@ mod account; mod setup; use account::*; -use cosmwasm_std::Addr; use cw_xcall_ibc_connection::state::CwIbcConnection; use setup::*; #[test]