Skip to content

Commit

Permalink
imp: further minimization of prost imports (#1000)
Browse files Browse the repository at this point in the history
* imp: further minimizing prost imports

* fix: merkle proof extraction in ics07

* chore: update Cargo.lock

* chore: clean ups

* chore: touch ups
  • Loading branch information
Farhad-Shabani authored Dec 2, 2023
1 parent 2259108 commit eafdd30
Show file tree
Hide file tree
Showing 34 changed files with 107 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [`ibc`] Minimize `prost` dependency by introducing `ToVec` trait
- Now `prost` is only imported in `ibc-primitives` crate
- Remove error variants originating from `prost` (Breaking change)
- Eliminate the need for the `bytes` dependency
([\#997](https://github.com/cosmos/ibc-rs/issues/997))

This file was deleted.

6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,14 @@ authors = ["Informal Systems <[email protected]>"]
[workspace.dependencies]
# external dependencies
borsh = { version = "0.10", default-features = false }
bytes = { version = "1.5.0", 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"] }
prost = { version = "0.12", default-features = false }
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 @@ -92,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
25 changes: 6 additions & 19 deletions ci/cw-check/Cargo.lock

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

16 changes: 0 additions & 16 deletions ci/no-std-check/Cargo.lock

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

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
11 changes: 4 additions & 7 deletions ibc-clients/ics07-tendermint/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use ibc_core_commitment_types::commitment::{
CommitmentPrefix, CommitmentProofBytes, CommitmentRoot,
};
use ibc_core_commitment_types::merkle::{apply_prefix, MerkleProof};
use ibc_core_commitment_types::proto::v1::MerkleProof as RawMerkleProof;
use ibc_core_host::types::identifiers::{ClientId, ClientType};
use ibc_core_host::types::path::{
ClientConsensusStatePath, ClientStatePath, Path, UpgradeClientPath,
Expand Down Expand Up @@ -199,9 +198,8 @@ impl ClientStateCommon for ClientState {
value: Vec<u8>,
) -> Result<(), ClientError> {
let merkle_path = apply_prefix(prefix, vec![path.to_string()]);
let merkle_proof: MerkleProof = RawMerkleProof::try_from(proof.clone())
.map_err(ClientError::InvalidCommitmentProof)?
.into();
let merkle_proof =
MerkleProof::try_from(proof.clone()).map_err(ClientError::InvalidCommitmentProof)?;

merkle_proof
.verify_membership(
Expand All @@ -222,9 +220,8 @@ impl ClientStateCommon for ClientState {
path: Path,
) -> Result<(), ClientError> {
let merkle_path = apply_prefix(prefix, vec![path.to_string()]);
let merkle_proof: MerkleProof = RawMerkleProof::try_from(proof.clone())
.map_err(ClientError::InvalidCommitmentProof)?
.into();
let merkle_proof =
MerkleProof::try_from(proof.clone()).map_err(ClientError::InvalidCommitmentProof)?;

merkle_proof
.verify_non_membership(&self.0.proof_specs, root.clone().into(), merkle_path)
Expand Down
Loading

0 comments on commit eafdd30

Please sign in to comment.