Skip to content

Commit

Permalink
Remove obsolete flag disable_bootstrap_on_start.
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-gadelshin committed Apr 17, 2024
1 parent 2d1e4dc commit 2fffb7f
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,6 @@ struct DsnArgs {
/// Known external addresses
#[arg(long, alias = "external-address")]
external_addresses: Vec<Multiaddr>,
/// Defines whether we should run blocking Kademlia bootstrap() operation before other requests.
#[arg(long, default_value_t = false)]
disable_bootstrap_on_start: bool,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -426,7 +423,6 @@ where

// Override flags with `--dev`
dsn.allow_private_ips = dsn.allow_private_ips || dev;
dsn.disable_bootstrap_on_start = dsn.disable_bootstrap_on_start || dev;

let _tmp_directory = if let Some(plot_size) = tmp {
let tmp_directory = tempfile::Builder::new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub(super) fn configure_dsn(
pending_in_connections,
pending_out_connections,
external_addresses,
disable_bootstrap_on_start,
}: DsnArgs,
weak_plotted_pieces: Weak<Mutex<Option<PlottedPieces>>>,
node_client: NodeRpcClient,
Expand Down Expand Up @@ -180,7 +179,6 @@ pub(super) fn configure_dsn(
bootstrap_addresses: bootstrap_nodes,
kademlia_mode: KademliaMode::Dynamic,
external_addresses,
disable_bootstrap_on_start,
..default_config
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ fn main() -> Result<(), Error> {
max_pending_in_connections: 100,
max_pending_out_connections: 150,
external_addresses: vec![],
disable_bootstrap_on_start: false,
}
};

Expand Down
16 changes: 0 additions & 16 deletions crates/subspace-networking/src/behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ pub(crate) struct BehaviorConfig<RecordStore> {
pub(crate) autonat: AutonatWrapperConfig,
}

// #[derive(Debug, Clone, Copy)]
// pub(crate) struct GeneralConnectedPeersInstance;
// #[derive(Debug, Clone, Copy)]
// pub(crate) struct SpecialConnectedPeersInstance;

#[derive(NetworkBehaviour)]
#[behaviour(to_swarm = "Event")]
#[behaviour(event_process = false)]
Expand All @@ -69,12 +64,6 @@ pub(crate) struct Behavior<RecordStore> {
pub(crate) request_response: RequestResponseFactoryBehaviour,
pub(crate) block_list: BlockListBehaviour,
pub(crate) reserved_peers: ReservedPeersBehaviour,
// TODO: Restore or remove connected peer later
// pub(crate) peer_info: Toggle<PeerInfoBehaviour>,
// pub(crate) general_connected_peers:
// Toggle<ConnectedPeersBehaviour<GeneralConnectedPeersInstance>>,
// pub(crate) special_connected_peers:
// Toggle<ConnectedPeersBehaviour<SpecialConnectedPeersInstance>>,
pub(crate) autonat: AutonatWrapper,
}

Expand All @@ -101,11 +90,6 @@ where
})
.into();

// TODO: Restore or remove connected peer later
// let peer_info = config
// .peer_info_provider
// .map(|provider| PeerInfoBehaviour::new(config.peer_info_config, provider));

Self {
connection_limits: ConnectionLimitsBehaviour::new(config.connection_limits),
identify: Identify::new(config.identify),
Expand Down
5 changes: 0 additions & 5 deletions crates/subspace-networking/src/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ pub struct Config<LocalRecordProvider> {
/// Known external addresses to the local peer. The addresses will be added on the swarm start
/// and enable peer to notify others about its reachable address.
pub external_addresses: Vec<Multiaddr>,
/// Defines whether we should run blocking Kademlia bootstrap() operation before other requests.
pub disable_bootstrap_on_start: bool,
}

impl<LocalRecordProvider> fmt::Debug for Config<LocalRecordProvider> {
Expand Down Expand Up @@ -366,7 +364,6 @@ where
bootstrap_addresses: Vec::new(),
kademlia_mode: KademliaMode::Static(Mode::Client),
external_addresses: Vec::new(),
disable_bootstrap_on_start: false,
}
}
}
Expand Down Expand Up @@ -430,7 +427,6 @@ where
bootstrap_addresses,
kademlia_mode,
external_addresses,
disable_bootstrap_on_start,
} = config;
let local_peer_id = peer_id(&keypair);

Expand Down Expand Up @@ -577,7 +573,6 @@ where
metrics,
protocol_version,
bootstrap_addresses,
disable_bootstrap_on_start,
});

Ok((node, node_runner))
Expand Down
11 changes: 1 addition & 10 deletions crates/subspace-networking/src/node_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ where
/// Optional storage for the [`HandlerId`] of the address removal task.
/// We keep to stop the task along with the rest of the networking.
_address_removal_task_handler_id: Option<HandlerId>,
/// Defines whether we should run blocking Kademlia bootstrap() operation before other requests.
disable_bootstrap_on_start: bool,
}

impl<LocalRecordProvider> fmt::Debug for NodeRunner<LocalRecordProvider>
Expand Down Expand Up @@ -160,7 +158,6 @@ where
pub(crate) metrics: Option<SubspaceMetrics>,
pub(crate) protocol_version: String,
pub(crate) bootstrap_addresses: Vec<Multiaddr>,
pub(crate) disable_bootstrap_on_start: bool,
}

impl<LocalRecordProvider> NodeRunner<LocalRecordProvider>
Expand All @@ -182,7 +179,6 @@ where
metrics,
protocol_version,
bootstrap_addresses,
disable_bootstrap_on_start,
}: NodeRunnerConfig<LocalRecordProvider>,
) -> Self {
// Setup the address removal events exchange between persistent params storage and Kademlia.
Expand Down Expand Up @@ -223,7 +219,6 @@ where
bootstrap_command_state: Arc::new(AsyncMutex::new(BootstrapCommandState::default())),
removed_addresses_rx,
_address_removal_task_handler_id: address_removal_task_handler_id,
disable_bootstrap_on_start,
}
}

Expand All @@ -246,11 +241,7 @@ where
}
}

if !self.disable_bootstrap_on_start {
self.bootstrap().await;
} else {
debug!("Kademlia bootstrapping was skipped.");
}
self.bootstrap().await;

loop {
futures::select! {
Expand Down
8 changes: 1 addition & 7 deletions crates/subspace-node/src/commands/run/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ struct DsnOptions {
#[arg(long, default_value_t = 150)]
dsn_pending_out_connections: u32,

/// Defines whether we should run blocking Kademlia bootstrap() operation before other requests.
#[arg(long, default_value_t = false)]
dsn_disable_bootstrap_on_start: bool,

/// Known external addresses
#[arg(long, alias = "dsn-external-address")]
dsn_external_addresses: Vec<Multiaddr>,
Expand Down Expand Up @@ -440,7 +436,7 @@ pub(super) fn create_consensus_chain_configuration(
mut force_synced,
mut force_authoring,
pot_external_entropy,
mut dsn_options,
dsn_options,
sync_from_dsn,
storage_monitor,
mut timekeeper_options,
Expand All @@ -459,7 +455,6 @@ pub(super) fn create_consensus_chain_configuration(
force_synced = true;
force_authoring = true;
network_options.allow_private_ips = true;
dsn_options.dsn_disable_bootstrap_on_start = true;
timekeeper_options.timekeeper = true;
}

Expand Down Expand Up @@ -643,7 +638,6 @@ pub(super) fn create_consensus_chain_configuration(
max_pending_in_connections: dsn_options.dsn_pending_in_connections,
max_pending_out_connections: dsn_options.dsn_pending_out_connections,
external_addresses: dsn_options.dsn_external_addresses,
disable_bootstrap_on_start: dsn_options.dsn_disable_bootstrap_on_start,
}
};

Expand Down
4 changes: 0 additions & 4 deletions crates/subspace-service/src/dsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ pub struct DsnConfig {

/// Known external addresses
pub external_addresses: Vec<Multiaddr>,

/// Defines whether we should run blocking Kademlia bootstrap() operation before other requests.
pub disable_bootstrap_on_start: bool,
}

pub(crate) fn create_dsn_instance(
Expand Down Expand Up @@ -118,7 +115,6 @@ pub(crate) fn create_dsn_instance(
bootstrap_addresses: dsn_config.bootstrap_nodes,
external_addresses: dsn_config.external_addresses,
kademlia_mode: KademliaMode::Static(Mode::Client),
disable_bootstrap_on_start: dsn_config.disable_bootstrap_on_start,

..default_networking_config
};
Expand Down

0 comments on commit 2fffb7f

Please sign in to comment.