From 236183a9bd97bdf14158bace65e62ddc56cbb0dd Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 17 Apr 2023 11:03:47 +0200 Subject: [PATCH 01/14] Check on CI whether library compiles for no_std --- .github/workflows/ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 848f8c9940..bfee448bba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,17 @@ jobs: - run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std - run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std + check-no-std: + runs-on: ubuntu-latest + container: + image: rust + steps: + - uses: actions/checkout@v2.4.0 + - uses: Swatinem/rust-cache@v2 + - run: rustup default nightly + - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below + - run: RUSTFLAGS=-Dwarnings cargo +nightly build --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi + fuzzing-binaries-compile: runs-on: ubuntu-latest steps: @@ -198,7 +209,7 @@ jobs: all-ci: # This dummy job depends on all the mandatory checks. It succeeds if and only if CI is # considered successful. - needs: [test-64bits, test-32bits, wasm-node-check, check-features, fuzzing-binaries-compile, check-rustdoc-links, fmt, clippy, cargo-deny, cargo-spellcheck, wasm-node-versions-match] + needs: [test-64bits, test-32bits, wasm-node-check, check-features, check-no-std, fuzzing-binaries-compile, check-rustdoc-links, fmt, clippy, cargo-deny, cargo-spellcheck, wasm-node-versions-match] runs-on: ubuntu-latest steps: - run: echo Success From 0e1f3e9919154a13ad591fc46f570e7c3b17e023 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 17 Apr 2023 11:07:59 +0200 Subject: [PATCH 02/14] Update checkout action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfee448bba..46fda5b46d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: container: image: rust steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 - run: rustup default nightly - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below From d229ad5dbddbdbc8ec9941fb68d5e3eaf83fd83e Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 17 Apr 2023 11:50:35 +0200 Subject: [PATCH 03/14] Missing -Z unstable-options --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46fda5b46d..3c67239e78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: rustup default nightly - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below - - run: RUSTFLAGS=-Dwarnings cargo +nightly build --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi + - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi fuzzing-binaries-compile: runs-on: ubuntu-latest From 81421becd4bf979df0129cee813419de1b819115 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 11 Jul 2023 08:47:21 +0200 Subject: [PATCH 04/14] Also compile smoldot-light --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6f4bea4db..506f444873 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,6 +106,7 @@ jobs: - run: rustup default nightly - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi + - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi fuzzing-binaries-compile: runs-on: ubuntu-latest From 80ae573f3271a007e0d00e8b09c954c702e67ede Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 12 Sep 2023 12:00:45 +0200 Subject: [PATCH 05/14] Update action a bit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89d592b92f..b06cc12cd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,9 +100,9 @@ jobs: check-no-std: runs-on: ubuntu-latest container: - image: rust + image: rust # Note: the Rust version doesn't matter as we're using the latest nightly steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 - run: rustup default nightly - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below From f9ace158f102a52044120d85b86f3a469a0a394e Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Oct 2023 16:13:08 +0200 Subject: [PATCH 06/14] Overwrite ruzstd to try it out --- Cargo.lock | 27 +++------------------------ lib/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 092e6e2754..b2b354c3b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2139,12 +2139,11 @@ dependencies = [ [[package]] name = "ruzstd" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" +version = "0.5.0" +source = "git+https://github.com/KillingSpark/zstd-rs#e620d2a856f96506aa8bb6eeae89547c4c54eb3e" dependencies = [ "byteorder", - "thiserror-core", + "derive_more", "twox-hash", ] @@ -2616,26 +2615,6 @@ dependencies = [ "thiserror-impl", ] -[[package]] -name = "thiserror-core" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" -dependencies = [ - "thiserror-core-impl", -] - -[[package]] -name = "thiserror-core-impl" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "thiserror-impl" version = "1.0.50" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 7446f3ebd0..8493c47310 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -66,7 +66,7 @@ pbkdf2 = { version = "0.12.1", default-features = false } poly1305 = { version = "0.8.0", default-features = false } rand = { version = "0.8.5", default-features = false, features = ["alloc"] } rand_chacha = { version = "0.3.1", default-features = false } -ruzstd = { version = "0.4.0" } # TODO: uses `#![feature(error_in_core)]` when the `std` feature is disabled, see https://github.com/rust-lang/rust/issues/103765 +ruzstd = { git = "https://github.com/KillingSpark/zstd-rs" } #{ version = "0.4.0" } # TODO: uses `#![feature(error_in_core)]` when the `std` feature is disabled, see https://github.com/rust-lang/rust/issues/103765 schnorrkel = { version = "0.11.2", default-features = false, features = ["preaudit_deprecated", "alloc"] } serde = { version = "1.0.183", default-features = false, features = ["alloc", "derive"] } serde_json = { version = "1.0.104", default-features = false, features = ["alloc", "raw_value"] } From 5a0f7a400c47c864ee673be30bc946d387ed7a0c Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Oct 2023 16:22:14 +0200 Subject: [PATCH 07/14] Forgot default-features = false --- lib/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 8493c47310..8f96827b96 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -66,7 +66,7 @@ pbkdf2 = { version = "0.12.1", default-features = false } poly1305 = { version = "0.8.0", default-features = false } rand = { version = "0.8.5", default-features = false, features = ["alloc"] } rand_chacha = { version = "0.3.1", default-features = false } -ruzstd = { git = "https://github.com/KillingSpark/zstd-rs" } #{ version = "0.4.0" } # TODO: uses `#![feature(error_in_core)]` when the `std` feature is disabled, see https://github.com/rust-lang/rust/issues/103765 +ruzstd = { git = "https://github.com/KillingSpark/zstd-rs", default-features = false } #{ version = "0.4.0" } # TODO: uses `#![feature(error_in_core)]` when the `std` feature is disabled, see https://github.com/rust-lang/rust/issues/103765 schnorrkel = { version = "0.11.2", default-features = false, features = ["preaudit_deprecated", "alloc"] } serde = { version = "1.0.183", default-features = false, features = ["alloc", "derive"] } serde_json = { version = "1.0.104", default-features = false, features = ["alloc", "raw_value"] } From 0509bfa9a5c49e22bebf3b6032893c12de4b1cad Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Oct 2023 16:23:38 +0200 Subject: [PATCH 08/14] Change target --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c636ea122d..d1da846593 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,8 +106,9 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: rustup default nightly - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below - - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi - - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=x86_64-unknown-uefi + # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine. Many targets unfortunately have Rust/LLVM bugs preventing compilation. + - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi + - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi fuzzing-binaries-compile: runs-on: ubuntu-latest From 95497afc1a617d3a32446c8db4966bc2130e7a22 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Oct 2023 16:27:42 +0200 Subject: [PATCH 09/14] Use a specific nightly --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1da846593..4d78b9537d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,8 +103,11 @@ jobs: image: rust # Note: the Rust version doesn't matter as we're using the latest nightly steps: - uses: actions/checkout@v4 + # 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. + - run: rustup default nightly-2023-10-24 - uses: Swatinem/rust-cache@v2 - - run: rustup default nightly - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine. Many targets unfortunately have Rust/LLVM bugs preventing compilation. - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi From 1c731124beda32089f04403ce8bdff743e28c143 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Oct 2023 18:55:32 +0200 Subject: [PATCH 10/14] Fix toolchain name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d78b9537d..e1a1c26ddb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: # is completely arbitrary. - run: rustup default nightly-2023-10-24 - uses: Swatinem/rust-cache@v2 - - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below + - run: rustup component add rust-src --toolchain nightly-2023-10-24-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine. Many targets unfortunately have Rust/LLVM bugs preventing compilation. - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi From 1c6c0de6966fd64c87d7975bcf8a985eb9128801 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Oct 2023 18:58:02 +0200 Subject: [PATCH 11/14] Fix toolchain name again --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1a1c26ddb..2542d1457c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,8 +110,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: rustup component add rust-src --toolchain nightly-2023-10-24-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine. Many targets unfortunately have Rust/LLVM bugs preventing compilation. - - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi - - run: RUSTFLAGS=-Dwarnings cargo +nightly build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi + - run: RUSTFLAGS=-Dwarnings cargo +nightly-2023-10-24 build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi + - run: RUSTFLAGS=-Dwarnings cargo +nightly-2023-10-24 build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi fuzzing-binaries-compile: runs-on: ubuntu-latest From 7d5fb0a6737d199f4542cb9926301d098e098858 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 29 Oct 2023 12:36:27 +0100 Subject: [PATCH 12/14] Try simplify the build --- .github/workflows/ci.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2542d1457c..8204a0be9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,18 +100,14 @@ jobs: check-no-std: runs-on: ubuntu-latest container: - image: rust # Note: the Rust version doesn't matter as we're using the latest nightly + image: rust:1.72 steps: - uses: actions/checkout@v4 - # 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. - - run: rustup default nightly-2023-10-24 + - run: rustup target add thumbv7m-none-eabi - uses: Swatinem/rust-cache@v2 - - run: rustup component add rust-src --toolchain nightly-2023-10-24-x86_64-unknown-linux-gnu # Necessary for `-Z build-std` below - # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine. Many targets unfortunately have Rust/LLVM bugs preventing compilation. - - run: RUSTFLAGS=-Dwarnings cargo +nightly-2023-10-24 build -Z unstable-options --keep-going --package smoldot --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi - - run: RUSTFLAGS=-Dwarnings cargo +nightly-2023-10-24 build -Z unstable-options --keep-going --package smoldot-light --locked --no-default-features -Z build-std=core,alloc --target=thumbv7m-none-eabi + # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine and doesn't support `std`. Many targets unfortunately have Rust/LLVM bugs preventing compilation. + - run: RUSTFLAGS=-Dwarnings cargo build --keep-going --package smoldot --locked --no-default-features --target=thumbv7m-none-eabi + - run: RUSTFLAGS=-Dwarnings cargo build --keep-going --package smoldot-light --locked --no-default-features --target=thumbv7m-none-eabi fuzzing-binaries-compile: runs-on: ubuntu-latest From fe8eba1fc2914923e17f545217d7f2751224eba4 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 29 Oct 2023 12:38:51 +0100 Subject: [PATCH 13/14] --keep-going is unstable --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8204a0be9d..9c265a4ea9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,8 +106,8 @@ jobs: - run: rustup target add thumbv7m-none-eabi - uses: Swatinem/rust-cache@v2 # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine and doesn't support `std`. Many targets unfortunately have Rust/LLVM bugs preventing compilation. - - run: RUSTFLAGS=-Dwarnings cargo build --keep-going --package smoldot --locked --no-default-features --target=thumbv7m-none-eabi - - run: RUSTFLAGS=-Dwarnings cargo build --keep-going --package smoldot-light --locked --no-default-features --target=thumbv7m-none-eabi + - run: RUSTFLAGS=-Dwarnings cargo build --package smoldot --locked --no-default-features --target=thumbv7m-none-eabi + - run: RUSTFLAGS=-Dwarnings cargo build --package smoldot-light --locked --no-default-features --target=thumbv7m-none-eabi fuzzing-binaries-compile: runs-on: ubuntu-latest From 0aad5cda23cf14069767984f52ab727410598faf Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 1 Nov 2023 14:27:57 +0100 Subject: [PATCH 14/14] Only check the smoldot library for now --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c265a4ea9..7c318ba40a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,9 +105,8 @@ jobs: - uses: actions/checkout@v4 - run: rustup target add thumbv7m-none-eabi - uses: Swatinem/rust-cache@v2 - # Note that we use `thumbv7m-none-eabi` as this target seems to generally work fine and doesn't support `std`. Many targets unfortunately have Rust/LLVM bugs preventing compilation. + # We use `thumbv7m-none-eabi` as this target seems to generally work fine and doesn't support `std`. Many targets unfortunately have Rust/LLVM bugs preventing compilation. - run: RUSTFLAGS=-Dwarnings cargo build --package smoldot --locked --no-default-features --target=thumbv7m-none-eabi - - run: RUSTFLAGS=-Dwarnings cargo build --package smoldot-light --locked --no-default-features --target=thumbv7m-none-eabi fuzzing-binaries-compile: runs-on: ubuntu-latest