Skip to content

Commit

Permalink
Avoided many unwraps() around Height conversion. (informalsystems#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
adizere committed Oct 12, 2020
1 parent f4d226d commit 36d71c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions relayer-cli/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down
5 changes: 2 additions & 3 deletions relayer/src/tx/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use prost_types::Any;
use std::convert::TryInto;
use std::time::Duration;

use ibc::ics02_client::client_def::{AnyClientState, AnyConsensusState};
Expand Down Expand Up @@ -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,
);

Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 36d71c0

Please sign in to comment.