Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ serde = { version = "1.0.126" }
serde_json = { version = "1.0.132", default-features = false }
static_assertions = { version = "1.1" }
try-runtime-cli = { version = "0.42" }
tracing = { version = "0.1.41", default-features = false }

[workspace]
resolver = "2"
Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ name = "polkadot-bulletin-chain"
[dependencies]
clap = { features = ["derive"], workspace = true }
futures = { features = ["thread-pool"], workspace = true }
tracing = { workspace = true }

frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
Expand Down
25 changes: 23 additions & 2 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE
use polkadot_bulletin_chain_runtime::Block;
use sc_cli::SubstrateCli;
use sc_service::PartialComponents;
use std::sync::Arc;
use std::{sync::Arc, time::Duration};

#[cfg(feature = "try-runtime")]
use {
polkadot_bulletin_chain_runtime::SLOT_DURATION,
try_runtime_cli::block_building_info::timestamp_with_babe_info,
};

/// Log target for this file.
const LOG_TARGET: &str = "command";

impl SubstrateCli for Cli {
fn impl_name() -> String {
"Polkadot Bulletin Chain Node".into()
Expand Down Expand Up @@ -206,7 +209,25 @@ pub fn run() -> sc_cli::Result<()> {
},
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
runner.run_node_until_exit(|mut config| async move {
// Override default idle connection timeout of 10 seconds to give IPFS clients more
// time to query data over Bitswap. This is needed when manually adding our node
// to a swarm of an IPFS node, because the IPFS node doesn't keep any active
// substreams with us and our node closes a connection after
// `idle_connection_timeout`.
const IPFS_WORKAROUND_TIMEOUT: Duration = Duration::from_secs(3600);

if config.network.idle_connection_timeout < IPFS_WORKAROUND_TIMEOUT {
tracing::info!(
target: LOG_TARGET,
old = ?config.network.idle_connection_timeout,
overriden_with = ?IPFS_WORKAROUND_TIMEOUT,
"Overriding `config.network.idle_connection_timeout` to allow long-lived connections with IPFS nodes",

);
config.network.idle_connection_timeout = IPFS_WORKAROUND_TIMEOUT;
}

service::new_full::<sc_network::Litep2pNetworkBackend>(config)
.map_err(sc_cli::Error::Service)
})
Expand Down