From a82ac9c50d20df9841efc2fc7c718affc05e48d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C8=99u?= Date: Mon, 28 Jun 2021 15:10:57 +0300 Subject: [PATCH] contracts: Removed mixnode location from the bonding process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bogdan-Ștefan Neacșu --- common/mixnet-contract/src/mixnode.rs | 1 - common/nymsphinx/src/receiver.rs | 3 --- common/topology/src/lib.rs | 7 +++---- common/topology/src/mix.rs | 2 -- contracts/mixnet/src/support/tests.rs | 2 -- 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/common/mixnet-contract/src/mixnode.rs b/common/mixnet-contract/src/mixnode.rs index 8ceb5c26fa..a58f48b96e 100644 --- a/common/mixnet-contract/src/mixnode.rs +++ b/common/mixnet-contract/src/mixnode.rs @@ -14,7 +14,6 @@ pub struct MixNode { pub verloc_port: u16, pub http_api_port: u16, pub layer: u64, - pub location: String, pub sphinx_key: SphinxKey, /// Base58 encoded ed25519 EdDSA public key. pub identity_key: IdentityKey, diff --git a/common/nymsphinx/src/receiver.rs b/common/nymsphinx/src/receiver.rs index 6898ea6c86..c9cbb76229 100644 --- a/common/nymsphinx/src/receiver.rs +++ b/common/nymsphinx/src/receiver.rs @@ -216,7 +216,6 @@ mod message_receiver { vec![mix::Node { owner: "foomp1".to_string(), stake: 123, - location: "unknown".to_string(), host: "10.20.30.40".parse().unwrap(), mix_host: "10.20.30.40:1789".parse().unwrap(), identity_key: identity::PublicKey::from_base58_string( @@ -237,7 +236,6 @@ mod message_receiver { vec![mix::Node { owner: "foomp2".to_string(), stake: 123, - location: "unknown".to_string(), host: "11.21.31.41".parse().unwrap(), mix_host: "11.21.31.41:1789".parse().unwrap(), identity_key: identity::PublicKey::from_base58_string( @@ -258,7 +256,6 @@ mod message_receiver { vec![mix::Node { owner: "foomp3".to_string(), stake: 123, - location: "unknown".to_string(), host: "12.22.32.42".parse().unwrap(), mix_host: "12.22.32.42:1789".parse().unwrap(), identity_key: identity::PublicKey::from_base58_string( diff --git a/common/topology/src/lib.rs b/common/topology/src/lib.rs index bfdca9aaec..3d19e04987 100644 --- a/common/topology/src/lib.rs +++ b/common/topology/src/lib.rs @@ -289,7 +289,6 @@ mod converting_mixes_to_vec { let node1 = mix::Node { owner: "N/A".to_string(), stake: 0, - location: "London".to_string(), host: "3.3.3.3".parse().unwrap(), mix_host: "3.3.3.3:1789".parse().unwrap(), identity_key: identity::PublicKey::from_base58_string( @@ -305,12 +304,12 @@ mod converting_mixes_to_vec { }; let node2 = mix::Node { - location: "Thunder Bay".to_string(), + owner: "Alice".to_string(), ..node1.clone() }; let node3 = mix::Node { - location: "Warsaw".to_string(), + owner: "Bob".to_string(), ..node1.clone() }; @@ -320,7 +319,7 @@ mod converting_mixes_to_vec { let topology = NymTopology::new(mixes, vec![]); let mixvec = topology.mixes_as_vec(); - assert!(mixvec.iter().any(|node| node.location == "London")); + assert!(mixvec.iter().any(|node| node.owner == "N/A")); } } diff --git a/common/topology/src/mix.rs b/common/topology/src/mix.rs index 291b7fabdc..8f4c8f7baf 100644 --- a/common/topology/src/mix.rs +++ b/common/topology/src/mix.rs @@ -83,7 +83,6 @@ pub struct Node { // somebody correct me if I'm wrong, but we should only ever have a single denom of currency // on the network at a type, right? pub stake: u128, - pub location: String, pub host: NetworkAddress, // we're keeping this as separate resolved field since we do not want to be resolving the potential // hostname every time we want to construct a path via this node @@ -137,7 +136,6 @@ impl<'a> TryFrom<&'a MixNodeBond> for Node { .first() .map(|stake| stake.amount.into()) .unwrap_or(0), - location: bond.mix_node.location.clone(), host, mix_host, identity_key: identity::PublicKey::from_base58_string(&bond.mix_node.identity_key)?, diff --git a/contracts/mixnet/src/support/tests.rs b/contracts/mixnet/src/support/tests.rs index c591b768a7..af83ac8dbc 100644 --- a/contracts/mixnet/src/support/tests.rs +++ b/contracts/mixnet/src/support/tests.rs @@ -111,7 +111,6 @@ pub mod helpers { verloc_port: 1790, http_api_port: 8000, layer: 1, - location: "Sweden".to_string(), sphinx_key: "sphinx".to_string(), identity_key: "identity".to_string(), version: "0.10.0".to_string(), @@ -125,7 +124,6 @@ pub mod helpers { verloc_port: 1790, http_api_port: 8000, layer: 1, - location: "London".to_string(), sphinx_key: "1234".to_string(), identity_key: "aaaa".to_string(), version: "0.10.0".to_string(),