Skip to content

Commit

Permalink
bump to 4MB
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
  • Loading branch information
sandreim committed May 7, 2024
1 parent b709dcc commit ba8562b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions polkadot/node/network/availability-recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const LRU_SIZE: u32 = 16;
const COST_INVALID_REQUEST: Rep = Rep::CostMajor("Peer sent unparsable request");

/// PoV size limit in bytes for which prefer fetching from backers.
const SMALL_POV_LIMIT: usize = 128 * 1024;
pub(crate) const FETCH_CHUNKS_THRESHOLD: usize = 4 * 1024 * 1024;

#[derive(Clone, PartialEq)]
/// The strategy we use to recover the PoV.
Expand Down Expand Up @@ -448,7 +448,7 @@ async fn handle_recover<Context>(
if let Some(backing_validators) = session_info.validator_groups.get(backing_group) {
let mut small_pov_size = true;

if let RecoveryStrategyKind::BackersFirstIfSizeLower(small_pov_limit) =
if let RecoveryStrategyKind::BackersFirstIfSizeLower(fetch_chunks_threshold) =
recovery_strategy_kind
{
// Get our own chunk size to get an estimate of the PoV size.
Expand All @@ -457,13 +457,13 @@ async fn handle_recover<Context>(
if let Ok(Some(chunk_size)) = chunk_size {
let pov_size_estimate =
chunk_size.saturating_mul(session_info.validators.len()) / 3;
small_pov_size = pov_size_estimate < small_pov_limit;
small_pov_size = pov_size_estimate < fetch_chunks_threshold;

gum::trace!(
target: LOG_TARGET,
?candidate_hash,
pov_size_estimate,
small_pov_limit,
fetch_chunks_threshold,
enabled = small_pov_size,
"Prefer fetch from backing group",
);
Expand Down Expand Up @@ -551,7 +551,9 @@ impl AvailabilityRecoverySubsystem {
metrics: Metrics,
) -> Self {
Self {
recovery_strategy_kind: RecoveryStrategyKind::BackersFirstIfSizeLower(SMALL_POV_LIMIT),
recovery_strategy_kind: RecoveryStrategyKind::BackersFirstIfSizeLower(
FETCH_CHUNKS_THRESHOLD,
),
bypass_availability_store: true,
post_recovery_check: PostRecoveryCheck::PovHash,
req_receiver,
Expand Down Expand Up @@ -595,7 +597,9 @@ impl AvailabilityRecoverySubsystem {
metrics: Metrics,
) -> Self {
Self {
recovery_strategy_kind: RecoveryStrategyKind::BackersFirstIfSizeLower(SMALL_POV_LIMIT),
recovery_strategy_kind: RecoveryStrategyKind::BackersFirstIfSizeLower(
FETCH_CHUNKS_THRESHOLD,
),
bypass_availability_store: false,
post_recovery_check: PostRecoveryCheck::Reencode,
req_receiver,
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/network/availability-recovery/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ fn recovers_from_only_chunks_if_pov_large() {
AllMessages::AvailabilityStore(
AvailabilityStoreMessage::QueryChunkSize(_, tx)
) => {
let _ = tx.send(Some(1000000));
let _ = tx.send(Some(crate::FETCH_CHUNKS_THRESHOLD + 1));
}
);

Expand Down Expand Up @@ -987,7 +987,7 @@ fn recovers_from_only_chunks_if_pov_large() {
AllMessages::AvailabilityStore(
AvailabilityStoreMessage::QueryChunkSize(_, tx)
) => {
let _ = tx.send(Some(1000000));
let _ = tx.send(Some(crate::FETCH_CHUNKS_THRESHOLD + 1));
}
);

Expand Down

0 comments on commit ba8562b

Please sign in to comment.