diff --git a/Dockerfile b/Dockerfile index 179fa0d8973..b8e4bb06cc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ ENV CXX=/usr/bin/clang++-14 RUN wget "https://sh.rustup.rs" -O rustup.sh \ && sh rustup.sh -y ENV PATH="/root/.cargo/bin:${PATH}" -RUN rustup default nightly-2024-02-09 +RUN rustup default nightly-2024-06-13 RUN cargo install --force cbindgen \ && rustup target add wasm32-unknown-emscripten @@ -49,10 +49,11 @@ COPY . /wallet-core WORKDIR /wallet-core # Install dependencies -RUN tools/install-dependencies +# RUN tools/install-dependencies # Build: generate files and rust lib -RUN tools/generate-files native +# RUN tools/generate-files native +RUN tools/rust-bindgen native # Build: cmake + make wallet core RUN cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug \ diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 73378992bdb..e94bd038f53 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1544,18 +1544,6 @@ dependencies = [ "syn 2.0.37", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.107", - "unicode-xid", -] - [[package]] name = "tap" version = "1.0.1" @@ -2079,12 +2067,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "untrusted" version = "0.7.1" @@ -2270,21 +2252,20 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] name = "zeroize" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", - "synstructure", + "syn 2.0.37", ] diff --git a/rust/chains/tw_internet_computer/src/address.rs b/rust/chains/tw_internet_computer/src/address.rs index a30ab2ef984..e439b573a9d 100644 --- a/rust/chains/tw_internet_computer/src/address.rs +++ b/rust/chains/tw_internet_computer/src/address.rs @@ -24,9 +24,11 @@ pub trait IcpAddress: std::str::FromStr + Into VisitResult { } let shift = u32::try_from(nth_byte) - .unwrap_or(std::u32::MAX) + .unwrap_or(u32::MAX) .saturating_mul(7); - let elem_val = elem_val.checked_shl(shift).unwrap_or(std::u32::MAX); + let elem_val = elem_val.checked_shl(shift).unwrap_or(u32::MAX); let new_val = val | elem_val; let val = u16::try_from(new_val).map_err(|_| VisitError::Overflow(new_val))?; @@ -172,7 +172,7 @@ pub fn serialize( let mut seq = serializer.serialize_tuple(1)?; let len = elements.len(); - if len > std::u16::MAX as usize { + if len > u16::MAX as usize { return Err(ser::Error::custom("length larger than u16")); } let short_len = ShortU16(len as u16); @@ -229,7 +229,7 @@ where T: Deserialize<'de>, { let visitor = ShortVecVisitor { _t: PhantomData }; - deserializer.deserialize_tuple(std::usize::MAX, visitor) + deserializer.deserialize_tuple(usize::MAX, visitor) } pub struct ShortVec(pub Vec); @@ -361,10 +361,10 @@ mod tests { #[test] fn test_short_vec_u8_too_long() { - let vec = ShortVec(vec![4u8; std::u16::MAX as usize]); + let vec = ShortVec(vec![4u8; u16::MAX as usize]); assert!(matches!(serialize(&vec), Ok(_))); - let vec = ShortVec(vec![4u8; std::u16::MAX as usize + 1]); + let vec = ShortVec(vec![4u8; u16::MAX as usize + 1]); assert!(matches!(serialize(&vec), Err(_))); } diff --git a/rust/tw_evm/src/transaction/mod.rs b/rust/tw_evm/src/transaction/mod.rs index aa91320ce31..949153e7946 100644 --- a/rust/tw_evm/src/transaction/mod.rs +++ b/rust/tw_evm/src/transaction/mod.rs @@ -4,8 +4,8 @@ //! Transactions can be: //! - Non-typed (legacy, pre-EIP2718) transactions: -//! -- simple ETH transfer -//! -- others with payload, function call, e.g. ERC20 transfer +//! - simple ETH transfer +//! - others with payload, function call, e.g. ERC20 transfer //! - Typed transactions (enveloped, EIP2718), with specific type and transaction payload //! - User operations (EIP4337) diff --git a/rust/tw_hash/Cargo.toml b/rust/tw_hash/Cargo.toml index 2e1740b15c1..c9b8ab18c42 100644 --- a/rust/tw_hash/Cargo.toml +++ b/rust/tw_hash/Cargo.toml @@ -20,7 +20,7 @@ sha2 = "0.10.6" sha3 = "0.10.6" tw_encoding = { path = "../tw_encoding" } tw_memory = { path = "../tw_memory" } -zeroize = "1.6.0" +zeroize = "1.8.1" [dev-dependencies] serde_json = "1.0" diff --git a/rust/tw_keypair/Cargo.toml b/rust/tw_keypair/Cargo.toml index b332c1e4aa4..b71d0b70b62 100644 --- a/rust/tw_keypair/Cargo.toml +++ b/rust/tw_keypair/Cargo.toml @@ -16,7 +16,7 @@ tw_encoding = { path = "../tw_encoding" } tw_hash = { path = "../tw_hash" } tw_memory = { path = "../tw_memory" } tw_misc = { path = "../tw_misc" } -zeroize = "1.6.0" +zeroize = "1.8.1" # ECDSA specific: ecdsa = "0.16.6" der = "0.7.3" diff --git a/rust/tw_misc/Cargo.toml b/rust/tw_misc/Cargo.toml index 13747bab355..49f5b9f0c5d 100644 --- a/rust/tw_misc/Cargo.toml +++ b/rust/tw_misc/Cargo.toml @@ -9,4 +9,4 @@ test-utils = ["serde", "serde_json"] [dependencies] serde = { version = "1.0", features = ["derive"], optional = true } serde_json = { version = "1.0", optional = true } -zeroize = "1.6.0" +zeroize = "1.8.1" diff --git a/rust/tw_number/src/i256.rs b/rust/tw_number/src/i256.rs index 49a617c4d6f..3f62160ba27 100644 --- a/rust/tw_number/src/i256.rs +++ b/rust/tw_number/src/i256.rs @@ -40,7 +40,6 @@ impl I256 { /// - `0` is [`U256::zero()`] /// - `-1` is [`U256::MAX`] /// - `-2` is [`U256::MAX - 1`] - /// ... #[inline] pub fn to_u256_repr(&self) -> U256 { U256::from(self.0) @@ -52,7 +51,6 @@ impl I256 { /// - [`U256::zero()`] is `0` /// - [`U256::MAX`] is `-1` /// - [`U256::MAX - 1`] is `-2` - /// ... #[inline] pub fn from_u256_repr(unsigned: U256) -> I256 { I256(unsigned.0) diff --git a/tools/install-rust-dependencies b/tools/install-rust-dependencies index 632c2290f1c..1b12239c010 100755 --- a/tools/install-rust-dependencies +++ b/tools/install-rust-dependencies @@ -2,7 +2,7 @@ set -e -NIGHTLY="nightly-2024-02-09" +NIGHTLY="nightly-2024-06-13" rustup toolchain install $NIGHTLY rustup default $NIGHTLY