Skip to content

Commit 080d7ca

Browse files
committed
toolchain: upgrade toolchain to 1.92.0
Signed-off-by: Eval EXEC <execvy@gmail.com>
1 parent 0cff318 commit 080d7ca

File tree

6 files changed

+17
-25
lines changed

6 files changed

+17
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
CARGO_TERM_COLOR: always
1010
RUSTFLAGS: -D warnings
1111
RUST_BACKTRACE: full
12-
RUST_TOOLCHAIN: 1.85.0
12+
RUST_TOOLCHAIN: 1.92.0
1313
jobs:
1414
rustfmt:
1515
name: Checks / Format

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
env:
66
CARGO_TERM_COLOR: always
77
RUSTFLAGS: -D warnings
8-
RUST_TOOLCHAIN: 1.85.0
8+
RUST_TOOLCHAIN: 1.92.0
99
permissions:
1010
contents: write
1111
id-token: write

light-client-lib/src/protocols/light_client/components/send_last_state_proof.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,32 +488,32 @@ impl EpochDifficultyTrend {
488488
) -> EpochDifficultyTrendDetails {
489489
let (increased, decreased) = match (limit, self) {
490490
(EstimatedLimit::Min, Self::Unchanged) => {
491-
let decreased = (n + 1) / 2;
491+
let decreased = n.div_ceil(2);
492492
let increased = n - decreased;
493493
(increased, decreased)
494494
}
495495
(EstimatedLimit::Max, Self::Unchanged) => {
496-
let increased = (n + 1) / 2;
496+
let increased = n.div_ceil(2);
497497
let decreased = n - increased;
498498
(increased, decreased)
499499
}
500500
(EstimatedLimit::Min, Self::Increased { .. }) => {
501-
let decreased = (n - k + 1) / 2;
501+
let decreased = (n - k).div_ceil(2);
502502
let increased = n - decreased;
503503
(increased, decreased)
504504
}
505505
(EstimatedLimit::Max, Self::Increased { .. }) => {
506-
let increased = (n - k + 1) / 2 + k;
506+
let increased = (n - k).div_ceil(2) + k;
507507
let decreased = n - increased;
508508
(increased, decreased)
509509
}
510510
(EstimatedLimit::Min, Self::Decreased { .. }) => {
511-
let decreased = (n - k + 1) / 2 + k;
511+
let decreased = (n - k).div_ceil(2) + k;
512512
let increased = n - decreased;
513513
(increased, decreased)
514514
}
515515
(EstimatedLimit::Max, Self::Decreased { .. }) => {
516-
let increased = (n - k + 1) / 2;
516+
let increased = (n - k).div_ceil(2);
517517
let decreased = n - increased;
518518
(increased, decreased)
519519
}

light-client-lib/src/protocols/light_client/peers.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ pub struct LastState {
113113
* @endum
114114
* ```
115115
*/
116-
#[derive(Clone)]
116+
#[allow(clippy::large_enum_variant)]
117+
#[derive(Clone, Default)]
117118
pub enum PeerState {
119+
#[default]
118120
Initialized,
119121
RequestFirstLastState {
120122
when_sent: u64,
@@ -569,7 +571,7 @@ impl CheckPoints {
569571
if check_points.is_empty() {
570572
return Err(StatusCode::CheckPointsIsEmpty.into());
571573
}
572-
if start_number % self.check_point_interval != 0 {
574+
if !start_number.is_multiple_of(self.check_point_interval) {
573575
let errmsg = format!(
574576
"check points should at `{} * N` but got {}",
575577
self.check_point_interval, start_number
@@ -778,12 +780,6 @@ impl LatestBlockFilterHashes {
778780
}
779781
}
780782

781-
impl Default for PeerState {
782-
fn default() -> Self {
783-
Self::Initialized
784-
}
785-
}
786-
787783
impl fmt::Display for PeerState {
788784
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
789785
let fullname = format!("PeerState::{}", self.name());
@@ -1163,7 +1159,7 @@ impl Peers {
11631159
}
11641160

11651161
pub(crate) fn required_peers_count(&self) -> usize {
1166-
let required_peers_count = ((self.get_max_outbound_peers() + 1) / 2) as usize;
1162+
let required_peers_count = self.get_max_outbound_peers().div_ceil(2) as usize;
11671163
if required_peers_count == 0 {
11681164
panic!("max outbound peers shouldn't be zero!");
11691165
}

light-client-lib/src/storage/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,14 @@ pub struct MatchedBlocks {
7777
pub blocks: Vec<MatchedBlock>,
7878
}
7979

80+
#[derive(Default)]
8081
pub enum SetScriptsCommand {
82+
#[default]
8183
All,
8284
Partial,
8385
Delete,
8486
}
8587

86-
impl Default for SetScriptsCommand {
87-
fn default() -> Self {
88-
Self::All
89-
}
90-
}
91-
9288
#[derive(PartialEq, Eq, Hash)]
9389
pub enum ScriptType {
9490
Lock,
@@ -437,7 +433,7 @@ fn parse_matched_blocks(data: &[u8]) -> (u64, Vec<(Byte32, bool)>) {
437433
let mut u64_bytes = [0u8; 8];
438434
u64_bytes.copy_from_slice(&data[0..8]);
439435
let blocks_count = u64::from_le_bytes(u64_bytes);
440-
assert!((data.len() - 8) % 33 == 0);
436+
assert!((data.len() - 8).is_multiple_of(33));
441437
let matched_len = (data.len() - 8) / 33;
442438
let matched_blocks = (0..matched_len)
443439
.map(|i| {

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.85.0
1+
1.92.0

0 commit comments

Comments
 (0)