Bump bitflags from 1.3.2 to 2.3.3 (#32438)
* Bump bitflags from 1.3.2 to 2.3.3 Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.3.3. - [Release notes](https://github.com/bitflags/bitflags/releases) - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md) - [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.3.3) --- updated-dependencies: - dependency-name: bitflags dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * updates programs/sbf/Cargo.lock * derives necessary traits * replaces from_bits_unchecked with from_bits_retain * patches test --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
parent
62b9fcfa76
commit
c2d605b884
|
@ -608,6 +608,9 @@ name = "bitflags"
|
|||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitmaps"
|
||||
|
@ -6083,7 +6086,7 @@ version = "1.17.0"
|
|||
dependencies = [
|
||||
"assert_matches",
|
||||
"bincode",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.3.3",
|
||||
"bs58",
|
||||
"byteorder",
|
||||
"chrono",
|
||||
|
@ -6431,7 +6434,7 @@ dependencies = [
|
|||
"assert_matches",
|
||||
"base64 0.21.2",
|
||||
"bincode",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.3.3",
|
||||
"blake3",
|
||||
"borsh 0.10.3",
|
||||
"bs58",
|
||||
|
@ -6841,7 +6844,7 @@ dependencies = [
|
|||
"assert_matches",
|
||||
"base64 0.21.2",
|
||||
"bincode",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.3.3",
|
||||
"borsh 0.10.3",
|
||||
"bs58",
|
||||
"bytemuck",
|
||||
|
|
|
@ -142,7 +142,7 @@ atty = "0.2.11"
|
|||
backoff = "0.4.0"
|
||||
base64 = "0.21.2"
|
||||
bincode = "1.3.3"
|
||||
bitflags = "1.3.1"
|
||||
bitflags = { version = "2.3.3", features = ["serde"] }
|
||||
blake3 = "1.4.1"
|
||||
block-buffer = "0.10.4"
|
||||
borsh = "0.10.3"
|
||||
|
|
|
@ -13,7 +13,7 @@ use {
|
|||
};
|
||||
|
||||
bitflags! {
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
||||
/// Flags to indicate whether a slot is a descendant of a slot on the main fork
|
||||
pub struct ConnectedFlags:u8 {
|
||||
// A slot S should be considered to be connected if:
|
||||
|
|
|
@ -118,7 +118,7 @@ pub const LEGACY_SHRED_DATA_CAPACITY: usize = legacy::ShredData::CAPACITY;
|
|||
// LAST_SHRED_IN_SLOT also implies DATA_COMPLETE_SHRED.
|
||||
// So it cannot be LAST_SHRED_IN_SLOT if not also DATA_COMPLETE_SHRED.
|
||||
bitflags! {
|
||||
#[derive(Default, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ShredFlags:u8 {
|
||||
const SHRED_TICK_REFERENCE_MASK = 0b0011_1111;
|
||||
const DATA_COMPLETE_SHRED = 0b0100_0000;
|
||||
|
@ -1678,6 +1678,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_shred_flags_serde() {
|
||||
let flags: ShredFlags = bincode::deserialize(&[0b0001_0101]).unwrap();
|
||||
assert!(!flags.contains(ShredFlags::DATA_COMPLETE_SHRED));
|
||||
assert!(!flags.contains(ShredFlags::LAST_SHRED_IN_SLOT));
|
||||
assert_eq!((flags & ShredFlags::SHRED_TICK_REFERENCE_MASK).bits(), 21u8);
|
||||
assert_eq!(bincode::serialize(&flags).unwrap(), [0b0001_0101]);
|
||||
|
||||
let flags: ShredFlags = bincode::deserialize(&[0b0111_0001]).unwrap();
|
||||
assert!(flags.contains(ShredFlags::DATA_COMPLETE_SHRED));
|
||||
assert!(!flags.contains(ShredFlags::LAST_SHRED_IN_SLOT));
|
||||
|
|
|
@ -236,13 +236,11 @@ impl ShredData {
|
|||
};
|
||||
let size = (data.len() + Self::SIZE_OF_HEADERS) as u16;
|
||||
let flags = flags
|
||||
| unsafe {
|
||||
ShredFlags::from_bits_unchecked(
|
||||
ShredFlags::SHRED_TICK_REFERENCE_MASK
|
||||
.bits()
|
||||
.min(reference_tick),
|
||||
)
|
||||
};
|
||||
| ShredFlags::from_bits_retain(
|
||||
ShredFlags::SHRED_TICK_REFERENCE_MASK
|
||||
.bits()
|
||||
.min(reference_tick),
|
||||
);
|
||||
let data_header = DataShredHeader {
|
||||
parent_offset,
|
||||
flags,
|
||||
|
@ -389,7 +387,8 @@ mod test {
|
|||
let mut shred = shred.clone();
|
||||
shred.data_header.flags |= ShredFlags::LAST_SHRED_IN_SLOT;
|
||||
assert_matches!(shred.sanitize(), Ok(()));
|
||||
shred.data_header.flags &= !ShredFlags::DATA_COMPLETE_SHRED;
|
||||
shred.data_header.flags &=
|
||||
ShredFlags::from_bits_retain(!ShredFlags::DATA_COMPLETE_SHRED.bits());
|
||||
assert_matches!(shred.sanitize(), Err(Error::InvalidShredFlags(131u8)));
|
||||
shred.data_header.flags |= ShredFlags::SHRED_TICK_REFERENCE_MASK;
|
||||
assert_matches!(shred.sanitize(), Err(Error::InvalidShredFlags(191u8)));
|
||||
|
|
|
@ -838,13 +838,11 @@ pub(super) fn make_shreds_from_data(
|
|||
.checked_sub(parent_slot)
|
||||
.and_then(|offset| u16::try_from(offset).ok())
|
||||
.ok_or(Error::InvalidParentSlot { slot, parent_slot })?;
|
||||
let flags = unsafe {
|
||||
ShredFlags::from_bits_unchecked(
|
||||
ShredFlags::SHRED_TICK_REFERENCE_MASK
|
||||
.bits()
|
||||
.min(reference_tick),
|
||||
)
|
||||
};
|
||||
let flags = ShredFlags::from_bits_retain(
|
||||
ShredFlags::SHRED_TICK_REFERENCE_MASK
|
||||
.bits()
|
||||
.min(reference_tick),
|
||||
);
|
||||
DataShredHeader {
|
||||
parent_offset,
|
||||
flags,
|
||||
|
@ -1191,7 +1189,7 @@ mod test {
|
|||
let reference_tick = rng.gen_range(0, 0x40);
|
||||
DataShredHeader {
|
||||
parent_offset: rng.gen::<u16>().max(1),
|
||||
flags: unsafe { ShredFlags::from_bits_unchecked(reference_tick) },
|
||||
flags: ShredFlags::from_bits_retain(reference_tick),
|
||||
size: 0,
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ pub(crate) enum ShredSource {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Default)]
|
||||
#[derive(Copy, Clone, Default)]
|
||||
struct SlotFlags: u8 {
|
||||
const DEAD = 0b00000001;
|
||||
const FULL = 0b00000010;
|
||||
|
|
|
@ -579,6 +579,9 @@ name = "bitflags"
|
|||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitmaps"
|
||||
|
@ -5100,7 +5103,7 @@ version = "1.17.0"
|
|||
dependencies = [
|
||||
"assert_matches",
|
||||
"bincode",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.3.3",
|
||||
"byteorder 1.4.3",
|
||||
"chrono",
|
||||
"chrono-humanize",
|
||||
|
@ -5278,7 +5281,7 @@ dependencies = [
|
|||
"array-bytes",
|
||||
"base64 0.21.2",
|
||||
"bincode",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.3.3",
|
||||
"blake3",
|
||||
"borsh 0.10.3",
|
||||
"bs58",
|
||||
|
@ -6022,7 +6025,7 @@ dependencies = [
|
|||
"assert_matches",
|
||||
"base64 0.21.2",
|
||||
"bincode",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.3.3",
|
||||
"borsh 0.10.3",
|
||||
"bs58",
|
||||
"bytemuck",
|
||||
|
|
|
@ -187,6 +187,7 @@ mod tests {
|
|||
use {super::*, crate::instruction::AccountMeta, bitflags::bitflags};
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct KeyFlags: u8 {
|
||||
const SIGNER = 0b00000001;
|
||||
const WRITABLE = 0b00000010;
|
||||
|
|
|
@ -22,7 +22,7 @@ pub const PACKET_DATA_SIZE: usize = 1280 - 40 - 8;
|
|||
|
||||
bitflags! {
|
||||
#[repr(C)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PacketFlags: u8 {
|
||||
const DISCARD = 0b0000_0001;
|
||||
const FORWARDED = 0b0000_0010;
|
||||
|
|
Loading…
Reference in New Issue