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
-2
View File
@@ -12,8 +12,6 @@ mod mix_nodes;
mod ping;
mod state;
const VALIDATOR_API: &str = "http://testnet-milhon-validator1.nymtech.net:8080";
const CONTRACT: &str = "punk10pyejy66429refv3g35g2t7am0was7yalwrzen";
const GEO_IP_SERVICE: &str = "https://freegeoip.app/json/";
#[tokio::main]
+5 -6
View File
@@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use crate::mix_nodes::utils::map_2_letter_to_3_letter_country_code;
use mixnet_contract::MixNodeBond;
use validator_client::Config;
use network_defaults::default_api_endpoints;
pub(crate) type LocationCache = HashMap<String, Location>;
@@ -137,7 +137,7 @@ impl ThreadsafeMixNodesResult {
let location = location_cache.get(&bond.mix_node.identity_key).cloned(); // add the location, if we've located this mix node before
(
bond.mix_node.identity_key.to_string(),
MixNodeBondWithLocation { bond, location },
MixNodeBondWithLocation { location, bond },
)
})
.collect(),
@@ -152,7 +152,7 @@ pub(crate) async fn retrieve_mixnodes() -> Vec<MixNodeBond> {
info!("About to retrieve mixnode bonds...");
let bonds: Vec<MixNodeBond> = match client.get_cached_mix_nodes().await {
let bonds: Vec<MixNodeBond> = match client.get_cached_mixnodes().await {
Ok(result) => result,
Err(e) => {
error!("Unable to retrieve mixnode bonds: {:?}", e);
@@ -164,7 +164,6 @@ pub(crate) async fn retrieve_mixnodes() -> Vec<MixNodeBond> {
}
// TODO: inject constants
fn new_validator_client() -> validator_client::Client {
let config = Config::new(vec![crate::VALIDATOR_API.to_string()], crate::CONTRACT);
validator_client::Client::new(config)
fn new_validator_client() -> validator_client::ApiClient {
validator_client::ApiClient::new(default_api_endpoints()[0].clone())
}