From 8ad8ccf8042260305a37eed94757f92ba8acf880 Mon Sep 17 00:00:00 2001 From: Hubert Date: Fri, 5 May 2023 06:54:50 +0200 Subject: [PATCH] move bootstrap peers to seperate files (#2828) --- Cargo.lock | 8 ++++++++ build/bootstrap/calibnet | 4 ++++ build/bootstrap/mainnet | 16 ++++++++++++++++ networks/Cargo.toml | 4 ++++ networks/src/calibnet/mod.rs | 23 ++++++++++++++++------- networks/src/mainnet/mod.rs | 35 ++++++++++++++++------------------- 6 files changed, 64 insertions(+), 26 deletions(-) create mode 100644 build/bootstrap/calibnet create mode 100644 build/bootstrap/mainnet diff --git a/Cargo.lock b/Cargo.lock index 8afdbaf3d492..9fc7bfba72e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1539,6 +1539,12 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +[[package]] +name = "const-str" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b62c6d3ea43cbe0bc5a081f276fd477e4291d168aacc9f9d98073325333c0d4" + [[package]] name = "const_format" version = "0.2.30" @@ -4356,11 +4362,13 @@ version = "0.8.1" dependencies = [ "anyhow", "cid", + "const-str", "fil_actors_runtime_v10", "forest_beacon", "forest_shim", "fvm_shared 2.3.0", "lazy_static", + "multiaddr", "serde", "strum_macros", "url", diff --git a/build/bootstrap/calibnet b/build/bootstrap/calibnet new file mode 100644 index 000000000000..4ac1d1e3a15b --- /dev/null +++ b/build/bootstrap/calibnet @@ -0,0 +1,4 @@ +/dns4/bootstrap-0.calibration.fildev.network/tcp/1347/p2p/12D3KooWCi2w8U4DDB9xqrejb5KYHaQv2iA2AJJ6uzG3iQxNLBMy +/dns4/bootstrap-1.calibration.fildev.network/tcp/1347/p2p/12D3KooWDTayrBojBn9jWNNUih4nNQQBGJD7Zo3gQCKgBkUsS6dp +/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWNRxTHUn8bf7jz1KEUPMc2dMgGfa4f8ZJTsquVSn3vHCG +/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWFWUqE9jgXvcKHWieYs9nhyp6NF4ftwLGAHm4sCv73jjK diff --git a/build/bootstrap/mainnet b/build/bootstrap/mainnet new file mode 100644 index 000000000000..47bb2547ba5d --- /dev/null +++ b/build/bootstrap/mainnet @@ -0,0 +1,16 @@ +/dns4/bootstrap-0.mainnet.filops.net/tcp/1347/p2p/12D3KooWCVe8MmsEMes2FzgTpt9fXtmCY7wrq91GRiaC8PHSCCBj +/dns4/bootstrap-1.mainnet.filops.net/tcp/1347/p2p/12D3KooWCwevHg1yLCvktf2nvLu7L9894mcrJR4MsBCcm4syShVc +/dns4/bootstrap-2.mainnet.filops.net/tcp/1347/p2p/12D3KooWEWVwHGn2yR36gKLozmb4YjDJGerotAPGxmdWZx2nxMC4 +/dns4/bootstrap-3.mainnet.filops.net/tcp/1347/p2p/12D3KooWKhgq8c7NQ9iGjbyK7v7phXvG6492HQfiDaGHLHLQjk7R +/dns4/bootstrap-4.mainnet.filops.net/tcp/1347/p2p/12D3KooWL6PsFNPhYftrJzGgF5U18hFoaVhfGk7xwzD8yVrHJ3Uc +/dns4/bootstrap-5.mainnet.filops.net/tcp/1347/p2p/12D3KooWLFynvDQiUpXoHroV1YxKHhPJgysQGH2k3ZGwtWzR4dFH +/dns4/bootstrap-6.mainnet.filops.net/tcp/1347/p2p/12D3KooWP5MwCiqdMETF9ub1P3MbCvQCcfconnYHbWg6sUJcDRQQ +/dns4/bootstrap-7.mainnet.filops.net/tcp/1347/p2p/12D3KooWRs3aY1p3juFjPy8gPN95PEQChm2QKGUCAdcDCC4EBMKf +/dns4/bootstrap-8.mainnet.filops.net/tcp/1347/p2p/12D3KooWScFR7385LTyR4zU1bYdzSiiAb5rnNABfVahPvVSzyTkR +/dns4/lotus-bootstrap.ipfsforce.com/tcp/41778/p2p/12D3KooWGhufNmZHF3sv48aQeS13ng5XVJZ9E6qy2Ms4VzqeUsHk +/dns4/bootstrap-0.starpool.in/tcp/12757/p2p/12D3KooWGHpBMeZbestVEWkfdnC9u7p6uFHXL1n7m1ZBqsEmiUzz +/dns4/bootstrap-1.starpool.in/tcp/12757/p2p/12D3KooWQZrGH1PxSNZPum99M1zNvjNFM33d1AAu5DcvdHptuU7u +/dns4/node.glif.io/tcp/1235/p2p/12D3KooWBF8cpp65hp2u9LK5mh19x67ftAam84z9LsfaquTDSBpt +/dns4/bootstrap-0.ipfsmain.cn/tcp/34721/p2p/12D3KooWQnwEGNqcM2nAcPtRR9rAX8Hrg4k9kJLCHoTR5chJfz6d +/dns4/bootstrap-1.ipfsmain.cn/tcp/34723/p2p/12D3KooWMKxMkD5DMpSWsW7dBddKxKT7L2GgbNuckz9otxvkvByP +/dns4/bootstarp-0.1475.io/tcp/61256/p2p/12D3KooWRzCVDwHUkgdK7eRgnoXbjDAELhxPErjHzbRLguSV1aRt diff --git a/networks/Cargo.toml b/networks/Cargo.toml index a846fccf5c91..ba08e0e53fab 100644 --- a/networks/Cargo.toml +++ b/networks/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" [dependencies] anyhow.workspace = true cid.workspace = true +const-str = "0.5.4" fil_actors_runtime_v10.workspace = true forest_beacon.workspace = true forest_shim.workspace = true @@ -17,3 +18,6 @@ lazy_static.workspace = true serde = { workspace = true, features = ["derive"] } strum_macros = "0.24" url.workspace = true + +[dev-dependencies] +multiaddr = "0.17.1" diff --git a/networks/src/calibnet/mod.rs b/networks/src/calibnet/mod.rs index ddd48c2228d1..e6c502cb3732 100644 --- a/networks/src/calibnet/mod.rs +++ b/networks/src/calibnet/mod.rs @@ -13,13 +13,9 @@ pub const DEFAULT_GENESIS: &[u8] = include_bytes!("genesis.car"); /// Genesis CID pub const GENESIS_CID: &str = "bafy2bzacecyaggy24wol5ruvs6qm73gjibs2l2iyhcqmvi7r7a4ph7zx3yqd4"; -/// Bootstrap peer ids. -pub const DEFAULT_BOOTSTRAP: &[&str] = &[ - "/dns4/bootstrap-0.calibration.fildev.network/tcp/1347/p2p/12D3KooWCi2w8U4DDB9xqrejb5KYHaQv2iA2AJJ6uzG3iQxNLBMy", - "/dns4/bootstrap-1.calibration.fildev.network/tcp/1347/p2p/12D3KooWDTayrBojBn9jWNNUih4nNQQBGJD7Zo3gQCKgBkUsS6dp", - "/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWNRxTHUn8bf7jz1KEUPMc2dMgGfa4f8ZJTsquVSn3vHCG", - "/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWFWUqE9jgXvcKHWieYs9nhyp6NF4ftwLGAHm4sCv73jjK", -]; +/// Default bootstrap peer ids. +pub const DEFAULT_BOOTSTRAP: &[&str] = + &const_str::split!(include_str!("../../../build/bootstrap/calibnet"), "\n"); const LIGHTNING_EPOCH: i64 = 489_094; @@ -149,3 +145,16 @@ pub(super) static DRAND_SCHEDULE: [DrandPoint<'static>; 1] = [DrandPoint { height: 0, config: &DRAND_MAINNET, }]; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn default_boostrap_list_not_empty() { + assert!(!DEFAULT_BOOTSTRAP.is_empty()); + DEFAULT_BOOTSTRAP.iter().for_each(|addr| { + assert!(addr.parse::().is_ok()); + }); + } +} diff --git a/networks/src/mainnet/mod.rs b/networks/src/mainnet/mod.rs index a24a621f7355..f70755949a95 100644 --- a/networks/src/mainnet/mod.rs +++ b/networks/src/mainnet/mod.rs @@ -19,25 +19,9 @@ pub const DEFAULT_GENESIS: &[u8] = include_bytes!("genesis.car"); /// Genesis CID pub const GENESIS_CID: &str = "bafy2bzacecnamqgqmifpluoeldx7zzglxcljo6oja4vrmtj7432rphldpdmm2"; -/// Bootstrap peer ids. -pub const DEFAULT_BOOTSTRAP: &[&str] = &[ - "/dns4/bootstrap-0.mainnet.filops.net/tcp/1347/p2p/12D3KooWCVe8MmsEMes2FzgTpt9fXtmCY7wrq91GRiaC8PHSCCBj", - "/dns4/bootstrap-1.mainnet.filops.net/tcp/1347/p2p/12D3KooWCwevHg1yLCvktf2nvLu7L9894mcrJR4MsBCcm4syShVc", - "/dns4/bootstrap-2.mainnet.filops.net/tcp/1347/p2p/12D3KooWEWVwHGn2yR36gKLozmb4YjDJGerotAPGxmdWZx2nxMC4", - "/dns4/bootstrap-3.mainnet.filops.net/tcp/1347/p2p/12D3KooWKhgq8c7NQ9iGjbyK7v7phXvG6492HQfiDaGHLHLQjk7R", - "/dns4/bootstrap-4.mainnet.filops.net/tcp/1347/p2p/12D3KooWL6PsFNPhYftrJzGgF5U18hFoaVhfGk7xwzD8yVrHJ3Uc", - "/dns4/bootstrap-5.mainnet.filops.net/tcp/1347/p2p/12D3KooWLFynvDQiUpXoHroV1YxKHhPJgysQGH2k3ZGwtWzR4dFH", - "/dns4/bootstrap-6.mainnet.filops.net/tcp/1347/p2p/12D3KooWP5MwCiqdMETF9ub1P3MbCvQCcfconnYHbWg6sUJcDRQQ", - "/dns4/bootstrap-7.mainnet.filops.net/tcp/1347/p2p/12D3KooWRs3aY1p3juFjPy8gPN95PEQChm2QKGUCAdcDCC4EBMKf", - "/dns4/bootstrap-8.mainnet.filops.net/tcp/1347/p2p/12D3KooWScFR7385LTyR4zU1bYdzSiiAb5rnNABfVahPvVSzyTkR", - "/dns4/lotus-bootstrap.ipfsforce.com/tcp/41778/p2p/12D3KooWGhufNmZHF3sv48aQeS13ng5XVJZ9E6qy2Ms4VzqeUsHk", - "/dns4/bootstrap-0.starpool.in/tcp/12757/p2p/12D3KooWGHpBMeZbestVEWkfdnC9u7p6uFHXL1n7m1ZBqsEmiUzz", - "/dns4/bootstrap-1.starpool.in/tcp/12757/p2p/12D3KooWQZrGH1PxSNZPum99M1zNvjNFM33d1AAu5DcvdHptuU7u", - "/dns4/node.glif.io/tcp/1235/p2p/12D3KooWBF8cpp65hp2u9LK5mh19x67ftAam84z9LsfaquTDSBpt", - "/dns4/bootstrap-0.ipfsmain.cn/tcp/34721/p2p/12D3KooWQnwEGNqcM2nAcPtRR9rAX8Hrg4k9kJLCHoTR5chJfz6d", - "/dns4/bootstrap-1.ipfsmain.cn/tcp/34723/p2p/12D3KooWMKxMkD5DMpSWsW7dBddKxKT7L2GgbNuckz9otxvkvByP", - "/dns4/bootstarp-0.1475.io/tcp/61256/p2p/12D3KooWRzCVDwHUkgdK7eRgnoXbjDAELhxPErjHzbRLguSV1aRt" -]; +/// Default bootstrap peer ids. +pub const DEFAULT_BOOTSTRAP: &[&str] = + &const_str::split!(include_str!("../../../build/bootstrap/mainnet"), "\n"); // The rollover period is the duration between nv19 and nv20 which both old // proofs (v1) and the new proofs (v1_1) proofs will be accepted by the @@ -171,3 +155,16 @@ pub(super) static DRAND_SCHEDULE: [DrandPoint<'static>; 2] = [ config: &DRAND_MAINNET, }, ]; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn default_boostrap_list_not_empty() { + assert!(!DEFAULT_BOOTSTRAP.is_empty()); + DEFAULT_BOOTSTRAP.iter().for_each(|addr| { + assert!(addr.parse::().is_ok()); + }); + } +}