From 0fcc2663775c0dd215594504d6521f6494be580d Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Oct 2024 13:14:04 +0100 Subject: [PATCH 1/6] ci: solve ecc feature combination with std --- .github/workflows/build.yml | 13 ------------- Cargo.toml | 7 ++++--- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 195c891..91f6f4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,19 +47,6 @@ jobs: run: cargo check --workspace --no-default-features --features=std,${{matrix.feature}} - name: Feature ${{matrix.feature}} run: cargo check --workspace --features=${{matrix.feature}} - features-nostd: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - feature: - - secp256k1 - - curve25519 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - name: Feature ${{matrix.feature}} - run: cargo check --workspace --no-default-features --features=alloc,${{matrix.feature}} platforms: runs-on: ${{ matrix.os }} strategy: diff --git a/Cargo.toml b/Cargo.toml index f562287..631a287 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,8 +30,8 @@ strict_types = { version = "2.7.0", optional = true } sha2 = "0.10.8" blake3 = "1.5.4" ripemd = "0.1.3" -secp256k1 = { version = "0.30.0", optional = true, features = ["global-context"] } -curve25519-dalek = { version = "3.2.1", optional = true } +secp256k1 = { version = "0.30.0", optional = true, features = ["global-context", "std"] } +curve25519-dalek = { version = "3.2.1", optional = true, features = ["std"] } half = "2.4.1" # Required to maintain MSRV serde_crate = { package = "serde", version = "1", optional = true } @@ -42,7 +42,8 @@ stl = ["strict_types/armor", "std"] std = ["amplify/std"] log = ["std"] alloc = ["amplify/alloc"] -curve25519 = ["curve25519-dalek"] +secp256k1 = ["dep:secp256k1", "std"] +curve25519 = ["curve25519-dalek", "std"] serde = ["serde_crate", "amplify/serde", "std", "strict_encoding/serde"] [target.'cfg(target_arch = "wasm32")'.dependencies] From 3b898f2f03851d83eb2981e16847006d68a3fada Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Oct 2024 13:14:31 +0100 Subject: [PATCH 2/6] chore: update dependencies --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eb435a3..1bf2f99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,9 +204,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.1.30" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "shlex", ] @@ -382,9 +382,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "log" @@ -394,9 +394,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "minicov" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" +checksum = "def6d99771d7c499c26ad4d40eb6645eafd3a1553b35fc26ea5a489a45e82d9a" dependencies = [ "cc", "walkdir", @@ -431,9 +431,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -532,22 +532,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -605,9 +605,9 @@ dependencies = [ [[package]] name = "strict_types" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f16e8855a575633815f01482ac927ebaca3d2485aec8e17226c6826de29154e" +checksum = "8bae7475fc901144d8a35d25e36d76aa020b840f233d60532d6d52318718781b" dependencies = [ "amplify", "ascii-armor", @@ -649,9 +649,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", @@ -660,22 +660,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -750,7 +750,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "wasm-bindgen-shared", ] @@ -784,7 +784,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -818,7 +818,7 @@ checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -931,7 +931,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 631a287..cd66dc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ ascii-armor = { version = "0.7.2", optional = true } baid64 = "0.2.2" paste = "1" strict_encoding = { version = "2.7.0", default-features = false, features = ["float", "derive"] } -strict_types = { version = "2.7.0", optional = true } +strict_types = { version = "2.7.2", optional = true } sha2 = "0.10.8" blake3 = "1.5.4" ripemd = "0.1.3" From e98795e93bd73e503e869bd93bc32310fef8cb5a Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Oct 2024 13:18:20 +0100 Subject: [PATCH 3/6] chore: fix clippy --- src/data/arithm.rs | 12 ++++++------ src/data/number.rs | 2 +- src/lib.rs | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/data/arithm.rs b/src/data/arithm.rs index df44e16..a680e09 100644 --- a/src/data/arithm.rs +++ b/src/data/arithm.rs @@ -135,13 +135,13 @@ impl Number { .checked_add(rhs.to_i1024_bytes()) .map(Number::from) .and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true)) - .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)), + .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then_some(n)), (Layout::Integer(IntLayout { bytes, .. }), false) => self .to_u1024_bytes() .checked_add(rhs.to_u1024_bytes()) .map(Number::from) .and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true)) - .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)), + .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then_some(n)), (Layout::Float(_), _) => panic!("integer addition of float numbers"), } } @@ -163,13 +163,13 @@ impl Number { .checked_sub(rhs.to_i1024_bytes()) .map(Number::from) .and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true)) - .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)), + .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then_some(n)), (Layout::Integer(IntLayout { bytes, .. }), false) => self .to_u1024_bytes() .checked_sub(rhs.to_u1024_bytes()) .map(Number::from) .and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true)) - .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)), + .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then_some(n)), (Layout::Float(_), _) => panic!("integer subtraction of float numbers"), } } @@ -191,13 +191,13 @@ impl Number { .checked_mul(rhs.to_i1024_bytes()) .map(Number::from) .and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true)) - .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)), + .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then_some(n)), (Layout::Integer(IntLayout { bytes, .. }), false) => self .to_u1024_bytes() .checked_mul(rhs.to_u1024_bytes()) .map(Number::from) .and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true)) - .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)), + .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then_some(n)), (Layout::Float(_), _) => panic!("integer multiplication of float numbers"), } } diff --git a/src/data/number.rs b/src/data/number.rs index 3382e46..0aea924 100644 --- a/src/data/number.rs +++ b/src/data/number.rs @@ -1126,7 +1126,7 @@ impl Number { /// Transformed number as an optional - or `None` if the operation was impossible without /// discarding bit information and `wrap` is set to false. pub fn reshaped(mut self, to: Layout, wrap: bool) -> Option { - self.reshape(to).then(|| self).or(if wrap { Some(self) } else { None }) + self.reshape(to).then_some(self).or(if wrap { Some(self) } else { None }) } #[doc(hidden)] diff --git a/src/lib.rs b/src/lib.rs index 42cfaa7..966d792 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,8 +136,7 @@ //! //! [AluVM]: https://github.com/internet2-org/aluvm-spec -// TODO: Remove this once MSRV >= 1.62 -#![allow(clippy::unnecessary_lazy_evaluations)] +#![allow(clippy::bool_assert_comparison)] // TODO(#6) Complete string operations // TODO(#7) Complete assembly compiler for string operations From 353bb847028d0892ef1be7e9f971d15e7fbd599b Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Oct 2024 13:20:47 +0100 Subject: [PATCH 4/6] ci: fix no-defailt build --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 966d792..279b4eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -144,6 +144,8 @@ #[macro_use] extern crate alloc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +extern crate alloc as std; #[macro_use] extern crate amplify; From a8e6f2412acbf04563f9363f85b6f2ddb13e02f1 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Oct 2024 13:21:14 +0100 Subject: [PATCH 5/6] Revert "ci: solve ecc feature combination with std" This reverts commit 0fcc2663775c0dd215594504d6521f6494be580d. --- .github/workflows/build.yml | 13 +++++++++++++ Cargo.toml | 7 +++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91f6f4e..195c891 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,19 @@ jobs: run: cargo check --workspace --no-default-features --features=std,${{matrix.feature}} - name: Feature ${{matrix.feature}} run: cargo check --workspace --features=${{matrix.feature}} + features-nostd: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + feature: + - secp256k1 + - curve25519 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Feature ${{matrix.feature}} + run: cargo check --workspace --no-default-features --features=alloc,${{matrix.feature}} platforms: runs-on: ${{ matrix.os }} strategy: diff --git a/Cargo.toml b/Cargo.toml index cd66dc1..de25140 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,8 +30,8 @@ strict_types = { version = "2.7.2", optional = true } sha2 = "0.10.8" blake3 = "1.5.4" ripemd = "0.1.3" -secp256k1 = { version = "0.30.0", optional = true, features = ["global-context", "std"] } -curve25519-dalek = { version = "3.2.1", optional = true, features = ["std"] } +secp256k1 = { version = "0.30.0", optional = true, features = ["global-context"] } +curve25519-dalek = { version = "3.2.1", optional = true } half = "2.4.1" # Required to maintain MSRV serde_crate = { package = "serde", version = "1", optional = true } @@ -42,8 +42,7 @@ stl = ["strict_types/armor", "std"] std = ["amplify/std"] log = ["std"] alloc = ["amplify/alloc"] -secp256k1 = ["dep:secp256k1", "std"] -curve25519 = ["curve25519-dalek", "std"] +curve25519 = ["curve25519-dalek"] serde = ["serde_crate", "amplify/serde", "std", "strict_encoding/serde"] [target.'cfg(target_arch = "wasm32")'.dependencies] From ccd9d944e5f76f72792a3a4541e05e0a317d9d21 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Oct 2024 13:22:18 +0100 Subject: [PATCH 6/6] chore: bump MSRV --- .github/workflows/build.yml | 2 +- Cargo.toml | 2 +- MANIFEST.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 195c891..de5813a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,7 +76,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [ nightly, beta, stable, 1.76.0 ] + toolchain: [ nightly, beta, stable, 1.77.0 ] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master diff --git a/Cargo.toml b/Cargo.toml index de25140..5f80930 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/aluvm/rust-aluvm" homepage = "https://aluvm.org" keywords = ["virtual-machine", "emulator", "functional", "risc", "edge-computing"] categories = ["no-std", "embedded", "compilers", "cryptography", "emulators"] -rust-version = "1.76.0" # Due to ascii-armor +rust-version = "1.77.0" edition = "2021" license = "Apache-2.0" readme = "README.md" diff --git a/MANIFEST.yml b/MANIFEST.yml index 34797ee..ff5db7b 100644 --- a/MANIFEST.yml +++ b/MANIFEST.yml @@ -3,7 +3,7 @@ Type: Library Kind: Free software License: Apache-2.0 Language: Rust -Compiler: 1.76 +Compiler: 1.78 Author: Maxim Orlovsky Maintained: UBIDECO Labs, Institute for Deterministic and Cognitive Computing, Switzerland Maintainers: