From 1a89e8225716b050ab053acf63811312691ca1ab Mon Sep 17 00:00:00 2001 From: loki-cmu Date: Sun, 1 Sep 2024 03:02:39 +0800 Subject: [PATCH 1/2] build: toolchain update to 1.80.1 --- Cargo.lock | 25 +++++++++++++++++++++++-- anychain-filecoin/Cargo.toml | 10 ++++++++-- anychain-filecoin/src/address.rs | 1 - anychain-kms/Cargo.toml | 12 ++++++++++-- anychain-kms/src/bip39/language.rs | 7 ++++++- rust-toolchain.toml | 2 +- 6 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb76d8f..cedf2d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -214,10 +214,11 @@ dependencies = [ [[package]] name = "anychain-filecoin" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anychain-core", "anyhow", + "arbitrary", "base64 0.21.7", "blake2b_simd 1.0.2", "bls-signatures", @@ -240,7 +241,7 @@ dependencies = [ [[package]] name = "anychain-kms" -version = "0.1.11" +version = "0.1.12" dependencies = [ "anyhow", "bs58 0.4.0", @@ -330,6 +331,15 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "ark-bls12-377" version = "0.4.0" @@ -1123,6 +1133,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "derive_more" version = "0.99.18" diff --git a/anychain-filecoin/Cargo.toml b/anychain-filecoin/Cargo.toml index 8cd6472..cc15279 100644 --- a/anychain-filecoin/Cargo.toml +++ b/anychain-filecoin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-filecoin" description = "A Rust library for Filecoin-focused cryptocurrency wallets, enabling seamless transactions on the Filecoin blockchain" -version = "0.1.7" +version = "0.1.8" keywords = ["filecoin", "blockchain", "cryptocurrencies", "wallet", "transactions"] # Workspace inherited keys @@ -33,4 +33,10 @@ forest_encoding = { workspace = true } cid = { workspace = true } base64 = { workspace = true } libsecp256k1 = { workspace = true } -bls-signatures = { workspace = true } \ No newline at end of file +bls-signatures = { workspace = true } +arbitrary = { version = "1.3.2", features = ["derive"], optional = true } + +[features] +default = ["std"] +std = ["anychain-core/std"] +arb = ["dep:arbitrary"] diff --git a/anychain-filecoin/src/address.rs b/anychain-filecoin/src/address.rs index 71e2a20..8770bec 100644 --- a/anychain-filecoin/src/address.rs +++ b/anychain-filecoin/src/address.rs @@ -23,7 +23,6 @@ use thiserror::Error; /// Represents a filecoin address #[derive(PartialEq, Eq, Clone, Debug, Hash, Copy, Default)] -#[cfg_attr(feature = "testing", derive(Default))] #[cfg_attr(feature = "arb", derive(arbitrary::Arbitrary))] pub struct FilecoinAddress { network: Network, diff --git a/anychain-kms/Cargo.toml b/anychain-kms/Cargo.toml index 571f3b6..d4fc379 100644 --- a/anychain-kms/Cargo.toml +++ b/anychain-kms/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-kms" description = "A Rust library providing Key Management Schema for AnyChain. Handles general security and signature algorithms." -version = "0.1.11" +version = "0.1.12" keywords = ["cryptography", "security", "signature", "algorithm"] # Workspace inherited keys @@ -36,6 +36,14 @@ encoding = "0.2.33" hex-literal = "0.4" [features] -default = ["std"] alloc = ["zeroize/alloc"] std = ["alloc"] +chinese-simplified = [] +chinese-traditional = [] +# Note: English is the standard for bip39 so always included +french = [] +italian = [] +japanese = [] +korean = [] +spanish = [] +default = ["std", "chinese-simplified", "chinese-traditional", "french", "italian", "japanese", "korean", "spanish"] diff --git a/anychain-kms/src/bip39/language.rs b/anychain-kms/src/bip39/language.rs index 9edadd0..2a680be 100644 --- a/anychain-kms/src/bip39/language.rs +++ b/anychain-kms/src/bip39/language.rs @@ -134,8 +134,13 @@ impl Language { pub fn from_language_code(language_code: &str) -> Option { match &language_code.to_ascii_lowercase()[..] { "en" => Some(Language::English), + #[cfg(feature = "chinese-simplified")] + "zh-hans" => Some(Language::ChineseSimplified), + #[cfg(feature = "chinese-simplified")] "zh-cn" => Some(Language::ChineseSimplified), #[cfg(feature = "chinese-traditional")] + "zh-hant" => Some(Language::ChineseTraditional), + #[cfg(feature = "chinese-traditional")] "zh-tw" => Some(Language::ChineseTraditional), #[cfg(feature = "french")] "fr" => Some(Language::French), @@ -244,7 +249,7 @@ mod test { assert!(res.is_empty()); } - fn _is_wordlist_nfkd(wl: &WordList) -> bool { + fn is_wordlist_nfkd(wl: &WordList) -> bool { for idx in 0..2047 { let word = wl.get_word(idx.into()); if !unicode_normalization::is_nfkd(word) { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 402b068..f049f11 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.79.0" +channel = "1.80.1" components = ["clippy", "rustfmt"] targets = [] profile = "minimal" From 473d8aac05dd07648077fb26cf5e1eb0f77dab5d Mon Sep 17 00:00:00 2001 From: loki-cmu Date: Sun, 1 Sep 2024 03:04:35 +0800 Subject: [PATCH 2/2] fix: ci toolchain --- .github/workflows/rust.yml | 50 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f369e55..781ad37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,30 +16,30 @@ jobs: strategy: matrix: - rust-version: [1.79.0] + rust-version: [ 1.80.1 ] steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Cache Cargo dependencies - uses: actions/cache@v2 - with: - path: ~/.cargo - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - name: Install Protoc - uses: arduino/setup-protoc@v1 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust-version }} - - name: Check formatting - run: cargo fmt -- --check - - name: cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --all-targets --tests -- -D warnings - - name: Build and test - run: cargo test --all-features + - name: Checkout code + uses: actions/checkout@v2 + - name: Cache Cargo dependencies + uses: actions/cache@v2 + with: + path: ~/.cargo + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust-version }} + - name: Check formatting + run: cargo fmt -- --check + - name: cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --all-targets --tests -- -D warnings + - name: Build and test + run: cargo test --all-features