From e2f96d7c908458e9f34d03e09bb9d63f3e188543 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Fri, 7 Jun 2024 17:07:43 +0200 Subject: [PATCH] Misc fixes --- crates/apps_lib/src/cli.rs | 10 ++++------ crates/core/src/time.rs | 6 +++--- crates/namada/src/ledger/native_vp/ibc/mod.rs | 5 +++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index eadf78063ab..e2a578329ba 100644 --- a/crates/apps_lib/src/cli.rs +++ b/crates/apps_lib/src/cli.rs @@ -3475,12 +3475,10 @@ pub mod args { fn def(app: App) -> App { app.arg(NAMADA_START_TIME.def().help(wrap!( - "The start time of the ledger. Accepts a relaxed form of \ - RFC3339. A space or a 'T' are accepted as the separator \ - between the date and time components. Additional spaces are \ - allowed between each component.\nAll of these examples are \ - equivalent:\n2023-01-20T12:12:12Z\n2023-01-20 \ - 12:12:12Z\n2023- 01-20T12: 12:12Z" + "The start time of the ledger. Accepts a strict subset of \ + RFC3339. A 'T' is accepted as the separator between the date \ + and time components.\nHere is a valid timestamp: \ + 2023-01-20T12:12:12Z" ))) .arg( PATH_OPT diff --git a/crates/core/src/time.rs b/crates/core/src/time.rs index 1c2827baa3c..ef6e1d9b55e 100644 --- a/crates/core/src/time.rs +++ b/crates/core/src/time.rs @@ -253,7 +253,7 @@ impl BorshSerialize for DateTimeUtc { &self, writer: &mut W, ) -> std::io::Result<()> { - let raw = self.0.to_rfc3339(); + let raw = self.to_rfc3339(); BorshSerialize::serialize(&raw, writer) } } @@ -344,7 +344,7 @@ impl TryFrom for DateTimeUtc { impl From for Rfc3339String { fn from(dt: DateTimeUtc) -> Self { - Self(DateTime::to_rfc3339(&dt.0)) + Self(dt.to_rfc3339()) } } @@ -352,7 +352,7 @@ impl TryFrom for crate::tendermint::time::Time { type Error = crate::tendermint::Error; fn try_from(dt: DateTimeUtc) -> Result { - Self::parse_from_rfc3339(&DateTime::to_rfc3339(&dt.0)) + Self::parse_from_rfc3339(&dt.to_rfc3339()) } } diff --git a/crates/namada/src/ledger/native_vp/ibc/mod.rs b/crates/namada/src/ledger/native_vp/ibc/mod.rs index 3f5bc24cc0f..fc676981ece 100644 --- a/crates/namada/src/ledger/native_vp/ibc/mod.rs +++ b/crates/namada/src/ledger/native_vp/ibc/mod.rs @@ -353,10 +353,11 @@ fn match_value( /// A dummy header used for testing #[cfg(any(test, feature = "testing", feature = "benches"))] pub fn get_dummy_header() -> crate::storage::Header { - use crate::tendermint::time::Time as TmTime; + use crate::time::{DateTimeUtc, DurationSecs}; crate::storage::Header { hash: crate::hash::Hash([0; 32]), - time: TmTime::now().try_into().unwrap(), + #[allow(clippy::disallowed_methods)] + time: DateTimeUtc::now() + DurationSecs(5), next_validators_hash: crate::hash::Hash([0; 32]), } }