Skip to content
Open
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,2 @@
- [ibc-client-tendermint] Make `rust-crypto` an optional default-enabled feature
([#1433](https://github.com/cosmos/ibc-rs/pull/1433))
3 changes: 2 additions & 1 deletion ibc-clients/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ibc-client-tendermint = { workspace = true }
ibc-client-wasm-types = { workspace = true }

[features]
default = [ "std" ]
default = [ "std", "rust-crypto" ]
rust-crypto = [ "ibc-client-tendermint/rust-crypto" ]
std = [
"ibc-client-tendermint/std",
"ibc-client-wasm-types/std",
Expand Down
5 changes: 3 additions & 2 deletions ibc-clients/ics07-tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ ibc-primitives = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
tendermint-light-client-verifier = { workspace = true, features = [ "rust-crypto" ] }
tendermint-light-client-verifier = { workspace = true }

[features]
default = [ "std" ]
default = [ "std", "rust-crypto" ]
rust-crypto = [ "tendermint-light-client-verifier/rust-crypto" ]
std = [
"serde/std",
"ibc-client-tendermint-types/std",
Expand Down
36 changes: 24 additions & 12 deletions ibc-clients/ics07-tendermint/src/client_state/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ use ibc_core_host::types::identifiers::ClientId;
use ibc_core_host::types::path::ClientConsensusStatePath;
use ibc_primitives::prelude::*;
use ibc_primitives::proto::Any;
use tendermint::crypto::default::Sha256;
use tendermint::crypto::Sha256 as Sha256Trait;
use tendermint::merkle::MerkleHash;
use tendermint_light_client_verifier::{ProdVerifier, Verifier};
use tendermint_light_client_verifier::Verifier;

use super::{
check_for_misbehaviour_on_misbehavior, check_for_misbehaviour_on_update,
Expand Down Expand Up @@ -48,17 +47,30 @@ where
/// parameter.
fn verify_client_message(
&self,
ctx: &V,
client_id: &ClientId,
client_message: Any,
_ctx: &V,
_client_id: &ClientId,
_client_message: Any,
) -> Result<(), ClientError> {
verify_client_message::<V, Sha256>(
self.inner(),
ctx,
client_id,
client_message,
&ProdVerifier::default(),
)
#[cfg(feature = "rust-crypto")]
{
use tendermint::crypto::default::Sha256;
use tendermint_light_client_verifier::ProdVerifier;

verify_client_message::<V, Sha256>(
self.inner(),
_ctx,
_client_id,
_client_message,
&ProdVerifier::default(),
)
}
#[cfg(not(feature = "rust-crypto"))]
{
unimplemented!(
"verify_client_message requires the `rust-crypto` feature; \
use a custom verifier via the standalone verify_client_message function instead"
)
}
}

fn check_for_misbehaviour(
Expand Down
2 changes: 1 addition & 1 deletion ibc-clients/ics07-tendermint/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ibc-proto = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
tendermint-light-client-verifier = { workspace = true, features = [ "rust-crypto" ] }
tendermint-light-client-verifier = { workspace = true }
tendermint-proto = { workspace = true }

# parity dependencies
Expand Down
3 changes: 2 additions & 1 deletion ibc-testkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ hex = { workspace = true }
rstest = { workspace = true }

[features]
default = [ "std" ]
default = [ "std", "rust-crypto" ]
rust-crypto = [ "ibc/rust-crypto" ]
std = [
"hex/std",
"serde/std",
Expand Down
1 change: 1 addition & 0 deletions ibc-testkit/src/relayer/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ where
}

#[cfg(test)]
#[cfg(feature = "rust-crypto")]
mod tests {
use super::*;
use crate::hosts::{MockHost, TendermintHost};
Expand Down
3 changes: 2 additions & 1 deletion ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ ibc-derive = { workspace = true }
ibc-primitives = { workspace = true }

[features]
default = [ "std" ]
default = [ "std", "rust-crypto" ]
rust-crypto = [ "ibc-clients/rust-crypto" ]
std = [
"ibc-apps/std",
"ibc-clients/std",
Expand Down
3 changes: 2 additions & 1 deletion tests-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ test-log = { version = "0.2.16", features = [ "trace" ] }
tendermint-rpc = { workspace = true }

[features]
default = [ "std" ]
default = [ "std", "rust-crypto" ]
rust-crypto = [ "ibc/rust-crypto" ]
std = [
"serde/std",
"serde-json/std",
Expand Down
1 change: 1 addition & 0 deletions tests-integration/tests/core/ics02_client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(feature = "serde")]
pub mod create_client;
pub mod recover_client;
#[cfg(feature = "rust-crypto")]
pub mod update_client;
#[cfg(feature = "serde")]
pub mod upgrade_client;
1 change: 1 addition & 0 deletions tests-integration/tests/core/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use ibc_testkit::testapp::ibc::clients::mock::client_state::MockClientState;
use ibc_testkit::testapp::ibc::clients::mock::consensus_state::MockConsensusState;
use ibc_testkit::testapp::ibc::clients::mock::header::MockHeader;
use ibc_testkit::testapp::ibc::core::router::MockRouter;
use std::panic;
use test_log::test;

#[test]
Expand Down