Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump ibc-proto-rs to v0.38.0 + some other dependency upgrades #949

Merged
merged 4 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Bump `ibc-proto-rs` to v0.38.0
([#949](https://github.com/cosmos/ibc-rs/issues/949))
Farhad-Shabani marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions ci/cw-check/Cargo.lock

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

4 changes: 2 additions & 2 deletions ci/no-std-check/Cargo.lock

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

10 changes: 5 additions & 5 deletions ci/no-std-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver = "2"

[dependencies]
ibc = { path = "../../crates/ibc", default-features = false, features = ["serde"] }
ibc-proto = { version = "0.37.1", default-features = false, features = [
ibc-proto = { version = "0.38.0", default-features = false, features = [
"parity-scale-codec",
"borsh",
"serde",
Expand All @@ -15,10 +15,10 @@ tendermint = { version = "0.34", default-features = false }
tendermint-proto = { version = "0.34", default-features = false }
tendermint-light-client-verifier = { version = "0.34", default-features = false, features = ["rust-crypto"] }

sp-core = { version = "24.0.0", default-features = false, optional = true }
sp-io = { version = "26.0.0", default-features = false, optional = true }
sp-runtime = { version = "27.0.0", default-features = false, optional = true }
sp-std = { version = "11.0.0", default-features = false, optional = true }
sp-core = { version = "25.0.0", default-features = false, optional = true }
sp-io = { version = "27.0.0", default-features = false, optional = true }
sp-runtime = { version = "28.0.0", default-features = false, optional = true }
sp-std = { version = "12.0.0", default-features = false, optional = true }
rnbguy marked this conversation as resolved.
Show resolved Hide resolved

# The indirect dependency `syn` 2.0.4 has a bug that causes
# compilation errors in `tendermint`. This is fixed in 2.0.5.
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc-derive/src/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn consensus_state_derive_impl(ast: DeriveInput) -> TokenStream {
}
}

fn encode_vec(&self) -> Vec<u8> {
fn encode_vec(self) -> Vec<u8> {
match self {
#(#encode_vec_impl),*
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ std = ["ibc-proto/std", "ibc/std"]

[dependencies]
ibc = { version = "0.47.0", path = "../ibc", default-features = false }
ibc-proto = { version = "0.37.1", default-features = false, features = ["server"] }
ibc-proto = { version = "0.38.0", default-features = false, features = ["server"] }
displaydoc = { version = "0.2", default-features = false }
tonic = "0.10"
4 changes: 2 additions & 2 deletions crates/ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mocks = ["tendermint-testgen", "parking_lot", "typed-builder", "std"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.37.1", default-features = false }
ibc-proto = { version = "0.38.0", default-features = false }
ics23 = { version = "0.11", default-features = false, features = ["host-functions"] }
time = { version = ">=0.3.0, <0.3.31", default-features = false }
serde_derive = { version = "1.0.104", default-features = false, optional = true }
Expand All @@ -73,7 +73,7 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
## for borsh encode or decode
borsh = {version = "0.10", default-features = false, optional = true }
parking_lot = { version = "0.12.1", default-features = false, optional = true }
typed-builder = { version = "0.17.0", optional = true }
typed-builder = { version = "0.18.0", optional = true }

ibc-derive = { version ="0.3.0", path = "../ibc-derive" }

Expand Down
6 changes: 2 additions & 4 deletions crates/ibc/src/applications/transfer/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use core::convert::Infallible;
use core::str::Utf8Error;

use displaydoc::Display;
use ibc_proto::protobuf::Error as TendermintProtoError;
use uint::FromDecStrErr;

use crate::core::ics04_channel::acknowledgement::StatusValue;
Expand Down Expand Up @@ -64,8 +63,8 @@ pub enum TokenTransferError {
port_id: PortId,
exp_port_id: PortId,
},
/// decoding raw msg error: `{0}`
DecodeRawMsg(TendermintProtoError),
/// decoding raw msg error: `{reason}`
DecodeRawMsg { reason: String },
/// unknown msg type: `{msg_type}`
UnknownMsgType { msg_type: String },
/// invalid coin string: `{coin}`
Expand All @@ -89,7 +88,6 @@ impl std::error::Error for TokenTransferError {
..
} => Some(e),
Self::InvalidAmount(e) => Some(e),
Self::DecodeRawMsg(e) => Some(e),
Self::Utf8Decode(e) => Some(e),
_ => None,
}
Expand Down
6 changes: 4 additions & 2 deletions crates/ibc/src/applications/transfer/msgs/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::applications::transfer::v1::MsgTransfer as RawMsgTransfer;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::applications::transfer::error::TokenTransferError;
use crate::applications::transfer::packet::PacketData;
Expand Down Expand Up @@ -115,7 +115,9 @@
fn try_from(raw: Any) -> Result<Self, Self::Error> {
match raw.type_url.as_str() {
TYPE_URL => {
MsgTransfer::decode_vec(&raw.value).map_err(TokenTransferError::DecodeRawMsg)
MsgTransfer::decode_vec(&raw.value).map_err(|e| TokenTransferError::DecodeRawMsg {
reason: e.to_string(),
})

Check warning on line 120 in crates/ibc/src/applications/transfer/msgs/transfer.rs

View check run for this annotation

Codecov / codecov/patch

crates/ibc/src/applications/transfer/msgs/transfer.rs#L118-L120

Added lines #L118 - L120 were not covered by tests
}
_ => Err(TokenTransferError::UnknownMsgType {
msg_type: raw.type_url,
Expand Down
4 changes: 2 additions & 2 deletions crates/ibc/src/clients/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::Height as RawHeight;
use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof;
use ibc_proto::ibc::lightclients::tendermint::v1::ClientState as RawTmClientState;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use prost::Message;
use tendermint::chain::id::MAX_LENGTH as MaxChainIdLen;
use tendermint::trust_threshold::TrustThresholdFraction as TendermintTrustThresholdFraction;
Expand Down Expand Up @@ -770,7 +770,7 @@ impl From<ClientState> for Any {
fn from(client_state: ClientState) -> Self {
Any {
type_url: TENDERMINT_CLIENT_STATE_TYPE_URL.to_string(),
value: Protobuf::<RawTmClientState>::encode_vec(&client_state),
value: Protobuf::<RawTmClientState>::encode_vec(client_state),
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/ibc/src/clients/ics07_tendermint/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::lightclients::tendermint::v1::ConsensusState as RawConsensusState;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use tendermint::hash::Algorithm;
use tendermint::time::Time;
use tendermint::Hash;
Expand Down Expand Up @@ -126,7 +126,7 @@
fn from(consensus_state: ConsensusState) -> Self {
Any {
type_url: TENDERMINT_CONSENSUS_STATE_TYPE_URL.to_string(),
value: Protobuf::<RawConsensusState>::encode_vec(&consensus_state),
value: Protobuf::<RawConsensusState>::encode_vec(consensus_state),
}
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@
self.timestamp.into()
}

fn encode_vec(&self) -> Vec<u8> {
fn encode_vec(self) -> Vec<u8> {

Check warning on line 159 in crates/ibc/src/clients/ics07_tendermint/consensus_state.rs

View check run for this annotation

Codecov / codecov/patch

crates/ibc/src/clients/ics07_tendermint/consensus_state.rs#L159

Added line #L159 was not covered by tests
<Self as Protobuf<Any>>::encode_vec(self)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/ibc/src/clients/ics07_tendermint/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::str::FromStr;
use bytes::Buf;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::lightclients::tendermint::v1::Header as RawHeader;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use pretty::{PrettySignedHeader, PrettyValidatorSet};
use prost::Message;
use tendermint::block::signed_header::SignedHeader;
Expand Down Expand Up @@ -186,7 +186,7 @@ impl From<Header> for Any {
fn from(header: Header) -> Self {
Any {
type_url: TENDERMINT_HEADER_TYPE_URL.to_string(),
value: Protobuf::<RawHeader>::encode_vec(&header),
value: Protobuf::<RawHeader>::encode_vec(header),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/ibc/src/clients/ics07_tendermint/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use bytes::Buf;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::lightclients::tendermint::v1::Misbehaviour as RawMisbehaviour;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use prost::Message;

use crate::clients::ics07_tendermint::error::Error;
Expand Down Expand Up @@ -135,7 +135,7 @@ impl From<Misbehaviour> for Any {
fn from(misbehaviour: Misbehaviour) -> Self {
Any {
type_url: TENDERMINT_MISBEHAVIOUR_TYPE_URL.to_string(),
value: Protobuf::<RawMisbehaviour>::encode_vec(&misbehaviour),
value: Protobuf::<RawMisbehaviour>::encode_vec(misbehaviour),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/clients/ics07_tendermint/trust_threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::convert::TryFrom;
use core::fmt::{Display, Error as FmtError, Formatter};

use ibc_proto::ibc::lightclients::tendermint::v1::Fraction;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use tendermint::trust_threshold::TrustThresholdFraction;

use crate::core::ics02_client::error::ClientError;
Expand Down
5 changes: 2 additions & 3 deletions crates/ibc/src/core/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ pub enum RouterError {
ContextError(ContextError),
/// unknown type URL `{url}`
UnknownMessageTypeUrl { url: String },
/// the message is malformed and cannot be decoded error: `{0}`
MalformedMessageBytes(ibc_proto::protobuf::Error),
/// the message is malformed and cannot be decoded error: `{reason}`
MalformedMessageBytes { reason: String },
/// port `{port_id}` is unknown
UnknownPort { port_id: PortId },
/// module not found
Expand All @@ -84,7 +84,6 @@ impl std::error::Error for RouterError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match &self {
Self::ContextError(e) => Some(e),
Self::MalformedMessageBytes(e) => Some(e),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ pub trait ConsensusState: Send + Sync {
/// Serializes the `ConsensusState`. This is expected to be implemented as
/// first converting to the raw type (i.e. the protobuf definition), and then
/// serializing that.
fn encode_vec(&self) -> Vec<u8>;
fn encode_vec(self) -> Vec<u8>;
}
6 changes: 2 additions & 4 deletions crates/ibc/src/core/ics02_client/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Defines the client error type

use displaydoc::Display;
use ibc_proto::protobuf::Error as TendermintProtoError;

use super::client_state::Status;
use crate::core::ics02_client::client_type::ClientType;
Expand Down Expand Up @@ -65,8 +64,8 @@ pub enum ClientError {
Decode(prost::DecodeError),
/// invalid client identifier error: `{0}`
InvalidClientIdentifier(IdentifierError),
/// invalid raw header error: `{0}`
InvalidRawHeader(TendermintProtoError),
/// invalid raw header error: `{reason}`
InvalidRawHeader { reason: String },
/// missing raw client message
MissingClientMessage,
/// invalid raw misbehaviour error: `{0}`
Expand Down Expand Up @@ -140,7 +139,6 @@ impl std::error::Error for ClientError {
} => Some(e),
Self::InvalidMsgUpdateClientId(e) => Some(e),
Self::InvalidClientIdentifier(e) => Some(e),
Self::InvalidRawHeader(e) => Some(e),
Self::InvalidRawMisbehaviour(e) => Some(e),
Self::InvalidCommitmentProof(e) => Some(e),
Self::InvalidPacketTimestamp(e) => Some(e),
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/height.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::str::FromStr;

use displaydoc::Display;
use ibc_proto::ibc::core::client::v1::Height as RawHeight;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics02_client::error::ClientError;
use crate::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/msgs/create_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::MsgCreateClient as RawMsgCreateClient;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics02_client::error::ClientError;
use crate::core::Msg;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/msgs/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_proto::google::protobuf::Any as ProtoAny;
use ibc_proto::ibc::core::client::v1::MsgSubmitMisbehaviour as RawMsgSubmitMisbehaviour;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics02_client::error::ClientError;
use crate::core::ics24_host::identifier::ClientId;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/msgs/update_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::MsgUpdateClient as RawMsgUpdateClient;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics02_client::error::ClientError;
use crate::core::ics24_host::identifier::ClientId;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/msgs/upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::str::FromStr;

use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::MsgUpgradeClient as RawMsgUpgradeClient;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics02_client::error::{ClientError, UpgradeClientError};
use crate::core::ics23_commitment::commitment::CommitmentProofBytes;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics03_connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ibc_proto::ibc::core::connection::v1::{
ConnectionEnd as RawConnectionEnd, Counterparty as RawCounterparty,
IdentifiedConnection as RawIdentifiedConnection,
};
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics02_client::error::ClientError;
use crate::core::ics03_connection::error::ConnectionError;
Expand Down
3 changes: 0 additions & 3 deletions crates/ibc/src/core/ics03_connection/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use alloc::string::String;

use displaydoc::Display;
use ibc_proto::protobuf::Error as ProtoError;

use crate::core::ics02_client::error as client_error;
use crate::core::ics03_connection::version::Version;
Expand All @@ -17,8 +16,6 @@ pub enum ConnectionError {
Client(client_error::ClientError),
/// invalid connection state: expected `{expected}`, actual `{actual}`
InvalidState { expected: String, actual: String },
/// invalid connection end error: `{0}`
InvalidConnectionEnd(ProtoError),
rnbguy marked this conversation as resolved.
Show resolved Hide resolved
/// consensus height claimed by the client on the other party is too advanced: `{target_height}` (host chain current height: `{current_height}`)
InvalidConsensusHeight {
target_height: Height,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Protocol logic specific to processing ICS3 messages of type `MsgConnectionOpenAck`.

use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use prost::Message;

use crate::core::context::ContextError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Protocol logic specific to processing ICS3 messages of type `MsgConnectionOpenConfirm`.

use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::context::ContextError;
use crate::core::events::{IbcEvent, MessageEvent};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Protocol logic specific to processing ICS3 messages of type `MsgConnectionOpenTry`.

use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;
use prost::Message;

use crate::core::context::ContextError;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics03_connection/msgs/conn_open_ack.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics03_connection::error::ConnectionError;
use crate::core::ics03_connection::version::Version;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics03_connection::error::ConnectionError;
use crate::core::ics23_commitment::commitment::CommitmentProofBytes;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::time::Duration;

use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenInit as RawMsgConnectionOpenInit;
use ibc_proto::protobuf::Protobuf;
use ibc_proto::Protobuf;

use crate::core::ics03_connection::connection::Counterparty;
use crate::core::ics03_connection::error::ConnectionError;
Expand Down
Loading
Loading