Skip to content

Commit

Permalink
Skip data columns by range request when low peers count
Browse files Browse the repository at this point in the history
  • Loading branch information
hangleang committed Feb 25, 2025
1 parent f29a929 commit 986ca62
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions p2p/src/sync_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,7 @@ impl SyncManager {
// let start_slot = sync_start_slot + slots_per_request * index;
// let count = remote_head_slot.saturating_sub(start_slot) + 1;
// let mut count = count.min(slots_per_request);
let mut count = if peers_to_sync.len() > 10 {
slots_per_request
} else if peers_to_sync.len() >= 5 {
slots_per_request.saturating_div(2)
} else {
slots_per_request.saturating_div(4)
};
let mut count = slots_per_request;

if misc::compute_epoch_at_slot::<P>(start_slot + count) == config.fulu_fork_epoch {
count -= 1;
Expand All @@ -544,7 +538,9 @@ impl SyncManager {
max_slot = start_slot + count - 1;

if config.phase_at_slot::<P>(start_slot).is_peerdas_activated() {
if misc::data_column_serve_range_slot::<P>(config, current_slot) < max_slot {
if peers_to_sync.len() >= 5
&& misc::data_column_serve_range_slot::<P>(config, current_slot) < max_slot
{
match self.map_peer_custody_columns(&columns, Some(&peers_to_sync)) {
Ok(peer_custody_columns_mapping) => {
for (peer_id, peer_custody_columns) in peer_custody_columns_mapping {
Expand Down Expand Up @@ -598,9 +594,7 @@ impl SyncManager {
data_columns: None,
});

if config.phase_at_slot::<P>(start_slot).is_peerdas_activated()
&& sync_batches.len() >= peers_to_sync.len()
{
if sync_batches.len() >= peers_to_sync.len() * 2 {
break;
}

Expand Down

0 comments on commit 986ca62

Please sign in to comment.