Skip to content
Draft
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
2 changes: 2 additions & 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 debian/usr/lib/systemd/system/monad-bft.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ExecStart=/usr/local/bin/monad-node \
--statesync-sq-thread-cpu 8 \
--record-metrics-interval-seconds 1 \
--validators-path /home/monad/monad-bft/config/validators/validators.toml \
--persisted-peers-path /home/monad/monad-bft/config/peers.toml \
--keystore-password "${KEYSTORE_PASSWORD}"
EnvironmentFile=-/home/monad/.env
Environment="RUST_LOG=debug,h2=warn,tower=warn,opentelemetry_sdk=warn,opentelemetry-otlp=warn"
Expand Down
1 change: 1 addition & 0 deletions docker/single-node/nets/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ services:
--node-config /monad/config/node.toml
--forkpoint-config /monad/config/forkpoint.genesis.toml
--validators-path /monad/config/validators.toml
--persisted-peers-path /monad/config/peers.toml
--statesync-ipc-path /monad/statesync.sock
--wal-path /monad/wal
--mempool-ipc-path /monad/mempool.sock
Expand Down
4 changes: 4 additions & 0 deletions monad-node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ pub struct Cli {

#[arg(long)]
pub manytrace_socket: Option<String>,

/// Set the path for the file that will persist peer discovery records across restarts
#[arg(long)]
pub persisted_peers_path: PathBuf,
}
4 changes: 4 additions & 0 deletions monad-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::{
collections::{BTreeMap, BTreeSet, HashMap},
marker::PhantomData,
net::{IpAddr, SocketAddr, ToSocketAddrs},
path::PathBuf,
process,
sync::Arc,
time::{Duration, Instant},
Expand Down Expand Up @@ -171,6 +172,7 @@ async fn run(node_state: NodeState) -> Result<(), ()> {
locked_epoch_validators.clone(),
current_epoch,
current_round,
node_state.persisted_peers_path,
);

let statesync_threshold: usize = node_state.node_config.statesync_threshold.into();
Expand Down Expand Up @@ -507,6 +509,7 @@ fn build_raptorcast_router<ST, SCT, M, OM>(
locked_epoch_validators: Vec<ValidatorSetDataWithEpoch<SCT>>,
current_epoch: Epoch,
current_round: Round,
persisted_peers_path: PathBuf,
) -> MultiRouter<ST, M, OM, MonadEvent<ST, SCT, ExecutionProtocolType>, PeerDiscovery<ST>>
where
ST: CertificateSignatureRecoverable,
Expand Down Expand Up @@ -657,6 +660,7 @@ where
enable_publisher: node_config.fullnode_raptorcast.enable_publisher,
enable_client: node_config.fullnode_raptorcast.enable_client,
rng: ChaCha8Rng::from_entropy(),
persisted_peers_path,
};

MultiRouter::new(
Expand Down
3 changes: 3 additions & 0 deletions monad-node/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub struct NodeState {
pub statesync_ipc_path: PathBuf,
pub statesync_sq_thread_cpu: Option<u32>,
pub triedb_path: PathBuf,
pub persisted_peers_path: PathBuf,

pub otel_endpoint_interval: Option<(String, Duration)>,
pub pprof: String,
Expand Down Expand Up @@ -95,6 +96,7 @@ impl NodeState {
record_metrics_interval_seconds,
pprof,
manytrace_socket,
persisted_peers_path,
} = Cli::from_arg_matches_mut(&mut cmd.get_matches_mut())?;

let (reload_handle, agent) = NodeState::setup_tracing(manytrace_socket)?;
Expand Down Expand Up @@ -200,6 +202,7 @@ impl NodeState {
pprof,
reload_handle,
manytrace_agent: agent,
persisted_peers_path,
})
}

Expand Down
2 changes: 2 additions & 0 deletions monad-peer-disc-swarm/tests/peer_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ fn setup_keys_and_swarm_builder(
enable_publisher: secondary_raptorcast_enabled,
enable_client: secondary_raptorcast_enabled,
rng: ChaCha8Rng::seed_from_u64(123456), // fixed seed for reproducibility
persisted_peers_path: Default::default(),
},
router_scheduler: NoSerRouterConfig::new(all_peers.keys().cloned().collect())
.build(),
Expand Down Expand Up @@ -396,6 +397,7 @@ fn test_update_name_record() {
enable_publisher: false,
enable_client: false,
rng: ChaCha8Rng::seed_from_u64(123456),
persisted_peers_path: Default::default(),
},
router_scheduler: NoSerRouterConfig::new(node_ids.iter().cloned().collect()).build(),
seed: 1,
Expand Down
4 changes: 3 additions & 1 deletion monad-peer-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ arrayvec = { workspace = true }
futures = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
serde = { workspace = true }
tracing = { workspace = true }
tokio-util = { workspace = true, features = ["time"] }
toml = { workspace = true }

[dev-dependencies]
monad-keystore = { workspace = true }
Expand All @@ -28,4 +30,4 @@ hex = { workspace = true }
insta = { workspace = true }
rstest = { workspace = true }
test-case = { workspace = true }
toml = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Loading
Loading