Skip to content

Commit

Permalink
remove unused sync-config fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lemmih committed Mar 6, 2025
1 parent a00f38e commit 88a8ce2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/chain_sync/chain_follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ pub async fn chain_follower<DB: Blockstore + Sync + Send + 'static>(
let network = network.clone();
async move {
while let Ok(event) = network_rx.recv_async().await {
// FIXME: Event metrics are not related to the chain follower. Should be moved elsewhere.
inc_gossipsub_event_metrics(&event);

// FIXME: Keeping peer information up to date is not related to the chain follower. Should be moved elsewhere.
upd_peer_information(
&event,
network.clone(),
Expand Down
13 changes: 0 additions & 13 deletions src/chain_sync/chain_muxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,21 @@

use serde::{Deserialize, Serialize};

// Sync the messages for one or many tipsets @ a time
// Lotus uses a window size of 8: https://github.com/filecoin-project/lotus/blob/c1d22d8b3298fdce573107413729be608e72187d/chain/sync.go#L56
const DEFAULT_REQUEST_WINDOW: usize = 8;
const DEFAULT_TIPSET_SAMPLE_SIZE: usize = 1;
const DEFAULT_RECENT_STATE_ROOTS: i64 = 2000;

/// Structure that defines syncing configuration options
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[cfg_attr(test, derive(derive_quickcheck_arbitrary::Arbitrary))]
pub struct SyncConfig {
/// Request window length for tipsets during chain exchange
#[cfg_attr(test, arbitrary(gen(|g| u32::arbitrary(g) as _)))]
pub request_window: usize,
/// Number of recent state roots to keep in the database after `sync`
/// and to include in the exported snapshot.
pub recent_state_roots: i64,
/// Sample size of tipsets to acquire before determining what the network
/// head is
#[cfg_attr(test, arbitrary(gen(|g| u32::arbitrary(g) as _)))]
pub tipset_sample_size: usize,
}

impl Default for SyncConfig {
fn default() -> Self {
Self {
request_window: DEFAULT_REQUEST_WINDOW,
recent_state_roots: DEFAULT_RECENT_STATE_ROOTS,
tipset_sample_size: DEFAULT_TIPSET_SAMPLE_SIZE,
}
}
}
7 changes: 0 additions & 7 deletions src/cli_shared/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,6 @@ impl CliOpts {
}
// (where to find these flags, should be easy to do with structops)

// check and set syncing configurations
if let Some(req_window) = self.req_window {
cfg.sync.request_window = req_window;
}
if let Some(tipset_sample_size) = self.tipset_sample_size {
cfg.sync.tipset_sample_size = tipset_sample_size.into();
}
if let Some(encrypt_keystore) = self.encrypt_keystore {
cfg.client.encrypt_keystore = encrypt_keystore;
}
Expand Down

0 comments on commit 88a8ce2

Please sign in to comment.