Remove eth feature, and BBBC related code (#1612)

* Remove eth feature, and BBBC related code

* Burn some more, especially clients
This commit is contained in:
Drazen Urch
2022-09-15 13:58:44 +02:00
committed by GitHub
parent e804b014a8
commit 16ef1c547b
94 changed files with 299 additions and 5316 deletions
-40
View File
@@ -23,12 +23,6 @@ const DEFAULT_GATEWAY_PING_INTERVAL: Duration = Duration::from_secs(60);
const DEFAULT_GATEWAY_RESPONSE_TIMEOUT: Duration = Duration::from_secs(5 * 60);
const DEFAULT_GATEWAY_CONNECTION_TIMEOUT: Duration = Duration::from_millis(2_500);
#[cfg(not(feature = "coconut"))]
const DEFAULT_ETH_ENDPOINT: &str = "https://rinkeby.infura.io/v3/00000000000000000000000000000000";
#[cfg(not(feature = "coconut"))]
const DEFAULT_ETH_PRIVATE_KEY: &str =
"0000000000000000000000000000000000000000000000000000000000000001";
const DEFAULT_TEST_ROUTES: usize = 3;
const DEFAULT_MINIMUM_TEST_ROUTES: usize = 1;
const DEFAULT_ROUTE_TEST_PACKETS: usize = 1000;
@@ -163,14 +157,6 @@ pub struct NetworkMonitor {
/// Path to the database containing bandwidth credentials of this client.
credentials_database_path: PathBuf,
/// Ethereum private key.
#[cfg(not(feature = "coconut"))]
eth_private_key: String,
/// Addess to an Ethereum full node.
#[cfg(not(feature = "coconut"))]
eth_endpoint: String,
/// Desired number of test routes to be constructed (and working) during a monitor test run.
test_routes: usize,
@@ -209,10 +195,6 @@ impl Default for NetworkMonitor {
gateway_connection_timeout: DEFAULT_GATEWAY_CONNECTION_TIMEOUT,
packet_delivery_timeout: DEFAULT_PACKET_DELIVERY_TIMEOUT,
credentials_database_path: Self::default_credentials_database_path(),
#[cfg(not(feature = "coconut"))]
eth_private_key: DEFAULT_ETH_PRIVATE_KEY.to_string(),
#[cfg(not(feature = "coconut"))]
eth_endpoint: DEFAULT_ETH_ENDPOINT.to_string(),
test_routes: DEFAULT_TEST_ROUTES,
minimum_test_routes: DEFAULT_MINIMUM_TEST_ROUTES,
route_test_packets: DEFAULT_ROUTE_TEST_PACKETS,
@@ -377,18 +359,6 @@ impl Config {
self
}
#[cfg(not(feature = "coconut"))]
pub fn with_eth_private_key(mut self, eth_private_key: String) -> Self {
self.network_monitor.eth_private_key = eth_private_key;
self
}
#[cfg(not(feature = "coconut"))]
pub fn with_eth_endpoint(mut self, eth_endpoint: String) -> Self {
self.network_monitor.eth_endpoint = eth_endpoint;
self
}
pub fn get_id(&self) -> String {
self.base.id.clone()
}
@@ -410,16 +380,6 @@ impl Config {
self.network_monitor.credentials_database_path.clone()
}
#[cfg(not(feature = "coconut"))]
pub fn get_network_monitor_eth_private_key(&self) -> String {
self.network_monitor.eth_private_key.clone()
}
#[cfg(not(feature = "coconut"))]
pub fn get_network_monitor_eth_endpoint(&self) -> String {
self.network_monitor.eth_endpoint.clone()
}
// TODO: Remove if still unused
#[allow(dead_code)]
pub fn get_rewarding_enabled(&self) -> bool {
-6
View File
@@ -57,12 +57,6 @@ packet_delivery_timeout = '{{ network_monitor.packet_delivery_timeout }}'
credentials_database_path = '{{ network_monitor.credentials_database_path }}'
# Ethereum private key.
eth_private_key = '{{ network_monitor.eth_private_key }}'
# Addess to an Ethereum full node.
eth_endpoint = '{{ network_monitor.eth_endpoint }}'
# Desired number of test routes to be constructed (and working) during a monitor test run.
test_routes = {{ network_monitor.test_routes }}
-29
View File
@@ -73,11 +73,6 @@ const KEYPAIR_ARG: &str = "keypair";
#[cfg(feature = "coconut")]
const COCONUT_ENABLED: &str = "enable-coconut";
#[cfg(not(feature = "coconut"))]
const ETH_ENDPOINT: &str = "eth_endpoint";
#[cfg(not(feature = "coconut"))]
const ETH_PRIVATE_KEY: &str = "eth_private_key";
const REWARDING_MONITOR_THRESHOLD_ARG: &str = "monitor-threshold";
const MIN_MIXNODE_RELIABILITY_ARG: &str = "min_mixnode_reliability";
@@ -199,20 +194,6 @@ fn parse_args() -> ArgMatches {
.requires_all(&[KEYPAIR_ARG, MNEMONIC_ARG, API_VALIDATORS_ARG])
.long(COCONUT_ENABLED),
);
#[cfg(not(feature = "coconut"))]
let base_app = base_app.arg(
Arg::with_name(ETH_ENDPOINT)
.help("URL of an Ethereum full node that we want to use for getting bandwidth tokens from ERC20 tokens")
.takes_value(true)
.long(ETH_ENDPOINT),
).arg(
Arg::with_name(ETH_PRIVATE_KEY)
.help("Ethereum private key used for obtaining bandwidth tokens from ERC20 tokens")
.takes_value(true)
.long(ETH_PRIVATE_KEY),
);
base_app.get_matches()
}
@@ -366,16 +347,6 @@ fn override_config(mut config: Config, matches: &ArgMatches) -> Config {
config = config.with_keypair_path(keypair_path.into())
}
#[cfg(not(feature = "coconut"))]
if let Some(eth_private_key) = matches.value_of("eth_private_key") {
config = config.with_eth_private_key(String::from(eth_private_key));
}
#[cfg(not(feature = "coconut"))]
if let Some(eth_endpoint) = matches.value_of("eth_endpoint") {
config = config.with_eth_endpoint(String::from(eth_endpoint));
}
if matches.is_present(ENABLED_CREDENTIALS_MODE_ARG_NAME) {
config = config.with_disabled_credentials_mode(false)
}
-2
View File
@@ -83,8 +83,6 @@ impl<'a> NetworkMonitorBuilder<'a> {
let bandwidth_controller = BandwidthController::new(
credential_storage::initialise_storage(self.config.get_credentials_database_path())
.await,
self.config.get_network_monitor_eth_endpoint(),
self.config.get_network_monitor_eth_private_key(),
)
.expect("Could not create bandwidth controller");