Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(network): update seednodes for netid 8762 #2024

Merged
merged 8 commits into from
Dec 11, 2023
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
2 changes: 1 addition & 1 deletion mm2src/coins/lp_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::collections::HashMap;
use std::str::Utf8Error;

const PRICE_ENDPOINTS: [&str; 2] = [
"https://prices.komodo.earth/api/v2/tickers",
"https://prices.komodian.info/api/v2/tickers",
"https://prices.cipig.net:1717/api/v2/tickers",
];

Expand Down
2 changes: 1 addition & 1 deletion mm2src/coins/nft/nft_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use mm2_number::BigDecimal;
use std::num::NonZeroUsize;
use std::str::FromStr;

const MORALIS_API_ENDPOINT_TEST: &str = "https://moralis-proxy.komodo.earth/api/v2";
const MORALIS_API_ENDPOINT_TEST: &str = "https://moralis-proxy.komodian.info/api/v2";
const TEST_WALLET_ADDR_EVM: &str = "0x394d86994f954ed931b86791b62fe64f4c5dac37";
const BLOCKLIST_API_ENDPOINT: &str = "https://nft.antispam.dragonhound.info";
const TOKEN_ADD: &str = "0xfd913a305d70a60aac4faac70c739563738e1f81";
Expand Down
53 changes: 45 additions & 8 deletions mm2src/mm2_main/src/lp_native_dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use mm2_err_handle::common_errors::InternalError;
use mm2_err_handle::prelude::*;
use mm2_event_stream::behaviour::{EventBehaviour, EventInitStatus};
use mm2_libp2p::behaviours::atomicdex::DEPRECATED_NETID_LIST;
use mm2_libp2p::{spawn_gossipsub, AdexBehaviourError, NodeType, RelayAddress, RelayAddressError, SwarmRuntime,
WssCerts};
use mm2_libp2p::{spawn_gossipsub, AdexBehaviourError, NodeType, RelayAddress, RelayAddressError, SeedNodeInfo,
SwarmRuntime, WssCerts};
use mm2_metrics::mm_gauge;
use mm2_net::network_event::NetworkEvent;
use mm2_net::p2p::P2PContext;
Expand Down Expand Up @@ -69,10 +69,47 @@ cfg_wasm32! {
pub mod init_metamask;
}

const DEFAULT_NETID_SEEDNODES: [&str; 3] = [
"streamseed1.komodo.earth",
"streamseed2.komodo.earth",
"streamseed3.komodo.earth",
const DEFAULT_NETID_SEEDNODES: &[SeedNodeInfo] = &[
SeedNodeInfo::new(
"12D3KooWHKkHiNhZtKceQehHhPqwU5W1jXpoVBgS1qst899GjvTm",
"168.119.236.251",
"viserion.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWAToxtunEBWCoAHjefSv74Nsmxranw8juy3eKEdrQyGRF",
"168.119.236.240",
"rhaegal.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWSmEi8ypaVzFA1AGde2RjxNW5Pvxw3qa2fVe48PjNs63R",
"168.119.236.239",
"drogon.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWMrjLmrv8hNgAoVf1RfumfjyPStzd4nv5XL47zN4ZKisb",
"168.119.237.8",
"falkor.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWEWzbYcosK2JK9XpFXzumfgsWJW1F7BZS15yLTrhfjX2Z",
"65.21.51.47",
"smaug.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWJWBnkVsVNjiqUEPjLyHpiSmQVAJ5t6qt1Txv5ctJi9Xd",
"135.181.34.220",
"balerion.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d",
"168.119.237.13",
"kalessin.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWEaZpH61H4yuQkaNG5AsyGdpBhKRppaLdAY52a774ab5u",
"46.4.78.11",
"fr1.cipig.net",
),
];

pub type P2PResult<T> = Result<T, MmError<P2PInitError>>;
Expand Down Expand Up @@ -270,7 +307,7 @@ fn default_seednodes(netid: u16) -> Vec<RelayAddress> {
if netid == 8762 {
DEFAULT_NETID_SEEDNODES
.iter()
.map(|seed| RelayAddress::Dns(seed.to_string()))
.map(|SeedNodeInfo { domain, .. }| RelayAddress::Dns(domain.to_string()))
.collect()
} else {
Vec::new()
Expand All @@ -283,7 +320,7 @@ fn default_seednodes(netid: u16) -> Vec<RelayAddress> {
if netid == 8762 {
DEFAULT_NETID_SEEDNODES
.iter()
.filter_map(|seed| addr_to_ipv4_string(seed).ok())
.filter_map(|SeedNodeInfo { domain, .. }| addr_to_ipv4_string(domain).ok())
.map(RelayAddress::IPv4)
.collect()
} else {
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_ordermatch/simple_market_maker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::collections::{HashMap, HashSet};
use uuid::Uuid;

// !< constants
pub const KMD_PRICE_ENDPOINT: &str = "https://prices.komodo.earth/api/v2/tickers";
pub const KMD_PRICE_ENDPOINT: &str = "https://prices.komodian.info/api/v2/tickers";
pub const BOT_DEFAULT_REFRESH_RATE: f64 = 30.0;
pub const PRECISION_FOR_NOTIFICATION: u64 = 8;
const LATEST_SWAPS_LIMIT: usize = 1000;
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_p2p/src/behaviours/atomicdex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ fn start_gossipsub(
if !network_info.in_memory() {
// Please note WASM nodes don't support `PeersExchange` currently,
// so `get_all_network_seednodes` returns an empty list.
for (peer_id, addr) in get_all_network_seednodes(netid) {
for (peer_id, addr, _domain) in get_all_network_seednodes(netid) {
let multiaddr = addr.try_to_multiaddr(network_info)?;
peers_exchange.add_peer_addresses_to_known_peers(&peer_id, iter::once(multiaddr).collect());
if peer_id != local_peer_id {
Expand Down
8 changes: 4 additions & 4 deletions mm2src/mm2_p2p/src/behaviours/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,18 +420,18 @@ mod tests {
assert!(!behaviour.validate_get_known_peers_response(&response));

let address: Multiaddr =
"/ip4/168.119.236.241/tcp/3000/p2p/12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P"
"/ip4/168.119.236.251/tcp/3000/p2p/12D3KooWHKkHiNhZtKceQehHhPqwU5W1jXpoVBgS1qst899GjvTm"
.parse()
.unwrap();
let response = HashMap::from_iter(vec![(PeerIdSerde(PeerId::random()), HashSet::from_iter(vec![address]))]);
assert!(behaviour.validate_get_known_peers_response(&response));

let address1: Multiaddr =
"/ip4/168.119.236.241/tcp/3000/p2p/12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P"
"/ip4/168.119.236.251/tcp/3000/p2p/12D3KooWHKkHiNhZtKceQehHhPqwU5W1jXpoVBgS1qst899GjvTm"
.parse()
.unwrap();

let address2: Multiaddr = "/ip4/168.119.236.241/tcp/3000".parse().unwrap();
let address2: Multiaddr = "/ip4/168.119.236.251/tcp/3000".parse().unwrap();
let response = HashMap::from_iter(vec![(
PeerIdSerde(PeerId::random()),
HashSet::from_iter(vec![address1, address2]),
Expand All @@ -448,7 +448,7 @@ mod tests {
let result = behaviour.get_random_known_peers(1);
assert!(result.is_empty());

let address: Multiaddr = "/ip4/168.119.236.241/tcp/3000".parse().unwrap();
let address: Multiaddr = "/ip4/168.119.236.251/tcp/3000".parse().unwrap();
behaviour.request_response.add_address(&peer_id, address.clone());

let result = behaviour.get_random_known_peers(1);
Expand Down
1 change: 1 addition & 0 deletions mm2src/mm2_p2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub use libp2p::identity::{secp256k1::PublicKey as Libp2pSecpPublic, PublicKey a
pub use libp2p::{Multiaddr, PeerId};

// relay-address related re-exports
pub use network::SeedNodeInfo;
pub use relay_address::RelayAddress;
pub use relay_address::RelayAddressError;

Expand Down
95 changes: 62 additions & 33 deletions mm2src/mm2_p2p/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,94 @@ use libp2p::PeerId;

pub const DEFAULT_NETID: u16 = 8762;

pub struct SeedNodeInfo {
pub id: &'static str,
pub ip: &'static str,
pub domain: &'static str,
}

impl SeedNodeInfo {
pub const fn new(id: &'static str, ip: &'static str, domain: &'static str) -> Self { Self { id, ip, domain } }
}

#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
const ALL_DEFAULT_NETID_SEEDNODES: &[(&str, &str)] = &[
(
const ALL_DEFAULT_NETID_SEEDNODES: &[SeedNodeInfo] = &[
SeedNodeInfo::new(
"12D3KooWHKkHiNhZtKceQehHhPqwU5W1jXpoVBgS1qst899GjvTm",
"168.119.236.251",
"viserion.dragon-seed.com",
),
(
SeedNodeInfo::new(
"12D3KooWAToxtunEBWCoAHjefSv74Nsmxranw8juy3eKEdrQyGRF",
"168.119.236.240",
"rhaegal.dragon-seed.com",
),
(
SeedNodeInfo::new(
"12D3KooWSmEi8ypaVzFA1AGde2RjxNW5Pvxw3qa2fVe48PjNs63R",
"168.119.236.239",
"drogon.dragon-seed.com",
),
("12D3KooWJWBnkVsVNjiqUEPjLyHpiSmQVAJ5t6qt1Txv5ctJi9Xd", "135.181.34.220"),
(
"12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P",
"168.119.236.241",
SeedNodeInfo::new(
"12D3KooWMrjLmrv8hNgAoVf1RfumfjyPStzd4nv5XL47zN4ZKisb",
"168.119.237.8",
"falkor.dragon-seed.com",
),
(
"12D3KooWHBeCnJdzNk51G4mLnao9cDsjuqiMTEo5wMFXrd25bd1F",
"168.119.236.243",
SeedNodeInfo::new(
"12D3KooWEWzbYcosK2JK9XpFXzumfgsWJW1F7BZS15yLTrhfjX2Z",
"65.21.51.47",
"smaug.dragon-seed.com",
),
// TODO: Uncomment this once re-enabled on the main network.
// (
// "12D3KooWKxavLCJVrQ5Gk1kd9m6cohctGQBmiKPS9XQFoXEoyGmS",
// "168.119.236.249",
// ),
(
"12D3KooW9soGyPfX6kcyh3uVXNHq1y2dPmQNt2veKgdLXkBiCVKq",
"168.119.236.246",
SeedNodeInfo::new(
"12D3KooWJWBnkVsVNjiqUEPjLyHpiSmQVAJ5t6qt1Txv5ctJi9Xd",
"135.181.34.220",
"balerion.dragon-seed.com",
),
(
"12D3KooWL6yrrNACb7t7RPyTEPxKmq8jtrcbkcNd6H5G2hK7bXaL",
"168.119.236.233",
SeedNodeInfo::new(
"12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d",
"168.119.237.13",
"kalessin.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y",
"65.108.90.210",
"icefyre.dragon-seed.com",
),
SeedNodeInfo::new(
"12D3KooWEaZpH61H4yuQkaNG5AsyGdpBhKRppaLdAY52a774ab5u",
"46.4.78.11",
"fr1.cipig.net",
),
("12D3KooWMrjLmrv8hNgAoVf1RfumfjyPStzd4nv5XL47zN4ZKisb", "168.119.237.8"),
("12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d", "168.119.237.13"),
("12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y", "65.108.90.210"),
("12D3KooWEaZpH61H4yuQkaNG5AsyGdpBhKRppaLdAY52a774ab5u", "46.4.78.11"),
("12D3KooWAd5gPXwX7eDvKWwkr2FZGfoJceKDCA53SHmTFFVkrN7Q", "46.4.87.18"),
];

// TODO: Uncomment these once re-enabled on the main network.
// Operated by Dragonhound, still on NetID 7777. Domains will update after netid migration.
// SeedNodeInfo::new("12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P", "168.119.236.241", "seed1.komodo.earth"), // tintaglia.dragon-seed.com
// SeedNodeInfo::new("12D3KooWHBeCnJdzNk51G4mLnao9cDsjuqiMTEo5wMFXrd25bd1F", "168.119.236.243", "seed2.komodo.earth"), // mercor.dragon-seed.com
// SeedNodeInfo::new("12D3KooWKxavLCJVrQ5Gk1kd9m6cohctGQBmiKPS9XQFoXEoyGmS", "168.119.236.249", "seed3.komodo.earth"), // karrigvestrit.dragon-seed.com
// SeedNodeInfo::new("12D3KooWGrUpCAbkxhPRioNs64sbUmPmpEcou6hYfrqQvxfWDEuf", "135.181.35.77", "seed4.komodo.earth"), // sintara.dragon-seed.com
// SeedNodeInfo::new("12D3KooWKu8pMTgteWacwFjN7zRWWHb3bctyTvHU3xx5x4x6qDYY", "65.21.56.210", "seed6.komodo.earth"), // heeby.dragon-seed.com
// SeedNodeInfo::new("12D3KooW9soGyPfX6kcyh3uVXNHq1y2dPmQNt2veKgdLXkBiCVKq", "168.119.236.246", "seed7.komodo.earth"), // kalo.dragon-seed.com
// SeedNodeInfo::new("12D3KooWL6yrrNACb7t7RPyTEPxKmq8jtrcbkcNd6H5G2hK7bXaL", "168.119.236.233", "seed8.komodo.earth"), // relpda.dragon-seed.com
// Operated by Cipi, still on NetID 7777
// SeedNodeInfo::new("12D3KooWAd5gPXwX7eDvKWwkr2FZGfoJceKDCA53SHmTFFVkrN7Q", "46.4.87.18", "fr2.cipig.net"),

#[cfg(target_arch = "wasm32")]
pub fn get_all_network_seednodes(_netid: u16) -> Vec<(PeerId, RelayAddress)> { Vec::new() }
pub fn get_all_network_seednodes(_netid: u16) -> Vec<(PeerId, RelayAddress, String)> { Vec::new() }

#[cfg(not(target_arch = "wasm32"))]
pub fn get_all_network_seednodes(netid: u16) -> Vec<(PeerId, RelayAddress)> {
pub fn get_all_network_seednodes(netid: u16) -> Vec<(PeerId, RelayAddress, String)> {
use std::str::FromStr;

if netid != DEFAULT_NETID {
return Vec::new();
}
ALL_DEFAULT_NETID_SEEDNODES
.iter()
.map(|(peer_id, ipv4)| {
let peer_id = PeerId::from_str(peer_id).expect("valid peer id");
let address = RelayAddress::IPv4(ipv4.to_string());
(peer_id, address)
.map(|SeedNodeInfo { id, ip, domain }| {
let peer_id = PeerId::from_str(id).expect("valid peer id");
let address = RelayAddress::IPv4(ip.to_string());
let domain = domain.to_string();
(peer_id, address, domain)
})
.collect()
}
Loading