Skip to content

Commit

Permalink
chore: touch ups
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad-Shabani committed Dec 2, 2023
1 parent b145aa2 commit 16f8e89
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 49 deletions.
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,12 @@ authors = ["Informal Systems <[email protected]>"]
borsh = { version = "0.10", default-features = false }
displaydoc = { version = "0.2", default-features = false }
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display", "try_into"] }
num-traits = { version = "0.2.17", default-features = false }
primitive-types = { version = "0.12.2", default-features = false, features = ["serde_no_std"] }
rstest = "0.18.2"
schemars = { version = "0.8.15" }
sha2 = { version = "0.10.8", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = { package = "serde-json-wasm", version = "1.0.0" , default-features = false }
subtle-encoding = { version = "0.5", default-features = false }
time = { version = ">=0.3.0, <0.3.31", default-features = false }

# ibc dependencies
ibc = { version = "0.48.1", path = "./ibc", default-features = false }
Expand Down Expand Up @@ -90,7 +87,6 @@ ibc-client-tendermint-types = { version = "0.48.1", path = "./ibc-clients/ics07-
ibc-app-transfer-types = { version = "0.48.1", path = "./ibc-apps/ics20-transfer/types", default-features = false }

ibc-proto = { version = "0.39.1", default-features = false }
ics23 = { version = "0.11", default-features = false }

# cosmos dependencies
tendermint = { version = "0.34.0", default-features = false }
Expand Down
16 changes: 8 additions & 8 deletions ibc-apps/ics20-transfer/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ all-features = true
borsh = { workspace = true, optional = true }
derive_more = { workspace = true }
displaydoc = { workspace = true }
primitive-types = { workspace = true }
primitive-types = { version = "0.12.2", default-features = false, features = ["serde_no_std"] }
schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
uint = { version = "0.9", default-features = false }
Expand Down Expand Up @@ -51,15 +51,15 @@ std = [
"ibc-proto/std",
]
serde = [
"dep:serde",
"dep:serde",
"ibc-core/serde",
"ibc-proto/serde",
"ibc-proto/serde",
]
schema = [
"dep:schemars",
"ibc-core/schema",
"dep:schemars",
"ibc-core/schema",
"ibc-proto/json-schema",
"serde",
"serde",
"std"
]
borsh = [
Expand All @@ -68,8 +68,8 @@ borsh = [
"ibc-proto/borsh"
]
parity-scale-codec = [
"dep:parity-scale-codec",
"dep:scale-info",
"dep:parity-scale-codec",
"dep:scale-info",
"ibc-core/parity-scale-codec",
"ibc-proto/parity-scale-codec"
]
5 changes: 3 additions & 2 deletions ibc-apps/ics20-transfer/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ pub(crate) mod serializers;
pub mod error;
mod memo;
pub use memo::*;
/// Re-exports `U256` from `primitive-types` crate for convenience.
pub use primitive_types::U256;

/// Re-exports ICS-20 token transfer proto types from the `ibc-proto` crate
/// for added convenience
/// Re-exports ICS-20 token transfer proto types from the `ibc-proto` crate.
pub mod proto {
pub use ibc_proto::ibc::apps::transfer;
}
Expand Down
7 changes: 3 additions & 4 deletions ibc-clients/ics07-tendermint/types/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,10 @@ impl TryFrom<Any> for ClientState {

fn try_from(raw: Any) -> Result<Self, Self::Error> {
fn decode_client_state(value: &[u8]) -> Result<ClientState, ClientError> {
let client_state = Protobuf::<RawTmClientState>::decode_vec(value).map_err(|e| {
ClientError::Other {
let client_state =
Protobuf::<RawTmClientState>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 351 in ibc-clients/ics07-tendermint/types/src/client_state.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/types/src/client_state.rs#L351

Added line #L351 was not covered by tests
}
})?;
})?;
Ok(client_state)
}

Expand Down
7 changes: 3 additions & 4 deletions ibc-clients/ics07-tendermint/types/src/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ impl TryFrom<Any> for ConsensusState {

fn try_from(raw: Any) -> Result<Self, Self::Error> {
fn decode_consensus_state(value: &[u8]) -> Result<ConsensusState, ClientError> {
let client_state = Protobuf::<RawConsensusState>::decode_vec(value).map_err(|e| {
ClientError::Other {
let client_state =
Protobuf::<RawConsensusState>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 112 in ibc-clients/ics07-tendermint/types/src/consensus_state.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/types/src/consensus_state.rs#L112

Added line #L112 was not covered by tests
}
})?;
})?;
Ok(client_state)
}

Expand Down
7 changes: 3 additions & 4 deletions ibc-clients/ics07-tendermint/types/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ impl TryFrom<Any> for Header {

fn try_from(raw: Any) -> Result<Self, Self::Error> {
fn decode_header(value: &[u8]) -> Result<Header, ClientError> {
let header =
Protobuf::<RawHeader>::decode_vec(value).map_err(|e| ClientError::Other {
description: e.to_string(),
})?;
let header = Protobuf::<RawHeader>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 192 in ibc-clients/ics07-tendermint/types/src/header.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/types/src/header.rs#L192

Added line #L192 was not covered by tests
})?;
Ok(header)
}
match raw.type_url.as_str() {
Expand Down
2 changes: 1 addition & 1 deletion ibc-clients/ics07-tendermint/types/src/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl TryFrom<Any> for Misbehaviour {
fn try_from(raw: Any) -> Result<Self, ClientError> {
fn decode_misbehaviour(value: &[u8]) -> Result<Misbehaviour, ClientError> {
let misbehaviour =
Protobuf::<RawMisbehaviour>::decode_vec(value).map_err(|e| ClientError::Other {
Protobuf::<RawMisbehaviour>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 116 in ibc-clients/ics07-tendermint/types/src/misbehaviour.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/types/src/misbehaviour.rs#L116

Added line #L116 was not covered by tests
})?;
Ok(misbehaviour)
Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics23-commitment/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ subtle-encoding = { workspace = true }

# ibc dependencies
ibc-proto = { workspace = true }
ibc-primitives = {workspace = true }
ics23 = { workspace = true, features = ["host-functions"] }
ibc-primitives = { workspace = true }
ics23 = { version = "0.11", default-features = false, features = ["host-functions"] }

# parity dependencies
parity-scale-codec = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion ibc-core/ics23-commitment/types/src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl TryFrom<CommitmentProofBytes> for MerkleProof {

fn try_from(value: CommitmentProofBytes) -> Result<Self, Self::Error> {
let value: Vec<u8> = value.into();
let merkle_proof = Protobuf::<RawMerkleProof>::decode_vec(value.as_ref())
let merkle_proof = Protobuf::<RawMerkleProof>::decode(value.as_ref())
.map_err(|e| CommitmentError::DecodingFailure(e.to_string()))?;
Ok(merkle_proof)

Check warning on line 133 in ibc-core/ics23-commitment/types/src/commitment.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics23-commitment/types/src/commitment.rs#L131-L133

Added lines #L131 - L133 were not covered by tests
}
Expand Down
2 changes: 1 addition & 1 deletion ibc-core/ics23-commitment/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum CommitmentError {
VerificationFailure,
/// encoded commitment prefix is not a valid hex string: `{0}`
EncodingFailure(String),
/// decoding failure: `{0}`
/// decoding commitment proof bytes failed: `{0}`
DecodingFailure(String),
}

Expand Down
3 changes: 0 additions & 3 deletions ibc-core/ics23-commitment/types/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ pub struct MerkleProof {

impl Protobuf<RawMerkleProof> for MerkleProof {}

/// Convert to ics23::CommitmentProof
/// The encoding and decoding shouldn't fail since ics23::CommitmentProof and ibc_proto::ics23::CommitmentProof should be the same
/// Ref. <https://github.com/informalsystems/ibc-rs/issues/853>
impl TryFrom<RawMerkleProof> for MerkleProof {
type Error = CommitmentError;

Expand Down
3 changes: 0 additions & 3 deletions ibc-core/ics26-routing/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ subtle-encoding = { workspace = true }
ibc-core-host-types = { workspace = true }
ibc-primitives = { workspace = true }
ibc-proto = {workspace = true }
ics23 = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
Expand All @@ -48,7 +47,6 @@ std = [
"ibc-primitives/std",
"ibc-core-host-types/std",
"ibc-proto/std",
"ics23/std",
"tendermint/std",
]
serde = [
Expand All @@ -57,7 +55,6 @@ serde = [
"ibc-core-host-types/serde",
"ibc-primitives/serde",
"ibc-proto/serde",
"ics23/serde",
]
borsh = [
"dep:borsh",
Expand Down
2 changes: 1 addition & 1 deletion ibc-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ displaydoc = { workspace = true }
prost = { version = "0.12", default-features = false }
schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
time = { workspace = true }
time = { version = ">=0.3.0, <0.3.31", default-features = false }

# ibc dependencies
ibc-proto = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion ibc-testkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ borsh = { workspace = true, optional = true }
derive_more = { workspace = true }
displaydoc = { workspace = true }
parking_lot = { version = "0.12.1", default-features = false }
primitive-types = { workspace = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
Expand Down
7 changes: 3 additions & 4 deletions ibc-testkit/src/testapp/ibc/clients/mock/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ impl TryFrom<Any> for MockClientState {

fn try_from(raw: Any) -> Result<Self, Self::Error> {
fn decode_client_state(value: &[u8]) -> Result<MockClientState, ClientError> {
let client_state = Protobuf::<RawMockClientState>::decode_vec(value).map_err(|e| {
ClientError::Other {
let client_state =
Protobuf::<RawMockClientState>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 107 in ibc-testkit/src/testapp/ibc/clients/mock/client_state.rs

View check run for this annotation

Codecov / codecov/patch

ibc-testkit/src/testapp/ibc/clients/mock/client_state.rs#L107

Added line #L107 was not covered by tests
}
})?;
})?;
Ok(client_state)
}
match raw.type_url.as_str() {
Expand Down
8 changes: 5 additions & 3 deletions ibc-testkit/src/testapp/ibc/clients/mock/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ impl TryFrom<Any> for MockConsensusState {

fn try_from(raw: Any) -> Result<Self, Self::Error> {
fn decode_consensus_state(value: &[u8]) -> Result<MockConsensusState, ClientError> {
let mock_consensus_state = Protobuf::<RawMockConsensusState>::decode_vec(value)
.map_err(|e| ClientError::Other {
description: e.to_string(),
let mock_consensus_state =
Protobuf::<RawMockConsensusState>::decode(value).map_err(|e| {
ClientError::Other {
description: e.to_string(),
}

Check warning on line 71 in ibc-testkit/src/testapp/ibc/clients/mock/consensus_state.rs

View check run for this annotation

Codecov / codecov/patch

ibc-testkit/src/testapp/ibc/clients/mock/consensus_state.rs#L69-L71

Added lines #L69 - L71 were not covered by tests
})?;
Ok(mock_consensus_state)
}
Expand Down
2 changes: 1 addition & 1 deletion ibc-testkit/src/testapp/ibc/clients/mock/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl TryFrom<Any> for Misbehaviour {
fn try_from(raw: Any) -> Result<Self, ClientError> {
fn decode_misbehaviour(value: &[u8]) -> Result<Misbehaviour, ClientError> {
let raw_misbehaviour =
Protobuf::<RawMisbehaviour>::decode_vec(value).map_err(|e| ClientError::Other {
Protobuf::<RawMisbehaviour>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 58 in ibc-testkit/src/testapp/ibc/clients/mock/misbehaviour.rs

View check run for this annotation

Codecov / codecov/patch

ibc-testkit/src/testapp/ibc/clients/mock/misbehaviour.rs#L58

Added line #L58 was not covered by tests
})?;
Ok(raw_misbehaviour)
Expand Down
3 changes: 1 addition & 2 deletions ibc-testkit/tests/core/router.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ibc::apps::transfer::handler::send_transfer;
use ibc::apps::transfer::types::error::TokenTransferError;
use ibc::apps::transfer::types::msgs::transfer::MsgTransfer;
use ibc::apps::transfer::types::BaseCoin;
use ibc::apps::transfer::types::{BaseCoin, U256};
use ibc::core::channel::types::error::ChannelError;
use ibc::core::channel::types::msgs::{
ChannelMsg, MsgAcknowledgement, MsgChannelCloseConfirm, MsgChannelCloseInit, MsgChannelOpenAck,
Expand Down Expand Up @@ -40,7 +40,6 @@ use ibc_testkit::testapp::ibc::clients::mock::consensus_state::MockConsensusStat
use ibc_testkit::testapp::ibc::clients::mock::header::MockHeader;
use ibc_testkit::testapp::ibc::core::router::MockRouter;
use ibc_testkit::testapp::ibc::core::types::MockContext;
use primitive_types::U256;
use test_log::test;

#[test]
Expand Down

0 comments on commit 16f8e89

Please sign in to comment.