Enforce consistent datetime serialization#3389
Conversation
a587e9b to
1ef2adf
Compare
tzemanovic
left a comment
There was a problem hiding this comment.
looks good, just in crates/apps_lib/src/cli.rs pls update help for NAMADA_START_TIME
1ef2adf to
7f38267
Compare
7f38267 to
3352219
Compare
3352219 to
834a468
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3389 +/- ##
=======================================
Coverage 53.92% 53.93%
=======================================
Files 317 317
Lines 107575 107610 +35
=======================================
+ Hits 58011 58037 +26
- Misses 49564 49573 +9 ☔ View full report in Codecov by Sentry. |
834a468 to
c18864e
Compare
murisi
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks!
murisi
left a comment
There was a problem hiding this comment.
Just to be sure that hardware wallet will continue to work, could we please demonstrate in a unit test that DateTimeUtc is a subset of DateTime somewhere?
* tiago/consistent-datetime-serialization: Changelog for #3389 Improve tx salting Fix from tm time impl for `DateTimeUtc` Misc fixes Increase gas limit in `FinalizeBlock` tests Rebuild tx fixtures Resign localnet genesis txs Rebuild wasms for tests gen_localnet.py: Fix genesis time string Add datetime encoding tests Enforce fixed RFC3339 format
Co-authored-by: Yuji Ito <yito88@users.noreply.github.com>
0ac361d to
7f90393
Compare
This PR works with the hardware wallet. We just need to make a (hopefully) minor change on the hardware wallet to increase the precision it displays. See for instance the following where |
murisi
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks!
Test vectors contain data not found in serializations.
murisi
left a comment
There was a problem hiding this comment.
Could we please change the line https://github.com/anoma/namada/blob/7f90393d0456a8fa4afac71aeb4caa390b99a229/crates/sdk/src/signing.rs#L1917 to format!("Timestamp : {}", tx.header.timestamp), ? This will change the expected output on the Ledger app from 2 | Timestamp : 4900-04-22 06:26:45.041754692 UTC to something like 3 | Timestamp : 4440-02-19T23:31:34.674481+00:00. This is required because the Borsh serialization does not contain the last 3 decimal places.
Either we do the above, or we increase the number of decimal places in the Borsh serialization of a DateTimeUtc so that the hardware wallet is able to meet the precise expectations.
murisi
left a comment
There was a problem hiding this comment.
Great! This PR does not break the hardware wallet. Thanks!
* tiago/consistent-datetime-serialization: Changelog for #3389 Regen tx fixtures Resign localnet genesis txs Rebuild wasms for tests gen_localnet.py: Fix genesis time string Increase precision of timestamps to 9 nanos Fix genesis time in tests Keep nanoseconds during CometBFT time conversions Switch to fixed offset format in UTC Increase robustness of datetime test Improve tx salting Fix from tm time impl for `DateTimeUtc` Misc fixes Increase gas limit in `FinalizeBlock` tests Add datetime encoding tests Enforce fixed RFC3339 format
* tiago/consistent-datetime-serialization: Changelog for #3389 Regen tx fixtures Resign localnet genesis txs Rebuild wasms for tests gen_localnet.py: Fix genesis time string Increase precision of timestamps to 9 nanos Fix genesis time in tests Keep nanoseconds during CometBFT time conversions Switch to fixed offset format in UTC Increase robustness of datetime test Improve tx salting Fix from tm time impl for `DateTimeUtc` Misc fixes Increase gas limit in `FinalizeBlock` tests Add datetime encoding tests Enforce fixed RFC3339 format
* origin/tiago/consistent-datetime-serialization: Changelog for #3389 Regen tx fixtures Resign localnet genesis txs Rebuild wasms for tests gen_localnet.py: Fix genesis time string Increase precision of timestamps to 9 nanos Fix genesis time in tests Keep nanoseconds during CometBFT time conversions Switch to fixed offset format in UTC Increase robustness of datetime test Improve tx salting Fix from tm time impl for `DateTimeUtc` Misc fixes Increase gas limit in `FinalizeBlock` tests Add datetime encoding tests Enforce fixed RFC3339 format
Describe your changes
Our
DateTimeUtctype allowed a relaxed representation of RFC3339 strings. We now enforce a string subset of this format, to guarantee deterministic serialization.Indicate on which release or other PRs this topic is based on
v0.39.0Checklist before merging to
draft