diff --git a/.cargo/config.toml b/.cargo/config.toml index 5bcbe5c77c..c03efdff1b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,9 +1,2 @@ -[target.x86_64-unknown-linux-gnu] -rustflags = [ - # LLD is generally faster and might be the default for Rust in the future. - # See here: https://github.com/rust-lang/rust/issues/71515 - "-C", "link-arg=-fuse-ld=lld", -] - [env] CXXFLAGS = "-include cstdint" #TODO: remove once RocksDB 0.24 is released diff --git a/.circleci/config.yml b/.circleci/config.yml index e1f9abf351..91d6e748ce 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,7 @@ executors: # The default docker image used in the main-workflow rust-docker: docker: - - image: cimg/rust:1.88.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.92.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well commands: check_windows: @@ -47,7 +47,7 @@ commands: # Install rust with rustup. Invoke-WebRequest -Uri "https://win.rustup.rs/" -OutFile "C:\rustup-init.exe" - & C:\rustup-init.exe -y --default-toolchain "1.88.0-x86_64-pc-windows-msvc" --no-modify-path --profile minimal # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + & C:\rustup-init.exe -y --default-toolchain "1.92.0-x86_64-pc-windows-msvc" --no-modify-path --profile minimal # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well # Add cargo to PATH $Env:Path += ";$Env:USERPROFILE\.cargo\bin" @@ -77,7 +77,7 @@ commands: parameters: cache_key: type: string - default: v4.2.0-rust-1.88.0-snarkos-stable-cache + default: v4.2.0-rust-1.92.0-snarkos-stable-cache steps: - run: set -e - run: @@ -117,7 +117,7 @@ commands: parameters: cache_key: type: string - default: v4.2.0-rust-1.88.0-snarkos-stable-cache + default: v4.2.0-rust-1.92.0-snarkos-stable-cache steps: - run: set +e - run: @@ -150,13 +150,13 @@ commands: steps: - checkout - setup_environment: - cache_key: v4.2.0-rust-1.88.0-<< parameters.cache_key >>-cache + cache_key: v4.2.0-rust-1.92.0-<< parameters.cache_key >>-cache - run: name: Install cargo-nextest command: | # Anything newer requires a Rust toolchain upgrade. - cargo install cargo-nextest@0.9.114 --locked || true + cargo install cargo-nextest@0.9.118 --locked || true - run: name: "Run Tests" @@ -320,7 +320,7 @@ commands: - store_test_results: path: target/nextest/ci - clear_environment: - cache_key: v4.2.0-rust-1.88.0-<< parameters.cache_key >>-cache + cache_key: v4.2.0-rust-1.92.0-<< parameters.cache_key >>-cache run_serial_long: description: "Build and run long running tests" @@ -531,7 +531,7 @@ jobs: steps: - run_devnet: workspace_member: . - cache_key: v4.2.0-rust-1.88.0-devnet-test-cache + cache_key: v4.2.0-rust-1.92.0-devnet-test-cache # Check crates that do not have any tests individually check-other-crates: @@ -540,7 +540,7 @@ jobs: steps: - checkout - setup_environment: - cache_key: v4.2.0-rust-1.88.0-check-other-crates-cache + cache_key: v4.2.0-rust-1.92.0-check-other-crates-cache - run: name: Check snarkos-node-metrics crate no_output_timeout: 10m @@ -550,7 +550,7 @@ jobs: no_output_timeout: 10m command: cargo check --package=snarkos-node-metrics --all-features - clear_environment: - cache_key: v4.2.0-rust-1.88.0-check-other-crates-cache + cache_key: v4.2.0-rust-1.92.0-check-other-crates-cache check-fmt: executor: rust-docker @@ -559,13 +559,13 @@ jobs: - checkout - install_rust_nightly - setup_environment: - cache_key: v4.2.0-rust-1.88.0-fmt-cache + cache_key: v4.2.0-rust-1.92.0-fmt-cache - run: name: Check style no_output_timeout: 35m command: cargo +nightly fmt --all -- --check - clear_environment: - cache_key: v4.2.0-rust-1.88.0-fmt-cache + cache_key: v4.2.0-rust-1.92.0-fmt-cache check-unused-dependencies: executor: rust-docker @@ -573,7 +573,7 @@ jobs: steps: - checkout - setup_environment: - cache_key: v4.2.0-rust-1.88.0-machete-cache + cache_key: v4.2.0-rust-1.92.0-machete-cache - run: name: Check for unused dependencies no_output_timeout: 10m @@ -581,7 +581,7 @@ jobs: cargo install cargo-machete@0.7.0 cargo machete - clear_environment: - cache_key: v4.2.0-rust-1.88.0-machete-cache + cache_key: v4.2.0-rust-1.92.0-machete-cache check-cargo-audit: executor: rust-docker @@ -589,15 +589,15 @@ jobs: steps: - checkout - setup_environment: - cache_key: v4.2.0-rust-1.88.0-cargo-audit-cache + cache_key: v4.2.0-rust-1.92.0-cargo-audit-cache - run: name: Check for security vulnerabilities no_output_timeout: 10m command: | - cargo install cargo-audit@0.21.2 --locked + cargo install cargo-audit@0.22.0 --locked cargo audit -D warnings - clear_environment: - cache_key: v4.2.0-rust-1.88.0-cargo-audit-cache + cache_key: v4.2.0-rust-1.92.0-cargo-audit-cache check-clippy: executor: rust-docker @@ -605,7 +605,7 @@ jobs: steps: - checkout - setup_environment: - cache_key: v4.2.0-rust-1.88.0-clippy-cache + cache_key: v4.2.0-rust-1.92.0-clippy-cache - run: name: Check lint no_output_timeout: 35m @@ -613,7 +613,7 @@ jobs: cargo clippy --workspace --all-targets -- -D warnings cargo clippy --workspace --all-targets --all-features -- -D warnings - clear_environment: - cache_key: v4.2.0-rust-1.88.0-clippy-cache + cache_key: v4.2.0-rust-1.92.0-clippy-cache lint-scripts: executor: rust-docker @@ -621,7 +621,7 @@ jobs: steps: - checkout - setup_environment: - cache_key: v4.2.0-rust-1.88.0-lint-scripts-cache + cache_key: v4.2.0-rust-1.92.0-lint-scripts-cache - run: name: Install shellcheck command: | @@ -634,7 +634,7 @@ jobs: command: | shellcheck -x .ci/*.sh - clear_environment: - cache_key: v4.2.0-rust-1.88.0-lint-scripts-cache + cache_key: v4.2.0-rust-1.92.0-lint-scripts-cache verify-windows: executor: diff --git a/Cargo.lock b/Cargo.lock index b97e470ba8..974ef8bc7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,9 +286,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b098575ebe77cb6d14fc7f32749631a6e44edbef6b796f89b020e99ba20d425" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ "axum-core 0.5.5", "bytes", @@ -362,7 +362,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9963ff19f40c6102c76756ef0a46004c0d58957d87259fc9208ff8441c12ab96" dependencies = [ - "axum 0.8.7", + "axum 0.8.8", "axum-core 0.5.5", "bytes", "futures-util", @@ -416,9 +416,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" [[package]] name = "bech32" @@ -544,9 +544,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "byteorder" @@ -587,9 +587,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.48" +version = "1.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" +checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" dependencies = [ "find-msvc-tools", "jobserver", @@ -927,7 +927,7 @@ dependencies = [ "document-features", "mio", "parking_lot", - "rustix 1.1.2", + "rustix 1.1.3", "signal-hook", "signal-hook-mio", "winapi", @@ -1165,18 +1165,18 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case", "proc-macro2", @@ -1683,9 +1683,9 @@ checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "git2" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" +checksum = "3e2b37e2f62729cdada11f0e6b3b6fe383c69c29fc619e391223e12856af308c" dependencies = [ "bitflags 2.10.0", "libc", @@ -2145,9 +2145,9 @@ checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" dependencies = [ "icu_collections", "icu_locale_core", @@ -2159,9 +2159,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" [[package]] name = "icu_provider" @@ -2325,9 +2325,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" [[package]] name = "jobserver" @@ -2396,9 +2396,9 @@ checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libgit2-sys" -version = "0.18.2+1.9.1" +version = "0.18.3+1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" +checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" dependencies = [ "cc", "libc", @@ -2424,9 +2424,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" dependencies = [ "bitflags 2.10.0", "libc", @@ -3038,9 +3038,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "f59e70c4aef1e55797c2e8fd94a4f2a973fc972cfde0e0b05f683667b0cd39dd" [[package]] name = "potential_utf" @@ -3483,9 +3483,9 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" -version = "0.12.24" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64 0.22.1", "bytes", @@ -3624,9 +3624,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.10.0", "errno", @@ -3652,9 +3652,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" dependencies = [ "web-time", "zeroize", @@ -3703,9 +3703,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" [[package]] name = "same-file" @@ -3867,9 +3867,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "217ca874ae0207aac254aa02c957ded05585a90892cc8d87f9e5fa49669dadd8" dependencies = [ "indexmap 2.12.1", "itoa", @@ -3892,9 +3892,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" dependencies = [ "serde_core", ] @@ -4021,9 +4021,9 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "simple_asn1" @@ -4094,7 +4094,7 @@ dependencies = [ "snarkos-node-tcp", "snarkvm", "tikv-jemallocator", - "toml 0.9.8", + "toml 0.9.10+spec-1.1.0", "tracing", "walkdir", ] @@ -4213,7 +4213,7 @@ dependencies = [ "anyhow", "async-recursion", "async-trait", - "axum 0.8.7", + "axum 0.8.8", "axum-extra", "bytes", "clap", @@ -4388,7 +4388,7 @@ name = "snarkos-node-rest" version = "4.4.0" dependencies = [ "anyhow", - "axum 0.8.7", + "axum 0.8.8", "axum-extra", "base64 0.22.1", "built", @@ -5689,7 +5689,7 @@ dependencies = [ "fastrand", "getrandom 0.3.4", "once_cell", - "rustix 1.1.2", + "rustix 1.1.3", "windows-sys 0.61.2", ] @@ -5986,9 +5986,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.8" +version = "0.9.10+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" +checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" dependencies = [ "indexmap 2.12.1", "serde_core", @@ -6001,27 +6001,27 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.3" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" dependencies = [ "serde_core", ] [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" dependencies = [ "winnow", ] [[package]] name = "toml_writer" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" [[package]] name = "tonic" @@ -6091,9 +6091,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ "bitflags 2.10.0", "bytes", @@ -6135,7 +6135,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84e6672c7510df74859726427edea641674dad1aeeb30057b87335b1ba23b843" dependencies = [ - "axum 0.8.7", + "axum 0.8.8", "forwarded-header-value", "governor", "http 1.4.0", @@ -6147,9 +6147,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", @@ -6170,9 +6170,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -6544,7 +6544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fabb953106c3c8eea8306e4393700d7657561cb43122571b172bbfb7c7ba1d" dependencies = [ "env_home", - "rustix 1.1.2", + "rustix 1.1.3", "winsafe", ] diff --git a/Cargo.toml b/Cargo.toml index 9c441c07cb..d2077979c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ keywords = [ categories = [ "cryptography", "cryptography::cryptocurrencies", "os" ] license = "Apache-2.0" edition = "2024" -rust-version = "1.88.0" # Attention - Change the MSRV in rust-toolchain and in .circleci/config.yml as well +rust-version = "1.92.0" # Attention - Change the MSRV in rust-toolchain and in .circleci/config.yml as well [workspace] members = [ diff --git a/cli/src/lib.rs b/cli/src/lib.rs index f459199295..15dc600e1c 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -15,6 +15,7 @@ // See https://github.com/ProvableHQ/snarkVM/issues/2775 #![forbid(unsafe_code)] +#![allow(clippy::collapsible_if)] #![recursion_limit = "256"] #[macro_use] diff --git a/display/src/lib.rs b/display/src/lib.rs index e97be68eae..14bbc7e5c9 100644 --- a/display/src/lib.rs +++ b/display/src/lib.rs @@ -14,6 +14,7 @@ // limitations under the License. #![forbid(unsafe_code)] +#![allow(clippy::collapsible_if)] mod pages; use pages::*; diff --git a/node/bft/ledger-service/src/ledger.rs b/node/bft/ledger-service/src/ledger.rs index 425b511770..68274b5743 100644 --- a/node/bft/ledger-service/src/ledger.rs +++ b/node/bft/ledger-service/src/ledger.rs @@ -177,7 +177,7 @@ impl> LedgerService for CoreLedgerService< fn get_committee_lookback_for_round(&self, round: u64) -> Result> { // Get the round number for the previous committee. Note, we subtract 2 from odd rounds, // because committees are updated in even rounds. - let previous_round = match round % 2 == 0 { + let previous_round = match round.is_multiple_of(2) { true => round.saturating_sub(1), false => round.saturating_sub(2), }; diff --git a/node/bft/ledger-service/src/lib.rs b/node/bft/ledger-service/src/lib.rs index 1f3520d0d7..d7911de1ef 100644 --- a/node/bft/ledger-service/src/lib.rs +++ b/node/bft/ledger-service/src/lib.rs @@ -15,6 +15,7 @@ // See https://github.com/ProvableHQ/snarkVM/issues/2775 #![forbid(unsafe_code)] +#![allow(clippy::collapsible_if)] #[macro_use] extern crate async_trait; diff --git a/node/bft/src/bft.rs b/node/bft/src/bft.rs index 0ce559dab7..b78ddd84aa 100644 --- a/node/bft/src/bft.rs +++ b/node/bft/src/bft.rs @@ -237,7 +237,7 @@ impl BFT { } // Determine if the BFT is ready to update to the next round. - let is_ready = match current_round % 2 == 0 { + let is_ready = match current_round.is_multiple_of(2) { true => self.update_leader_certificate_to_even_round(current_round), false => self.is_leader_quorum_or_nonleaders_available(current_round), }; @@ -254,7 +254,7 @@ impl BFT { } // Log whether the round is going to update. - if current_round % 2 == 0 { + if current_round.is_multiple_of(2) { // Determine if there is a leader certificate. if let Some(leader_certificate) = self.leader_certificate.read().as_ref() { // Ensure the state of the leader certificate is consistent with the BFT being ready. @@ -312,7 +312,7 @@ impl BFT { } // If the current round is odd, return false. - if current_round % 2 != 0 || current_round < 2 { + if !current_round.is_multiple_of(2) || current_round < 2 { error!("BFT cannot update the leader certificate in an odd round"); return false; } @@ -1627,7 +1627,7 @@ mod tests { // Sample 5 rounds of batch certificates starting at the genesis round from a static set of 4 authors. let (round_to_certificates_map, committee) = { - let private_keys = vec![ + let private_keys = &[ PrivateKey::new(rng).unwrap(), PrivateKey::new(rng).unwrap(), PrivateKey::new(rng).unwrap(), @@ -1844,7 +1844,7 @@ mod tests { // Sample 5 rounds of batch certificates starting at the genesis round from a static set of 4 authors. let (round_to_certificates_map, committee) = { - let private_keys = vec![ + let private_keys = &[ PrivateKey::new(rng).unwrap(), PrivateKey::new(rng).unwrap(), PrivateKey::new(rng).unwrap(), diff --git a/node/bft/src/lib.rs b/node/bft/src/lib.rs index c92032d4c7..20bd9252ab 100644 --- a/node/bft/src/lib.rs +++ b/node/bft/src/lib.rs @@ -15,6 +15,7 @@ #![forbid(unsafe_code)] #![allow(clippy::blocks_in_conditions)] +#![allow(clippy::collapsible_if)] #![allow(clippy::type_complexity)] #[macro_use] diff --git a/node/bft/src/sync/mod.rs b/node/bft/src/sync/mod.rs index d6e4ce2a22..521b4746b7 100644 --- a/node/bft/src/sync/mod.rs +++ b/node/bft/src/sync/mod.rs @@ -1134,7 +1134,7 @@ mod tests { // Sample 5 rounds of batch certificates starting at the genesis round from a static set of 4 authors. let (round_to_certificates_map, committee) = { - let addresses = vec![ + let addresses = &[ Address::try_from(private_keys[0])?, Address::try_from(private_keys[1])?, Address::try_from(private_keys[2])?, diff --git a/node/src/lib.rs b/node/src/lib.rs index ddbb56677f..86c483a135 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -14,6 +14,7 @@ // limitations under the License. #![forbid(unsafe_code)] +#![allow(clippy::collapsible_if)] #![allow(clippy::too_many_arguments)] #![recursion_limit = "256"] diff --git a/node/sync/locators/src/lib.rs b/node/sync/locators/src/lib.rs index f2e1cf9715..729913b571 100644 --- a/node/sync/locators/src/lib.rs +++ b/node/sync/locators/src/lib.rs @@ -14,6 +14,7 @@ // limitations under the License. #![forbid(unsafe_code)] +#![allow(clippy::collapsible_if)] #[macro_use] extern crate tracing; diff --git a/node/sync/src/lib.rs b/node/sync/src/lib.rs index 38d9ef61e6..f5f5d582de 100644 --- a/node/sync/src/lib.rs +++ b/node/sync/src/lib.rs @@ -14,6 +14,7 @@ // limitations under the License. #![forbid(unsafe_code)] +#![allow(clippy::collapsible_if)] #[macro_use] extern crate tracing; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 65c49ede4f..777bf1b105 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel="1.88" +channel="1.92" components=["cargo", "rustc", "clippy", "rustfmt"] diff --git a/snarkos/main.rs b/snarkos/main.rs index f0558f35bc..b8b4b18db9 100644 --- a/snarkos/main.rs +++ b/snarkos/main.rs @@ -13,6 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::collapsible_if)] + use snarkos_cli::{commands::CLI, helpers::Updater}; use snarkvm::utilities::display_error;