Skip to content

Commit cf485ad

Browse files
imp: further minimization of prost imports (#1000)
* imp: further minimizing prost imports * fix: merkle proof extraction in ics07 * chore: update Cargo.lock * chore: clean ups * chore: touch ups
1 parent f62c356 commit cf485ad

File tree

34 files changed

+107
-217
lines changed

34 files changed

+107
-217
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- [`ibc`] Minimize `prost` dependency by introducing `ToVec` trait
2+
- Now `prost` is only imported in `ibc-primitives` crate
3+
- Remove error variants originating from `prost` (Breaking change)
4+
- Eliminate the need for the `bytes` dependency
5+
([\#997](https://github.com/cosmos/ibc-rs/issues/997))

.changelog/unreleased/improvements/997-minimize-prost-dependency.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,14 @@ authors = ["Informal Systems <[email protected]>"]
4848
[workspace.dependencies]
4949
# external dependencies
5050
borsh = { version = "0.10", default-features = false }
51-
bytes = { version = "1.5.0", default-features = false }
5251
displaydoc = { version = "0.2", default-features = false }
5352
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display", "try_into"] }
54-
num-traits = { version = "0.2.17", default-features = false }
55-
primitive-types = { version = "0.12.2", default-features = false, features = ["serde_no_std"] }
56-
prost = { version = "0.12", default-features = false }
5753
rstest = "0.18.2"
5854
schemars = { version = "0.8.15" }
5955
sha2 = { version = "0.10.8", default-features = false }
6056
serde = { version = "1.0", default-features = false }
6157
serde_json = { package = "serde-json-wasm", version = "1.0.0" , default-features = false }
6258
subtle-encoding = { version = "0.5", default-features = false }
63-
time = { version = ">=0.3.0, <0.3.31", default-features = false }
6459

6560
# ibc dependencies
6661
ibc = { version = "0.48.1", path = "./ibc", default-features = false }
@@ -92,7 +87,6 @@ ibc-client-tendermint-types = { version = "0.48.1", path = "./ibc-clients/ics07-
9287
ibc-app-transfer-types = { version = "0.48.1", path = "./ibc-apps/ics20-transfer/types", default-features = false }
9388

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

9791
# cosmos dependencies
9892
tendermint = { version = "0.34.0", default-features = false }

ci/cw-check/Cargo.lock

Lines changed: 6 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci/no-std-check/Cargo.lock

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ibc-apps/ics20-transfer/types/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ all-features = true
2222
borsh = { workspace = true, optional = true }
2323
derive_more = { workspace = true }
2424
displaydoc = { workspace = true }
25-
primitive-types = { workspace = true }
25+
primitive-types = { version = "0.12.2", default-features = false, features = ["serde_no_std"] }
2626
schemars = { workspace = true, optional = true }
2727
serde = { workspace = true, optional = true }
2828
uint = { version = "0.9", default-features = false }
@@ -51,15 +51,15 @@ std = [
5151
"ibc-proto/std",
5252
]
5353
serde = [
54-
"dep:serde",
54+
"dep:serde",
5555
"ibc-core/serde",
56-
"ibc-proto/serde",
56+
"ibc-proto/serde",
5757
]
5858
schema = [
59-
"dep:schemars",
60-
"ibc-core/schema",
59+
"dep:schemars",
60+
"ibc-core/schema",
6161
"ibc-proto/json-schema",
62-
"serde",
62+
"serde",
6363
"std"
6464
]
6565
borsh = [
@@ -68,8 +68,8 @@ borsh = [
6868
"ibc-proto/borsh"
6969
]
7070
parity-scale-codec = [
71-
"dep:parity-scale-codec",
72-
"dep:scale-info",
71+
"dep:parity-scale-codec",
72+
"dep:scale-info",
7373
"ibc-core/parity-scale-codec",
7474
"ibc-proto/parity-scale-codec"
7575
]

ibc-apps/ics20-transfer/types/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ pub(crate) mod serializers;
4040
pub mod error;
4141
mod memo;
4242
pub use memo::*;
43+
/// Re-exports `U256` from `primitive-types` crate for convenience.
44+
pub use primitive_types::U256;
4345

44-
/// Re-exports ICS-20 token transfer proto types from the `ibc-proto` crate
45-
/// for added convenience
46+
/// Re-exports ICS-20 token transfer proto types from the `ibc-proto` crate.
4647
pub mod proto {
4748
pub use ibc_proto::ibc::apps::transfer;
4849
}

ibc-clients/ics07-tendermint/src/client_state.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use ibc_core_commitment_types::commitment::{
2626
CommitmentPrefix, CommitmentProofBytes, CommitmentRoot,
2727
};
2828
use ibc_core_commitment_types::merkle::{apply_prefix, MerkleProof};
29-
use ibc_core_commitment_types::proto::v1::MerkleProof as RawMerkleProof;
3029
use ibc_core_host::types::identifiers::{ClientId, ClientType};
3130
use ibc_core_host::types::path::{
3231
ClientConsensusStatePath, ClientStatePath, Path, UpgradeClientPath,
@@ -199,9 +198,8 @@ impl ClientStateCommon for ClientState {
199198
value: Vec<u8>,
200199
) -> Result<(), ClientError> {
201200
let merkle_path = apply_prefix(prefix, vec![path.to_string()]);
202-
let merkle_proof: MerkleProof = RawMerkleProof::try_from(proof.clone())
203-
.map_err(ClientError::InvalidCommitmentProof)?
204-
.into();
201+
let merkle_proof =
202+
MerkleProof::try_from(proof.clone()).map_err(ClientError::InvalidCommitmentProof)?;
205203

206204
merkle_proof
207205
.verify_membership(
@@ -222,9 +220,8 @@ impl ClientStateCommon for ClientState {
222220
path: Path,
223221
) -> Result<(), ClientError> {
224222
let merkle_path = apply_prefix(prefix, vec![path.to_string()]);
225-
let merkle_proof: MerkleProof = RawMerkleProof::try_from(proof.clone())
226-
.map_err(ClientError::InvalidCommitmentProof)?
227-
.into();
223+
let merkle_proof =
224+
MerkleProof::try_from(proof.clone()).map_err(ClientError::InvalidCommitmentProof)?;
228225

229226
merkle_proof
230227
.verify_non_membership(&self.0.proof_specs, root.clone().into(), merkle_path)

0 commit comments

Comments
 (0)