Skip to content

Commit

Permalink
Merge branch 'development' into comms-peer-manager-signed-peers
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler authored Dec 2, 2021
2 parents 316a8d4 + 2e1500b commit 37210a0
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 152 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,29 @@ name: CI

env:
CARGO_HTTP_MULTIPLEXING: false
PROTOC: protoc
toolchain: nightly-2021-09-18

jobs:
clippy:
name: clippy
runs-on: ubuntu-18.04
steps:
- name: ubuntu dependencies
run: |
sudo apt-get update && \
sudo apt-get -y install \
libssl-dev \
openssl \
libsqlite3-dev \
pkg-config \
git \
cmake \
zip \
libc++-dev \
libc++abi-dev \
libprotobuf-dev \
protobuf-compiler
- name: checkout
uses: actions/checkout@v2
- name: toolchain
Expand All @@ -40,10 +56,10 @@ jobs:
command: fmt
args: --all -- --check
- name: Clippy check
uses: actions-rs/clippy-check@v1
uses: actions-rs/cargo@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
command: clippy
args: --all-targets -- -D warnings
test:
name: test
runs-on: ubuntu-18.04
Expand All @@ -59,7 +75,6 @@ jobs:
target
key: ${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
- name: ubuntu dependencies
if: startsWith(matrix.os,'ubuntu')
run: |
sudo apt-get update && \
sudo apt-get -y install \
Expand Down
11 changes: 4 additions & 7 deletions applications/tari_app_utilities/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub fn init_configuration(
log::info!(target: LOG_TARGET, "{} ({})", application_type, consts::APP_VERSION);

// Populate the configuration struct
let mut global_config = GlobalConfig::convert_from(application_type, cfg.clone())
.map_err(|err| ExitCodes::ConfigError(err.to_string()))?;
let mut global_config = GlobalConfig::convert_from(application_type, cfg.clone(), bootstrap.network.clone())?;

if let Some(str) = bootstrap.network.clone() {
log::info!(target: LOG_TARGET, "Network selection requested");
Expand All @@ -54,11 +53,9 @@ pub fn init_configuration(
global_config.wallet_peer_db_path = global_config.data_dir.join("wallet_peer_db");
global_config.console_wallet_peer_db_path = global_config.data_dir.join("console_wallet_peer_db");
},
Err(_) => {
log::warn!(
target: LOG_TARGET,
"Network selection was invalid, continuing with default network."
);
Err(e) => {
log::error!(target: LOG_TARGET, "Network selection was invalid, exiting.");
return Err(e.into());
},
}
}
Expand Down
60 changes: 35 additions & 25 deletions applications/tari_base_node/src/command_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use std::{
sync::Arc,
time::{Duration, Instant},
};
use tari_app_utilities::consts;
use tari_app_utilities::{consts, utilities::parse_emoji_id_or_public_key};
use tari_common::GlobalConfig;
use tari_common_types::{
emoji::EmojiId,
Expand Down Expand Up @@ -417,36 +417,46 @@ impl CommandHandler {
let peer_manager = self.peer_manager.clone();

self.executor.spawn(async move {
match peer_manager.find_all_starts_with(&partial).await {
let peer = match peer_manager.find_all_starts_with(&partial).await {
Ok(peers) if peers.is_empty() => {
println!("No peer matching '{}'", original_str);
},
Ok(peers) => {
let peer = peers.first().unwrap();
let eid = EmojiId::from_pubkey(&peer.public_key);
println!("Emoji ID: {}", eid);
println!("Public Key: {}", peer.public_key);
println!("NodeId: {}", peer.node_id);
println!("Addresses:");
peer.addresses.iter().for_each(|a| {
println!("- {}", a);
});
println!("User agent: {}", peer.user_agent);
println!("Features: {:?}", peer.features);
println!("Supported protocols:");
peer.supported_protocols.iter().for_each(|p| {
println!("- {}", String::from_utf8_lossy(p));
});
if let Some(dt) = peer.banned_until() {
println!("Banned until {}, reason: {}", dt, peer.banned_reason);
}
if let Some(dt) = peer.last_seen() {
println!("Last seen: {}", dt);
if let Some(pk) = parse_emoji_id_or_public_key(&original_str) {
if let Ok(peer) = peer_manager.find_by_public_key(&pk).await {
peer
} else {
println!("No peer matching '{}'", original_str);
return;
}
} else {
println!("No peer matching '{}'", original_str);
return;
}
},
Ok(mut peers) => peers.remove(0),
Err(err) => {
println!("{}", err);
return;
},
};

let eid = EmojiId::from_pubkey(&peer.public_key);
println!("Emoji ID: {}", eid);
println!("Public Key: {}", peer.public_key);
println!("NodeId: {}", peer.node_id);
println!("Addresses:");
peer.addresses.iter().for_each(|a| {
println!("- {}", a);
});
println!("User agent: {}", peer.user_agent);
println!("Features: {:?}", peer.features);
println!("Supported protocols:");
peer.supported_protocols.iter().for_each(|p| {
println!("- {}", String::from_utf8_lossy(p));
});
if let Some(dt) = peer.banned_until() {
println!("Banned until {}, reason: {}", dt, peer.banned_reason);
}
if let Some(dt) = peer.last_seen() {
println!("Last seen: {}", dt);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_stratum_transcoder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ fn initialize() -> Result<GlobalConfig, StratumTranscoderProxyError> {
#[cfg(not(feature = "envlog"))]
bootstrap.initialize_logging()?;

let cfg = GlobalConfig::convert_from(application_type, cfg)?;
let cfg = GlobalConfig::convert_from(application_type, cfg, bootstrap.network)?;
Ok(cfg)
}
87 changes: 50 additions & 37 deletions common/config/presets/common.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,6 @@
# weatherwax - the Tari testnet
network = "weatherwax"

# When first logging onto the Tari network, you need to find a few peers to bootstrap the process. In the absence of
# any servers, this is a little more challenging than usual. Our best strategy is just to try and connect to the peers
# you knew about last time you ran the software. But what about when you run the software for the first time? That's
# where this allowlist comes in. It's a list of known Tari nodes that are likely to be around for a long time and that
# new nodes can use to introduce themselves to the network.
# peer_seeds = ["public_key1::address1", "public_key2::address2",... ]
peer_seeds = [
# weatherwax
"98bc76afc1c35ad4651bdc9ef57bbe0655a2ea3cd86c0e19b5fd5890546eb040::/onion3/33izgtjkrlxhxybj6luqowkpiy2wvte43osejnbqyieqtdfhovzghxad:18141", #jozi
"9a26e910288213d649b26f9a7a7ee51fe2b2a67ff7d42334523463bf4be94312::/onion3/56kq54ylttnbl5ikotqex3oqvtzlxdpn7zlx4v56rvzf4kq7eezlclid:18141", #london
"6afd5b3c7772ad7d4bb26e0c19668fe04f2d68f99de9e132bee50a6c1846946d::/onion3/may4ajbmcn4dlnzf6fanvqlklxzqiw6qwu6ywqwkjc3bb354rc2i5wid:18141", #ncal
"8e7beec9becdc44fe6015a00d97a77fa3dbafe65127dcc988df6326bd9fd040d::/onion3/3pise36l4imoopsbjic5rtw67adx7rms6w5pgjmccpdwiqx66j7oqcqd:18141", #nvir
"80bb590d943a46e63ae79af5dc2c7d35a3dcd7922c182b28f619dc4cfc366f44::/onion3/oaxwahri7r3h5qjlcdbveyjmg4jsttausik66bicmhixft73nmvecdad:18141", #oregon
"981cc8cd1e4fe2f99ea1bd3e0ab1e7821ca0bfab336a4967cfec053fee86254c::/onion3/7hxpnxrxycdfevirddau7ybofwedaamjrg2ijm57k2kevh5q46ixamid:18141", #seoul
"f2ce179fb733725961a5f7e1e45dacdd443dd43ba6237438d6abe344fb717058::/onion3/nvgdmjf4wucgatz7vemzvi2u4sw5o4gyzwuikagpepoj4w7mkii47zid:18141", #stockholm
"909c0160f4d8e815aba5c2bbccfcceb448877e7b38759fb160f3e9494484d515::/onion3/qw5uxv533sqdn2qoncfyqo35dgecy4rt4x27rexi2her6q6pcpxbm4qd:18141", #sydney
# igor
"8e7eb81e512f3d6347bf9b1ca9cd67d2c8e29f2836fc5bd608206505cc72af34::/onion3/l4wouomx42nezhzexjdzfh7pcou5l7df24ggmwgekuih7tkv2rsaokqd:18141",
"00b35047a341401bcd336b2a3d564280a72f6dc72ec4c739d30c502acce4e803::/onion3/ojhxd7z6ga7qrvjlr3px66u7eiwasmffnuklscbh5o7g6wrbysj45vid:18141",
"40a9d8573745072534bce7d0ecafe882b1c79570375a69841c08a98dee9ecb5f::/onion3/io37fylc2pupg4cte4siqlsmuszkeythgjsxs2i3prm6jyz2dtophaad:18141",
"126c7ee64f71aca36398b977dd31fbbe9f9dad615df96473fb655bef5709c540::/onion3/6ilmgndocop7ybgmcvivbdsetzr5ggj4hhsivievoa2dx2b43wqlrlid:18141",
]

# DNS seeds
# The DNS records in these hostnames should provide TXT records as per https://github.com/tari-project/tari/pull/2319
# Enter a domain name for the TXT records: seeds.tari.com
dns_seeds =["seeds.weatherwax.tari.com"]
# The name server used to resolve DNS seeds format: {socket address}/{tls sni dns name} (Default: cloudflare)
# dns_seeds_name_server = "1.1.1.1:853/cloudfare-dns.com"
# Servers addresses, majority of them have to agree.
# autoupdate_dns_hosts = [#server1, #server2, ...]
# Set to true to only accept DNS records that pass DNSSEC validation (Default: true)
dns_seeds_use_dnssec = false

# Tari is a 100% peer-to-peer network, so there are no servers to hold messages for you while you're offline.
# Instead, we rely on our peers to hold messages for us while we're offline. This settings sets maximum size of the
# message cache that for holding our peers' messages, in MB.
Expand Down Expand Up @@ -92,13 +58,60 @@ dedup_cache_capacity = 25000
# sessions.
rpc_max_simultaneous_sessions = 10000

[common.weatherwax]
# When first logging onto the Tari network, you need to find a few peers to bootstrap the process. In the absence of
# any servers, this is a little more challenging than usual. Our best strategy is just to try and connect to the peers
# you knew about last time you ran the software. But what about when you run the software for the first time? That's
# where this allowlist comes in. It's a list of known Tari nodes that are likely to be around for a long time and that
# new nodes can use to introduce themselves to the network.
# peer_seeds = ["public_key1::address1", "public_key2::address2",... ]
peer_seeds = [
# weatherwax
"98bc76afc1c35ad4651bdc9ef57bbe0655a2ea3cd86c0e19b5fd5890546eb040::/onion3/33izgtjkrlxhxybj6luqowkpiy2wvte43osejnbqyieqtdfhovzghxad:18141", #jozi
"9a26e910288213d649b26f9a7a7ee51fe2b2a67ff7d42334523463bf4be94312::/onion3/56kq54ylttnbl5ikotqex3oqvtzlxdpn7zlx4v56rvzf4kq7eezlclid:18141", #london
"6afd5b3c7772ad7d4bb26e0c19668fe04f2d68f99de9e132bee50a6c1846946d::/onion3/may4ajbmcn4dlnzf6fanvqlklxzqiw6qwu6ywqwkjc3bb354rc2i5wid:18141", #ncal
"8e7beec9becdc44fe6015a00d97a77fa3dbafe65127dcc988df6326bd9fd040d::/onion3/3pise36l4imoopsbjic5rtw67adx7rms6w5pgjmccpdwiqx66j7oqcqd:18141", #nvir
"80bb590d943a46e63ae79af5dc2c7d35a3dcd7922c182b28f619dc4cfc366f44::/onion3/oaxwahri7r3h5qjlcdbveyjmg4jsttausik66bicmhixft73nmvecdad:18141", #oregon
"981cc8cd1e4fe2f99ea1bd3e0ab1e7821ca0bfab336a4967cfec053fee86254c::/onion3/7hxpnxrxycdfevirddau7ybofwedaamjrg2ijm57k2kevh5q46ixamid:18141", #seoul
"f2ce179fb733725961a5f7e1e45dacdd443dd43ba6237438d6abe344fb717058::/onion3/nvgdmjf4wucgatz7vemzvi2u4sw5o4gyzwuikagpepoj4w7mkii47zid:18141", #stockholm
"909c0160f4d8e815aba5c2bbccfcceb448877e7b38759fb160f3e9494484d515::/onion3/qw5uxv533sqdn2qoncfyqo35dgecy4rt4x27rexi2her6q6pcpxbm4qd:18141", #sydney
]

# DNS seeds
# The DNS records in these hostnames should provide TXT records as per https://github.com/tari-project/tari/pull/2319
# Enter a domain name for the TXT records:
dns_seeds =["seeds.weatherwax.tari.com"]
# The name server used to resolve DNS seeds format: {socket address}/{tls sni dns name} (Default: cloudflare)
# dns_seeds_name_server = "1.1.1.1:853/cloudfare-dns.com"
# Servers addresses, majority of them have to agree.
# autoupdate_dns_hosts = [#server1, #server2, ...]
# Set to true to only accept DNS records that pass DNSSEC validation (Default: true)
dns_seeds_use_dnssec = false

# Auto Update
#
# This interval in seconds to check for software updates. Setting this to 0 disables checking.
# auto_update.check_interval = 300
# Customize the hosts that are used to check for updates. These hosts must contain update information in DNS TXT records.
# auto_update.dns_hosts = ["updates.taripulse.com"]
# "auto_update.dns_hosts" = ["updates.weatherwax.taripulse.com"]
# Customize the location of the update SHA hashes and maintainer-signed signature.
# auto_update.hashes_url = "https://<address>/hashes.txt"
# auto_update.hashes_sig_url = "https://<address>/hashes.txt.sig"
# "auto_update.hashes_url" = "https://<address>/hashes.txt"
# "auto_update.hashes_sig_url" = "https://<address>/hashes.txt.sig"

[common.igor]
peer_seeds = [
# igor
"8e7eb81e512f3d6347bf9b1ca9cd67d2c8e29f2836fc5bd608206505cc72af34::/onion3/l4wouomx42nezhzexjdzfh7pcou5l7df24ggmwgekuih7tkv2rsaokqd:18141",
"00b35047a341401bcd336b2a3d564280a72f6dc72ec4c739d30c502acce4e803::/onion3/ojhxd7z6ga7qrvjlr3px66u7eiwasmffnuklscbh5o7g6wrbysj45vid:18141",
"40a9d8573745072534bce7d0ecafe882b1c79570375a69841c08a98dee9ecb5f::/onion3/io37fylc2pupg4cte4siqlsmuszkeythgjsxs2i3prm6jyz2dtophaad:18141",
"126c7ee64f71aca36398b977dd31fbbe9f9dad615df96473fb655bef5709c540::/onion3/6ilmgndocop7ybgmcvivbdsetzr5ggj4hhsivievoa2dx2b43wqlrlid:18141",
]

dns_seeds =["seeds.igor.tari.com"]
# dns_seeds_name_server = "1.1.1.1:853/cloudfare-dns.com"
dns_seeds_use_dnssec = false

# auto_update.check_interval = 300
# "auto_update.dns_hosts" = ["updates.igor.taripulse.com"]
# "auto_update.hashes_url" = "https://<address>/hashes.txt"
# "auto_update.hashes_sig_url" = "https://<address>/hashes.txt.sig"
1 change: 0 additions & 1 deletion common/config/presets/merge_mining_proxy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ monerod_password = ""
# or not. If merge mining starts before the base node has achieved initial sync, those Tari mined blocks will not be
# accepted. (Default value = true; will wait for base node initial sync).
#wait_for_initial_sync_at_startup = true

Loading

0 comments on commit 37210a0

Please sign in to comment.