From c9a16932899d3e40734cdadb4a1734f6a1821eaa Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 8 Aug 2023 13:12:12 +0000 Subject: [PATCH] Update to Rust 1.71 (#922) * Update to Rust 1.71 * Use "limited", actually * Fix new warnings * Update the fuzzing toolchain --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/deploy.yml | 8 ++++---- .github/workflows/periodic-cargo-update.yml | 2 +- Cargo.toml | 2 +- light-base/src/runtime_service.rs | 6 +++--- light-base/src/sync_service/parachain.rs | 2 +- light-base/src/transactions_service.rs | 2 +- wasm-node/javascript/prepare.mjs | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a12fce324..2a901a5e70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: test-64bits: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -39,7 +39,7 @@ jobs: test-32bits: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - run: apt-get update && apt install -y libc6-dev-i386 - uses: actions/checkout@v3 @@ -50,7 +50,7 @@ jobs: wasm-node-check: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -65,7 +65,7 @@ jobs: check-features: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 @@ -105,7 +105,7 @@ jobs: # Since build artifacts are specific to a nightly version, we pin the specific nightly # version to use in order to not invalidate the build cache every day. The exact version # is completely arbitrary. - toolchain: nightly-2023-04-20 + toolchain: nightly-2023-07-15 override: true - uses: baptiste0928/cargo-install@v2 # This action ensures that the compilation is cached. with: @@ -119,7 +119,7 @@ jobs: check-rustdoc-links: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fae0d061b2..fc7d0c4072 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -56,7 +56,7 @@ jobs: build-js-doc: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 with: @@ -82,7 +82,7 @@ jobs: build-rust-doc: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 with: @@ -103,7 +103,7 @@ jobs: build-tests-coverage: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - run: apt update && apt install -y jq - run: rustup component add llvm-tools-preview @@ -173,7 +173,7 @@ jobs: npm-publish: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3.7.0 diff --git a/.github/workflows/periodic-cargo-update.yml b/.github/workflows/periodic-cargo-update.yml index 9e33c34faa..b47fc12ec2 100644 --- a/.github/workflows/periodic-cargo-update.yml +++ b/.github/workflows/periodic-cargo-update.yml @@ -9,7 +9,7 @@ jobs: cargo-update: runs-on: ubuntu-latest container: - image: rust:1.70 + image: rust:1.71 steps: - uses: actions/checkout@v3 # Note: `cargo update --workspace` doesn't seem to have any effect. diff --git a/Cargo.toml b/Cargo.toml index 01b6c6d34a..cd5d57b760 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ repository = "https://github.com/smol-dot/smoldot" include = ["**/*.rs"] # Only Rust files are included, as anything else might be a test fixture. [profile.dev] -debug = 1 # Default value is `2`, which contains the full debug info. `1` is enough for stack traces. # TODO: use the named version after Cargo v1.71 +debug = "limited" opt-level = 2 panic = "abort" [profile.dev.package."*"] diff --git a/light-base/src/runtime_service.rs b/light-base/src/runtime_service.rs index 9e1ecdd1dd..baf75ebe4c 100644 --- a/light-base/src/runtime_service.rs +++ b/light-base/src/runtime_service.rs @@ -227,7 +227,7 @@ impl RuntimeService { } } }; - let mut guarded_lock = &mut *guarded_lock; + let guarded_lock = &mut *guarded_lock; // Extract the components of the `FinalizedBlockRuntimeKnown`. We are guaranteed by the // block above to be in this state. @@ -1413,7 +1413,7 @@ async fn run_background( let near_head_of_chain = background.sync_service.is_near_head_of_chain_heuristic().await; let mut guarded = background.guarded.lock().await; - let mut guarded = &mut *guarded; + let guarded = &mut *guarded; // TODO: note that this code is never reached for parachains if new_block.is_new_best { guarded.best_near_head_of_chain = near_head_of_chain; @@ -1466,7 +1466,7 @@ async fn run_background( let near_head_of_chain = background.sync_service.is_near_head_of_chain_heuristic().await; let mut guarded = background.guarded.lock().await; - let mut guarded = &mut *guarded; + let guarded = &mut *guarded; guarded.best_near_head_of_chain = near_head_of_chain; match &mut guarded.tree { diff --git a/light-base/src/sync_service/parachain.rs b/light-base/src/sync_service/parachain.rs index 9f7aeaeac9..6a8f784f1d 100644 --- a/light-base/src/sync_service/parachain.rs +++ b/light-base/src/sync_service/parachain.rs @@ -675,7 +675,7 @@ impl ParachainBackgroundTask { /// Start fetching parachain headers of new blocks whose parachain block needs to be fetched. fn start_paraheads_fetch(&mut self) { - let mut runtime_subscription = match &mut self.subscription_state { + let runtime_subscription = match &mut self.subscription_state { ParachainBackgroundState::NotSubscribed { .. } => return, ParachainBackgroundState::Subscribed(s) => s, }; diff --git a/light-base/src/transactions_service.rs b/light-base/src/transactions_service.rs index e5d58ad166..ecfb3c442c 100644 --- a/light-base/src/transactions_service.rs +++ b/light-base/src/transactions_service.rs @@ -673,7 +673,7 @@ async fn background_task(mut config: BackgroundTaskConfig b, None => { // It is possible that this block has been discarded because a sibling diff --git a/wasm-node/javascript/prepare.mjs b/wasm-node/javascript/prepare.mjs index a2b164337b..1faf44c875 100755 --- a/wasm-node/javascript/prepare.mjs +++ b/wasm-node/javascript/prepare.mjs @@ -38,7 +38,7 @@ if (buildProfile != 'debug' && buildProfile != 'min-size-release') // The Rust version is pinned because the wasi target is still unstable. Without pinning, it is // possible for the wasm-js bindings to change between two Rust versions. Feel free to update // this version pin whenever you like, provided it continues to build. -const rustVersion = '1.70.0'; +const rustVersion = '1.71.0'; // Assume that the user has `rustup` installed and make sure that `rust_version` is available. // Because `rustup install` requires an Internet connection, check whether the toolchain is