From b2889cd9677ba18a09061eb8305552fdda4b7863 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 10 May 2024 17:13:11 +0200 Subject: [PATCH] Remove IbcFullAcknowledgement from async ack --- .../schema/ibc-reflect-send.json | 19 +++----------- .../schema/ibc/packet_msg.json | 19 +++----------- .../ibc-reflect-send/schema/raw/execute.json | 19 +++----------- contracts/ibc-reflect/src/contract.rs | 12 ++++----- contracts/ibc-reflect/src/msg.rs | 26 ++----------------- packages/std/src/ibc.rs | 2 +- 6 files changed, 21 insertions(+), 76 deletions(-) diff --git a/contracts/ibc-reflect-send/schema/ibc-reflect-send.json b/contracts/ibc-reflect-send/schema/ibc-reflect-send.json index 96b9a9415d..1b82538492 100644 --- a/contracts/ibc-reflect-send/schema/ibc-reflect-send.json +++ b/contracts/ibc-reflect-send/schema/ibc-reflect-send.json @@ -402,25 +402,14 @@ } ] }, - "IbcFullAcknowledgement": { - "description": "The acknowledgement written by the module on the destination chain. It is different from the [`crate::IbcAcknowledgement`] as it can be unsuccessful.", + "IbcAcknowledgement": { "type": "object", "required": [ - "data", - "success" + "data" ], "properties": { "data": { - "description": "The acknowledgement data returned by the module.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "success": { - "description": "Whether the acknowledgement was successful or not.", - "type": "boolean" + "$ref": "#/definitions/Binary" } }, "additionalProperties": false @@ -535,7 +524,7 @@ "description": "The acknowledgement to send back", "allOf": [ { - "$ref": "#/definitions/IbcFullAcknowledgement" + "$ref": "#/definitions/IbcAcknowledgement" } ] }, diff --git a/contracts/ibc-reflect-send/schema/ibc/packet_msg.json b/contracts/ibc-reflect-send/schema/ibc/packet_msg.json index 01712d977a..5adb814ade 100644 --- a/contracts/ibc-reflect-send/schema/ibc/packet_msg.json +++ b/contracts/ibc-reflect-send/schema/ibc/packet_msg.json @@ -343,25 +343,14 @@ } ] }, - "IbcFullAcknowledgement": { - "description": "The acknowledgement written by the module on the destination chain. It is different from the [`crate::IbcAcknowledgement`] as it can be unsuccessful.", + "IbcAcknowledgement": { "type": "object", "required": [ - "data", - "success" + "data" ], "properties": { "data": { - "description": "The acknowledgement data returned by the module.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "success": { - "description": "Whether the acknowledgement was successful or not.", - "type": "boolean" + "$ref": "#/definitions/Binary" } }, "additionalProperties": false @@ -476,7 +465,7 @@ "description": "The acknowledgement to send back", "allOf": [ { - "$ref": "#/definitions/IbcFullAcknowledgement" + "$ref": "#/definitions/IbcAcknowledgement" } ] }, diff --git a/contracts/ibc-reflect-send/schema/raw/execute.json b/contracts/ibc-reflect-send/schema/raw/execute.json index c3ffa80817..c11d6d9d5a 100644 --- a/contracts/ibc-reflect-send/schema/raw/execute.json +++ b/contracts/ibc-reflect-send/schema/raw/execute.json @@ -391,25 +391,14 @@ } ] }, - "IbcFullAcknowledgement": { - "description": "The acknowledgement written by the module on the destination chain. It is different from the [`crate::IbcAcknowledgement`] as it can be unsuccessful.", + "IbcAcknowledgement": { "type": "object", "required": [ - "data", - "success" + "data" ], "properties": { "data": { - "description": "The acknowledgement data returned by the module.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "success": { - "description": "Whether the acknowledgement was successful or not.", - "type": "boolean" + "$ref": "#/definitions/Binary" } }, "additionalProperties": false @@ -524,7 +513,7 @@ "description": "The acknowledgement to send back", "allOf": [ { - "$ref": "#/definitions/IbcFullAcknowledgement" + "$ref": "#/definitions/IbcAcknowledgement" } ] }, diff --git a/contracts/ibc-reflect/src/contract.rs b/contracts/ibc-reflect/src/contract.rs index 8278cf83b0..1c1eb4dba0 100644 --- a/contracts/ibc-reflect/src/contract.rs +++ b/contracts/ibc-reflect/src/contract.rs @@ -1,10 +1,10 @@ use cosmwasm_std::{ entry_point, from_json, to_json_binary, wasm_execute, BankMsg, Binary, CosmosMsg, Deps, - DepsMut, Empty, Env, Event, Ibc3ChannelOpenResponse, IbcBasicResponse, IbcChannelCloseMsg, - IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcFullAcknowledgement, - IbcMsg, IbcOrder, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, - IbcReceiveResponse, MessageInfo, Never, QueryResponse, Reply, Response, StdError, StdResult, - SubMsg, SubMsgResponse, SubMsgResult, WasmMsg, + DepsMut, Empty, Env, Event, Ibc3ChannelOpenResponse, IbcAcknowledgement, IbcBasicResponse, + IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcMsg, + IbcOrder, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, + MessageInfo, Never, QueryResponse, Reply, Response, StdError, StdResult, SubMsg, + SubMsgResponse, SubMsgResult, WasmMsg, }; use crate::msg::{ @@ -56,7 +56,7 @@ pub fn execute( fn execute_async_ack( channel_id: String, packet_sequence: u64, - ack: IbcFullAcknowledgement, + ack: IbcAcknowledgement, ) -> StdResult { Ok(Response::new().add_message(IbcMsg::WriteAcknowledgement { channel_id, diff --git a/contracts/ibc-reflect/src/msg.rs b/contracts/ibc-reflect/src/msg.rs index 99d75dc5b1..65277e1fc8 100644 --- a/contracts/ibc-reflect/src/msg.rs +++ b/contracts/ibc-reflect/src/msg.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{Coin, CosmosMsg, IbcFullAcknowledgement, Uint64}; +use cosmwasm_std::{Coin, CosmosMsg, IbcAcknowledgement, Uint64}; /// Just needs to know the code_id of a reflect contract to spawn sub-accounts #[cw_serde] @@ -15,7 +15,7 @@ pub enum ExecuteMsg { /// Sequence number of the packet that was received packet_sequence: Uint64, /// The acknowledgement to send back - ack: IbcFullAcknowledgement, + ack: IbcAcknowledgement, }, } @@ -116,25 +116,3 @@ pub struct BalancesResponse { /// This is the success response we send on ack for PacketMsg::ReturnMsgs. /// Just acknowledge success or error pub type ReturnMsgsResponse = (); - -#[cfg(test)] -mod tests { - use cosmwasm_std::from_json; - - use super::*; - - #[test] - fn test_serde_packet_msg() { - let packet_msg = PacketMsg::AsyncAck { - channel_id: "channel-0".to_string(), - packet_sequence: Uint64(1), - ack: IbcFullAcknowledgement { - data: Some(b"my ack".to_vec()), - ..Default::default() - }, - }; - - let json = r#"{"async_ack":{"channel_id":"channel-0","packet_sequence": 1, "ack": {"data":"my ack", "success": true}}}"#; - let packet_msg: PacketMsg = from_json(json).unwrap(); - } -} diff --git a/packages/std/src/ibc.rs b/packages/std/src/ibc.rs index d3581296a0..1447d34018 100644 --- a/packages/std/src/ibc.rs +++ b/packages/std/src/ibc.rs @@ -63,7 +63,7 @@ pub enum IbcMsg { /// Sequence number of the packet that was received packet_sequence: u64, /// The acknowledgement to send back - ack: IbcFullAcknowledgement, + ack: IbcAcknowledgement, }, /// This will close an existing channel that is owned by this contract. /// Port is auto-assigned to the contract's IBC port