Feature/dkg publish vk (#1747)

* Save to disk coconut keypair

* Check verification keys of the other signers

* Post verification key to chain

* Add multisig propose/vote for vks

* Execute the proposal

* Parse announce address argument

* Gateway uses chain data

* Network requester uses chain data

* Native&socks5 clients use chain data

* Credential client signature uses chain data

* Remove redundant api endpoints

* Undo debugging logging

* Fix some tests

* Fix clippy

* Fix wasm client and contract test

* More contract clippy

* Update CHANGELOG

* Use a bigger expiry period then the testing one
This commit is contained in:
Bogdan-Ștefan Neacşu
2022-11-22 11:16:02 +02:00
committed by GitHub
parent f1deebc0f1
commit 2db1bc8efa
88 changed files with 1623 additions and 603 deletions
+17 -5
View File
@@ -7,6 +7,7 @@ use futures::channel::mpsc;
use gateway_client::bandwidth::BandwidthController;
use std::sync::Arc;
use task::ShutdownNotifier;
use validator_client::nymd::SigningNymdClient;
use crate::config::Config;
use crate::contract_cache::ValidatorCache;
@@ -20,6 +21,7 @@ use crate::network_monitor::monitor::receiver::{
use crate::network_monitor::monitor::sender::PacketSender;
use crate::network_monitor::monitor::summary_producer::SummaryProducer;
use crate::network_monitor::monitor::Monitor;
use crate::nymd_client::Client;
use crate::storage::ValidatorApiStorage;
pub(crate) mod chunker;
@@ -32,6 +34,7 @@ pub(crate) const ROUTE_TESTING_TEST_NONCE: u64 = 0;
pub(crate) struct NetworkMonitorBuilder<'a> {
config: &'a Config,
_nymd_client: Client<SigningNymdClient>,
system_version: String,
node_status_storage: ValidatorApiStorage,
validator_cache: ValidatorCache,
@@ -40,12 +43,14 @@ pub(crate) struct NetworkMonitorBuilder<'a> {
impl<'a> NetworkMonitorBuilder<'a> {
pub(crate) fn new(
config: &'a Config,
_nymd_client: Client<SigningNymdClient>,
system_version: &str,
node_status_storage: ValidatorApiStorage,
validator_cache: ValidatorCache,
) -> Self {
NetworkMonitorBuilder {
config,
_nymd_client,
system_version: system_version.to_string(),
node_status_storage,
validator_cache,
@@ -74,11 +79,18 @@ impl<'a> NetworkMonitorBuilder<'a> {
);
#[cfg(feature = "coconut")]
let bandwidth_controller = BandwidthController::new(
credential_storage::initialise_storage(self.config.get_credentials_database_path())
.await,
self.config.get_all_validator_api_endpoints(),
);
let bandwidth_controller = {
let client = self._nymd_client.0.read().await;
let coconut_api_clients =
validator_client::CoconutApiClient::all_coconut_api_clients(&client)
.await
.expect("Could not query api clients");
BandwidthController::new(
credential_storage::initialise_storage(self.config.get_credentials_database_path())
.await,
coconut_api_clients,
)
};
#[cfg(not(feature = "coconut"))]
let bandwidth_controller = BandwidthController::new(
credential_storage::initialise_storage(self.config.get_credentials_database_path())
@@ -90,15 +90,6 @@ struct FreshGatewayClientData {
gateways_status_updater: GatewayClientUpdateSender,
local_identity: Arc<identity::KeyPair>,
gateway_response_timeout: Duration,
// I guess in the future this struct will require aggregated verification key and....
// ... something for obtaining actual credential
// TODO:
// SECURITY:
// for coconut bandwidth credentials we currently have no double spending protection, just to
// get things running we're re-using the same credential for all gateways all the time.
// THIS IS VERY BAD!!
bandwidth_controller: BandwidthController<PersistentStorage>,
disabled_credentials_mode: bool,
}
@@ -140,8 +131,6 @@ pub(crate) struct PacketSender {
// behaviour is unlikely.
active_gateway_clients: ActiveGatewayClients,
// I guess that will be required later on if credentials are got per gateway
// aggregated_verification_key: Arc<VerificationKey>,
fresh_gateway_client_data: Arc<FreshGatewayClientData>,
gateway_connection_timeout: Duration,
max_concurrent_clients: usize,