Skip to content

Commit 5dd7a82

Browse files
committed
GH-146: More rebranding, merging in master
2 parents c38db95 + 8d9c61c commit 5dd7a82

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2603
-1237
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ assignees: ''
77

88
---
99

10-
**SubstratumNode Version**
11-
Need the full version of SubstratumNode (e.g. SubstratumNode 0.4.2)
10+
**MASQ Node Version**
11+
Need the full version of MASQ Node (e.g. MASQNode 0.4.2)
1212

1313
**Describe the bug**
1414
A clear and concise description of what the bug is.
@@ -27,7 +27,7 @@ A clear and concise description of what you expected to happen.
2727
If applicable, add screenshots to help explain your problem.
2828

2929
**Log files**
30-
Include any relavent logging information. (e.g. /tmp/SubstratumNode.log on Ubuntu)
30+
Include any relevant logging information.
3131

3232
**Device Details (please complete the following information):**
3333
- Device Type [e.g. laptop, desktop, mobile phone, router, IoT]

CODE-OF-CONDUCT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Substratum Network Code of Conduct
1+
# MASQ Network Code of Conduct
22

33
## Our Pledge
44

@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at [[email protected]](mailto:[email protected]).
58+
reported by contacting the project team.
5959
All complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

CONTRIBUTING.md

+41-41
Large diffs are not rendered by default.

README.md

+118-113
Large diffs are not rendered by default.

ci/publish_results.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ cat README.md.clean | sed -n '/\(Results Marker\)/,$p' | tail -n+2 >> README.md
5252

5353
mkdir -p "results/$RESULTS_LABEL"
5454
cp ../generated.tar.gz "results/$RESULTS_LABEL/$GENERATED_NAME.tar.gz"
55-
git add README.md "results/$RESULTS_LABEL/$GENERATED_NAME.tar.gz"
55+
git checkout --orphan new-master
56+
git add README.md results
5657
git commit -m "Latest results for $RESULTS_LABEL ($GENERATED_TYPE) - $STATUS"
57-
git pull
58-
git push
58+
git branch -D master
59+
git branch -M new-master master
60+
git checkout master
61+
git push -f -u origin HEAD
5962

6063
popd

multinode_integration_tests/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ base64 = "0.10.1"
1313
ethereum-types = "0.6.0"
1414
ethsign-crypto = "0.1.0"
1515
futures = "0.1.28"
16+
itertools = "0.8.0"
1617
pretty-hex = "0.1.0"
1718
primitive-types = {version = "0.5.0", default-features = false, features = ["default", "rlp", "serde"] }
1819
regex = "1.2.1"

multinode_integration_tests/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
pub mod blockchain;
44
pub mod command;
55
pub mod main;
6-
pub mod multinode_gossip;
7-
pub mod neighborhood_constructor;
8-
pub mod rest_utils;
96
pub mod masq_cores_client;
107
pub mod masq_cores_server;
118
pub mod masq_mock_node;
@@ -14,4 +11,7 @@ pub mod masq_node_client;
1411
pub mod masq_node_cluster;
1512
pub mod masq_node_server;
1613
pub mod masq_real_node;
14+
pub mod multinode_gossip;
15+
pub mod neighborhood_constructor;
16+
pub mod rest_utils;
1717
pub mod utils;

multinode_integration_tests/src/masq_cores_server.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ impl MASQCoresServer {
132132
pub fn node_reference(&self) -> NodeReference {
133133
NodeReference {
134134
public_key: self.cryptde.public_key().clone(),
135-
node_addr: NodeAddr::new(&self.socket_addr.ip(), &vec![self.socket_addr.port()]),
135+
node_addr_opt: Some(NodeAddr::new(
136+
&self.socket_addr.ip(),
137+
&vec![self.socket_addr.port()],
138+
)),
136139
}
137140
}
138141

@@ -144,8 +147,8 @@ impl MASQCoresServer {
144147
self.node_reference().public_key.clone()
145148
}
146149

147-
pub fn node_addr(&self) -> NodeAddr {
148-
self.node_reference().node_addr.clone()
150+
pub fn node_addr_opt(&self) -> Option<NodeAddr> {
151+
self.node_reference().node_addr_opt.clone()
149152
}
150153

151154
pub fn private_key(&self) -> &PrivateKey {

multinode_integration_tests/src/masq_mock_node.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) 2017-2019, Substratum LLC (https://substratum.net) and/or its affiliates. All rights reserved.
22
use crate::command::Command;
33
use crate::main::CONTROL_STREAM_PORT;
4-
use crate::multinode_gossip::{Introduction, MultinodeGossip, SingleNode};
5-
use crate::masq_node::NodeReference;
6-
use crate::masq_node::PortSelector;
74
use crate::masq_node::MASQNode;
85
use crate::masq_node::MASQNodeUtils;
6+
use crate::masq_node::NodeReference;
7+
use crate::masq_node::PortSelector;
8+
use crate::multinode_gossip::{Introduction, MultinodeGossip, SingleNode};
99
use node_lib::hopper::live_cores_package::LiveCoresPackage;
1010
use node_lib::json_masquerader::JsonMasquerader;
1111
use node_lib::masquerader::{MasqueradeError, Masquerader};
@@ -65,7 +65,7 @@ impl MASQNode for MASQMockNode {
6565
fn node_reference(&self) -> NodeReference {
6666
NodeReference::new(
6767
self.signing_cryptde().unwrap().public_key().clone(),
68-
self.node_addr().ip_addr(),
68+
Some(self.node_addr().ip_addr()),
6969
self.node_addr().ports(),
7070
)
7171
}
@@ -119,6 +119,14 @@ impl MASQNode for MASQMockNode {
119119
fn chain(&self) -> Option<String> {
120120
self.guts.chain.clone()
121121
}
122+
123+
fn accepts_connections(&self) -> bool {
124+
true // just a guess
125+
}
126+
127+
fn routes_data(&self) -> bool {
128+
true // just a guess
129+
}
122130
}
123131

124132
impl MASQMockNode {
@@ -343,7 +351,7 @@ impl MASQMockNode {
343351
match self.wait_for_package(&masquerader, timeout) {
344352
Ok((from, _, package)) => {
345353
let incoming_cores_package = package
346-
.to_expired(from.ip(), self.signing_cryptde().unwrap())
354+
.to_expired(from, self.signing_cryptde().unwrap())
347355
.unwrap();
348356
match incoming_cores_package.payload {
349357
MessageType::Gossip(g) => Some((g, from.ip())),

multinode_integration_tests/src/masq_node.rs

+53-26
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use std::time::Instant;
2828
#[derive(PartialEq, Clone, Debug)]
2929
pub struct NodeReference {
3030
pub public_key: PublicKey,
31-
pub node_addr: NodeAddr,
31+
pub node_addr_opt: Option<NodeAddr>,
3232
}
3333

3434
impl FromStr for NodeReference {
@@ -49,14 +49,19 @@ impl FromStr for NodeReference {
4949
impl fmt::Display for NodeReference {
5050
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5151
let public_key_string = base64::encode_config(&self.public_key.as_slice(), STANDARD_NO_PAD);
52-
let ip_addr_string = format!("{}", self.node_addr.ip_addr());
53-
let port_list_string = self
54-
.node_addr
55-
.ports()
56-
.iter()
57-
.map(|port| port.to_string())
58-
.collect::<Vec<String>>()
59-
.join(",");
52+
let ip_addr_string = match &self.node_addr_opt {
53+
Some(node_addr) => format!("{}", node_addr.ip_addr()),
54+
None => String::new(),
55+
};
56+
let port_list_string = match &self.node_addr_opt {
57+
Some(node_addr) => node_addr
58+
.ports()
59+
.iter()
60+
.map(|port| port.to_string())
61+
.collect::<Vec<String>>()
62+
.join(","),
63+
None => String::new(),
64+
};
6065
write!(
6166
f,
6267
"{}:{}:{}",
@@ -68,10 +73,20 @@ impl fmt::Display for NodeReference {
6873
}
6974

7075
impl NodeReference {
71-
pub fn new(public_key: PublicKey, ip_addr: IpAddr, ports: Vec<u16>) -> NodeReference {
72-
NodeReference {
73-
public_key,
74-
node_addr: NodeAddr::new(&ip_addr, &ports),
76+
pub fn new(
77+
public_key: PublicKey,
78+
ip_addr_opt: Option<IpAddr>,
79+
ports: Vec<u16>,
80+
) -> NodeReference {
81+
match ip_addr_opt {
82+
Some(ip_addr) => NodeReference {
83+
public_key,
84+
node_addr_opt: Some(NodeAddr::new(&ip_addr, &ports)),
85+
},
86+
None => NodeReference {
87+
public_key,
88+
node_addr_opt: None,
89+
},
7590
}
7691
}
7792

@@ -82,14 +97,18 @@ impl NodeReference {
8297
}
8398
}
8499

85-
fn extract_ip_addr(slice: &str) -> Result<IpAddr, String> {
86-
match IpAddr::from_str(slice) {
87-
Ok(ip_addr) => Ok(ip_addr),
88-
Err(_) => {
89-
return Err(format!(
90-
"The IP address of a NodeReference must be valid, not '{}'",
91-
slice
92-
));
100+
fn extract_ip_addr(slice: &str) -> Result<Option<IpAddr>, String> {
101+
if slice.is_empty() {
102+
Ok(None)
103+
} else {
104+
match IpAddr::from_str(slice) {
105+
Ok(ip_addr) => Ok(Some(ip_addr)),
106+
Err(_) => {
107+
return Err(format!(
108+
"The IP address of a NodeReference must be valid, not '{}'",
109+
slice
110+
));
111+
}
93112
}
94113
}
95114
}
@@ -159,6 +178,8 @@ pub trait MASQNode: Any {
159178
fn rate_pack(&self) -> RatePack;
160179
// Valid values are "dev, "ropsten" for now. Add "mainnet" when it's time.
161180
fn chain(&self) -> Option<String>;
181+
fn accepts_connections(&self) -> bool;
182+
fn routes_data(&self) -> bool;
162183
}
163184

164185
pub struct MASQNodeUtils {}
@@ -319,8 +340,11 @@ mod tests {
319340

320341
assert_eq!(result.public_key, key);
321342
assert_eq!(
322-
result.node_addr,
323-
NodeAddr::new(&IpAddr::from_str("12.34.56.78").unwrap(), &vec!(1234, 2345))
343+
result.node_addr_opt,
344+
Some(NodeAddr::new(
345+
&IpAddr::from_str("12.34.56.78").unwrap(),
346+
&vec!(1234, 2345)
347+
))
324348
);
325349
}
326350

@@ -333,16 +357,19 @@ mod tests {
333357

334358
assert_eq!(result.public_key, key);
335359
assert_eq!(
336-
result.node_addr,
337-
NodeAddr::new(&IpAddr::from_str("12.34.56.78").unwrap(), &vec!())
360+
result.node_addr_opt,
361+
Some(NodeAddr::new(
362+
&IpAddr::from_str("12.34.56.78").unwrap(),
363+
&vec!()
364+
))
338365
);
339366
}
340367

341368
#[test]
342369
fn node_reference_can_display_itself() {
343370
let subject = NodeReference::new(
344371
PublicKey::new(&b"Booga"[..]),
345-
IpAddr::from_str("12.34.56.78").unwrap(),
372+
Some(IpAddr::from_str("12.34.56.78").unwrap()),
346373
vec![1234, 5678],
347374
);
348375

multinode_integration_tests/src/masq_node_cluster.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
use crate::command::Command;
33
use crate::masq_mock_node::MASQMockNode;
44
use crate::masq_node::{MASQNode, MASQNodeUtils};
5-
use crate::masq_real_node::NodeStartupConfig;
65
use crate::masq_real_node::MASQRealNode;
6+
use crate::masq_real_node::NodeStartupConfig;
77
use node_lib::sub_lib::cryptde::PublicKey;
88
use node_lib::test_utils::DEFAULT_CHAIN_ID;
99
use std::collections::HashMap;

0 commit comments

Comments
 (0)