diff --git a/packages/interchain/interchain-core/Cargo.toml b/packages/interchain/interchain-core/Cargo.toml index f2b49b29..1ec4101c 100644 --- a/packages/interchain/interchain-core/Cargo.toml +++ b/packages/interchain/interchain-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cw-orch-interchain-core" -version = "0.8.4" +version = "0.8.5" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/packages/interchain/interchain-core/src/ack_parser.rs b/packages/interchain/interchain-core/src/ack_parser.rs index 200cc4db..a56b1a8e 100644 --- a/packages/interchain/interchain-core/src/ack_parser.rs +++ b/packages/interchain/interchain-core/src/ack_parser.rs @@ -51,15 +51,12 @@ impl IbcAckParser { /// /// Returns an error if there was an error in the parsing process pub fn ics20_ack(ack: &Binary) -> Result<(), InterchainError> { - let decoded_fungible_packet: Result = from_json(ack); - if let Ok(decoded_fungible_packet) = decoded_fungible_packet { - match decoded_fungible_packet { - FungibleTokenPacketAcknowledgement::Result(_) => return Ok(()), - FungibleTokenPacketAcknowledgement::Error(e) => { - return Err(InterchainError::FailedAckReceived(e)) - } - } + let successful_ics20_packet = Binary::new(vec![0x01]); + + if ack == &successful_ics20_packet { + return Ok(()); } + Err(decode_ack_error(ack)) } @@ -118,15 +115,6 @@ pub(crate) fn decode_ack_error(ack: &Binary) -> InterchainError { ) } -#[cw_serde] -/// Taken from https://github.com/cosmos/ibc/blob/main/spec/app/ics-020-fungible-token-transfer/README.md#data-structures -pub enum FungibleTokenPacketAcknowledgement { - /// Successful packet - Result(Binary), - /// Error packet - Error(String), -} - /// This is copied from https://github.com/cosmos/cosmos-rust/blob/4f2e3bbf9c67c8ffef44ef1e485a327fd66f060a/cosmos-sdk-proto/src/prost/ibc-go/ibc.core.channel.v1.rs#L164 /// This is the ICS-004 standard proposal pub mod acknowledgement { @@ -210,3 +198,18 @@ pub mod polytone_callback { FatalError(String), } } + +#[cfg(test)] +mod test { + use cosmwasm_std::Binary; + + use super::IbcAckParser; + + #[test] + fn ics20_ack_test() -> cw_orch::anyhow::Result<()> { + let success_ack = Binary::from_base64("AQ==")?; + + IbcAckParser::ics20_ack(&success_ack)?; + Ok(()) + } +}