Skip to content

Commit

Permalink
rm unused utils and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Feb 2, 2024
1 parent 0c9bee1 commit ebf3019
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
1 change: 0 additions & 1 deletion ibc-testkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ basecoin-store = { git = "https://github.com/informalsystems/basecoin-rs", rev =
# cosmos dependencies
tendermint = { workspace = true }
tendermint-testgen = { workspace = true }
tendermint-proto = { workspace = true }

[dev-dependencies]
env_logger = "0.11.0"
Expand Down
30 changes: 0 additions & 30 deletions ibc-testkit/src/testapp/ibc/utils.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,4 @@
use core::time::Duration;

use ibc::core::client::types::Height;
use ibc::primitives::Timestamp;
use ibc_proto::google::protobuf::{Duration as GDuration, Timestamp as GTimestamp};

pub fn timestamp_gpb_to_ibc(gpb_timestamp: GTimestamp) -> Timestamp {
let GTimestamp { seconds, nanos } = gpb_timestamp;
Timestamp::from_nanoseconds(seconds as u64 * 1_000_000_000 + nanos as u64)
.expect("no hmm overflow")
}

pub fn timestamp_ibc_to_gpb(ibc_timestamp: Timestamp) -> GTimestamp {
let tendermint_proto::google::protobuf::Timestamp { seconds, nanos } = ibc_timestamp
.into_tm_time()
.unwrap_or_else(|| tendermint::Time::from_unix_timestamp(0, 0).expect("no overflow"))
.into();
GTimestamp { seconds, nanos }
}

pub fn duration_gpb_to_ibc(gbp_duration: GDuration) -> Duration {
let GDuration { seconds, nanos } = gbp_duration;
Duration::from_nanos(seconds as u64 * 1_000_000_000 + nanos as u64)
}

pub fn duration_ibc_to_gbp(ibc_duration: Duration) -> GDuration {
GDuration {
seconds: ibc_duration.as_secs() as i64,
nanos: ibc_duration.subsec_nanos() as i32,
}
}

pub fn blocks_since(a: Height, b: Height) -> Option<u64> {
(a.revision_number() == b.revision_number() && a.revision_height() >= b.revision_height())
Expand Down

0 comments on commit ebf3019

Please sign in to comment.