Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-631: Gossip Storm Avoidance #196

Merged
merged 36 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
63f74ab
GH-631: get the skeleton ready
utkarshg6 Oct 19, 2022
4d38ea0
GH-631: add a working recursive method for computing patch
utkarshg6 Nov 1, 2022
5d95637
GH-631: add test for computing patch; not working yet
utkarshg6 Nov 2, 2022
507f0af
GH-631: improve the test for the compute_patch function and make it w…
utkarshg6 Nov 3, 2022
36c466a
GH-631: refactor the recursive function to compute patch
utkarshg6 Nov 3, 2022
280b3b2
GH-631: refactor the conditionals inside the recursion
utkarshg6 Nov 3, 2022
8f8b28f
GH-631: refactor the compute_patch() to use match
utkarshg6 Nov 3, 2022
8277905
GH-631: compute_patch() should search for neighbors in it's database …
utkarshg6 Nov 3, 2022
3f8fd66
GH-631: improve the solution for the compute_patch()
utkarshg6 Nov 3, 2022
e2f9922
GH-631: minor code cleanup
utkarshg6 Nov 4, 2022
00270a3
GH-631: add one more test to make compute_patch() robust
utkarshg6 Nov 4, 2022
83ab0f3
GH-631: add one more test for compute_patch()
utkarshg6 Nov 8, 2022
cad6695
GH-631: reduce the number of recursion calls and minize hashset size
utkarshg6 Nov 8, 2022
c4143b9
GH-631: add test to check if the standard gossip handler ignores goss…
utkarshg6 Nov 16, 2022
541260c
GH-631: make the test work
utkarshg6 Nov 16, 2022
325f1a7
GH-631: fix the test proper_standard_gossip_is_matched_and_handled
utkarshg6 Nov 18, 2022
92a8eb9
GH-631: fix the tests inside gossip_acceptor.rs
utkarshg6 Nov 22, 2022
6a2f92f
GH-631: refactor the compute_patch()
utkarshg6 Nov 22, 2022
18191a0
GH-631: remove compiler warnings
utkarshg6 Nov 25, 2022
d1281af
GH-631: filter agrs before calling the function that'll add introduct…
utkarshg6 Nov 25, 2022
663ba06
GH-631: only use references to build hashmap from agr
utkarshg6 Nov 25, 2022
ad33fad
GH-631: use constant for computing patch
utkarshg6 Nov 28, 2022
fff58c8
GH-631: remove redundant code
utkarshg6 Nov 29, 2022
53bd30a
GH-631: remove clippy warnings
utkarshg6 Nov 29, 2022
0588c33
GH-631: rename test to can_retrieve_all_full_and_half_neighbors()
utkarshg6 Nov 29, 2022
7e9dcac
GH-631: remove contract test for eth ropsten
utkarshg6 Nov 29, 2022
6651717
GH-631: modify extract_node_reference()
utkarshg6 Nov 29, 2022
8a8b1a4
GH-631: Did more fixing on the blockchain multinode test
dnwiebe Nov 30, 2022
446b17b
GH-631: format the code
utkarshg6 Nov 30, 2022
81f404c
GH-600: Workaround multinode test libc failure
masqrauder Nov 30, 2022
7d3e8d3
GH-631: Review 1 (#202)
utkarshg6 Dec 12, 2022
5d29f26
GH-631: remove clippy warnings
utkarshg6 Dec 12, 2022
bf1cf1c
GH-633: change the version number of libc from 2.36-4 to 2.36-6
masqrauder Nov 30, 2022
cfbb1f7
Trigger Build
utkarshg6 Dec 12, 2022
64cfa77
GH-631: An attempt to fix multinode test provided_and_consumed_servic…
utkarshg6 Dec 13, 2022
d4e125e
GH-631: remove the clippy allow statement for the compute_patch_recur…
utkarshg6 Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions multinode_integration_tests/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved.
#FROM debian:stable-slim
#FROM debian:buster-slim
FROM debian:bullseye-slim
#FROM debian:bullseye-slim
FROM debian:bookworm-slim

RUN apt-get update && \
apt-get install -y libc6 && \
apt-get install -y libc6=2.36-6 && \
# These lines are commented out because for some reason the installation of iptables-persistent hangs forever on
# bullseye-slim. Its absence means that the NodeStartupConfigBuilder::open_firewall_port() function won't work, but
# at the time of this comment it's used in only one place in a way that doesn't have any value. So we decided to
Expand Down
47 changes: 25 additions & 22 deletions multinode_integration_tests/src/masq_real_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,39 +1144,42 @@ impl MASQRealNode {
}

fn extract_node_reference(name: &str) -> Result<NodeReference, String> {
let regex = Self::descriptor_regex();
let descriptor_regex = Self::descriptor_regex();
let mut retries_left = 25;
loop {
if retries_left <= 0 {
return Err(format!("Node {} never started", name));
}
retries_left -= 1;
println!("Checking for {} startup", name);
thread::sleep(Duration::from_millis(100));
let output = Self::exec_command_on_container_and_wait(
thread::sleep(Duration::from_millis(250));
match Self::exec_command_on_container_and_wait(
name,
vec![
"cat",
&format!("{}/{}", DATA_DIRECTORY, CURRENT_LOGFILE_NAME),
],
)
.unwrap_or_else(|e| {
panic!(
"Failed to read {}/{}: {}",
DATA_DIRECTORY, CURRENT_LOGFILE_NAME, e
)
});
match regex.captures(output.as_str()) {
Some(captures) => {
let node_reference =
NodeReference::from_str(captures.get(1).unwrap().as_str()).unwrap();
println!("{} startup detected at {}", name, node_reference);
return Ok(node_reference);
}
None => {
if retries_left <= 0 {
return Err(format!("Node {} never started:\n{}", name, output));
) {
Ok(output) => {
if let Some(captures) = descriptor_regex.captures(output.as_str()) {
let node_reference =
NodeReference::from_str(captures.get(1).unwrap().as_str()).unwrap();
println!("{} startup detected at {}", name, node_reference);
return Ok(node_reference);
} else {
retries_left -= 1;
println!(
"No local descriptor for {} in logfile yet\n{}",
name, output
)
}
}
}
Err(e) => {
println!(
"Failed to cat logfile for {} at {}/{}: {}",
name, DATA_DIRECTORY, CURRENT_LOGFILE_NAME, e
);
}
};
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn debtors_are_credited_once_but_not_twice() {
}

#[test]
fn blockchain_bridge_logs_when_started() {
fn blockchain_bridge_starts_properly_on_bootstrap() {
let mut cluster = MASQNodeCluster::start().unwrap();
let private_key = "0011223300112233001122330011223300112233001122330011223300112233";
let subject = cluster.start_real_node(
Expand Down
5 changes: 4 additions & 1 deletion multinode_integration_tests/tests/bookkeeping_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn provided_and_consumed_services_are_recorded_in_databases() {
.map(|_| start_real_node(&mut cluster, originating_node.node_reference()))
.collect::<Vec<MASQRealNode>>();

thread::sleep(Duration::from_millis(10_000));
thread::sleep(Duration::from_secs(10));

let mut client = originating_node.make_client(8080);
let request = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n".as_bytes();
Expand All @@ -39,6 +39,9 @@ fn provided_and_consumed_services_are_recorded_in_databases() {
// get all payables from originating node
let payables = non_pending_payables(&originating_node);

// Waiting until the serving nodes have finished accruing their receivables
thread::sleep(Duration::from_secs(2));

// get all receivables from all other nodes
let receivable_balances = non_originating_nodes
.iter()
Expand Down
2 changes: 1 addition & 1 deletion node/src/neighborhood/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::net::{IpAddr, SocketAddr};
pub struct GossipNodeRecord {
pub signed_data: PlainData,
pub signature: CryptData,
pub node_addr_opt: Option<NodeAddr>, // Only for use in introductions
pub node_addr_opt: Option<NodeAddr>,
}

impl Debug for GossipNodeRecord {
Expand Down
Loading