Skip to content

Commit

Permalink
Merge branch 'master' into dimitris/xnet-test-canister
Browse files Browse the repository at this point in the history
  • Loading branch information
dsarlis committed Aug 7, 2024
2 parents 9a143be + a0c43a1 commit ca43ff8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion rs/validator/ingress_message/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ DEPENDENCIES = [
"//rs/crypto/interfaces/sig_verification",
"//rs/crypto/standalone-sig-verifier",
"//rs/crypto/utils/threshold_sig_der",
"//rs/rust_canisters/dfn_core",
"//rs/types/types",
"//rs/validator",
"@crate_index//:base64",
"@crate_index//:hex",
"@crate_index//:ic-cdk",
]

DEV_DEPENDENCIES = [
Expand Down
2 changes: 1 addition & 1 deletion rs/validator/ingress_message/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ documentation.workspace = true

[dependencies]
base64 = { workspace = true }
dfn_core = { path = "../../rust_canisters/dfn_core" }
hex = { workspace = true }
ic-cdk = { workspace = true }
ic-crypto-interfaces-sig-verification = { path = "../../crypto/interfaces/sig_verification" }
ic-crypto-standalone-sig-verifier = { path = "../../crypto/standalone-sig-verifier" }
ic-crypto-utils-threshold-sig-der = { path = "../../crypto/utils/threshold_sig_der" }
Expand Down
19 changes: 13 additions & 6 deletions rs/validator/ingress_message/src/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ use ic_crypto_interfaces_sig_verification::{BasicSigVerifierByPublicKey, Caniste
use ic_types::crypto::threshold_sig::{IcRootOfTrust, RootOfTrustProvider};
use ic_types::crypto::{BasicSigOf, CanisterSigOf, CryptoResult, Signable, UserPublicKey};
use ic_types::messages::{HttpRequest, HttpRequestContent};
use ic_types::time::UNIX_EPOCH;
use ic_types::Time;
use std::convert::Infallible;
use std::sync::Arc;
use std::time::SystemTime;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -276,10 +274,19 @@ impl TimeProvider {
match &self {
TimeProvider::Constant(time) => *time,
TimeProvider::SystemTime => {
UNIX_EPOCH
+ dfn_core::api::now()
.duration_since(SystemTime::UNIX_EPOCH)
.expect("SystemTime is before UNIX EPOCH!")
#[cfg(not(target_arch = "wasm32"))]
{
Time::from_nanos_since_unix_epoch(
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("SystemTime is before UNIX EPOCH!")
.as_nanos() as u64,
)
}
#[cfg(target_arch = "wasm32")]
{
Time::from_nanos_since_unix_epoch(ic_cdk::api::time())
}
}
}
}
Expand Down

0 comments on commit ca43ff8

Please sign in to comment.