Feature/nymd client integration (#736)

* Calculating gas fees

* Ability to set custom fees

* Added extra test

* Removed commented code

* Moved all msg types to common contract crate

* Temporarily disabling get_tx method

* Finishing up nymd client API

* Comment fix

* Remaining fee values

* Some cleanup

* Removed needless borrow

* Fixed imports in contract tests

* Moved error types around

* New ValidatorClient

* Experiment with new type of defaults

* Removed dead module

* Dealt with unwrap

* Migrated mixnode to use new validator client

* Migrated gateway to use new validator client

* Mixnode and gateway adjustments

* More exported defaults

* Clients using new validator client

* Fixed mixnode upgrade

* Moved default values to a new crate

* Changed behaviour of validator client features

* Migrated basic functions of validator api

* Updated config + fixed startup

* Fixed wasm client build

* Integration with the explorer api

* Removed tokio dev dependency

* Needless borrow

* Fixex wasm client build

* Fixed tauri client build

* Needless borrows

* Fixed client upgrade print

* Removed redundant comments

* Made note on aggregated verification key into a doc comment

* Removed mixnet contract references from verloc

* Modified default validators structure

* Reformatted validator-api Cargo.toml file

* Removed commented code

* Made the doc comment example a no-run

* Fixed a upgrade print... again

* Adjusted the doc example

* Removed unused import
This commit is contained in:
Jędrzej Stuczyński
2021-08-18 14:41:00 +01:00
committed by GitHub
parent eec211e038
commit a274edffba
91 changed files with 2249 additions and 2784 deletions
+9 -8
View File
@@ -17,6 +17,8 @@ use crate::node::packet_delayforwarder::{DelayForwarder, PacketDelayForwardSende
use crypto::asymmetric::{encryption, identity};
use log::{error, info, warn};
use mixnode_common::verloc::{self, AtomicVerlocResult, VerlocMeasurer};
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::net::SocketAddr;
use std::process;
use std::sync::Arc;
@@ -164,8 +166,7 @@ impl MixNode {
.tested_nodes_batch_size(self.config.get_measurement_tested_nodes_batch_size())
.testing_interval(self.config.get_measurement_testing_interval())
.retry_timeout(self.config.get_measurement_retry_timeout())
.validator_urls(self.config.get_validator_rest_endpoints())
.mixnet_contract_address(self.config.get_validator_mixnet_contract_address())
.validator_api_urls(self.config.get_validator_api_endpoints())
.build();
let mut verloc_measurer = VerlocMeasurer::new(config, Arc::clone(&self.identity_keypair));
@@ -176,13 +177,13 @@ impl MixNode {
// TODO: ask DH whether this function still makes sense in ^0.10
async fn check_if_same_ip_node_exists(&mut self) -> Option<String> {
let validator_client_config = validator_client::Config::new(
self.config.get_validator_rest_endpoints(),
self.config.get_validator_mixnet_contract_address(),
);
let validator_client = validator_client::Client::new(validator_client_config);
let endpoints = self.config.get_validator_api_endpoints();
let validator_api = endpoints
.choose(&mut thread_rng())
.expect("The list of validator apis is empty");
let validator_client = validator_client::ApiClient::new(validator_api.clone());
let existing_nodes = match validator_client.get_cached_mix_nodes().await {
let existing_nodes = match validator_client.get_cached_mixnodes().await {
Ok(nodes) => nodes,
Err(err) => {
error!("failed to grab initial network mixnodes - {}\n Please try to startup again in few minutes", err);