Skip to content

Commit eea09d0

Browse files
committed
deps: upgrade bitflags from 1.3 to 2.9, fix nervosnetwork#4844
1 parent 6bbf084 commit eea09d0

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ axum = "0.7"
113113
backtrace = "0.3"
114114
base64 = "0.21.0"
115115
bit-vec = "0.6.3"
116-
bitflags = "1.0"
116+
bitflags = "2.9"
117117
blake2b-ref = "0.3"
118118
bloom-filters = "0.1"
119119
bs58 = "0.5.0"

network/src/protocols/identify/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ impl Identify {
625625

626626
bitflags::bitflags! {
627627
/// Node Function Identification
628+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
628629
pub struct Flags: u64 {
629630
/// Compatibility reserved
630631
const COMPATIBILITY = 0b1;

shared/src/block_status.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
use bitflags::bitflags;
66
bitflags! {
7+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
78
pub struct BlockStatus: u32 {
89
const UNKNOWN = 0;
910

1011
const HEADER_VALID = 1;
11-
const BLOCK_RECEIVED = 1 | (Self::HEADER_VALID.bits << 1);
12-
const BLOCK_STORED = 1 | (Self::BLOCK_RECEIVED.bits << 1);
13-
const BLOCK_VALID = 1 | (Self::BLOCK_STORED.bits << 1);
12+
const BLOCK_RECEIVED = 1 | (Self::HEADER_VALID.bits() << 1);
13+
const BLOCK_STORED = 1 | (Self::BLOCK_RECEIVED.bits() << 1);
14+
const BLOCK_VALID = 1 | (Self::BLOCK_STORED.bits() << 1);
1415

1516
const BLOCK_INVALID = 1 << 12;
1617
}

verification/traits/src/lib.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub trait Verifier {
1414

1515
bitflags! {
1616
/// The bit flags for particular process block verify
17+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1718
pub struct Switch: u32 {
1819
/// None of verifier will be disabled
1920
const NONE = 0b00000000;
@@ -43,14 +44,14 @@ bitflags! {
4344
const DISABLE_EXTENSION = 0b10000000;
4445

4546
/// Disable all verifier
46-
const DISABLE_ALL = Self::DISABLE_EPOCH.bits | Self::DISABLE_UNCLES.bits |
47-
Self::DISABLE_TWO_PHASE_COMMIT.bits | Self::DISABLE_DAOHEADER.bits |
48-
Self::DISABLE_REWARD.bits |
49-
Self::DISABLE_NON_CONTEXTUAL.bits | Self::DISABLE_SCRIPT.bits |
50-
Self::DISABLE_EXTENSION.bits;
47+
const DISABLE_ALL = Self::DISABLE_EPOCH.bits() | Self::DISABLE_UNCLES.bits() |
48+
Self::DISABLE_TWO_PHASE_COMMIT.bits() | Self::DISABLE_DAOHEADER.bits() |
49+
Self::DISABLE_REWARD.bits() |
50+
Self::DISABLE_NON_CONTEXTUAL.bits() | Self::DISABLE_SCRIPT.bits() |
51+
Self::DISABLE_EXTENSION.bits();
5152

5253
/// Only script verification
53-
const ONLY_SCRIPT = Self::DISABLE_ALL.bits & (!Self::DISABLE_SCRIPT.bits);
54+
const ONLY_SCRIPT = Self::DISABLE_ALL.bits() & (!Self::DISABLE_SCRIPT.bits());
5455
}
5556
}
5657

0 commit comments

Comments
 (0)