diff --git a/.travis.yml b/.travis.yml index 210d4c956e..7fa73dd1b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,15 +16,15 @@ env: matrix: include: - - rust: 1.31.1 + - rust: 1.32.0 os: osx env: FMT=true CHECK=true TEST=true if: type = pull_request - - rust: 1.31.1 + - rust: 1.32.0 os: osx env: FMT=true CHECK=true TEST=true if: type != pull_request - - rust: 1.31.1 + - rust: 1.32.0 os: linux env: TEST=true if: type != pull_request diff --git a/README.md b/README.md index 033bf17b0c..55b3a9a054 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,13 @@ The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md), an ## Build dependencies -CKB is currently tested mainly with `stable-1.31.1` on Linux and Mac OSX. +CKB is currently tested mainly with `stable-1.32.0` on Linux and Mac OSX. We recommend installing Rust through [rustup](https://www.rustup.rs/) ```bash # Get rustup from rustup.rs, then in your `ckb` folder: -rustup override set 1.31.1 +rustup override set 1.32.0 rustup component add rustfmt rustup component add clippy ``` diff --git a/core/src/transaction.rs b/core/src/transaction.rs index 2b621e0900..88adcf278e 100644 --- a/core/src/transaction.rs +++ b/core/src/transaction.rs @@ -4,7 +4,6 @@ use crate::script::Script; use crate::BlockNumber; pub use crate::Capacity; use bincode::{deserialize, serialize}; -use ckb_util::u64_to_bytes; use faster_hex::hex_string; use hash::sha3_256; use numext_fixed_hash::H256; @@ -73,7 +72,7 @@ impl CellInput { 0, Vec::new(), None, - Some(u64_to_bytes(block_number.to_le()).to_vec()), + Some(block_number.to_le_bytes().to_vec()), Vec::new(), ), } diff --git a/docker/hub/Dockerfile b/docker/hub/Dockerfile index 4041c5ac91..c529997a97 100644 --- a/docker/hub/Dockerfile +++ b/docker/hub/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:bionic as ckb-builder ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:$PATH \ - RUST_VERSION=1.31.1 + RUST_VERSION=1.32.0 RUN set -eux; \ apt-get update; \ diff --git a/network/src/ckb_protocol.rs b/network/src/ckb_protocol.rs index 758b974ec5..7567f18470 100644 --- a/network/src/ckb_protocol.rs +++ b/network/src/ckb_protocol.rs @@ -115,7 +115,7 @@ where IoErrorKind::Other, format!("faild to upgrade ckb_protocol, error: {}", err), )) - } + }; } }; diff --git a/network/src/ckb_service.rs b/network/src/ckb_service.rs index bd0d77e753..b0ae15e715 100644 --- a/network/src/ckb_service.rs +++ b/network/src/ckb_service.rs @@ -64,7 +64,7 @@ impl CKBService { return Box::new(future::err(IoError::new( IoErrorKind::Other, format!("can't find peer {:?}", peer_id), - ))) + ))); } }; diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 2402ef1f19..900a822040 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -6,7 +6,6 @@ mod protocol_generated; pub use crate::protocol_generated::ckb::protocol::*; use byteorder::{ByteOrder, LittleEndian, WriteBytesExt}; -use ckb_util::u64_to_bytes; use hash::sha3_256; use numext_fixed_hash::H256; use siphasher::sip::SipHasher; @@ -57,7 +56,7 @@ pub fn short_transaction_id(key0: u64, key1: u64, transaction_hash: &H256) -> Sh hasher.write(transaction_hash.as_bytes()); let siphash_transaction_hash = hasher.finish(); - let siphash_transaction_hash_bytes = u64_to_bytes(siphash_transaction_hash.to_le()); + let siphash_transaction_hash_bytes = siphash_transaction_hash.to_le_bytes(); let mut short_transaction_id = [0u8; 6]; diff --git a/rust-toolchain b/rust-toolchain index 6bae540243..359c41089a 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.31.1 +1.32.0 diff --git a/src/cli/run_impl.rs b/src/cli/run_impl.rs index e983fe46ce..9c2150f9cf 100644 --- a/src/cli/run_impl.rs +++ b/src/cli/run_impl.rs @@ -21,7 +21,6 @@ use ckb_sync::{ use crypto::secp::Generator; use log::info; use numext_fixed_hash::H256; -use serde_json; use std::sync::Arc; use std::thread; diff --git a/util/src/lib.rs b/util/src/lib.rs index 328e76b5ae..2c2f0cac59 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -1,6 +1,5 @@ mod unstable; -pub use crate::unstable::int_to_from_bytes::u64_to_bytes; pub use parking_lot::{ Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockUpgradableReadGuard, RwLockWriteGuard, diff --git a/util/src/unstable/int_to_from_bytes.rs b/util/src/unstable/int_to_from_bytes.rs deleted file mode 100644 index cfaa93c613..0000000000 --- a/util/src/unstable/int_to_from_bytes.rs +++ /dev/null @@ -1,19 +0,0 @@ -/// Return the memory representation of this u64 as a byte array. -/// -/// The target platform’s native endianness is used. -/// Portable code likely wants to use this with [`to_be`] or [`to_le`]. -/// -/// [`to_be`]: #method.to_be -/// [`to_le`]: #method.to_le -/// -/// # Examples -/// -/// ``` -/// let bytes = ckb_util::u64_to_bytes(1u64.to_le()); -/// assert_eq!(bytes, [1, 0, 0, 0, 0, 0, 0, 0]); -/// ``` -/// remove it when feature "int_to_from_bytes" stable -#[inline] -pub fn u64_to_bytes(input: u64) -> [u8; 8] { - unsafe { ::std::mem::transmute(input) } -} diff --git a/util/src/unstable/mod.rs b/util/src/unstable/mod.rs index dd734e9658..8b13789179 100644 --- a/util/src/unstable/mod.rs +++ b/util/src/unstable/mod.rs @@ -1 +1 @@ -pub mod int_to_from_bytes; +