diff --git a/.gitignore b/.gitignore index 8dc09ba907..9221b1f7d6 100644 --- a/.gitignore +++ b/.gitignore @@ -52,5 +52,3 @@ target-debian/ /Mintlayer_Node_win_*_Setup.exe /Mintlayer_Node_GUI_win_*_Setup.exe -# local agent workspace -.opencode/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 374a532a19..0bfbebcfd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,22 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/ ## [Unreleased] ### Changed + - Build: + - the workspace no longer depends on `chrono` (unmaintained per RUSTSEC-2026-0543): + first-party code now uses `jiff`, and the remaining transitive uses are served by + temporary overlay forks (file-rotate, reedline, serde_with) that make `chrono` + optional or drop it; the overlays are tracked for removal once upstream releases + allow it. + + - Wallet CLI: + - `until_time(...)` output timelocks are now parsed as zero-padded, RFC 3339-style + timestamps (e.g. `2027-01-31T12:00:00Z`). Several lenient variants that were + accepted before (non-zero-padded fields such as `2027-1-31T12:0:0Z`) are now + rejected, while some extensions (space separator, omitted seconds, short + offsets, zone annotations) remain accepted. The `Bad time` error message now + renders timestamps in RFC 3339 form (e.g. `2024-01-12T12:54:52Z`) instead of the + previous `2024-01-12 12:54:52 UTC`. + - Wallet: - coin selection leaves out redundant UTXOs: the selection algorithms stop as soon as the target is met, and among equally economical solutions the one spending @@ -33,13 +49,8 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/ likewise now require an explicit `true`/`false` value. This makes the absence of an option distinguishable from an explicit opt-out, so a value from the configuration file is no longer silently overridden by the command line or the environment. - corresponding `ML_NODE_*` environment variables likewise now require an explicit - `true`/`false` value. This makes the absence of an option distinguishable from an - explicit opt-out, so a value from the configuration file is no longer silently - overridden by the command line or the environment. - `--enable-db-reckless-mode-in-ibd true`) instead of working as value-less flags; this - makes the absence of an option distinguishable from an explicit opt-out, so a value - from the configuration file is no longer silently overridden by the command line. + + ## [1.4.5] - 2026-11-10 ### Added diff --git a/Cargo.lock b/Cargo.lock index 717e576859..91d683eae5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -285,11 +285,11 @@ dependencies = [ "api-server-common", "async-trait", "chainstate-test-framework", - "chrono", "common", "crypto", "ctor", "futures", + "jiff", "libtest-mimic", "logging", "pos-accounting", @@ -762,6 +762,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "base64ct" version = "1.8.3" @@ -1566,20 +1572,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "chrono" -version = "0.4.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link 0.2.1", -] - [[package]] name = "ciborium" version = "0.2.2" @@ -1776,7 +1768,6 @@ dependencies = [ "anyhow", "bech32 0.11.1", "bitcoin-bech32", - "chrono", "clap", "crypto", "ctor", @@ -1786,6 +1777,7 @@ dependencies = [ "hex", "indoc", "itertools 0.14.0", + "jiff", "lazy_static", "logging", "merkletree-mintlayer", @@ -2386,12 +2378,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" dependencies = [ - "darling_core 0.23.0", - "darling_macro 0.23.0", + "darling_core 0.24.1", + "darling_macro 0.24.1", ] [[package]] @@ -2410,15 +2402,15 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" dependencies = [ "ident_case", "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.114", + "syn 3.0.9", ] [[package]] @@ -2434,13 +2426,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" dependencies = [ - "darling_core 0.23.0", + "darling_core 0.24.1", "quote", - "syn 2.0.114", + "syn 3.0.9", ] [[package]] @@ -2951,7 +2943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3054,7 +3046,7 @@ checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" dependencies = [ "cfg-if", "rustix 1.1.3", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3075,10 +3067,8 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "file-rotate" version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3ed82142801f5b1363f7d463963d114db80f467e860b1cd82228eaebc627a0" +source = "git+https://github.com/nullPointerEnjoyer/file-rotate.git?rev=642a9d0a262912798e7edb5d2970d0129123d48b#642a9d0a262912798e7edb5d2970d0129123d48b" dependencies = [ - "chrono", "flate2", ] @@ -3387,7 +3377,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows-link 0.2.1", + "windows-link 0.1.3", "windows-result 0.4.1", ] @@ -4022,7 +4012,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.5", + "socket2 0.5.10", "system-configuration", "tokio", "tower-service", @@ -4030,30 +4020,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core 0.61.2", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "iced" version = "0.13.1" @@ -4074,7 +4040,6 @@ version = "0.12.2" source = "git+https://github.com/iced-rs/iced_aw?rev=def1db9aac1e58a47e0c3127d4d4e95d724ca8ad#def1db9aac1e58a47e0c3127d4d4e95d724ca8ad" dependencies = [ "cfg-if", - "chrono", "iced", "iced_fonts", "itertools 0.14.0", @@ -4461,7 +4426,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -4503,6 +4468,58 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "jiff" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e" +dependencies = [ + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link 0.2.1", +] + +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb", +] + [[package]] name = "jni" version = "0.19.0" @@ -5616,7 +5633,6 @@ version = "1.4.5" dependencies = [ "anyhow", "chainstate", - "chrono", "common", "ctor", "futures", @@ -5624,6 +5640,7 @@ dependencies = [ "iced", "iced_aw", "iced_fonts", + "jiff", "logging", "networking", "node-comm", @@ -5651,7 +5668,6 @@ version = "1.4.5" dependencies = [ "anyhow", "chainstate", - "chrono", "common", "crypto", "futures", @@ -6791,6 +6807,15 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + [[package]] name = "pos-accounting" version = "1.4.5" @@ -7003,7 +7028,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.10.5", "proc-macro2", "quote", "syn 2.0.114", @@ -7318,10 +7343,8 @@ dependencies = [ [[package]] name = "reedline" version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bfa8cb0ad84c396c936d8abb814703d7042a433d2da75a0c7060cbdc89109f3" +source = "git+https://github.com/nullPointerEnjoyer/reedline.git?rev=1747ab50dacb0d476666cfd072afa73b5283db82#1747ab50dacb0d476666cfd072afa73b5283db82" dependencies = [ - "chrono", "crossbeam", "crossterm", "fd-lock", @@ -7752,7 +7775,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -7765,7 +7788,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -7822,7 +7845,7 @@ dependencies = [ "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -8138,9 +8161,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.149" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "itoa", "memchr", @@ -8203,13 +8226,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" +version = "3.23.0" +source = "git+https://github.com/nullPointerEnjoyer/serde_with.git?rev=9fdd6874f5e2e7ea5a6be56d279d9db4b60ca135#9fdd6874f5e2e7ea5a6be56d279d9db4b60ca135" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bs58", - "chrono", "hex", "indexmap 1.9.3", "indexmap 2.13.0", @@ -8223,14 +8244,13 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" +version = "3.23.0" +source = "git+https://github.com/nullPointerEnjoyer/serde_with.git?rev=9fdd6874f5e2e7ea5a6be56d279d9db4b60ca135#9fdd6874f5e2e7ea5a6be56d279d9db4b60ca135" dependencies = [ - "darling 0.23.0", + "darling 0.24.1", "proc-macro2", "quote", - "syn 2.0.114", + "syn 3.0.9", ] [[package]] @@ -8990,7 +9010,7 @@ dependencies = [ "getrandom 0.4.1", "once_cell", "rustix 1.1.3", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -10115,7 +10135,6 @@ dependencies = [ "build_utils", "chainstate", "chainstate-storage", - "chrono", "clap", "common", "consensus", @@ -10130,6 +10149,7 @@ dependencies = [ "hex", "humantime", "itertools 0.14.0", + "jiff", "jsonrpsee", "lazy_static", "logging", @@ -10814,7 +10834,7 @@ dependencies = [ "js-sys", "log", "naga", - "parking_lot 0.12.5", + "parking_lot 0.11.2", "profiling", "raw-window-handle", "smallvec", @@ -10842,7 +10862,7 @@ dependencies = [ "log", "naga", "once_cell", - "parking_lot 0.12.5", + "parking_lot 0.11.2", "profiling", "raw-window-handle", "rustc-hash 1.1.0", @@ -10884,7 +10904,7 @@ dependencies = [ "ndk-sys 0.5.0+25.2.9519653", "objc", "once_cell", - "parking_lot 0.12.5", + "parking_lot 0.11.2", "profiling", "range-alloc", "raw-window-handle", @@ -10948,7 +10968,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 57b88577b4..e5695b442c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,7 +151,6 @@ bytes = "1.1" byte-unit = "5.1" cfg-if = "1.0" chacha20poly1305 = "0.10" -chrono = "0.4" clap = "4.5" clap_complete = "4.5" console-subscriber = "0.5" @@ -170,7 +169,9 @@ dyn-clone = "1.0" enum-iterator = "2.0" enumflags2 = "0.7" expect-test = "1.3" -file-rotate = "0.7" +# Overlay fork with chrono made optional (RUSTSEC-2026-0543); see +# https://github.com/kstrafe/file-rotate/pull/40 — revert to a released version once it ships. +file-rotate = { git = "https://github.com/nullPointerEnjoyer/file-rotate.git", rev = "642a9d0a262912798e7edb5d2970d0129123d48b", default-features = false } fix-hidden-lifetime-bug = "0.2" # Note: we deliberately don't enable the `rand` feature of `fixed-hash` because it still uses # the `rand` crate v0.8.x, so the `random_using` calls generated by `construct_fixed_hash!` would @@ -198,10 +199,28 @@ hyper = "1.7" iced = "0.13" # Note: we need this fix - https://github.com/iced-rs/iced_aw/pull/329 # TODO: switch back to a released version of iced_aw once the fix is released (need version > 0.12) -iced_aw = { git = "https://github.com/iced-rs/iced_aw", rev = "def1db9aac1e58a47e0c3127d4d4e95d724ca8ad" } +iced_aw = { git = "https://github.com/iced-rs/iced_aw", rev = "def1db9aac1e58a47e0c3127d4d4e95d724ca8ad", default-features = false, features = [ + "badge", + "card", + "number_input", + "color_picker", + "grid", + "tab_bar", + "tabs", + "slide_bar", + "wrap", + "selection_list", + "quad", + "context_menu", + "spinner", + "drop_down", + "menu", + "sidebar", +] } iced_fonts = "0.1" indoc = "2.0" itertools = "0.14" +jiff = "1.0" jsonrpsee = { version = "0.26", default-features = false } lazy_static = "1.4" libtest-mimic = "0.8" @@ -227,7 +246,9 @@ rand_core = "0.10" rand_0_8 = { version = "0.8", package = "rand" } rand_chacha = "0.10" rayon = "1.10" -reedline = "0.38" +# Overlay fork without chrono (RUSTSEC-2026-0543); revert to a released version once our +# MSRV allows reedline >= 0.53 (which dropped chrono upstream). +reedline = { git = "https://github.com/nullPointerEnjoyer/reedline.git", rev = "1747ab50dacb0d476666cfd072afa73b5283db82" } ref-cast = "1.0" regex = "1.10" replace_with = "0.1" @@ -245,7 +266,10 @@ semver = "1.0" serde = "1.0" serde_json = "1.0" serde_test = "1.0" -serde_with = "3.6" +# Overlay fork without the optional chrono integration (RUSTSEC-2026-0543); the weak +# feature references otherwise force chrono into the lockfile even when unused. +# Revert to a released version when the advisory is resolved upstream. +serde_with = { git = "https://github.com/nullPointerEnjoyer/serde_with.git", rev = "9fdd6874f5e2e7ea5a6be56d279d9db4b60ca135" } serial_test = "3.5" sha-1 = "0.10" sha2 = "0.10" @@ -373,3 +397,4 @@ parity-scale-codec = { git = "https://github.com/paritytech/parity-scale-codec.g # Upstream has replaced the crate with "cryoglyph" in unreleased iced 0.15, so there is no # upstream release with the fix. Drop this patch once iced ships one. iced_glyphon = { git = "https://github.com/mintlayer/iced-glyphon", rev = "acb3fc10a3a15ee6e0e7da4e264db2338c09a7c1" } + diff --git a/api-server/storage-test-suite/Cargo.toml b/api-server/storage-test-suite/Cargo.toml index 54a267aa04..6914cd3db5 100644 --- a/api-server/storage-test-suite/Cargo.toml +++ b/api-server/storage-test-suite/Cargo.toml @@ -18,7 +18,7 @@ randomness = { path = "../../randomness" } serialization = { path = "../../serialization" } async-trait.workspace = true -chrono.workspace = true +jiff.workspace = true ctor.workspace = true futures = { workspace = true, default-features = false } libtest-mimic.workspace = true diff --git a/api-server/storage-test-suite/src/podman.rs b/api-server/storage-test-suite/src/podman.rs index 7aa355b748..c6739a2f2f 100644 --- a/api-server/storage-test-suite/src/podman.rs +++ b/api-server/storage-test-suite/src/podman.rs @@ -67,7 +67,10 @@ fn random_string(length: usize) -> String { } fn current_datetime_as_string() -> String { - chrono::Utc::now().format("%Y%m%d_%H%M%S").to_string() + jiff::Timestamp::now() + .to_zoned_datetime(jiff::tz::TimeZone::UTC) + .strftime("%Y%m%d_%H%M%S") + .to_string() } pub struct Podman { diff --git a/common/Cargo.toml b/common/Cargo.toml index f5f1dee55b..a1e7a71931 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -18,7 +18,7 @@ utils = { path = "../utils" } anyhow.workspace = true bech32.workspace = true -chrono = { workspace = true } +jiff = { workspace = true } clap = { workspace = true, features = ["derive"] } fixed-hash.workspace = true generic-array.workspace = true diff --git a/common/src/primitives/time.rs b/common/src/primitives/time.rs index f6f06f3717..8adca29ae9 100644 --- a/common/src/primitives/time.rs +++ b/common/src/primitives/time.rs @@ -19,7 +19,6 @@ use std::{ time::{Duration, SystemTime}, }; -use chrono::TimeZone; use serde::{Deserialize, Serialize}; use rpc_description::HasValueHint; @@ -110,28 +109,26 @@ impl Time { self.time.saturating_sub(t.time) } - /// Convert this `Time` instance to `chrono::DateTime`. + /// Convert this `Time` instance to a `jiff::Timestamp`. /// - /// This may fail if the time is too far into the future. - pub fn as_absolute_time(&self) -> Option> { - TryInto::::try_into(self.time.as_secs()).ok().and_then(|secs| { - // Note: chrono::DateTime supports time values up to about 262,000 years away - // from the common era, which is still way below i64::MAX; i.e. timestamp_opt - // may still return None here. - chrono::Utc.timestamp_opt(secs, self.time.subsec_nanos()).single() - }) + /// This may fail if the time is too far into the future: `jiff::Timestamp` + /// supports dates up to the end of year 9999. + pub fn as_absolute_time(&self) -> Option { + TryInto::::try_into(self.time.as_secs()) + .ok() + .and_then(|secs| jiff::Timestamp::new(secs, self.time.subsec_nanos() as i32).ok()) } - /// Create a new `Time` instance from `chrono::DateTime`. + /// Create a new `Time` instance from a `jiff::Timestamp`. /// /// This will fail if the date-time is before the Unix epoch or if it doesn't represent /// a whole number of seconds. - pub fn from_absolute_time(time: &chrono::DateTime) -> Option { - if time.timestamp_subsec_nanos() != 0 { + pub fn from_absolute_time(time: &jiff::Timestamp) -> Option { + if time.subsec_nanosecond() != 0 { return None; } - let seconds: u64 = time.timestamp().try_into().ok()?; + let seconds: u64 = time.as_second().try_into().ok()?; Some(Self::from_secs_since_epoch(seconds)) } } @@ -165,7 +162,9 @@ impl Debug for Time { let utc_time = self.as_absolute_time(); if let Some(time) = utc_time { - write!(f, "{time:?}") + // `jiff::Timestamp`'s Display renders RFC 3339 (e.g. "2024-01-12T12:54:52Z"), + // which is what the Debug output looked like with `chrono`. + write!(f, "{time}") } else { write!(f, "Time({:?})", self.time) } @@ -177,7 +176,21 @@ impl Display for Time { let utc_time = self.as_absolute_time(); if let Some(time) = utc_time { - write!(f, "{time}") + // Same format that `chrono`'s Display used to produce, e.g. + // "2024-01-12 12:54:52 UTC" / "2024-01-12 12:54:52.123 UTC"; the subsecond + // part uses chrono's grouping (3, 6 or 9 digits, no trailing-zero trimming). + let subsec_nanos = time.subsec_nanosecond(); + let base = + time.to_zoned_datetime(jiff::tz::TimeZone::UTC).strftime("%Y-%m-%d %H:%M:%S"); + if subsec_nanos == 0 { + write!(f, "{base} UTC") + } else if subsec_nanos % 1_000_000 == 0 { + write!(f, "{base}.{:03} UTC", subsec_nanos / 1_000_000) + } else if subsec_nanos % 1_000 == 0 { + write!(f, "{base}.{:06} UTC", subsec_nanos / 1_000) + } else { + write!(f, "{base}.{:09} UTC", subsec_nanos) + } } else { // Note: we could use humantime::format_duration here, but the output won't be // very nice, e.g. for Duration::MAX it'll be: @@ -257,6 +270,14 @@ mod tests { let s = format!("{t}"); assert_eq!(s, "2024-01-12 12:54:52.123 UTC"); + // Subsecond digits use chrono's 3/6/9 grouping (no trailing-zero trimming). + let t = Time::from_duration_since_epoch(Duration::from_millis(1705064092100)); + assert_eq!(format!("{t}"), "2024-01-12 12:54:52.100 UTC"); + let t = Time::from_duration_since_epoch(Duration::from_micros(1705064092001100)); + assert_eq!(format!("{t}"), "2024-01-12 12:54:52.001100 UTC"); + let t = Time::from_duration_since_epoch(Duration::from_nanos(1_705_064_092_000_000_001)); + assert_eq!(format!("{t}"), "2024-01-12 12:54:52.000000001 UTC"); + let t = Time::from_duration_since_epoch(Duration::MAX); let s = format!("{t:?}"); assert_eq!(s, "Time(18446744073709551615.999999999s)"); @@ -268,26 +289,23 @@ mod tests { #[trace] #[case(Seed::from_entropy())] fn from_to_absolute_time(#[case] seed: Seed) { - use chrono::prelude::*; - let mut rng = make_seedable_rng(seed); for _ in 0..10 { let year = rng.random_range(1970..=3000); let month = rng.random_range(1..=12); let days_in_month = - NaiveDate::from_ymd_opt(year, month, 1).unwrap().num_days_in_month(); + jiff::civil::date(year, month.try_into().unwrap(), 1).days_in_month(); let day = rng.random_range(1..=days_in_month); let hour = rng.random_range(0..24); let min = rng.random_range(0..60); let sec = rng.random_range(0..60); - let abs_time = DateTime::from_naive_utc_and_offset( - NaiveDateTime::new( - NaiveDate::from_ymd_opt(year, month, day.into()).unwrap(), - NaiveTime::from_hms_opt(hour, min, sec).unwrap(), - ), - Utc, - ); + let abs_time = jiff::tz::TimeZone::UTC + .to_zoned_datetime( + jiff::civil::date(year, month.try_into().unwrap(), day).at(hour, min, sec, 0), + ) + .unwrap() + .timestamp(); let time = Time::from_absolute_time(&abs_time).unwrap(); let abs_time_from_conversion = time.as_absolute_time().unwrap(); @@ -295,7 +313,8 @@ mod tests { // Only a whole number of seconds should be allowed. let millis = rng.random_range(1..1000); - let abs_time_with_millis = abs_time + Duration::from_millis(millis); + let abs_time_with_millis = + abs_time.checked_add(jiff::SignedDuration::from_millis(millis)).unwrap(); assert!(Time::from_absolute_time(&abs_time_with_millis).is_none()); } } diff --git a/deny.toml b/deny.toml index b6d431259f..dc8c354619 100644 --- a/deny.toml +++ b/deny.toml @@ -1,3 +1,14 @@ +[sources] +# Temporary overlays (RUSTSEC-2026-0543 chrono removal) — narrow, exact-URL allows +# instead of an org-wide expansion; remove when upstream releases land +# (file-rotate: kstrafe/file-rotate#40; reedline >= 0.53 after an MSRV bump; serde_with +# once chrono's status is resolved upstream). +allow-git = [ + "https://github.com/nullPointerEnjoyer/file-rotate", + "https://github.com/nullPointerEnjoyer/reedline", + "https://github.com/nullPointerEnjoyer/serde_with", +] + [sources.allow-org] github = [ "mintlayer", # allow any code from mintlayer's github diff --git a/node-gui/Cargo.toml b/node-gui/Cargo.toml index 8e5e165866..f478dfad3b 100644 --- a/node-gui/Cargo.toml +++ b/node-gui/Cargo.toml @@ -25,7 +25,7 @@ wallet-types = { path = "../wallet/types", default-features = false } wallet-storage = { path = "../wallet/storage", default-features = false } anyhow.workspace = true -chrono.workspace = true +jiff.workspace = true ctor.workspace = true futures.workspace = true heck.workspace = true diff --git a/node-gui/backend/Cargo.toml b/node-gui/backend/Cargo.toml index a53801f9ae..c16ebd9d69 100644 --- a/node-gui/backend/Cargo.toml +++ b/node-gui/backend/Cargo.toml @@ -26,7 +26,6 @@ wallet-rpc-lib = { path = "../../wallet/wallet-rpc-lib", default-features = fals wallet-types = { path = "../../wallet/types", default-features = false } anyhow.workspace = true -chrono.workspace = true futures.workspace = true itertools.workspace = true semver.workspace = true diff --git a/node-gui/src/main_window/mod.rs b/node-gui/src/main_window/mod.rs index b9f51091e4..f08be98f52 100644 --- a/node-gui/src/main_window/mod.rs +++ b/node-gui/src/main_window/mod.rs @@ -106,13 +106,15 @@ fn print_coin_amount_with_ticker(chain_config: &ChainConfig, value: Amount) -> S fn print_timestamp(timestamp: Duration) -> Option { let timestamp: i64 = timestamp.as_secs().try_into().ok()?; - let timestamp = chrono::DateTime::from_timestamp(timestamp, 0); - - // To print in local timezone - // use chrono::TimeZone; - // let timestamp = chrono::Local.from_utc_datetime(×tamp); - - timestamp.map(|t| t.format("%Y-%m-%d %H:%M:%S").to_string()) + let timestamp = jiff::Timestamp::from_second(timestamp).ok()?; + + // To print in local timezone, use `jiff::tz::TimeZone::system()` instead of UTC. + Some( + timestamp + .to_zoned_datetime(jiff::tz::TimeZone::UTC) + .strftime("%Y-%m-%d %H:%M:%S") + .to_string(), + ) } fn print_block_timestamp(timestamp: BlockTimestamp) -> String { diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 00160da8ef..ad73bebd0c 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -312,12 +312,6 @@ user-id = 267 # Tony Arcieri (tarcieri) start = "2019-08-30" end = "2026-10-15" -[[trusted.chrono]] -criteria = "safe-to-deploy" -user-id = 4556 # Dirkjan Ochtman (djc) -start = "2022-07-25" -end = "2026-12-08" - [[trusted.clap]] criteria = "safe-to-deploy" user-id = 6743 # Ed Page (epage) diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 477399d33a..85dfc3b305 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -28,6 +28,9 @@ url = "https://raw.githubusercontent.com/mozilla/supply-chain/main/audits.toml" [imports.zcash] url = "https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/audits.toml" +[policy.file-rotate] +audit-as-crates-io = false + [policy.fontconfig-parser] audit-as-crates-io = true @@ -52,6 +55,15 @@ audit-as-crates-io = true [policy.parity-scale-codec-derive] audit-as-crates-io = true +[policy.reedline] +audit-as-crates-io = false + +[policy.serde_with] +audit-as-crates-io = false + +[policy.serde_with_macros] +audit-as-crates-io = false + [policy.trezor-client] audit-as-crates-io = false @@ -115,6 +127,10 @@ criteria = "safe-to-deploy" version = "1.1.1" criteria = "safe-to-deploy" +[[exemptions.base64]] +version = "0.23.1" +criteria = "safe-to-deploy" + [[exemptions.bigdecimal]] version = "0.4.10" criteria = "safe-to-deploy" @@ -340,7 +356,7 @@ version = "0.14.4" criteria = "safe-to-deploy" [[exemptions.darling]] -version = "0.23.0" +version = "0.24.1" criteria = "safe-to-deploy" [[exemptions.darling_core]] @@ -348,7 +364,7 @@ version = "0.14.4" criteria = "safe-to-deploy" [[exemptions.darling_core]] -version = "0.23.0" +version = "0.24.1" criteria = "safe-to-deploy" [[exemptions.darling_macro]] @@ -356,7 +372,7 @@ version = "0.14.4" criteria = "safe-to-deploy" [[exemptions.darling_macro]] -version = "0.23.0" +version = "0.24.1" criteria = "safe-to-deploy" [[exemptions.dashmap]] @@ -519,10 +535,6 @@ criteria = "safe-to-deploy" version = "1.0.0" criteria = "safe-to-deploy" -[[exemptions.file-rotate]] -version = "0.7.6" -criteria = "safe-to-deploy" - [[exemptions.find-msvc-tools]] version = "0.1.9" criteria = "safe-to-deploy" @@ -679,10 +691,6 @@ criteria = "safe-to-deploy" version = "0.5.2" criteria = "safe-to-deploy" -[[exemptions.iana-time-zone]] -version = "0.1.65" -criteria = "safe-to-deploy" - [[exemptions.iced_aw]] version = "0.12.2@git:def1db9aac1e58a47e0c3127d4d4e95d724ca8ad" criteria = "safe-to-deploy" @@ -707,6 +715,26 @@ criteria = "safe-to-deploy" version = "0.7.10" criteria = "safe-to-run" +[[exemptions.jiff]] +version = "1.0.1" +criteria = "safe-to-deploy" + +[[exemptions.jiff-core]] +version = "1.0.1" +criteria = "safe-to-deploy" + +[[exemptions.jiff-static]] +version = "1.0.1" +criteria = "safe-to-deploy" + +[[exemptions.jiff-tzdb]] +version = "1.0.0" +criteria = "safe-to-deploy" + +[[exemptions.jiff-tzdb-platform]] +version = "1.0.0" +criteria = "safe-to-deploy" + [[exemptions.jni]] version = "0.19.0" criteria = "safe-to-deploy" @@ -1055,6 +1083,10 @@ criteria = "safe-to-deploy" version = "1.15.0" criteria = "safe-to-deploy" +[[exemptions.portable-atomic-util]] +version = "0.2.8" +criteria = "safe-to-deploy" + [[exemptions.ppv-lite86]] version = "0.2.21" criteria = "safe-to-deploy" @@ -1163,10 +1195,6 @@ criteria = "safe-to-deploy" version = "0.4.6" criteria = "safe-to-deploy" -[[exemptions.reedline]] -version = "0.38.0" -criteria = "safe-to-deploy" - [[exemptions.rend]] version = "0.4.2" criteria = "safe-to-deploy" @@ -1279,14 +1307,6 @@ criteria = "safe-to-deploy" version = "0.7.1" criteria = "safe-to-deploy" -[[exemptions.serde_with]] -version = "3.21.0" -criteria = "safe-to-deploy" - -[[exemptions.serde_with_macros]] -version = "3.21.0" -criteria = "safe-to-deploy" - [[exemptions.serial_test]] version = "3.5.0" criteria = "safe-to-run" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index a69f2d551a..c8914b5759 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -308,13 +308,6 @@ user-id = 267 user-login = "tarcieri" user-name = "Tony Arcieri" -[[publisher.chrono]] -version = "0.4.43" -when = "2026-01-14" -user-id = 4556 -user-login = "djc" -user-name = "Dirkjan Ochtman" - [[publisher.clap]] version = "4.5.57" when = "2026-02-03" @@ -879,6 +872,13 @@ user-id = 6743 user-login = "epage" user-name = "Ed Page" +[[publisher.itertools]] +version = "0.10.5" +when = "2022-09-20" +user-id = 1442 +user-login = "jswrenn" +user-name = "Jack Wrenn" + [[publisher.itertools]] version = "0.12.1" when = "2024-01-29" @@ -1506,8 +1506,8 @@ user-login = "dtolnay" user-name = "David Tolnay" [[publisher.serde_json]] -version = "1.0.149" -when = "2026-01-06" +version = "1.0.154" +when = "2026-10-11" user-id = 3618 user-login = "dtolnay" user-name = "David Tolnay" @@ -2811,11 +2811,6 @@ criteria = "safe-to-deploy" delta = "1.0.0-rc.2 -> 1.0.0" notes = "Only minor changes made for a stable release." -[[audits.bytecode-alliance.audits.iana-time-zone-haiku]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.1.2" - [[audits.bytecode-alliance.audits.idna]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -3663,12 +3658,6 @@ delta = "2.0.0-beta1 -> 2.0.0-beta2" notes = "from_utf8_unchecked unsafe remove, all other unsafe not meaningfully changed" aggregated-from = "https://chromium.googlesource.com/chromium/src/+/main/third_party/rust/chromium_crates_io/supply-chain/audits.toml?format=TEXT" -[[audits.google.audits.itertools]] -who = "ChromeOS" -criteria = "safe-to-run" -version = "0.10.5" -aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" - [[audits.google.audits.lazy_static]] who = "Lukasz Anforowicz " criteria = "safe-to-deploy" diff --git a/wallet/wallet-cli-commands/Cargo.toml b/wallet/wallet-cli-commands/Cargo.toml index 3b15d57e20..3754b0de65 100644 --- a/wallet/wallet-cli-commands/Cargo.toml +++ b/wallet/wallet-cli-commands/Cargo.toml @@ -28,7 +28,7 @@ wallet-types = { path = "../types", default-features = false } async-trait.workspace = true bigdecimal.workspace = true -chrono.workspace = true +jiff.workspace = true clap = { workspace = true, features = ["derive"] } crossterm.workspace = true derive_more.workspace = true diff --git a/wallet/wallet-cli-commands/src/helper_types.rs b/wallet/wallet-cli-commands/src/helper_types.rs index 902bf6de87..61681b322a 100644 --- a/wallet/wallet-cli-commands/src/helper_types.rs +++ b/wallet/wallet-cli-commands/src/helper_types.rs @@ -613,7 +613,7 @@ impl CliTokenTotalSupply { } /// An OutputTimeLock that can be parsed from strings of the form "block_count(num)", "seconds(num)", -/// "until_height(num)" and "until_time(RFC 3339 datetime)". +/// "until_height(num)" and "until_time(RFC 3339-style datetime)". #[derive(Debug, Clone)] pub enum CliOutputTimeLock { UntilHeight(BlockHeight), @@ -648,7 +648,7 @@ impl FromStr for CliOutputTimeLock { Self::UntilHeight(parse_u64(arg)?.into()) } else if lock_type.eq_ignore_ascii_case("until_time") { let date_time = arg - .parse::>() + .parse::() .map_err(|_| ParseError::InvalidTime(arg.to_owned()))?; let time = Time::from_absolute_time(&date_time).ok_or(ParseError::BadTime(date_time))?; @@ -821,7 +821,7 @@ pub enum ParseError { InvalidTime(String), #[error("Bad time: {0}")] - BadTime(chrono::DateTime), + BadTime(jiff::Timestamp), #[error("Invalid currency: {0}")] InvalidCurrency(String), @@ -840,7 +840,6 @@ pub enum ParseError { #[cfg(test)] mod tests { - use std::time::Duration; use rstest::rstest; @@ -1248,8 +1247,6 @@ mod tests { #[trace] #[case(Seed::from_entropy())] fn test_parse_output_timelock(#[case] seed: Seed) { - use chrono::prelude::*; - let mut rng = make_seedable_rng(seed); for _ in 0..10 { @@ -1276,28 +1273,30 @@ mod tests { let year = rng.random_range(1970..=3000); let month = rng.random_range(1..=12); let days_in_month = - NaiveDate::from_ymd_opt(year, month, 1).unwrap().num_days_in_month(); + jiff::civil::date(year, month.try_into().unwrap(), 1).days_in_month(); let day = rng.random_range(1..=days_in_month); let hour = rng.random_range(0..24); let min = rng.random_range(0..60); let sec = rng.random_range(0..60); - let expected_time = NaiveDateTime::new( - NaiveDate::from_ymd_opt(year, month, day.into()).unwrap(), - NaiveTime::from_hms_opt(hour, min, sec).unwrap(), - ); - let expected_time_utc = DateTime::from_naive_utc_and_offset(expected_time, Utc); + let expected_time_utc = jiff::tz::TimeZone::UTC + .to_zoned_datetime( + jiff::civil::date(year, month.try_into().unwrap(), day).at(hour, min, sec, 0), + ) + .unwrap() + .timestamp(); let tz_hours = rng.random_range(0..24); let tz_mins = rng.random_range(0..60); let tz_positive = rng.random_bool(0.5); let expected_time_with_tz = { - let offset = Duration::from_secs(tz_hours * 3600 + tz_mins * 60); + let offset = jiff::SignedDuration::from_secs(tz_hours * 3600 + tz_mins * 60); if tz_positive { expected_time_utc - offset } else { expected_time_utc + offset } }; - let datetime_base_str = format!("{year}-{month}-{day}T{hour}:{min}:{sec}"); + let datetime_base_str = + format!("{year:04}-{month:02}-{day:02}T{hour:02}:{min:02}:{sec:02}"); let datetime_str_utc = format!("{datetime_base_str}Z"); let tz_plus_minus = if tz_positive { "+" } else { "-" }; let tz_str = format!("{tz_plus_minus}{tz_hours:02}:{tz_mins:02}"); @@ -1326,6 +1325,32 @@ mod tests { Time::from_absolute_time(&expected_time_with_tz).unwrap() )) ); + + // Non-zero-padded variants that the previous parser accepted are + // now rejected (fixed single-digit fields, independent of the + // random values above). + let unpadded_str = "2419-3-29T6:7:5Z"; + let res = CliOutputTimeLock::from_str(&format!("until_time({unpadded_str})")); + assert!(matches!(res, Err(ParseError::InvalidTime(_)))); + + // Some lenient extensions remain accepted (Temporal-style parsing): + // space separator and omitted seconds. + let space_str = + format!("{year:04}-{month:02}-{day:02} {hour:02}:{min:02}:{sec:02}Z"); + let parsed: OutputTimeLock = + CliOutputTimeLock::from_str(&format!("until_time({space_str})")) + .unwrap() + .into(); + assert_eq!( + parsed, + OutputTimeLock::UntilTime(BlockTimestamp::from_time( + Time::from_absolute_time(&expected_time_utc).unwrap() + )) + ); + + // Bare epoch seconds are not a valid timestamp here. + let res = CliOutputTimeLock::from_str(&format!("until_time({})", 1705064092_u64)); + assert!(matches!(res, Err(ParseError::InvalidTime(_)))); } let sec_frac = rng.random_range(1..1000); diff --git a/wallet/wallet-cli-commands/src/lib.rs b/wallet/wallet-cli-commands/src/lib.rs index 83f965cf2e..5cc04d8fbf 100644 --- a/wallet/wallet-cli-commands/src/lib.rs +++ b/wallet/wallet-cli-commands/src/lib.rs @@ -1050,7 +1050,7 @@ pub enum HtlcGroupSubCommand { secret_hash: String, /// The address that can spend the HTLC providing the secret. spend_address: String, - /// The refund timelock, e.g. block_count(720) or until_time(RFC 3339). + /// The refund timelock, e.g. block_count(720) or until_time(RFC 3339-style). refund_timelock: CliOutputTimeLock, /// The address that can refund the HTLC after the refund timelock expires. refund_address: String, @@ -2601,7 +2601,7 @@ pub enum WalletCommand { /// The refund timelock. /// - /// The format is one of: block_count(num), seconds(num), until_height(num) and until_time(RFC 3339 datetime), + /// The format is one of: block_count(num), seconds(num), until_height(num) and until_time(RFC 3339-style datetime), /// e.g. block_count(720), seconds(86400), until_height(500000), until_time(2026-02-26T12:30:00Z). refund_timelock: CliOutputTimeLock, diff --git a/wallet/wallet-cli-commands/src/wizard/mod.rs b/wallet/wallet-cli-commands/src/wizard/mod.rs index 9859680801..f4e5c8dec6 100644 --- a/wallet/wallet-cli-commands/src/wizard/mod.rs +++ b/wallet/wallet-cli-commands/src/wizard/mod.rs @@ -419,7 +419,7 @@ pub fn htlc_create(backend: &mut impl PromptBackend) -> Result "Refund time (RFC 3339):", + 3 => "Refund time (RFC 3339-style):", _ => "Timelock value:", }, None,