Skip to content

Commit

Permalink
[Rust]: Update rust toolchain to nightly-2024-06-13 (#3932)
Browse files Browse the repository at this point in the history
* [Rust]: Update rust toolchain to nightly-2024-06-13

* [Rust]: Revert Dockerfile
  • Loading branch information
satoshiotomakan authored Jul 9, 2024
1 parent 352e083 commit c072e13
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 5 additions & 24 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions rust/chains/tw_internet_computer/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ pub trait IcpAddress: std::str::FromStr<Err = AddressError> + Into<AccountIdenti
/// * \x0Aaccount-id
/// * the owner's principal ID
/// * subaccount (32-bytes)
///
/// Then,
/// * CRC32 the SHA-224 hash
/// * Prepend the CRC32 to the SHA-224.
///
/// https://internetcomputer.org/docs/current/references/ledger/#_accounts
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AccountIdentifier {
Expand Down
12 changes: 6 additions & 6 deletions rust/chains/tw_solana/src/transaction/short_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ fn visit_byte(elem: u8, val: u16, nth_byte: usize) -> 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))?;
Expand Down Expand Up @@ -172,7 +172,7 @@ pub fn serialize<S: Serializer, T: 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);
Expand Down Expand Up @@ -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<T>(pub Vec<T>);
Expand Down Expand Up @@ -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(_)));
}

Expand Down
4 changes: 2 additions & 2 deletions rust/tw_evm/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion rust/tw_hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion rust/tw_keypair/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_misc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 0 additions & 2 deletions rust/tw_number/src/i256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tools/install-rust-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

NIGHTLY="nightly-2024-02-09"
NIGHTLY="nightly-2024-06-13"

rustup toolchain install $NIGHTLY
rustup default $NIGHTLY
Expand Down

0 comments on commit c072e13

Please sign in to comment.