mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 08:52:54 +00:00
pr feedback
This commit is contained in:
@@ -121,7 +121,7 @@ const MAX_AGGREGATED_ATTESTATION_REPROCESS_QUEUE_LEN: usize = 1_024;
|
|||||||
/// before we start dropping them.
|
/// before we start dropping them.
|
||||||
const MAX_GOSSIP_BLOCK_QUEUE_LEN: usize = 1_024;
|
const MAX_GOSSIP_BLOCK_QUEUE_LEN: usize = 1_024;
|
||||||
|
|
||||||
/// The maximum number of queued `SignedBeaconBlockAndBlobsSidecar` objects received on gossip that
|
/// The maximum number of queued `SignedBlobSidecar` objects received on gossip that
|
||||||
/// will be stored before we start dropping them.
|
/// will be stored before we start dropping them.
|
||||||
const MAX_GOSSIP_BLOB_QUEUE_LEN: usize = 1_024;
|
const MAX_GOSSIP_BLOB_QUEUE_LEN: usize = 1_024;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ const MAX_SYNC_CONTRIBUTION_QUEUE_LEN: usize = 1024;
|
|||||||
/// The maximum number of queued `SignedBeaconBlock` objects received from the network RPC that
|
/// The maximum number of queued `SignedBeaconBlock` objects received from the network RPC that
|
||||||
/// will be stored before we start dropping them.
|
/// will be stored before we start dropping them.
|
||||||
const MAX_RPC_BLOCK_QUEUE_LEN: usize = 1_024;
|
const MAX_RPC_BLOCK_QUEUE_LEN: usize = 1_024;
|
||||||
const MAX_RPC_BLOB_QUEUE_LEN: usize = 1_024 * 4; // TODO(sean) make function of max blobs per block? or is this just too big?
|
const MAX_RPC_BLOB_QUEUE_LEN: usize = 1_024 * 4;
|
||||||
|
|
||||||
/// The maximum number of queued `Vec<SignedBeaconBlock>` objects received during syncing that will
|
/// The maximum number of queued `Vec<SignedBeaconBlock>` objects received during syncing that will
|
||||||
/// be stored before we start dropping them.
|
/// be stored before we start dropping them.
|
||||||
|
|||||||
@@ -8,18 +8,15 @@ impl<N: Unsigned + Clone> TestRandom for BitList<N> {
|
|||||||
let mut raw_bytes = smallvec![0; initial_len];
|
let mut raw_bytes = smallvec![0; initial_len];
|
||||||
rng.fill_bytes(&mut raw_bytes);
|
rng.fill_bytes(&mut raw_bytes);
|
||||||
|
|
||||||
let highest_set_bit = raw_bytes
|
let non_zero_bytes = raw_bytes
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.rev()
|
.rev()
|
||||||
.find(|(_, byte)| **byte > 0)
|
.find_map(|(i, byte)| (*byte > 0).then_some(i + 1))
|
||||||
.map(|(i, byte)| i * 8 + 7 - byte.leading_zeros() as usize)
|
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
|
|
||||||
let actual_len = highest_set_bit / 8 + 1;
|
if non_zero_bytes < initial_len {
|
||||||
|
raw_bytes.truncate(non_zero_bytes);
|
||||||
if actual_len < initial_len {
|
|
||||||
raw_bytes.truncate(actual_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::from_bytes(raw_bytes).expect("we generate a valid BitList")
|
Self::from_bytes(raw_bytes).expect("we generate a valid BitList")
|
||||||
|
|||||||
Reference in New Issue
Block a user