Skip to content

Commit

Permalink
Bump ibc-proto from 0.33.0 to 0.34.0 (#3552)
Browse files Browse the repository at this point in the history
* Bump ibc-proto from 0.33.0 to 0.34.0

Bumps [ibc-proto](https://github.com/cosmos/ibc-proto-rs) from 0.33.0 to 0.34.0.
- [Release notes](https://github.com/cosmos/ibc-proto-rs/releases)
- [Changelog](https://github.com/cosmos/ibc-proto-rs/blob/main/CHANGELOG.md)
- [Commits](cosmos/ibc-proto-rs@v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: ibc-proto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Post-update fixes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Romain Ruetschi <106849+romac@users.noreply.github.com>
Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
3 people authored Sep 14, 2023
1 parent 4b3b8cd commit 070f60d
Show file tree
Hide file tree
Showing 22 changed files with 87 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/chain-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl TryFrom<RawMisbehaviour> for Misbehaviour {

impl From<Misbehaviour> for RawMisbehaviour {
fn from(value: Misbehaviour) -> Self {
#[allow(deprecated)]
RawMisbehaviour {
client_id: value.client_id.to_string(),
header_1: Some(value.header1.into()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl TryFrom<RawMsgUpdateClient> 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)?,
})
}
Expand All @@ -64,7 +64,7 @@ impl From<MsgUpdateClient> 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(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ impl TryFrom<RawMsgConnectionOpenAck> 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)?,
Expand All @@ -71,6 +72,10 @@ impl TryFrom<RawMsgConnectionOpenAck> 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
Expand All @@ -85,7 +90,8 @@ impl TryFrom<RawMsgConnectionOpenAck> 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,
)
Expand All @@ -106,16 +112,19 @@ impl From<MsgConnectionOpenAck> 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(),
}
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl TryFrom<RawMsgConnectionOpenConfirm> for MsgConnectionOpenConfirm {
None,
None,
None,
None,
proof_height,
)
.map_err(Error::invalid_proof)?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ impl TryFrom<RawMsgConnectionOpenTry> 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()
Expand All @@ -113,6 +117,7 @@ impl TryFrom<RawMsgConnectionOpenTry> 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,
)
Expand Down Expand Up @@ -144,12 +149,15 @@ impl From<MsgConnectionOpenTry> 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()
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl TryFrom<RawMsgAcknowledgement> for MsgAcknowledgement {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl TryFrom<RawMsgChannelCloseConfirm> for MsgChannelCloseConfirm {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl TryFrom<RawMsgChannelOpenAck> for MsgChannelOpenAck {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl TryFrom<RawMsgChannelOpenConfirm> for MsgChannelOpenConfirm {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl TryFrom<RawMsgChannelOpenTry> for MsgChannelOpenTry {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl TryFrom<RawMsgRecvPacket> for MsgRecvPacket {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl TryFrom<RawMsgTimeout> for MsgTimeout {
None,
None,
None,
None,
raw_msg
.proof_height
.and_then(|raw_height| raw_height.try_into().ok())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl TryFrom<RawMsgTimeoutOnClose> for MsgTimeoutOnClose {
.map_err(Error::invalid_proof)?,
None,
None,
None,
Some(
raw_msg
.proof_close
Expand Down Expand Up @@ -97,8 +98,7 @@ impl From<MsgTimeoutOnClose> 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(),
Expand Down
14 changes: 14 additions & 0 deletions crates/relayer-types/src/core/ics23_commitment/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ pub struct CommitmentProofBytes {
bytes: Vec<u8>,
}

impl CommitmentProofBytes {
pub fn into_bytes(self) -> Vec<u8> {
self.bytes
}

pub fn to_bytes(&self) -> Vec<u8> {
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();
Expand Down
21 changes: 15 additions & 6 deletions crates/relayer-types/src/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct Proofs {
object_proof: CommitmentProofBytes,
client_proof: Option<CommitmentProofBytes>,
consensus_proof: Option<ConsensusProof>,
host_consensus_state_proof: Option<CommitmentProofBytes>,
/// Currently used for proof_close for MsgTimeoutOnCLose where object_proof is proof_unreceived
other_proof: Option<CommitmentProofBytes>,
/// Height for the commitment root for proving the proofs above.
Expand All @@ -40,22 +41,30 @@ impl Proofs {
object_proof: CommitmentProofBytes,
client_proof: Option<CommitmentProofBytes>,
consensus_proof: Option<ConsensusProof>,
host_consensus_state_proof: Option<CommitmentProofBytes>,
other_proof: Option<CommitmentProofBytes>,
height: Height,
) -> Result<Self, ProofError> {
Ok(Self {
object_proof,
client_proof,
consensus_proof,
host_consensus_state_proof,
other_proof,
height,
})
}

/// 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<ConsensusProof> {
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
Expand All @@ -70,13 +79,13 @@ impl Proofs {
}

/// Getter for the client_proof.
pub fn client_proof(&self) -> &Option<CommitmentProofBytes> {
&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<CommitmentProofBytes> {
&self.other_proof
pub fn other_proof(&self) -> Option<&CommitmentProofBytes> {
self.other_proof.as_ref()
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
1 change: 1 addition & 0 deletions crates/relayer/src/chain/cosmos/query/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
13 changes: 11 additions & 2 deletions crates/relayer/src/chain/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(),
)
Expand Down
2 changes: 1 addition & 1 deletion tools/test-framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 070f60d

Please sign in to comment.