Skip to content

Commit

Permalink
Remove IbcFullAcknowledgement from async ack
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed May 10, 2024
1 parent 0a9d03a commit b2889cd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 76 deletions.
19 changes: 4 additions & 15 deletions contracts/ibc-reflect-send/schema/ibc-reflect-send.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -535,7 +524,7 @@
"description": "The acknowledgement to send back",
"allOf": [
{
"$ref": "#/definitions/IbcFullAcknowledgement"
"$ref": "#/definitions/IbcAcknowledgement"
}
]
},
Expand Down
19 changes: 4 additions & 15 deletions contracts/ibc-reflect-send/schema/ibc/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -476,7 +465,7 @@
"description": "The acknowledgement to send back",
"allOf": [
{
"$ref": "#/definitions/IbcFullAcknowledgement"
"$ref": "#/definitions/IbcAcknowledgement"
}
]
},
Expand Down
19 changes: 4 additions & 15 deletions contracts/ibc-reflect-send/schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -524,7 +513,7 @@
"description": "The acknowledgement to send back",
"allOf": [
{
"$ref": "#/definitions/IbcFullAcknowledgement"
"$ref": "#/definitions/IbcAcknowledgement"
}
]
},
Expand Down
12 changes: 6 additions & 6 deletions contracts/ibc-reflect/src/contract.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -56,7 +56,7 @@ pub fn execute(
fn execute_async_ack(
channel_id: String,
packet_sequence: u64,
ack: IbcFullAcknowledgement,
ack: IbcAcknowledgement,
) -> StdResult<Response> {
Ok(Response::new().add_message(IbcMsg::WriteAcknowledgement {
channel_id,
Expand Down
26 changes: 2 additions & 24 deletions contracts/ibc-reflect/src/msg.rs
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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,
},
}

Expand Down Expand Up @@ -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();
}
}
2 changes: 1 addition & 1 deletion packages/std/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2889cd

Please sign in to comment.