Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cf-solana: get timestamp in ns for cf-solana #397

Merged
merged 1 commit into from
Oct 16, 2024
Merged
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
11 changes: 4 additions & 7 deletions common/cf-solana/src/client/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use alloc::string::ToString;
use alloc::vec::Vec;
use core::num::NonZeroU64;

use ibc_core_client_context::consensus_state::ConsensusState as _;

use crate::proto::Any;
use crate::{
proof, ClientMessage, ClientState, ConsensusState, Header, Misbehaviour,
Expand Down Expand Up @@ -168,7 +170,6 @@ impl ibc::ClientStateCommon for ClientState {
}
}


dhruvja marked this conversation as resolved.
Show resolved Hide resolved
impl<E> ibc::ClientStateExecution<E> for ClientState
where
E: ibc::ExecutionContext + ibc::ClientExecutionContext + CommonContext,
Expand Down Expand Up @@ -311,7 +312,6 @@ where
}
}


impl ClientState {
pub fn do_update_state(
&self,
Expand Down Expand Up @@ -486,8 +486,8 @@ impl ClientState {
host_timestamp: ibc::Timestamp,
) -> bool {
let expiry_ns = consensus
.timestamp_sec
.get()
.timestamp()
.nanoseconds()
dhruvja marked this conversation as resolved.
Show resolved Hide resolved
.saturating_add(self.trusting_period_ns);
ibc::Timestamp::from_nanoseconds(expiry_ns).unwrap() <= host_timestamp
}
Expand All @@ -511,12 +511,10 @@ impl ClientState {
}
}


fn error(msg: impl ToString) -> ibc::ClientError {
ibc::ClientError::Other { description: msg.to_string() }
}


/// Checks client id’s client type is what’s expected and then parses the id as
/// `ClientIdx`.
///
Expand All @@ -536,7 +534,6 @@ fn parse_client_id(client_id: &ibc::ClientId) -> Result<trie_ids::ClientIdx> {
Err(ibc::ClientError::ClientSpecific { description })
}


#[test]
fn test_verify_client_type() {
use core::str::FromStr;
Expand Down
Loading