From dbc8fc9459bff6ae5420740166dd96388f1e28a5 Mon Sep 17 00:00:00 2001 From: shuimuliang Date: Sat, 7 Oct 2023 00:37:14 +0800 Subject: [PATCH 1/3] build: toolchain update to 1.73.0 --- .github/workflows/rust.yml | 2 +- anychain-ripple/src/transaction.rs | 20 ++++++++++---------- rust-toolchain.toml | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b7cb743..771ec91 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - rust-version: [1.72.1] + rust-version: [1.73.0] steps: - name: Checkout code diff --git a/anychain-ripple/src/transaction.rs b/anychain-ripple/src/transaction.rs index 56aaf1e..08592b6 100644 --- a/anychain-ripple/src/transaction.rs +++ b/anychain-ripple/src/transaction.rs @@ -489,30 +489,30 @@ impl PartialEq for SerializedType { } } -impl PartialOrd for SerializedType { - fn partial_cmp(&self, other: &Self) -> Option { +impl Ord for SerializedType { + fn cmp(&self, other: &Self) -> Ordering { let typ0 = self.typ() as u32; let val0 = self.val(); let typ1 = other.typ() as u32; let val1 = other.val(); if typ0 < typ1 { - Some(Ordering::Less) + Ordering::Less } else if typ0 > typ1 { - Some(Ordering::Greater) + Ordering::Greater } else if val0 < val1 { - Some(Ordering::Less) + Ordering::Less } else if val0 > val1 { - Some(Ordering::Greater) + Ordering::Greater } else { - Some(Ordering::Equal) + Ordering::Equal } } } -impl Ord for SerializedType { - fn cmp(&self, other: &Self) -> Ordering { - self.partial_cmp(other).unwrap() +impl PartialOrd for SerializedType { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ad0f092..30b679b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.72.1" +channel = "1.73.0" components = ["clippy", "rustfmt"] targets = [] profile = "minimal" From 89c9eb2f698a0887505c33bb2f559c89e2e616d7 Mon Sep 17 00:00:00 2001 From: shuimuliang Date: Mon, 9 Oct 2023 12:44:20 +0800 Subject: [PATCH 2/3] build: update crates version bls-signatures fvm_shared anyhow base64 clap pbkdf2 --- Cargo.toml | 13 +++++++------ anychain-filecoin/src/transaction.rs | 14 ++++++++++---- anychain-kms/src/bip39/crypto.rs | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 975a02b..88e4efc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "anychain-core", "anychain-bitcoin", @@ -27,7 +28,7 @@ blake2b_simd = "1.0.0" bech32 = "0.9.0" hex = "0.4.2" libsecp256k1 = "0.7.1" -bls-signatures = "0.13.0" +bls-signatures = "0.14.0" base58 = { version = "0.2" } rand = { version = "0.8.5" } rand_core = { version = "0.6.3", default-features = false } @@ -35,7 +36,7 @@ rlp = { version = "0.5.2", features = ["derive"] } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } sha2 = { version = "0.10.2", default-features = false } serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] } -fvm_shared = "0.8.0" +fvm_shared = "3.3.1" data-encoding = "2.3.2" data-encoding-macro = "0.1.12" fvm_ipld_encoding = "0.2.2" @@ -44,21 +45,21 @@ num-traits = "0.2.15" lazy_static = "1.4.0" unsigned-varint = "0.7.1" num-bigint = "0.4.3" -anyhow = "1.0.72" +anyhow = "1.0.75" forest_encoding = "0.2.2" cid = "0.8.6" -base64 = "0.13.0" +base64 = "0.21.1" bytes = "1.0" protobuf = { version = "3.3.0" } chrono = "0.4" ethabi = "17.2.0" regex = { version = "1.3" } -clap = "4.3.10" +clap = "4.4.6" primitive-types = { version = "0.11.1", features = ["rlp"] } rustc-hash = "1.1.0" hmac = "0.12.1" bs58 = { version = "0.4", default-features = false, features = ["check"] } -pbkdf2 = { version = "0.11.0", default-features = false } +pbkdf2 = { version = "0.12.1", default-features = false } unicode-normalization = "0.1.22" zeroize = { version = "1.5.5", default-features = false } once_cell = { version = "1.18.0" } diff --git a/anychain-filecoin/src/transaction.rs b/anychain-filecoin/src/transaction.rs index 0e00f40..6178dbb 100644 --- a/anychain-filecoin/src/transaction.rs +++ b/anychain-filecoin/src/transaction.rs @@ -356,6 +356,7 @@ pub mod parameter_json { use super::FilecoinAmount; use super::FilecoinTransactionParameters; use super::RawBytes; + use base64::{engine::general_purpose, Engine as _}; use cid::Cid; use serde::{de, ser, Deserialize, Deserializer, Serialize, Serializer}; @@ -420,7 +421,7 @@ pub mod parameter_json { gas_fee_cap: params.gas_fee_cap.clone(), gas_premium: params.gas_premium.clone(), method_num: params.method_num, - params: Some(base64::encode(params.params.bytes())), + params: Some(general_purpose::STANDARD.encode(params.params.bytes())), cid: Some(params.cid().map_err(ser::Error::custom)?), } .serialize(serializer) @@ -442,7 +443,9 @@ pub mod parameter_json { gas_premium: m.gas_premium, method_num: m.method_num, params: RawBytes::new( - base64::decode(m.params.unwrap_or_default()).map_err(de::Error::custom)?, + general_purpose::STANDARD + .decode(m.params.unwrap_or_default()) + .map_err(de::Error::custom)?, ), }) } @@ -450,6 +453,7 @@ pub mod parameter_json { pub mod signature_json { use super::{FilecoinSignature, FilecoinSignatureType}; + use base64::{engine::general_purpose, Engine as _}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; // Wrapper for serializing and deserializing a Signature from JSON. @@ -476,7 +480,7 @@ pub mod signature_json { { JsonHelper { sig_type: sig.sig_type, - bytes: base64::encode(&sig.bytes), + bytes: general_purpose::STANDARD.encode(&sig.bytes), } .serialize(serializer) } @@ -488,7 +492,9 @@ pub mod signature_json { let JsonHelper { sig_type, bytes } = Deserialize::deserialize(deserializer)?; Ok(FilecoinSignature { sig_type, - bytes: base64::decode(bytes).map_err(de::Error::custom)?, + bytes: general_purpose::STANDARD + .decode(bytes) + .map_err(de::Error::custom)?, }) } diff --git a/anychain-kms/src/bip39/crypto.rs b/anychain-kms/src/bip39/crypto.rs index a32fe79..0b0dcd5 100644 --- a/anychain-kms/src/bip39/crypto.rs +++ b/anychain-kms/src/bip39/crypto.rs @@ -37,7 +37,7 @@ pub(crate) fn gen_random_bytes(byte_length: usize) -> Vec { pub(crate) fn pbkdf2(input: &[u8], salt: &str) -> Vec { let mut seed = vec![0u8; PBKDF2_BYTES]; - pbkdf2::pbkdf2::>(input, salt.as_bytes(), PBKDF2_ROUNDS, &mut seed); + let _ = pbkdf2::pbkdf2::>(input, salt.as_bytes(), PBKDF2_ROUNDS, &mut seed); seed } From c197927bdf79a4935ddc4c2cf3e115a92e4c1095 Mon Sep 17 00:00:00 2001 From: shuimuliang Date: Mon, 9 Oct 2023 15:25:01 +0800 Subject: [PATCH 3/3] build: update crates version anychain-kms 0.1.2 anychain-core 0.1.3 anychain-bitcoin 0.1.3 anychain-ethereum 0.1.2 anychain-filecoin 0.1.2 anychain-tron 0.2.1 anychain-ripple 0.1.4 --- anychain-bitcoin/Cargo.toml | 2 +- anychain-bitcoin/README.md | 2 +- anychain-core/Cargo.toml | 2 +- anychain-core/README.md | 2 +- anychain-ethereum/Cargo.toml | 2 +- anychain-ethereum/README.md | 2 +- anychain-filecoin/Cargo.toml | 2 +- anychain-filecoin/README.md | 2 +- anychain-kms/Cargo.toml | 2 +- anychain-ripple/Cargo.toml | 2 +- anychain-ripple/README.md | 2 +- anychain-tron/Cargo.toml | 2 +- anychain-tron/README.md | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/anychain-bitcoin/Cargo.toml b/anychain-bitcoin/Cargo.toml index 8f9abda..18ae649 100644 --- a/anychain-bitcoin/Cargo.toml +++ b/anychain-bitcoin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-bitcoin" description = "A Rust library for Bitcoin-focused cryptocurrency wallets, enabling seamless transactions on the Bitcoin blockchain" -version = "0.1.2" +version = "0.1.3" keywords = ["bitcoin", "blockchain", "cryptocurrency", "wallet", "transactions"] # Workspace inherited keys diff --git a/anychain-bitcoin/README.md b/anychain-bitcoin/README.md index 86e0241..d2b3fe9 100644 --- a/anychain-bitcoin/README.md +++ b/anychain-bitcoin/README.md @@ -14,7 +14,7 @@ anychain-bitcoin is a Rust crate that provides a simple and efficient way to int To use anychain-bitcoin in your Rust project, add the following to your Cargo.toml file: ```toml [dependencies] -anychain-bitcoin = "0.1.1" +anychain-bitcoin = "0.1.3" ``` Then, import the crate in your code: diff --git a/anychain-core/Cargo.toml b/anychain-core/Cargo.toml index 72a9f9d..4d9aa1f 100644 --- a/anychain-core/Cargo.toml +++ b/anychain-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "anychain-core" -version = "0.1.2" +version = "0.1.3" description = "A core support for cryptocurrency wallets" categories = ["command-line-utilities", "cryptocurrency"] keywords = ["bitcoin", "blockchain", "ethereum", "no_std"] diff --git a/anychain-core/README.md b/anychain-core/README.md index 695353f..387a152 100644 --- a/anychain-core/README.md +++ b/anychain-core/README.md @@ -14,7 +14,7 @@ anychain-core is a Rust crate that provides core functionality for working with To start using anychain-core, add it as a dependency in your Cargo.toml file: ```toml [dependencies] -anychain-core = "0.1.1" +anychain-core = "0.1.3" ``` Then, import the crate in your Rust code: diff --git a/anychain-ethereum/Cargo.toml b/anychain-ethereum/Cargo.toml index 11d8a7b..b40fb07 100644 --- a/anychain-ethereum/Cargo.toml +++ b/anychain-ethereum/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-ethereum" description = "A Rust library for Ethereum-focused cryptocurrency wallets, enabling seamless transactions on the Ethereum blockchain" -version = "0.1.1" +version = "0.1.2" keywords = ["blockchain", "crypto", "cryptocurrency", "ethereum", "wallet"] # Workspace inherited keys diff --git a/anychain-ethereum/README.md b/anychain-ethereum/README.md index 401e406..b3ddbe1 100644 --- a/anychain-ethereum/README.md +++ b/anychain-ethereum/README.md @@ -18,7 +18,7 @@ This is the README for the anychain-ethereum crate, a Rust library that provides To use the anychain-ethereum crate in your Rust project, add the following to your Cargo.toml file: ```toml [dependencies] -anychain-ethereum = "0.1.1" +anychain-ethereum = "0.1.2" ``` ## Usage diff --git a/anychain-filecoin/Cargo.toml b/anychain-filecoin/Cargo.toml index 481c070..8a62cda 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.1" +version = "0.1.2" keywords = ["filecoin", "blockchain", "cryptocurrency", "wallet", "transactions"] # Workspace inherited keys diff --git a/anychain-filecoin/README.md b/anychain-filecoin/README.md index 00035b2..5b0fd5e 100644 --- a/anychain-filecoin/README.md +++ b/anychain-filecoin/README.md @@ -17,7 +17,7 @@ anychain-filecoin is a Rust library that provides a simple and unified interface Add the following to your Cargo.toml file: ```toml [dependencies] -anychain-filecoin = "0.1.1" +anychain-filecoin = "0.1.2" ``` Then run cargo build to download and compile the library. diff --git a/anychain-kms/Cargo.toml b/anychain-kms/Cargo.toml index f232251..36b635d 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.1" +version = "0.1.2" keywords = ["cryptography", "security", "signature", "algorithm"] # Workspace inherited keys diff --git a/anychain-ripple/Cargo.toml b/anychain-ripple/Cargo.toml index 76af3ee..a6021ff 100644 --- a/anychain-ripple/Cargo.toml +++ b/anychain-ripple/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-ripple" description = "A Rust library for interacting with the Ripple blockchain. It provides core functionalities such as transaction signing and serialization, address generation, and network communication." -version = "0.1.3" +version = "0.1.4" keywords = ["ripple", "blockchain", "cryptocurrency", "wallet", "transactions"] # Workspace inherited keys diff --git a/anychain-ripple/README.md b/anychain-ripple/README.md index 51b48e5..405babe 100644 --- a/anychain-ripple/README.md +++ b/anychain-ripple/README.md @@ -15,7 +15,7 @@ Features Add the following to your Cargo.toml file: ```toml [dependencies] -anychain-ripple = "0.1.0" +anychain-ripple = "0.1.4" ``` Then run cargo build to download and compile the anychain-ripple library. diff --git a/anychain-tron/Cargo.toml b/anychain-tron/Cargo.toml index 90396fd..f2c873d 100644 --- a/anychain-tron/Cargo.toml +++ b/anychain-tron/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-tron" description = "A Rust library for Tron-focused cryptocurrency wallets, enabling seamless transactions on the Tron blockchain" -version = "0.2.0" +version = "0.2.1" keywords = ["tron", "blockchain", "cryptocurrency", "wallet", "transactions"] # Workspace inherited keys diff --git a/anychain-tron/README.md b/anychain-tron/README.md index c0a0308..48fbffd 100644 --- a/anychain-tron/README.md +++ b/anychain-tron/README.md @@ -16,7 +16,7 @@ anychain-tron is a Rust library that provides a simple and unified interface for Add the following to your Cargo.toml file: ```toml [dependencies] -anychain-tron = "0.1.1" +anychain-tron = "0.2.1" ``` Then, run cargo build to download and compile the library.