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

imp: further minimization of prost imports #1000

Merged
merged 5 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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,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 @@
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 @@
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)?;

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

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/src/client_state.rs#L201-L202

Added lines #L201 - L202 were not covered by tests

merkle_proof
.verify_membership(
Expand All @@ -222,9 +220,8 @@
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)?;

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

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/src/client_state.rs#L223-L224

Added lines #L223 - L224 were not covered by tests

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