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

Replace chrono with time 0.3 #1030

Merged
merged 32 commits into from
Dec 7, 2021
Merged

Replace chrono with time 0.3 #1030

merged 32 commits into from
Dec 7, 2021

Commits on Nov 26, 2021

  1. pbt-gen: Converted from chrono to time 0.3

    chrono has soundness issues (see RUSTSEC-2020-0159) and does not
    seem to be maintained.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    7cdafe2 View commit details
    Browse the repository at this point in the history
  2. Replace dependency on chrono with time 0.3

    Change Time implementation to crate time: chrono has soundness issues
    (see RUSTSEC-2020-0159) and does not seem to be actively maintained.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    41f0aeb View commit details
    Browse the repository at this point in the history
  3. Add Time methods checked_add and checked_sub

    These should be used instead of the overloaded operators that broke
    the operator convention by returning a Result.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    a3a1972 View commit details
    Browse the repository at this point in the history
  4. proto: Don't use formatting methods of time

    Drop the "formatting" feature of time, as this brings in std.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    fe61780 View commit details
    Browse the repository at this point in the history
  5. pbt-gen: Add arb_datetime_for_rfc3339

    With crate time, the range of supported dates stretches to the ancient
    past beyond the common era, which is not representable in RFC 3339.
    Add a generator to produce `OffsetDateTime` values that are
    within the RFC 3339 spec.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    15a01b0 View commit details
    Browse the repository at this point in the history
  6. Ensure Time can only have values good for RFC 3339

    As the time values are meant for human-readable representation in
    the RFC 3339 format, make it not possible to construct Time with values
    that fall outside this standard representation.
    Conversion from time::OffsetDateTime is made fallible with
    a TryFrom impl replacing the From impl.
    Conversion from Unix timestamps is also affected.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    eb92f46 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    864d7fb View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    69f7512 View commit details
    Browse the repository at this point in the history
  9. Less allocatey ways of formatting date-times

    Provide and use another helper in proto mod serializers::timestamp,
    one that formats into a provided fmt::Write object rather than
    allocating a string.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    a56d3be View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2ae78de View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    5d68502 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    fb9918e View commit details
    Browse the repository at this point in the history
  13. tendermint: Remove a comment referencing chrono

    We use ErrorDetail::DurationOutOfRange without the source error
    from the time library because that is uninformative in the context.
    Also move the DateOutOfRange close with DurationOutOfRange
    since they can occur in the same operations and are generally similar.
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    f0cd9b7 View commit details
    Browse the repository at this point in the history
  14. light-client: add std feature for time

    The clock needs OffsetDateTime::now_utc().
    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    3e6e2ab View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    baaf513 View commit details
    Browse the repository at this point in the history
  16. testgen: minor code cleanup

    mzabaluev committed Nov 26, 2021
    Configuration menu
    Copy the full SHA
    bd4667e View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2021

  1. Restrict valid Time years to 1-9999

    Exclude year 0 because the spec on Google protobuf Timestamp forbids it.
    
    Add more helpers in pbt-gen to produce protobuf-safe values in both
    OffsetDateTime and RFC 3339 strings.
    
    Restrict the property tests to only use the protobuf-safe values
    where expected.
    mzabaluev committed Nov 29, 2021
    Configuration menu
    Copy the full SHA
    71644b1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c9d1a13 View commit details
    Browse the repository at this point in the history
  3. Changelog entries for #1030

    mzabaluev committed Nov 29, 2021
    Configuration menu
    Copy the full SHA
    d0e2392 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0fbe8b7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e26ed13 View commit details
    Browse the repository at this point in the history
  6. proto: remove the chrono type conversions

    The From impls are panicky and do not enforce compliance with
    protobuf message value restrictions.
    mzabaluev committed Nov 29, 2021
    Configuration menu
    Copy the full SHA
    f5c5f8b View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2021

  1. tendermint: remove direct uses of chrono types

    Replace with tendermint::Time.
    mzabaluev committed Nov 30, 2021
    Configuration menu
    Copy the full SHA
    1187ea9 View commit details
    Browse the repository at this point in the history
  2. Harden Timestamp conversions and serde

    Require the timestamp to be in the validity range (years 1-9999 in UTC)
    and the nanosecond member value to not exceed  999_999_999.
    
    Rename ErrorDetail::TimestampOverflow to TimestampNanosOutOfRange,
    because the old variant was not very informative (the chained
    TryFromIntError did not help) and we also use it for the above-range
    case now which is not an overflow.
    mzabaluev committed Nov 30, 2021
    Configuration menu
    Copy the full SHA
    3187803 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d36f166 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2021

  1. Restore nanosecond range check in Time::from_unix_timestamp

    Add a unit test to exercise the check.
    mzabaluev committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    135e062 View commit details
    Browse the repository at this point in the history
  2. proto: Improve timestamp::fmt_as_rfc3339_nanos

    - More ergonomic signature
    - A non-allocating implementation
    mzabaluev committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    2bbc9f4 View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2021

  1. Fix component name in changelog for 1030-remove-chrono

    Co-authored-by: Thane Thomson <thane@informal.systems>
    mzabaluev and thanethomson committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    0799aa1 View commit details
    Browse the repository at this point in the history
  2. time: Use Self instead of the type name in methods

    Co-authored-by: Thane Thomson <thane@informal.systems>
    mzabaluev and thanethomson committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    a7f1b20 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a091b0f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d87e926 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f5e6244 View commit details
    Browse the repository at this point in the history