Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade rust-toolchain from 1.81.0 to 1.85.0, Upgrade rust edition from 2021 to 2024 #4818

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dcdb702
Upgrade rust-toolchain to 1.85.0
eval-exec Feb 22, 2025
992fddd
Use rust edition 2024 in Cargo.toml
eval-exec Feb 22, 2025
04f2f4c
chore: reword document comment prefix
eval-exec Feb 22, 2025
36154e6
clippy: allow needless_lifetimes: https://rust-lang.github.io/rust-cl…
eval-exec Feb 22, 2025
1fdedb1
clippy: pacnic::PanicInfo is deprecated, sue PanicHookInfo
eval-exec Feb 22, 2025
1bb4db4
clippy: add crate documentation for logger-service
eval-exec Feb 22, 2025
8d6e535
clippy: use div_ceil: https://rust-lang.github.io/rust-clippy/master/…
eval-exec Feb 22, 2025
4c703b6
clippy: remove needless type conversion
eval-exec Feb 22, 2025
567079c
clippy: fix precedence and apply clippy suggests to add parentheses
eval-exec Feb 22, 2025
0105617
clippy: rename `Setup::gen` to `Setup::generate` since `gen` is a res…
eval-exec Feb 22, 2025
445e907
clippy: Use rust 2021 for ckb-gen-types since https://doc.rust-lang.o…
eval-exec Feb 22, 2025
a6fbabf
clippy: fix rust 2024 match-ergonomics https://doc.rust-lang.org/nigh…
eval-exec Feb 22, 2025
8309296
clippy: std::env::set_var is unsafe
eval-exec Feb 22, 2025
4953fce
clippy: Use rust 2021 for ckb-jsonrpc-types since 3rd crate schemars …
eval-exec Feb 22, 2025
220c18d
clippy: Upgrade ckb_schemar to rust 2024
eval-exec Mar 1, 2025
956b890
clippy: make ckb_schemars gen reserve keyword to literal identifier
eval-exec Mar 1, 2025
69a26a5
clippy: remove ref mut in ckb-resources
eval-exec Feb 22, 2025
8ac4a57
clippy: binding modifier not allowed under `ref` default binding mode
eval-exec Mar 1, 2025
0e4730d
clippy: use unsafe to wrap env::set_var is unsafe
eval-exec Mar 1, 2025
902a999
clippy: Allow elided lifetime has a name in chain_controller
eval-exec Mar 1, 2025
c815258
rustfmt: execute `cargo fmt`
eval-exec Mar 1, 2025
cfddf9c
CI: use rust 2024 version of cargo-shear on MacOS CI workflows
eval-exec Mar 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[cargo-new]
name = "Nervos Core Dev"
email = "[email protected]"
edition = "2021"
edition = "2024"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
2 changes: 1 addition & 1 deletion .github/workflows/ci_aarch64_build_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- uses: actions/checkout@v3
- run: rustup component add rustfmt
- run: sudo apt-get update && sudo apt-get install libssl-dev pkg-config libclang-dev -y && sudo apt-get install -y gcc-multilib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_benchmarks_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- run: rustup component add rustfmt
- run: rustup component add clippy
- run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config libclang-dev
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_integration_tests_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- run: rustup component add rustfmt
- run: rustup component add clippy
- run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config libclang-dev
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- run: rustup component add rustfmt
- run: rustup component add clippy
- run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config libclang-dev
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_linters_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- uses: actions/checkout@v3
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_quick_checks_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- run: rustup component add rustfmt
- uses: actions/checkout@v3
- run: cargo fmt --all -- --check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_unit_tests_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
toolchain: 1.85.0
- run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config libclang-dev
- name: Install nextest
uses: taiki-e/install-action@nextest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
name: ckb_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
BUILDER_IMAGE: nervos/ckb-docker-builder:bionic-rust-1.81.0
BUILDER_IMAGE: nervos/ckb-docker-builder:bionic-rust-1.85.0
REL_PKG: ${{ matrix.rel_pkg }}

package-for-linux-aarch64:
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
name: ckb_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
BUILDER_IMAGE: nervos/ckb-docker-builder:centos-7-rust-1.81.0
BUILDER_IMAGE: nervos/ckb-docker-builder:centos-7-rust-1.85.0
REL_PKG: ${{ matrix.rel_pkg }}

package-for-mac:
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name = "ckb"
version = "0.200.0-pre"
license = "MIT"
authors = ["Nervos Core Dev <[email protected]>"]
edition = "2021"
edition = "2024"
build = "build.rs"
description = "CKB is the layer 1 of Nervos Network, a public/permissionless blockchain."
homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"
rust-version = "1.81.0"
rust-version = "1.85.0"

[build-dependencies]
ckb-build-info = { path = "util/build-info", version = "= 0.200.0-pre" }
Expand Down Expand Up @@ -100,6 +100,8 @@ members = [
[workspace.dependencies]
tempfile = "3"
itertools = "0.11.0"
# issue tracking: https://github.com/GREsau/schemars/pull/251
schemars = { package = "ckb_schemars", version="0.8.22" }

[profile.release]
overflow-checks = true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MOLC := moleculec
MOLC_VERSION := 0.7.5
VERBOSE := $(if ${CI},--verbose,)
CLIPPY_OPTS := -D warnings -D clippy::clone_on_ref_ptr -D clippy::redundant_clone -D clippy::enum_glob_use -D clippy::fallible_impl_from \
-A clippy::mutable_key_type -A clippy::upper_case_acronyms -A clippy::needless_return
-A clippy::mutable_key_type -A clippy::upper_case_acronyms -A clippy::needless_return -A clippy::needless_lifetimes -A clippy::extra_unused_lifetimes
CKB_TEST_ARGS := -c 4 ${CKB_TEST_ARGS}
CKB_FEATURES ?= deadlock_detection,with_sentry
ALL_FEATURES := deadlock_detection,with_sentry,with_dns_seeding,profiling,march-native
Expand Down
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "ckb-benches"
version = "0.200.0-pre"
license = "MIT"
authors = ["Nervos Core Dev <[email protected]>"]
edition = "2021"
edition = "2024"
description = "CKB benchmarks."
homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"
Expand Down
32 changes: 19 additions & 13 deletions benches/benches/benchmarks/always_success.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::benchmarks::util::{gen_always_success_block, new_always_success_chain};
use ckb_store::{self, ChainStore};
use ckb_verification_traits::Switch;
use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion};
use criterion::{BatchSize, BenchmarkId, Criterion, criterion_group};
use std::sync::Arc;

#[cfg(not(feature = "ci"))]
Expand All @@ -24,10 +24,12 @@ fn bench(c: &mut Criterion) {
let chains = new_always_success_chain(*i, 2);
let (ref chain1, ref shared1) = chains.0[0];
let (ref chain2, ref shared2) = chains.0[1];
let mut blocks = vec![shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap()];
let mut blocks = vec![
shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap(),
];
let mut parent = blocks[0].clone();
(0..20).for_each(|_| {
let block = gen_always_success_block(&mut blocks, &parent, shared2);
Expand Down Expand Up @@ -72,10 +74,12 @@ fn bench(c: &mut Criterion) {
let (ref chain1, ref shared1) = chains.0[0];
let (ref chain2, ref shared2) = chains.0[1];
let (ref chain3, ref shared3) = chains.0[2];
let mut blocks = vec![shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap()];
let mut blocks = vec![
shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap(),
];
let mut parent = blocks[0].clone();
(0..5).for_each(|i| {
let block = gen_always_success_block(&mut blocks, &parent, shared2);
Expand Down Expand Up @@ -149,10 +153,12 @@ fn bench(c: &mut Criterion) {
let (ref chain1, ref shared1) = chains.0[0];
let (ref chain2, ref shared2) = chains.0[1];
let (ref chain3, ref shared3) = chains.0[2];
let mut blocks = vec![shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap()];
let mut blocks = vec![
shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap(),
];
let mut parent = blocks[0].clone();
(0..5).for_each(|i| {
let block = gen_always_success_block(&mut blocks, &parent, shared2);
Expand Down
12 changes: 6 additions & 6 deletions benches/benches/benchmarks/overall.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
use crate::benchmarks::util::{create_2out_transaction, create_secp_tx, secp_cell};
use ckb_app_config::NetworkConfig;
use ckb_app_config::{BlockAssemblerConfig, TxPoolConfig};
use ckb_chain::{start_chain_services, ChainController};
use ckb_chain::{ChainController, start_chain_services};
use ckb_chain_spec::consensus::{ConsensusBuilder, ProposalWindow};
use ckb_dao_utils::genesis_dao_data;
use ckb_jsonrpc_types::JsonBytes;
use ckb_network::{network::TransportType, Flags, NetworkController, NetworkService, NetworkState};
use ckb_network::{Flags, NetworkController, NetworkService, NetworkState, network::TransportType};
use ckb_shared::{Shared, SharedBuilder};
use ckb_store::ChainStore;
use ckb_types::{
U256,
bytes::Bytes,
core::{
capacity_bytes, BlockBuilder, BlockView, Capacity, EpochNumberWithFraction, FeeRate,
ScriptHashType, TransactionBuilder, TransactionView,
BlockBuilder, BlockView, Capacity, EpochNumberWithFraction, FeeRate, ScriptHashType,
TransactionBuilder, TransactionView, capacity_bytes,
},
packed::{Block, CellDep, CellInput, CellOutput, Header, OutPoint},
prelude::*,
utilities::difficulty_to_compact,
U256,
};
use ckb_verification::HeaderVerifier;
use ckb_verification_traits::Switch;
use ckb_verification_traits::Verifier;
use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion};
use criterion::{BatchSize, BenchmarkId, Criterion, criterion_group};
use rand::random;
use std::sync::Arc;

Expand Down
9 changes: 4 additions & 5 deletions benches/benches/benchmarks/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
use crate::benchmarks::util::create_2out_transaction;
use ckb_app_config::{BlockAssemblerConfig, TxPoolConfig};
use ckb_chain::{start_chain_services, ChainController};
use ckb_chain::{ChainController, start_chain_services};
use ckb_chain_spec::{ChainSpec, IssuedCell};
use ckb_jsonrpc_types::JsonBytes;
use ckb_resource::Resource;
use ckb_shared::{Shared, SharedBuilder, Snapshot};
use ckb_types::global::DATA_DIR;
use ckb_types::{
H160, H256,
bytes::Bytes,
core::{
capacity_bytes,
BlockView, Capacity, DepType, FeeRate, ScriptHashType, TransactionView, capacity_bytes,
cell::{resolve_transaction, setup_system_cell_cache},
BlockView, Capacity, DepType, FeeRate, ScriptHashType, TransactionView,
},
h160, h256,
packed::{CellDep, OutPoint, Script},
prelude::*,
H160, H256,
};
use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion};
use criterion::{BatchSize, BenchmarkId, Criterion, criterion_group};
use std::collections::HashSet;

#[cfg(not(feature = "ci"))]
Expand Down
32 changes: 19 additions & 13 deletions benches/benches/benchmarks/secp_2in2out.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::benchmarks::util::{gen_secp_block, new_secp_chain};
use ckb_store::{self, ChainStore};
use ckb_verification_traits::Switch;
use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion};
use criterion::{BatchSize, BenchmarkId, Criterion, criterion_group};
use std::sync::Arc;

#[cfg(not(feature = "ci"))]
Expand All @@ -24,10 +24,12 @@ fn bench(c: &mut Criterion) {
let chains = new_secp_chain(*txs_size, 2);
let (ref chain1, ref shared1) = chains.0[0];
let (ref chain2, ref shared2) = chains.0[1];
let mut blocks = vec![shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap()];
let mut blocks = vec![
shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap(),
];
let mut parent = blocks[0].clone();
(0..20).for_each(|_| {
let block = gen_secp_block(&mut blocks, &parent, shared2);
Expand Down Expand Up @@ -72,10 +74,12 @@ fn bench(c: &mut Criterion) {
let (ref chain1, ref shared1) = chains.0[0];
let (ref chain2, ref shared2) = chains.0[1];
let (ref chain3, ref shared3) = chains.0[2];
let mut blocks = vec![shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap()];
let mut blocks = vec![
shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap(),
];
let mut parent = blocks[0].clone();
(0..5).for_each(|i| {
let block = gen_secp_block(&mut blocks, &parent, shared2);
Expand Down Expand Up @@ -149,10 +153,12 @@ fn bench(c: &mut Criterion) {
let (ref chain1, ref shared1) = chains.0[0];
let (ref chain2, ref shared2) = chains.0[1];
let (ref chain3, ref shared3) = chains.0[2];
let mut blocks = vec![shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap()];
let mut blocks = vec![
shared1
.snapshot()
.get_block(&shared1.genesis_hash())
.unwrap(),
];
let mut parent = blocks[0].clone();
(0..5).for_each(|i| {
let block = gen_secp_block(&mut blocks, &parent, shared2);
Expand Down
Loading
Loading