Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Jun 7, 2024
1 parent 0709b3b commit e2f96d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 4 additions & 6 deletions crates/apps_lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -344,15 +344,15 @@ impl TryFrom<Rfc3339String> for DateTimeUtc {

impl From<DateTimeUtc> for Rfc3339String {
fn from(dt: DateTimeUtc) -> Self {
Self(DateTime::to_rfc3339(&dt.0))
Self(dt.to_rfc3339())
}
}

impl TryFrom<DateTimeUtc> for crate::tendermint::time::Time {
type Error = crate::tendermint::Error;

fn try_from(dt: DateTimeUtc) -> Result<Self, Self::Error> {
Self::parse_from_rfc3339(&DateTime::to_rfc3339(&dt.0))
Self::parse_from_rfc3339(&dt.to_rfc3339())
}
}

Expand Down
5 changes: 3 additions & 2 deletions crates/namada/src/ledger/native_vp/ibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
}
}
Expand Down

0 comments on commit e2f96d7

Please sign in to comment.