diff --git a/Cargo.lock b/Cargo.lock index 09344dfe85..5f556161bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2041,15 +2041,6 @@ dependencies = [ "unionlabs", ] -[[package]] -name = "diferred-ack-api" -version = "0.1.0" -dependencies = [ - "cosmwasm-schema 2.0.2", - "cosmwasm-std 2.0.3", - "thiserror", -] - [[package]] name = "digest" version = "0.9.0" @@ -7544,7 +7535,6 @@ dependencies = [ "cw-controllers", "cw-storage-plus 2.0.0", "cw2 2.0.0", - "diferred-ack-api", "dlmalloc", "ethabi", "go-parse-duration", @@ -7567,7 +7557,6 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema 2.0.2", "cosmwasm-std 2.0.3", - "diferred-ack-api", "ethabi", "go-parse-duration", "prost", diff --git a/Cargo.toml b/Cargo.toml index e23c5db829..1422389d22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ resolver = "2" # NOTE: All paths must be listed out (i.e. no globs) since ifd is still broken in nix (still can't import the output of `cargo metadata` :( ). See crane.nix for where this is used. members = [ "cosmwasm/token-factory-api", - "cosmwasm/diferred-ack-api", "cosmwasm/ucs00-pingpong", "cosmwasm/ucs01-relay", "cosmwasm/ucs01-relay-api", @@ -92,7 +91,6 @@ block-message = { path = "lib/block-message", default-features = fal chain-utils = { path = "lib/chain-utils", default-features = false } cometbls-groth16-verifier = { path = "lib/cometbls-groth16-verifier", default-features = false } contracts = { path = "generated/rust/contracts", default-features = false } -diferred-ack-api = { path = "cosmwasm/diferred-ack-api", default-features = false } ethereum-light-client = { path = "light-clients/ethereum-light-client", default-features = false } ethereum-verifier = { path = "lib/ethereum-verifier", default-features = false } gnark-key-parser = { path = "lib/gnark-key-parser", default-features = false } diff --git a/cosmwasm/diferred-ack-api/Cargo.toml b/cosmwasm/diferred-ack-api/Cargo.toml deleted file mode 100644 index 729c10d57f..0000000000 --- a/cosmwasm/diferred-ack-api/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -edition = "2021" -name = "diferred-ack-api" -version = "0.1.0" - -[lints] -workspace = true - -[dependencies] -cosmwasm-schema = { version = "2.0.0" } -cosmwasm-std = { version = "2.0.0" } -thiserror = { workspace = true } diff --git a/cosmwasm/diferred-ack-api/src/lib.rs b/cosmwasm/diferred-ack-api/src/lib.rs deleted file mode 100644 index 6d76d1063f..0000000000 --- a/cosmwasm/diferred-ack-api/src/lib.rs +++ /dev/null @@ -1,85 +0,0 @@ -use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{Binary, CosmosMsg, CustomMsg, CustomQuery, Uint64}; - -#[derive(thiserror::Error, Clone, PartialEq, Eq, Debug)] -pub enum EncodingError { - #[error("Unable to encode or decode the data")] - InvalidEncoding, -} - -/// Special messages to be supported by any chain that supports diferred_ack -#[cw_serde] -pub enum DiferredAckMsg { - WriteDiferredAck { - sender: String, - diferred_packet_info: DiferredPacketInfo, - ack: Acknowledgement, - }, -} - -impl TryFrom for Binary { - type Error = EncodingError; - - fn try_from(value: DiferredAckMsg) -> Result { - Ok(cosmwasm_std::to_json_vec(&value) - .map_err(|_| EncodingError::InvalidEncoding)? - .into()) - } -} - -#[cw_serde] -pub struct DiferredPacketInfo { - pub refund_channel_id: String, - pub refund_port_id: String, - pub packet_src_channel_id: String, - pub packet_src_port_id: String, - pub packet_timeout_timestamp: Uint64, - pub packet_timeout_height: String, - pub packet_data: Binary, - pub sequence: Uint64, -} - -/// Acknowledgement is the recommended acknowledgement format to be used by -/// app-specific protocols. -#[cw_serde] -pub struct Acknowledgement { - /// response contains either a result or an error and must be non-empty - pub response: Option, -} - -/// response contains either a result or an error and must be non-empty -#[cw_serde] -pub enum Response { - Result(Binary), - Error(String), -} - -/// This maps to diferredack.v1beta1.Params protobuf struct -#[cw_serde] -pub struct Params {} - -impl From for CosmosMsg { - fn from(msg: DiferredAckMsg) -> CosmosMsg { - CosmosMsg::Custom(msg) - } -} - -impl CustomMsg for DiferredAckMsg {} - -/// This is in the data field in the reply from a DiferredAck::WriteDiferredAck SubMsg -pub struct WriteDiferredAckResponse {} - -#[cw_serde] -#[derive(QueryResponses)] -pub enum DiferredAckQuery { - /// Returns configuration params for Diferred Ack modules - #[returns(ParamsResponse)] - Params {}, -} - -impl CustomQuery for DiferredAckQuery {} - -#[cw_serde] -pub struct ParamsResponse { - pub params: Params, -} diff --git a/cosmwasm/ucs01-relay-api/Cargo.toml b/cosmwasm/ucs01-relay-api/Cargo.toml index 5a71666d8e..ba942bef78 100644 --- a/cosmwasm/ucs01-relay-api/Cargo.toml +++ b/cosmwasm/ucs01-relay-api/Cargo.toml @@ -9,7 +9,6 @@ workspace = true [dependencies] cosmwasm-schema = { version = "2.0.0" } cosmwasm-std = { version = "2.0.0", features = ["stargate"] } -diferred-ack-api = { workspace = true } ethabi = { workspace = true } go-parse-duration = { workspace = true } prost = { workspace = true } diff --git a/cosmwasm/ucs01-relay/Cargo.toml b/cosmwasm/ucs01-relay/Cargo.toml index a46605e084..95e599b8ef 100644 --- a/cosmwasm/ucs01-relay/Cargo.toml +++ b/cosmwasm/ucs01-relay/Cargo.toml @@ -22,7 +22,6 @@ cosmwasm-std = { version = "2.0.0", features = ["stargate", "cosmwasm_2_0", cw-controllers = { version = "2.0.0" } cw-storage-plus = { version = "2.0.0" } cw2 = { version = "2.0.0" } -diferred-ack-api = { workspace = true } dlmalloc = { workspace = true, features = ["global"] } ethabi = { workspace = true } go-parse-duration = { workspace = true } diff --git a/cosmwasm/ucs01-relay/src/protocol.rs b/cosmwasm/ucs01-relay/src/protocol.rs index 87b277dee1..5d8fc7fad0 100644 --- a/cosmwasm/ucs01-relay/src/protocol.rs +++ b/cosmwasm/ucs01-relay/src/protocol.rs @@ -4,7 +4,7 @@ use cosmwasm_std::{ }; use prost::Message; use protos::{ - diferredack::v1beta1::MsgWriteDiferredAck, + deferredack::v1beta1::MsgWriteDeferredAck, ibc::core::channel::v1::{acknowledgement::Response, Acknowledgement}, }; use sha2::{Digest, Sha256}; @@ -646,7 +646,7 @@ impl<'a> TransferProtocol for Ics20Protocol<'a> { Err(_) => return Ok(None), }; - let (mut ack_msgs, mut ack_attr, ack_dif) = match ack { + let (mut ack_msgs, mut ack_attr, ack_def) = match ack { Ok(value) => { let value_string = value.to_string(); ( @@ -678,7 +678,7 @@ impl<'a> TransferProtocol for Ics20Protocol<'a> { None => "0-0".to_string(), }; - let diferred_packet_into = protos::diferredack::v1beta1::DiferredPacketInfo { + let deferred_packet_into = protos::deferredack::v1beta1::DeferredPacketInfo { refund_channel_id: refund_info.refund_channel_id, refund_port_id: refund_info.refund_port_id, packet_src_channel_id: refund_info.packet_src_channel_id, @@ -689,19 +689,19 @@ impl<'a> TransferProtocol for Ics20Protocol<'a> { sequence: refund_info.packet_sequence, }; - let value = MsgWriteDiferredAck { + let value = MsgWriteDeferredAck { sender: self.self_addr().to_string(), - diferred_packet_info: Some(diferred_packet_into), - ack: Some(ack_dif), + deferred_packet_info: Some(deferred_packet_into), + ack: Some(ack_def), } .encode_to_vec(); - let diferred_ack_msg = CosmosMsg::::Any(AnyMsg { - type_url: "/diferredack.v1beta1.MsgWriteDiferredAck".to_owned(), + let deferred_ack_msg = CosmosMsg::::Any(AnyMsg { + type_url: "/deferredack.v1beta1.MsgWriteDeferredAck".to_owned(), value: value.into(), }); - ack_msgs.append(vec![diferred_ack_msg].as_mut()); + ack_msgs.append(vec![deferred_ack_msg].as_mut()); ack_attr.append(vec![("pfm", "pfm_ack_confirm".to_string())].as_mut()); IN_FLIGHT_PFM_PACKETS.remove(self.common.deps.storage, refund_key); @@ -1009,7 +1009,7 @@ impl<'a> TransferProtocol for Ucs01Protocol<'a> { Err(_) => return Ok(None), }; - let (mut ack_msgs, mut ack_attr, ack_dif) = match ack { + let (mut ack_msgs, mut ack_attr, ack_def) = match ack { Ok(value) => { let value_string = value.to_string(); ( @@ -1041,7 +1041,7 @@ impl<'a> TransferProtocol for Ucs01Protocol<'a> { None => "0-0".to_string(), }; - let diferred_packet_into = protos::diferredack::v1beta1::DiferredPacketInfo { + let deferred_packet_into = protos::deferredack::v1beta1::DeferredPacketInfo { refund_channel_id: refund_info.refund_channel_id, refund_port_id: refund_info.refund_port_id, packet_src_channel_id: refund_info.packet_src_channel_id, @@ -1052,19 +1052,19 @@ impl<'a> TransferProtocol for Ucs01Protocol<'a> { sequence, }; - let value = MsgWriteDiferredAck { + let value = MsgWriteDeferredAck { sender: self.self_addr().to_string(), - diferred_packet_info: Some(diferred_packet_into), - ack: Some(ack_dif), + deferred_packet_info: Some(deferred_packet_into), + ack: Some(ack_def), } .encode_to_vec(); - let diferred_ack_msg = CosmosMsg::::Any(AnyMsg { - type_url: "/diferredack.v1beta1.MsgWriteDiferredAck".to_owned(), + let deferred_ack_msg = CosmosMsg::::Any(AnyMsg { + type_url: "/deferredack.v1beta1.MsgWriteDeferredAck".to_owned(), value: value.into(), }); - ack_msgs.append(vec![diferred_ack_msg].as_mut()); + ack_msgs.append(vec![deferred_ack_msg].as_mut()); ack_attr.append(vec![("pfm", "pfm_ack".to_string())].as_mut()); IN_FLIGHT_PFM_PACKETS.remove(self.common.deps.storage, refund_key); @@ -1171,7 +1171,7 @@ mod tests { } #[test] - fn receive_transfer_destination_collision_yields_different_hashes() { + fn receive_transfer_destination_collision_yields_defferent_hashes() { let source_endpoint_1 = IbcEndpoint { port_id: "wasm.0xDEADC0DE".into(), channel_id: "channel-1".into(),