From 36d71c0bd595efb277e68b7b26c20339d7803ab5 Mon Sep 17 00:00:00 2001 From: Adi Seredinschi Date: Mon, 12 Oct 2020 11:09:48 +0200 Subject: [PATCH] Avoided many unwraps() around Height conversion. (#301) --- relayer-cli/tests/integration.rs | 5 +++-- relayer/src/tx/client.rs | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/relayer-cli/tests/integration.rs b/relayer-cli/tests/integration.rs index 9a10c7d372..a2eb43c94f 100644 --- a/relayer-cli/tests/integration.rs +++ b/relayer-cli/tests/integration.rs @@ -22,6 +22,7 @@ use tendermint_proto::DomainType; use std::convert::TryInto; use std::str::FromStr; +use tendermint::block::Height; /// Configuration that connects to the informaldev/simd DockerHub image running on localhost. fn simd_config() -> Config { @@ -85,7 +86,7 @@ fn query_channel_id() { PortId::from_str("firstport").unwrap(), ChannelId::from_str("firstchannel").unwrap(), ), - 0_u64.try_into().unwrap(), + Height::from(0_u32), false, ) .unwrap(), @@ -109,7 +110,7 @@ fn query_client_id() { &chain .query( ClientConnections(ClientId::from_str("clientidone").unwrap()), - 0_u64.try_into().unwrap(), + Height::from(0_u32), false, ) .unwrap(), diff --git a/relayer/src/tx/client.rs b/relayer/src/tx/client.rs index 3d295e1c6b..c0143d2b37 100644 --- a/relayer/src/tx/client.rs +++ b/relayer/src/tx/client.rs @@ -1,5 +1,4 @@ use prost_types::Any; -use std::convert::TryInto; use std::time::Duration; use ibc::ics02_client::client_def::{AnyClientState, AnyConsensusState}; @@ -30,7 +29,7 @@ pub fn create_client(opts: CreateClientOptions) -> Result<(), Error> { // Query the client state on destination chain. let response = dest_chain.query( ClientStatePath(opts.clone().dest_client_id), - 0_u64.try_into().unwrap(), + Height::from(0_u32), false, ); @@ -67,7 +66,7 @@ pub fn create_client(opts: CreateClientOptions) -> Result<(), Error> { src_chain.unbonding_period(), Duration::from_millis(3000), height, - 0_u64.try_into().unwrap(), + Height::from(0_u32), false, false, )