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 (backport to 0.23.x) #1036

Merged
merged 10 commits into from
Dec 7, 2021

Commits on Nov 29, 2021

  1. Replace dependency on chrono with time 0.3

    Changes in tendermint:
    
    Change Time implementation to crate time.
    chrono has soundness issues (see RUSTSEC-2020-0159) and does not seem
    to be actively maintained.
    
    Ensure Time can only have values that are valid for Google protobuf
    Timestamp messages. Add ErrorDetail variant DateOutOfRange to report
    when this restriction is not met.
    
    Remove conversions between Time and chrono::DateTime, replacing them
    with conversions from/to time::OffsetDateTime.
    Conversion from time::OffsetDateTime is made fallible with
    a TryFrom impl.
    
    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.
    
    Changes in tendermint-pbt-gen:
    
    Change the time stragegies and helpers to produce
    time::OffsetDateTime values.
    Add strategies to generate date-time values and RFC 3339 strings
    in the range valid for protobuf Timestamp messages.
    
    Changes in tendermint-proto:
    
    Provide another helper in the serializers::timestamp module,
    one that formats into a provided fmt::Write object.
    
    Changes in tendermint-rpc:
    
    Use `OffsetDateTime` and `Date` types provided by the `time` crate
    in query operands instead of their `chrono` counterparts.
    mzabaluev committed Nov 29, 2021
    Configuration menu
    Copy the full SHA
    73ba36e View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2021

  1. 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
    28d1f98 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ae72117 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
    225c179 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
    dcd6ea5 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
    88b4594 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
    a6542d4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c7f2ddb View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    56fdfe1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2498607 View commit details
    Browse the repository at this point in the history