Feature/host ip split (#654)

* Updated smart contract to work with future cosmwasm 0.14.0 update

* Updated the rest of the codebase

* Reordered imports

* Missing imports

* cargo fmt

* More cargo fmt action

* Introduced type alias for IdentityKey reference

* Constant defined arguments for gateway and mixnode

* Spliting host into explicit address and port(s)

* Using more type restrictive IpAddr rather than String for listening address

* Updated config templates

* Tentative upgrade commands, probably to be further changed before release

* Fixed mixnet contract test fixtures

* Further missing test adjustments
This commit is contained in:
Jędrzej Stuczyński
2021-06-25 10:33:12 +01:00
committed by GitHub
parent 5ba20268dd
commit b7f197d278
28 changed files with 661 additions and 722 deletions
+12 -5
View File
@@ -17,6 +17,7 @@ use crate::node::packet_delayforwarder::{DelayForwarder, PacketDelayForwardSende
use crypto::asymmetric::{encryption, identity};
use log::{error, info, warn};
use mixnode_common::rtt_measurement::{self, AtomicVerlocResult, RttMeasurer};
use std::net::SocketAddr;
use std::process;
use std::sync::Arc;
use tokio::runtime::Runtime;
@@ -61,7 +62,7 @@ impl MixNode {
let mut config = rocket::config::Config::release_default();
// bind to the same address as we are using for mixnodes
config.address = self.config.get_listening_address().ip();
config.address = self.config.get_listening_address();
let verloc_state = VerlocState::new(atomic_verloc_result);
let descriptor = self.descriptor.clone();
@@ -106,9 +107,12 @@ impl MixNode {
let connection_handler = ConnectionHandler::new(packet_processor, delay_forwarding_channel);
let listener = Listener::new(self.config.get_listening_address());
let listening_address = SocketAddr::new(
self.config.get_listening_address(),
self.config.get_mix_port(),
);
listener.start(connection_handler);
Listener::new(listening_address).start(connection_handler);
}
fn start_packet_delay_forwarder(
@@ -147,10 +151,11 @@ impl MixNode {
// use the same binding address with the HARDCODED port for time being (I don't like that approach personally)
let listening_address = rtt_measurement::replace_port(
let listening_address = SocketAddr::new(
self.config.get_listening_address(),
rtt_measurement::DEFAULT_MEASUREMENT_PORT,
);
let config = rtt_measurement::ConfigBuilder::new()
.listening_address(listening_address)
.packets_per_node(self.config.get_measurement_packets_per_node())
@@ -186,9 +191,11 @@ impl MixNode {
}
};
let our_host = self.config.get_announce_address();
existing_nodes
.iter()
.find(|node| node.mix_node.host == self.config.get_announce_address())
.find(|node| node.mix_node.host == our_host)
.map(|node| node.mix_node.identity_key.clone())
}