Skip to content

Commit

Permalink
Update tendermint-rs to v0.23.5 and use verification functions from `…
Browse files Browse the repository at this point in the history
…tendermint-light-client-verifier` (#1748)

* Use verification function from tendermint-light-client-verifier

* Update to tendermint-rs v0.23.5

* Add changelog entry

Co-authored-by: Romain Ruetschi <[email protected]>
  • Loading branch information
soareschen and romac authored Jan 14, 2022
1 parent de42b9e commit efcd884
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Update tendermint-rs dependencies to 0.23.5
([#1767](https://github.com/informalsystems/ibc-rs/issues/1767))
43 changes: 30 additions & 13 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ exclude = [
# tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs", branch = "v0.23.x" }
# tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs", branch = "v0.23.x" }
# tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs", branch = "v0.23.x" }
# tendermint-light-client-verifier = { git = "https://github.com/informalsystems/tendermint-rs", branch = "v0.23.x" }
# tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs", branch = "v0.23.x" }
14 changes: 7 additions & 7 deletions modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ sha2 = { version = "0.10.1", default-features = false }
flex-error = { version = "0.4.4", default-features = false }

[dependencies.tendermint]
version = "=0.23.4"
version = "=0.23.5"

[dependencies.tendermint-proto]
version = "=0.23.4"
version = "=0.23.5"

[dependencies.tendermint-light-client]
version = "=0.23.4"
[dependencies.tendermint-light-client-verifier]
version = "=0.23.5"
default-features = false

[dependencies.tendermint-testgen]
version = "=0.23.4"
version = "=0.23.5"
optional = true

[dev-dependencies]
Expand All @@ -61,8 +61,8 @@ tracing-subscriber = { version = "0.3.5", features = ["fmt", "env-filter", "json
test-log = { version = "0.2.8", features = ["trace"] }
modelator = "0.4.1"
sha2 = { version = "0.10.1" }
tendermint-rpc = { version = "=0.23.4", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "=0.23.4" } # Needed for generating (synthetic) light blocks.
tendermint-rpc = { version = "=0.23.5", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "=0.23.5" } # Needed for generating (synthetic) light blocks.

[[test]]
name = "mbt"
Expand Down
4 changes: 2 additions & 2 deletions modules/src/clients/ics07_tendermint/client_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use core::convert::TryInto;

use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof;
use prost::Message;
use tendermint_light_client::components::verifier::{ProdVerifier, Verdict, Verifier};
use tendermint_light_client::types::{TrustedBlockState, UntrustedBlockState};
use tendermint_light_client_verifier::types::{TrustedBlockState, UntrustedBlockState};
use tendermint_light_client_verifier::{ProdVerifier, Verdict, Verifier};
use tendermint_proto::Protobuf;
use time::OffsetDateTime;

Expand Down
2 changes: 1 addition & 1 deletion modules/src/clients/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::convert::{TryFrom, TryInto};
use core::time::Duration;

use serde::{Deserialize, Serialize};
use tendermint_light_client::light_client::Options;
use tendermint_light_client_verifier::options::Options;
use tendermint_proto::Protobuf;

use ibc_proto::ibc::lightclients::tendermint::v1::ClientState as RawClientState;
Expand Down
4 changes: 3 additions & 1 deletion modules/src/clients/ics07_tendermint/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ use crate::core::ics23_commitment::error::Error as Ics23Error;
use crate::core::ics24_host::error::ValidationError;
use crate::core::ics24_host::identifier::ClientId;
use crate::timestamp::{Timestamp, TimestampOverflowError};

use crate::Height;
use tendermint::account::Id;
use tendermint::hash::Hash;
use tendermint::Error as TendermintError;
use tendermint_light_client_verifier::errors::VerificationErrorDetail as LightClientErrorDetail;

define_error! {
#[derive(Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -216,7 +218,7 @@ define_error! {
},

VerificationError
{ detail: tendermint_light_client::predicates::errors::VerificationErrorDetail }
{ detail: LightClientErrorDetail }
| e | {
format_args!("verification failed: {}", e.detail)
},
Expand Down
2 changes: 1 addition & 1 deletion modules/src/mock/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ impl HostBlock {
// same timestamp as two block can be generated per second.
let ten_millis = core::time::Duration::from_millis(1000);
std::thread::sleep(ten_millis);

let time: Time = OffsetDateTime::now_utc().try_into().unwrap();
let time = time.duration_since(Time::unix_epoch()).unwrap().as_secs();

TestgenLightBlock::new_default_with_time_and_chain_id(chain_id.to_string(), time, height)
.generate()
Expand Down
2 changes: 1 addition & 1 deletion proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ getrandom = { version = "0.2", features = ["js"] }
serde = "1.0"

[dependencies.tendermint-proto]
version = "=0.23.4"
version = "=0.23.5"
11 changes: 7 additions & 4 deletions relayer-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,23 @@ flex-error = { version = "0.4.4", default-features = false, features = ["std", "
signal-hook = "0.3.13"

[dependencies.tendermint-proto]
version = "=0.23.4"
version = "=0.23.5"

[dependencies.tendermint]
version = "=0.23.4"
version = "=0.23.5"
features = ["secp256k1"]

[dependencies.tendermint-rpc]
version = "=0.23.4"
version = "=0.23.5"
features = ["http-client", "websocket-client"]

[dependencies.tendermint-light-client]
version = "=0.23.4"
version = "=0.23.5"
features = ["unstable"]

[dependencies.tendermint-light-client-verifier]
version = "=0.23.5"

[dependencies.abscissa_core]
version = "=0.6.0-beta.1"
features = ["options"]
Expand Down
2 changes: 1 addition & 1 deletion relayer-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::path::PathBuf;
use flex_error::{define_error, TraceError};
use ibc::core::ics24_host::identifier::ChainId;
use ibc_relayer::config::{Config, ModeConfig};
use tendermint_light_client::types::TrustThreshold;
use tendermint_light_client_verifier::types::TrustThreshold;
use tracing_subscriber::filter::ParseError;

use crate::application::app_reader;
Expand Down
14 changes: 9 additions & 5 deletions relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,24 @@ version = "0.4.0"
features = ["num-bigint", "serde"]

[dependencies.tendermint]
version = "=0.23.4"
version = "=0.23.5"
features = ["secp256k1"]

[dependencies.tendermint-rpc]
version = "=0.23.4"
version = "=0.23.5"
features = ["http-client", "websocket-client"]

[dependencies.tendermint-light-client]
version = "=0.23.4"
version = "=0.23.5"
default-features = false
features = ["rpc-client", "secp256k1", "unstable"]

[dependencies.tendermint-light-client-verifier]
version = "=0.23.5"
default-features = false

[dependencies.tendermint-proto]
version = "=0.23.4"
version = "=0.23.5"

[dev-dependencies]
ibc = { version = "0.10.0", path = "../modules", features = ["mocks"] }
Expand All @@ -93,4 +97,4 @@ tracing-subscriber = { version = "0.3.5", features = ["fmt", "env-filter", "json
test-log = { version = "0.2.8", features = ["trace"] }

# Needed for generating (synthetic) light blocks.
tendermint-testgen = { version = "=0.23.4" }
tendermint-testgen = { version = "=0.23.5" }
4 changes: 2 additions & 2 deletions relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use tendermint::abci::{Code, Event, Path as TendermintABCIPath};
use tendermint::account::Id as AccountId;
use tendermint::block::Height;
use tendermint::consensus::Params;
use tendermint_light_client::types::LightBlock as TMLightBlock;
use tendermint_light_client_verifier::types::LightBlock as TMLightBlock;
use tendermint_proto::Protobuf;
use tendermint_rpc::endpoint::tx::Response as ResultTx;
use tendermint_rpc::query::{EventType, Query};
Expand Down Expand Up @@ -959,7 +959,7 @@ impl ChainEndpoint for CosmosSdkChain {
}

fn init_light_client(&self) -> Result<Self::LightClient, Error> {
use tendermint_light_client::types::PeerId;
use tendermint_light_client_verifier::types::PeerId;

crate::time!("init_light_client");

Expand Down
2 changes: 1 addition & 1 deletion relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::sync::{Arc, RwLock};
use std::{fs, fs::File, io::Write, path::Path};

use serde_derive::{Deserialize, Serialize};
use tendermint_light_client::types::TrustThreshold;
use tendermint_light_client_verifier::types::TrustThreshold;

use ibc::core::ics23_commitment::specs::ProofSpecs;
use ibc::core::ics24_host::identifier::{ChainId, ChannelId, PortId};
Expand Down
11 changes: 6 additions & 5 deletions relayer/src/light_client/tendermint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ use itertools::Itertools;

use tendermint_light_client::{
components::{self, io::AtHeight},
light_client::{LightClient as TmLightClient, Options as TmOptions},
operations,
light_client::LightClient as TmLightClient,
state::State as LightClientState,
store::{memory::MemoryStore, LightStore},
types::Height as TMHeight,
types::{LightBlock, PeerId, Status},
};
use tendermint_light_client_verifier::operations;
use tendermint_light_client_verifier::options::Options as TmOptions;
use tendermint_light_client_verifier::types::{Height as TMHeight, LightBlock, PeerId, Status};
use tendermint_light_client_verifier::ProdVerifier;
use tendermint_rpc as rpc;

use ibc::{
Expand Down Expand Up @@ -180,7 +181,7 @@ impl LightClient {
fn prepare_client(&self, client_state: &AnyClientState) -> Result<TmLightClient, Error> {
let clock = components::clock::SystemClock;
let hasher = operations::hasher::ProdHasher;
let verifier = components::verifier::ProdVerifier::default();
let verifier = ProdVerifier::default();
let scheduler = components::scheduler::basic_bisecting_schedule;

let client_state =
Expand Down
4 changes: 2 additions & 2 deletions tools/integration-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ ibc = { path = "../../modules" }
ibc-relayer = { path = "../../relayer" }
ibc-relayer-cli = { path = "../../relayer-cli" }
ibc-proto = { path = "../../proto" }
tendermint = { version = "=0.23.4" }
tendermint-rpc = { version = "=0.23.4", features = ["http-client", "websocket-client"] }
tendermint = { version = "=0.23.5" }
tendermint-rpc = { version = "=0.23.5", features = ["http-client", "websocket-client"] }

tokio = { version = "1.0", features = ["full"] }
tracing = "0.1.26"
Expand Down

0 comments on commit efcd884

Please sign in to comment.