Skip to content

Commit

Permalink
Merge pull request #4903 from nymtech/feature/directory-v3-purge-base
Browse files Browse the repository at this point in the history
Directory Sevices v2.1
  • Loading branch information
jstuczyn authored Oct 11, 2024
2 parents 27ac345 + c3e3ef1 commit 8113948
Show file tree
Hide file tree
Showing 508 changed files with 28,549 additions and 16,026 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [arc-ubuntu-20.04, custom-runner-mac-m1]
os: [ arc-ubuntu-20.04, custom-runner-mac-m1 ]
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -62,14 +62,6 @@ jobs:
with:
command: build

# while disabled by default, this build ensures nothing is broken within
# `axum` feature
- name: Build with `axum` feature
uses: actions-rs/cargo@v1
with:
command: build
args: --features axum

- name: Build all examples
if: contains(matrix.os, 'ubuntu')
uses: actions-rs/cargo@v1
Expand All @@ -95,4 +87,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets --features axum -- -D warnings
args: --workspace --all-targets -- -D warnings
115 changes: 96 additions & 19 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ parking_lot = "0.12.3"
pem = "0.8"
petgraph = "0.6.5"
pin-project = "1.0"
pin-project-lite = "0.2.14"
pretty_env_logger = "0.4.0"
publicsuffix = "2.2.3"
quote = "1"
Expand Down Expand Up @@ -326,7 +327,7 @@ tracing = "0.1.37"
tracing-opentelemetry = "0.19.0"
tracing-subscriber = "0.3.16"
tracing-tree = "0.2.2"
ts-rs = "7.0.0"
ts-rs = "10.0.0"
tungstenite = { version = "0.20.1", default-features = false }
url = "2.5"
utoipa = "4.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use log::{debug, error};
use nym_explorer_client::{ExplorerClient, PrettyDetailedMixNodeBond};
use nym_network_defaults::var_names::EXPLORER_API;
use nym_topology::{
nym_topology_from_detailed,
nym_topology_from_basic_info,
provider_trait::{async_trait, TopologyProvider},
NymTopology,
};
use nym_validator_client::client::MixId;
use nym_validator_client::client::NodeId;
use rand::{prelude::SliceRandom, thread_rng};
use std::collections::HashMap;
use tap::TapOptional;
Expand Down Expand Up @@ -39,10 +39,10 @@ fn create_explorer_client() -> Option<ExplorerClient> {

fn group_mixnodes_by_country_code(
mixnodes: Vec<PrettyDetailedMixNodeBond>,
) -> HashMap<CountryGroup, Vec<MixId>> {
) -> HashMap<CountryGroup, Vec<NodeId>> {
mixnodes
.into_iter()
.fold(HashMap::<CountryGroup, Vec<MixId>>::new(), |mut acc, m| {
.fold(HashMap::<CountryGroup, Vec<NodeId>>::new(), |mut acc, m| {
if let Some(ref location) = m.location {
let country_code = location.two_letter_iso_country_code.clone();
let group_code = CountryGroup::new(country_code.as_str());
Expand All @@ -53,7 +53,7 @@ fn group_mixnodes_by_country_code(
})
}

fn log_mixnode_distribution(mixnodes: &HashMap<CountryGroup, Vec<MixId>>) {
fn log_mixnode_distribution(mixnodes: &HashMap<CountryGroup, Vec<NodeId>>) {
let mixnode_distribution = mixnodes
.iter()
.map(|(k, v)| format!("{}: {}", k, v.len()))
Expand Down Expand Up @@ -110,15 +110,15 @@ impl GeoAwareTopologyProvider {
}

async fn get_topology(&self) -> Option<NymTopology> {
let mixnodes = match self.validator_client.get_cached_active_mixnodes().await {
let mixnodes = match self.validator_client.get_basic_mixnodes(None).await {
Err(err) => {
error!("failed to get network mixnodes - {err}");
return None;
}
Ok(mixes) => mixes,
};

let gateways = match self.validator_client.get_cached_gateways().await {
let gateways = match self.validator_client.get_basic_gateways(None).await {
Err(err) => {
error!("failed to get network gateways - {err}");
return None;
Expand Down Expand Up @@ -182,10 +182,10 @@ impl GeoAwareTopologyProvider {

let mixnodes = mixnodes
.into_iter()
.filter(|m| filtered_mixnode_ids.contains(&m.mix_id()))
.filter(|m| filtered_mixnode_ids.contains(&m.node_id))
.collect::<Vec<_>>();

let topology = nym_topology_from_detailed(mixnodes, gateways)
let topology = nym_topology_from_basic_info(&mixnodes, &gateways)
.filter_system_version(&self.client_version);

// TODO: return real error type
Expand Down
10 changes: 0 additions & 10 deletions common/client-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,6 @@ pub enum ClientCoreError {
source: Ed25519RecoveryError,
},

#[error("the account owner of gateway {gateway_id} ({raw_owner}) is malformed: {err}")]
MalformedGatewayOwnerAccountAddress {
gateway_id: String,

raw_owner: String,

// just use the string formatting as opposed to underlying type to avoid having to import cosmrs
err: String,
},

#[error(
"the listening address of gateway {gateway_id} ({raw_listener}) is malformed: {source}"
)]
Expand Down
Loading

0 comments on commit 8113948

Please sign in to comment.