diff --git a/Cargo.lock b/Cargo.lock index 3d807e9d6f..b4b72cf6f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1441,9 +1441,9 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d0bc49ee5fc8e5d0e668765d470cb201fd0cdee4166f49c6cbcf3100466137" +checksum = "f6e8625e1aa28e4da4a33505c6469747a9201f14ccd9012e2481313dfbbf9e2f" dependencies = [ "base64 0.21.2", "bytes", diff --git a/crates/chain-registry/Cargo.toml b/crates/chain-registry/Cargo.toml index 890f2af979..a8c2809788 100644 --- a/crates/chain-registry/Cargo.toml +++ b/crates/chain-registry/Cargo.toml @@ -12,7 +12,7 @@ description = """ """ [dependencies] -ibc-proto = { version = "0.33.0" } +ibc-proto = { version = "0.34.0", features = ["serde"] } ibc-relayer-types = { version = "0.25.0", path = "../relayer-types" } tendermint-rpc = { version = "0.33.0", features = [ "http-client", diff --git a/crates/relayer-types/Cargo.toml b/crates/relayer-types/Cargo.toml index e890969979..9b96c6496d 100644 --- a/crates/relayer-types/Cargo.toml +++ b/crates/relayer-types/Cargo.toml @@ -24,7 +24,7 @@ mocks = ["tendermint-testgen", "clock"] [dependencies] # Proto definitions for all IBC-related interfaces, e.g., connections or channels. -ibc-proto = { version = "0.33.0" } +ibc-proto = { version = "0.34.0" } ics23 = { version = "0.10.2", features = ["std", "host-functions"] } time = { version = "0.3" } serde_derive = { version = "1.0.104" } diff --git a/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs b/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs index 3668563bda..f8d1034a3e 100644 --- a/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs +++ b/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs @@ -48,6 +48,7 @@ impl TryFrom for Misbehaviour { impl From for RawMisbehaviour { fn from(value: Misbehaviour) -> Self { + #[allow(deprecated)] RawMisbehaviour { client_id: value.client_id.to_string(), header_1: Some(value.header1.into()), diff --git a/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs b/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs index 8e457266d4..5ab3fef364 100644 --- a/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs +++ b/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs @@ -54,7 +54,7 @@ impl TryFrom for MsgUpdateClient { .client_id .parse() .map_err(Error::invalid_msg_update_client_id)?, - header: raw.header.ok_or_else(Error::missing_raw_header)?, + header: raw.client_message.ok_or_else(Error::missing_raw_header)?, signer: raw.signer.parse().map_err(Error::signer)?, }) } @@ -64,7 +64,7 @@ impl From for RawMsgUpdateClient { fn from(ics_msg: MsgUpdateClient) -> Self { RawMsgUpdateClient { client_id: ics_msg.client_id.to_string(), - header: Some(ics_msg.header), + client_message: Some(ics_msg.header), signer: ics_msg.signer.to_string(), } } diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs index ca35efe957..72798ecc2a 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs @@ -55,7 +55,8 @@ impl TryFrom for MsgConnectionOpenAck { .consensus_height .and_then(|raw_height| raw_height.try_into().ok()) .ok_or_else(Error::missing_consensus_height)?; - let consensus_proof_obj = ConsensusProof::new( + + let consensus_proof = ConsensusProof::new( msg.proof_consensus .try_into() .map_err(Error::invalid_proof)?, @@ -71,6 +72,10 @@ impl TryFrom for MsgConnectionOpenAck { let client_proof = CommitmentProofBytes::try_from(msg.proof_client).map_err(Error::invalid_proof)?; + // Host consensus state proof can be missing for IBC-Go < 7.2.0 + let consensus_state_proof = + CommitmentProofBytes::try_from(msg.host_consensus_state_proof).ok(); + Ok(Self { connection_id: msg .connection_id @@ -85,7 +90,8 @@ impl TryFrom for MsgConnectionOpenAck { proofs: Proofs::new( msg.proof_try.try_into().map_err(Error::invalid_proof)?, Some(client_proof), - Option::from(consensus_proof_obj), + Some(consensus_proof), + consensus_state_proof, None, proof_height, ) @@ -106,16 +112,19 @@ impl From for RawMsgConnectionOpenAck { proof_client: ics_msg .proofs .client_proof() - .clone() - .map_or_else(Vec::new, |v| v.into()), + .map_or_else(Vec::new, |v| v.to_bytes()), proof_consensus: ics_msg .proofs .consensus_proof() - .map_or_else(Vec::new, |v| v.proof().clone().into()), + .map_or_else(Vec::new, |v| v.proof().to_bytes()), consensus_height: ics_msg .proofs .consensus_proof() .map_or_else(|| None, |h| Some(h.height().into())), + host_consensus_state_proof: ics_msg + .proofs + .host_consensus_state_proof() + .map_or_else(Vec::new, |v| v.to_bytes()), version: Some(ics_msg.version.into()), signer: ics_msg.signer.to_string(), } @@ -145,6 +154,7 @@ pub mod test_util { revision_height: proof_height, }), proof_consensus: get_dummy_proof(), + host_consensus_state_proof: get_dummy_proof(), consensus_height: Some(Height { revision_number: 0, revision_height: consensus_height, diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs index 6971415e91..ae20b9bd5f 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs @@ -54,6 +54,7 @@ impl TryFrom for MsgConnectionOpenConfirm { None, None, None, + None, proof_height, ) .map_err(Error::invalid_proof)?, diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs index bd768a36c0..2915ff87bd 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs @@ -90,6 +90,10 @@ impl TryFrom for MsgConnectionOpenTry { let client_proof = CommitmentProofBytes::try_from(msg.proof_client).map_err(Error::invalid_proof)?; + // Host consensus state proof can be missing for IBC-Go < 7.2.0 + let host_consensus_state_proof = + CommitmentProofBytes::try_from(msg.host_consensus_state_proof).ok(); + let counterparty_versions = msg .counterparty_versions .into_iter() @@ -113,6 +117,7 @@ impl TryFrom for MsgConnectionOpenTry { msg.proof_init.try_into().map_err(Error::invalid_proof)?, Some(client_proof), Some(consensus_proof_obj), + host_consensus_state_proof, None, proof_height, ) @@ -144,12 +149,15 @@ impl From for RawMsgConnectionOpenTry { proof_client: ics_msg .proofs .client_proof() - .clone() - .map_or_else(Vec::new, |v| v.into()), + .map_or_else(Vec::new, |v| v.to_bytes()), proof_consensus: ics_msg .proofs .consensus_proof() - .map_or_else(Vec::new, |v| v.proof().clone().into()), + .map_or_else(Vec::new, |v| v.proof().to_bytes()), + host_consensus_state_proof: ics_msg + .proofs + .host_consensus_state_proof() + .map_or_else(Vec::new, |v| v.to_bytes()), consensus_height: ics_msg .proofs .consensus_proof() @@ -215,6 +223,7 @@ pub mod test_util { revision_height: proof_height, }), proof_consensus: get_dummy_proof(), + host_consensus_state_proof: get_dummy_proof(), consensus_height: Some(Height { revision_number: 0, revision_height: consensus_height, diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs b/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs index 0494bc0361..3bb054f8cb 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs @@ -88,6 +88,7 @@ impl TryFrom for MsgAcknowledgement { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs index 131f27dc57..9102a104a5 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs @@ -60,6 +60,7 @@ impl TryFrom for MsgChannelCloseConfirm { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs index c95a1f0204..7409775097 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs @@ -68,6 +68,7 @@ impl TryFrom for MsgChannelOpenAck { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs index 2bc80b8307..6a29096945 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs @@ -57,6 +57,7 @@ impl TryFrom for MsgChannelOpenConfirm { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs index 22c1020d0d..c9b65c6772 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs @@ -83,6 +83,7 @@ impl TryFrom for MsgChannelOpenTry { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs b/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs index 0abdbdf3c9..24d0b587ee 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs @@ -57,6 +57,7 @@ impl TryFrom for MsgRecvPacket { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs b/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs index 465a24636a..0c8f2cc620 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs @@ -64,6 +64,7 @@ impl TryFrom for MsgTimeout { None, None, None, + None, raw_msg .proof_height .and_then(|raw_height| raw_height.try_into().ok()) diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs b/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs index d1de6e4988..e4d39f956a 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs @@ -62,6 +62,7 @@ impl TryFrom for MsgTimeoutOnClose { .map_err(Error::invalid_proof)?, None, None, + None, Some( raw_msg .proof_close @@ -97,8 +98,7 @@ impl From for RawMsgTimeoutOnClose { proof_close: domain_msg .proofs .other_proof() - .clone() - .map_or_else(Vec::new, |v| v.into()), + .map_or_else(Vec::new, |v| v.to_bytes()), proof_height: Some(domain_msg.proofs.height().into()), next_sequence_recv: domain_msg.next_sequence_recv.into(), signer: domain_msg.signer.to_string(), diff --git a/crates/relayer-types/src/core/ics23_commitment/commitment.rs b/crates/relayer-types/src/core/ics23_commitment/commitment.rs index de0eb472eb..978f126df0 100644 --- a/crates/relayer-types/src/core/ics23_commitment/commitment.rs +++ b/crates/relayer-types/src/core/ics23_commitment/commitment.rs @@ -56,6 +56,20 @@ pub struct CommitmentProofBytes { bytes: Vec, } +impl CommitmentProofBytes { + pub fn into_bytes(self) -> Vec { + self.bytes + } + + pub fn to_bytes(&self) -> Vec { + self.bytes.to_vec() + } + + pub fn as_bytes(&self) -> &[u8] { + &self.bytes + } +} + impl fmt::Debug for CommitmentProofBytes { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let hex = Hex::upper_case().encode_to_string(&self.bytes).unwrap(); diff --git a/crates/relayer-types/src/proofs.rs b/crates/relayer-types/src/proofs.rs index e41021e7dc..945cafbd6e 100644 --- a/crates/relayer-types/src/proofs.rs +++ b/crates/relayer-types/src/proofs.rs @@ -28,6 +28,7 @@ pub struct Proofs { object_proof: CommitmentProofBytes, client_proof: Option, consensus_proof: Option, + host_consensus_state_proof: Option, /// Currently used for proof_close for MsgTimeoutOnCLose where object_proof is proof_unreceived other_proof: Option, /// Height for the commitment root for proving the proofs above. @@ -40,6 +41,7 @@ impl Proofs { object_proof: CommitmentProofBytes, client_proof: Option, consensus_proof: Option, + host_consensus_state_proof: Option, other_proof: Option, height: Height, ) -> Result { @@ -47,6 +49,7 @@ impl Proofs { object_proof, client_proof, consensus_proof, + host_consensus_state_proof, other_proof, height, }) @@ -54,8 +57,14 @@ impl Proofs { /// Getter for the consensus_proof field of this proof. Intuitively, this is a proof that a /// client on the source chain stores a consensus state for the destination chain. - pub fn consensus_proof(&self) -> Option { - self.consensus_proof.clone() + pub fn consensus_proof(&self) -> Option<&ConsensusProof> { + self.consensus_proof.as_ref() + } + + /// Getter for the host_consensus_state_proof field of this proof. + /// This is an optional proof data for host state machines that are unable to introspect their own consensus state. + pub fn host_consensus_state_proof(&self) -> Option<&CommitmentProofBytes> { + self.host_consensus_state_proof.as_ref() } /// Getter for the height field of this proof (i.e., the consensus height where this proof was @@ -70,13 +79,13 @@ impl Proofs { } /// Getter for the client_proof. - pub fn client_proof(&self) -> &Option { - &self.client_proof + pub fn client_proof(&self) -> Option<&CommitmentProofBytes> { + self.client_proof.as_ref() } /// Getter for the other_proof. - pub fn other_proof(&self) -> &Option { - &self.other_proof + pub fn other_proof(&self) -> Option<&CommitmentProofBytes> { + self.other_proof.as_ref() } } diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index ee92d095e2..07eb956974 100644 --- a/crates/relayer/Cargo.toml +++ b/crates/relayer/Cargo.toml @@ -20,7 +20,7 @@ default = ["flex-error/std", "flex-error/eyre_tracer"] telemetry = ["ibc-telemetry"] [dependencies] -ibc-proto = { version = "0.33.0" } +ibc-proto = { version = "0.34.0", features = ["serde"] } ibc-telemetry = { version = "0.25.0", path = "../telemetry", optional = true } ibc-relayer-types = { version = "0.25.0", path = "../relayer-types", features = ["mocks"] } diff --git a/crates/relayer/src/chain/cosmos/query/balance.rs b/crates/relayer/src/chain/cosmos/query/balance.rs index 114bd27e74..f8c5e30580 100644 --- a/crates/relayer/src/chain/cosmos/query/balance.rs +++ b/crates/relayer/src/chain/cosmos/query/balance.rs @@ -55,6 +55,7 @@ pub async fn query_all_balances( let request = tonic::Request::new(QueryAllBalancesRequest { address: account_address.to_string(), + resolve_denom: false, pagination: None, }); diff --git a/crates/relayer/src/chain/endpoint.rs b/crates/relayer/src/chain/endpoint.rs index 5d2f70ab10..4c0134dfb3 100644 --- a/crates/relayer/src/chain/endpoint.rs +++ b/crates/relayer/src/chain/endpoint.rs @@ -492,6 +492,7 @@ pub trait ChainEndpoint: Sized { CommitmentProofBytes::try_from(connection_proof).map_err(Error::malformed_proof)?, client_proof, consensus_proof, + None, // TODO: Retrieve host consensus proof when available None, height.increment(), ) @@ -523,8 +524,15 @@ pub trait ChainEndpoint: Sized { let channel_proof_bytes = CommitmentProofBytes::try_from(channel_proof).map_err(Error::malformed_proof)?; - Proofs::new(channel_proof_bytes, None, None, None, height.increment()) - .map_err(Error::malformed_proof) + Proofs::new( + channel_proof_bytes, + None, + None, + None, + None, + height.increment(), + ) + .map_err(Error::malformed_proof) } /// Builds the proof for packet messages. @@ -662,6 +670,7 @@ pub trait ChainEndpoint: Sized { CommitmentProofBytes::try_from(packet_proof).map_err(Error::malformed_proof)?, None, None, + None, channel_proof, height.increment(), ) diff --git a/tools/test-framework/Cargo.toml b/tools/test-framework/Cargo.toml index 0dcd3daca3..e8cdf503dc 100644 --- a/tools/test-framework/Cargo.toml +++ b/tools/test-framework/Cargo.toml @@ -17,7 +17,7 @@ description = """ ibc-relayer-types = { version = "=0.25.0", path = "../../crates/relayer-types" } ibc-relayer = { version = "=0.25.0", path = "../../crates/relayer" } ibc-relayer-cli = { version = "=1.6.0", path = "../../crates/relayer-cli" } -ibc-proto = { version = "0.33.0" } +ibc-proto = { version = "0.34.0", features = ["serde"] } tendermint-rpc = { version = "0.33.0", features = ["http-client", "websocket-client"] } http = "0.2.9"