Skip to content

Commit

Permalink
GH-541 review 3 (#250)
Browse files Browse the repository at this point in the history
* GH-633: Optimise routing to reduce DNS resolution 'mark' (#183)

* GH-633: modify how the NodeRecordMetadataMessage is handled

* GH-633: use the hashset for unreachable hosts for compute_undesirability()

* GH-633: NodeRecordMetadataMessage handler is able to add unreachable host to the hashset of unreachanle hosts

* GH-633: add the ability to receive the Option of hostname inside compute_new_undesirability()

* GH-633: remove clippy warnings

* GH-633: fix tests in proxy_server.rs

* GH-611: fix test masq_erc20_contract_exists_on_ethereum_ropsten_integration

* GH-633: remove commented out code

* GH-633: fix the errors in multinode integration tests

* GH-633: use an enum to generalise NodeRecordMetadataMessage and only send this message when host name is found

* GH-633: remove the desirable_for_exit field

* GH-633: rename server_name to server_name_opt inside AddReturnRouteMessage

* GH-633: remove problems due to change in NodeRecordMetadata structure inside multinode integration tests

* GH-633: use lifetime specifier instead of cloning the hostname as a String

* GH-633: Review 2 changes

* GH-633: refactor the code isnide handle_dns_resolve_failure()

* Partial multinode test

* GH-633 Test is written, but doesn't pass yet

* GH-633 New multinode test passes, but suspiciously

* GH-633 Multinode test working, but failing; plus some light mods

* Removed warnings

* GH-499: Made ProxyServer picky about main and alias keys; fixed CryptDENull to panic about mismatched keys

* There's something funky about the way Standard Gossip is processed that produces a half neighborship where there should be a full neighborship

* GH-633: Test works better

* GH-633: remove clippy warnings

* GH-633: fix the failing test

* Multinode test is still failing, but more successfully than ever before

* GH-633: Commented out part of multinode test that doesn't pass in order to consider a new card

* GH-633: minor review changes inside proxy_server/mod.rs

* GH-633: formatting changes

* GH-633: remove clippy warnings

* GH-633: increase version

* GH-633: rename field to originator_public_key

* GH-631: Did more fixing on the blockchain multinode test

* GH-633: An attempt to remove the warnings inside the multinode test

* GH-633: change the version number of libc from 2.36-4 to 2.36-6

* GH-633: implement alias_public_key
() and absorb_configuration() for MASQRealNode

* GH-633: trying to fix the multinode test errors

* GH-633: rename the field back to originator_alias_public_key

* GH-633: remove clippy warnings from the multinode tests

* GH-611: remove unused import from the file communication_failure_test.rs

* GH-633: remove warnings from the connection_termination_test.rs

* GH-633: Added some time for example.com to respond

* GH-633: fixing to right use of cryptdes on decrypting cores packages as the routing service

* GH-633: fix one test in the routing_service.rs

* GH-633: modify helper functions and fix the test logs_and_ignores_message_that_cannot_be_decrypted

* GH-633: fix test route_logs_and_ignores_cores_package_that_demands_proxy_client_routing_with_paying_wallet_that_cant_pay

* GH-633: fix test converts_live_message_to_expired_for_existing_proxy_client

* GH-633: continue with Bert

* GH-633: add some panics and eprintlns for debugging

* GH-633: fix all tests in routing_service.rs

* GH-633: add a todo

* GH-633: fix the integration test

* GH-633: fix test reported_server_drop

* GH-633: fix of an issue with fatal instance dropping: seeking for a decent solution of that need for allowence of post-creation configuration of MASQMockNode

* GH-633(for bert): Review 1 Changes (#228)

* GH-633: fix the test symmetric_encryption_fails_with_different_keys (only failing on IDE)

* GH-633: remove the to_hex function

* GH-633: reduce the thread sleep by 1 sec inside the bookkeeping test

* GH-633: remove the lazy_static inside the test module of the file routing_service.rs

* GH-633: review changes for the routing_service.rs

* GH-633: add test route_data_to_peripheral_component_uses_main_key_on_payload_for_hopper

* GH-633: add review changes for gossip_acceptor.rs

* GH-633: further changes in gossip_acceptor.rs

* GH-633: compose message only if log level is debug

* GH-633: typecast payload_size to u64

* GH-633: improve the trace log for calculating undesirability of the DNS Resolution failure

* GH-633: further review changes for the src/neighborhood/mod.rs

* GH-633: join filter and map to form filter_map

* GH-633: add diagram to the test standard_gossip_containing_unfamiliar_node_addrs_leads_to_them_being_ignored

* GH-633: add review changes for the src/proxy_client/mod.rs

* GH-633: rename variables in verify_sigature()

* GH-633: use the 2 functions inside impl block of RatePack in production code

* GH-633: bring back the test id_returns_error_when_the_id_fails_to_decrypt

* GH-633: rename utility function to make_route_to_proxy_client()

* GH-633: improve comment and rename variables in the function make_round_trip_route

* GH-633: fix the problem with the match arm in compute_new_undesirability

* GH-633: represent pub key in hex

* GH-633: remove the commented out code after migrating it to a new card

* GH-633: add assertions for dns error response inside the multinode test

* GH-633: change host_name to hostname inside the NRMetadataChange::AddUnreachableHost

* GH-633: formatting fixes

* GH-633: make the assertions alive inside the multinode test and add a new todo

* GH-633 (for bert): Review 2 Changes (#231)

* GH-633: function rename to add_src_node_as_half_neighbor

* GH-633: improve diagram for the test standard_gossip_containing_unfamiliar_node_addrs_leads_to_them_being_ignored

* GH-633: improve the way debug message is built

* GH-633: improve assertion for logs for fn computing_undesirability_works_for_exit_on_over_leg_for_blacklisted_host

* GH-633: rename variables inside fn verify_signature

* GH-633: rename the fn name to make_one_way_route_to_proxy_client

* GH-633: formatiing changes

* GH-633: remove blank line

* GH-633: remove unnecessary comment inside the test

* GH-633: attempt to fix build errors

* GH-671: removing www.failingFailing.com as non-http anymore for www.neverssl.com

* GH-633: fix formatting issues

* GH-633: correction of a non-ideal design for a configurable mock node handle

* GH-633: fix the test symmetric_encryption_fails_with_different_keys

* GH-633: fix formatting issues

* GH-633: review five (#235)

* GH-633-after-review-four: addressed things from the review

* GH-633: another try to implement the mutable MASQMockNode even better, huh

* GH-633-after-review-four: a little change in function name

---------

Co-authored-by: Bert <Bert@Bert.com>

* GH-633: bump the version to 0.7.2

---------

Co-authored-by: Dan Wiebe <dnwiebe@gmail.com>
Co-authored-by: masqrauder <60554948+masqrauder@users.noreply.github.com>
Co-authored-by: Bert <Bert@Bert.com>
Co-authored-by: Bert <65427484+bertllll@users.noreply.github.com>

* Added review changes - all test passing

* GH-679: Create a script for bumping version (#242)

* initialize bump_version script

* GH-679: add the ability to generate lockfile

* GH-679: minor improvements

* GH-679: add the ability to print the names of failed crates

* GH-679: conditionally print the output message

* GH-679: remove the error coming from the asterisk

* GH-679: iterate through loops for the crates

* GH-679: check if the right number of args were supplied

* GH-679: quotes cleanup

* GH-679: improve the regex

* GH-679: decouple pattern from the sed command

* GH-679: check the pattern with grep

* GH-679: conditionally print message for failed crates

* GH-679: migrate pushd and popd to the for loop

* GH-679: add the ability to find crates

* GH-679: review 2 changes

* GH-541-review-1: Resolved review comments from db_migrator.rs

* GH-544 - removing wrap_to_ok() and wrap_to_error()  (#246)

* Remove useless code utility #544

* replace wrap_to_ok() with Ok() in mock.rs line 626

* bumped port_exposer version

* removing dead code and fix formatting

---------

Co-authored-by: Vojtěch Parkán <vojtechparkan@Vojtechs-iMac.home>

* GH-677:  Refactor the extremely long function `handle_dispatcher_node_query_response()` (#236)

* Actor StreamHandlerPool and friends renamed to NeighborStreamHandlerPool

* More cleanup renaming

* One more...

* code formatting

* Big method is broken into three; needs more

* Big match statement is broken into three methods. Possibly more to come.

* Doesn't work; StreamStarter needs to be split and renamed

* Closer, but still doesn't work

* Make success and failure handler inside the open_new_stream_and_recycle_message

* Modify the way we return results

* Rename function name and variable

* Changed an error message

* Appeased clippy

* Appeased formatter

* master-commented: Corrected TODO comment

* GH-677: add the comment over stream_handler_pool, to make it easier to differentiate from the other

* GH-677: revert the rename to StreamHandlerPool

* GH-677: revert the rename to StreamHandlerPoolSubs

* GH-677: revert the rename to StreamHandlerPoolCluster

* GH-677: revert the name from NeighborPublicKey to Key inside the enum Endpoint

* GH-677: rename the filename from neighbor_stream_handler_pool.rs to stream_handler_pool.rs

* GH-677: rename NeighborStreamHandlerPool to StreamHandlerPool at other places

* GH-677: revert rename in the reamining places

* GH-677: rename in crash_command.rs

* GH-677: change the debug to an error

* GH-677: remove the comment 'way to big'

* GH-671: removing www.failingFailing.com as non-http anymore for www.neverssl.com

* GH-677: fix formatting issue

* GH-677: fix the multiple_stream_zero_hop_test

* GH-677: wrote test log_an_error_when_it_fails_to_send_a_packet

* GH-677: review 2 changes

* GH-677: review 3 changes

---------

Co-authored-by: Dan Wiebe <dnwiebe@gmail.com>
Co-authored-by: Bert <Bert@Bert.com>

* GH-541-review-2: Finished review comments

* GH-541-review-2: amended changes & increassed sleep duration

* GH-541-review-2: Fix merge issues

---------

Co-authored-by: Utkarsh Gupta <32920299+utkarshg6@users.noreply.github.com>
Co-authored-by: Dan Wiebe <dnwiebe@gmail.com>
Co-authored-by: masqrauder <60554948+masqrauder@users.noreply.github.com>
Co-authored-by: Bert <Bert@Bert.com>
Co-authored-by: Bert <65427484+bertllll@users.noreply.github.com>
Co-authored-by: Czarte <czarte@gmail.com>
Co-authored-by: Vojtěch Parkán <vojtechparkan@Vojtechs-iMac.home>
  • Loading branch information
8 people authored Mar 27, 2023
1 parent 96f55d8 commit fca1b15
Show file tree
Hide file tree
Showing 70 changed files with 2,229 additions and 1,031 deletions.
4 changes: 2 additions & 2 deletions automap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion automap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "automap"
version = "0.7.0"
version = "0.7.2"
authors = ["Dan Wiebe <dnwiebe@gmail.com>", "MASQ"]
license = "GPL-3.0-only"
copyright = "Copyright (c) 2019-2021, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."
Expand Down
3 changes: 2 additions & 1 deletion ci/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ echo "*** AUTOMAP HEAD
cd "$CI_DIR/../automap"
ci/all.sh "$PARENT_DIR"
echo "*** AUTOMAP TAIL ***"
echo "*********************************************************************************************************"
echo "*********************************************************************************************************"

64 changes: 64 additions & 0 deletions ci/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

if [ $# != 1 ]
then
echo "Please provide version as the first argument"
exit 1
fi

version="$1"
CI_DIR="$( cd "$( dirname "$0" )" && pwd )"
pushd "$CI_DIR/../"

echo "Searching for crates..."

crates=($(find . -type d -exec bash -c '[ -f "$0"/Cargo.toml ]' '{}' \; -print))

if [[ "${#crates[@]}" == "0" ]]; then
echo "No crates found."
exit 1
else
echo "Found ${#crates[@]} crate(s): ${crates[*]}"
fi

file=Cargo.toml
final_exit_code=0
declare -a grep_failures
declare -a lockfile_failures

bump_version() {
# Catches every `version` that begins a line and doesn't end with a comma.
find_pattern='^version\s*=.*[^,]\s*$'
replace_pattern='s/'$find_pattern'/version = "'"$version"'"/'

grep -q "$find_pattern" "$file" && sed -i "$replace_pattern" "$file"
exit_code="$?"
if [[ "$exit_code" != "0" ]]; then
final_exit_code=1
grep_failures+=($1)
return
fi

cargo generate-lockfile
exit_code="$?"
if [[ "$exit_code" != "0" ]]; then
final_exit_code=1
lockfile_failures+=($1)
fi
}

for crate in "${crates[@]}"
do
pushd "$crate"
bump_version "$crate"
popd
done

if [[ $final_exit_code != 0 ]]; then
[[ "${#grep_failures[@]}" != "0" ]] && echo "Failed to find 'version' for ${#grep_failures[@]} crate(s): ${grep_failures[*]}"
[[ "${#lockfile_failures[@]}" != "0" ]] && echo "Failed to generate lockfile for ${#lockfile_failures[@]} crate(s): ${lockfile_failures[*]}"
else
echo "The version number has been changed to $version."
fi

exit $final_exit_code
4 changes: 2 additions & 2 deletions dns_utility/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dns_utility/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dns_utility"
version = "0.7.1"
version = "0.7.2"
license = "GPL-3.0-only"
authors = ["Dan Wiebe <dnwiebe@gmail.com>", "MASQ"]
copyright = "Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."
Expand Down
2 changes: 1 addition & 1 deletion masq/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "masq"
version = "0.7.1"
version = "0.7.2"
authors = ["Dan Wiebe <dnwiebe@gmail.com>", "MASQ"]
license = "GPL-3.0-only"
copyright = "Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."
Expand Down
13 changes: 6 additions & 7 deletions masq/src/terminal/terminal_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::terminal::secondary_infrastructure::{
use linefeed::{Interface, Signal};
use masq_lib::command::StdStreams;
use masq_lib::constants::MASQ_PROMPT;
use masq_lib::utils::WrapResult;
use std::sync::Arc;

#[cfg(not(test))]
Expand Down Expand Up @@ -65,8 +64,9 @@ impl TerminalWrapper {
if std::env::var(prod_cfg::MASQ_TEST_INTEGRATION_KEY)
.eq(&Ok(prod_cfg::MASQ_TEST_INTEGRATION_VALUE.to_string()))
{
TerminalWrapper::new(Arc::new(prod_cfg::IntegrationTestTerminal::default()))
.wrap_to_ok()
Ok(TerminalWrapper::new(Arc::new(
prod_cfg::IntegrationTestTerminal::default(),
)))
} else {
//we have no positive test aimed at this (only negative and as an integration test)
Self::configure_interface_generic(Box::new(prod_cfg::DefaultTerminal::new))
Expand All @@ -80,11 +80,10 @@ impl TerminalWrapper {
F: FnOnce() -> std::io::Result<TerminalType>,
TerminalType: linefeed::Terminal + 'static,
{
Self::new(Arc::new(interface_configurator(
Ok(Self::new(Arc::new(interface_configurator(
terminal_creator_of_certain_type,
Box::new(Interface::with_term),
)?))
.wrap_to_ok()
)?)))
}
}

Expand All @@ -109,7 +108,7 @@ where

set_all_settable_parameters(interface.as_mut())?;

TerminalReal::new(interface).wrap_to_ok()
Ok(TerminalReal::new(interface))
}

fn set_all_settable_parameters<I>(interface: &mut I) -> Result<(), String>
Expand Down
3 changes: 1 addition & 2 deletions masq/src/test_utils/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use masq_lib::command::StdStreams;
use masq_lib::constants::DEFAULT_UI_PORT;
use masq_lib::test_utils::fake_stream_holder::{ByteArrayWriter, ByteArrayWriterInner};
use masq_lib::ui_gateway::MessageBody;
use masq_lib::utils::WrapResult;
use std::cell::RefCell;
use std::fmt::Arguments;
use std::io::{Read, Write};
Expand Down Expand Up @@ -624,7 +623,7 @@ impl InterfaceWrapper for InterfaceRawMock {
if let Err(err) = taken_result {
Err(err)
} else {
(taken_result.unwrap() as Box<dyn WriterLock + 'static>).wrap_to_ok()
Ok(taken_result.unwrap() as Box<dyn WriterLock + 'static>)
}
}

Expand Down
2 changes: 1 addition & 1 deletion masq_lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "masq_lib"
version = "0.7.1"
version = "0.7.2"
authors = ["Dan Wiebe <dnwiebe@gmail.com>", "MASQ"]
license = "GPL-3.0-only"
copyright = "Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."
Expand Down
3 changes: 1 addition & 2 deletions masq_lib/src/multi_config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved.

use crate::shared_schema::{ConfiguratorError, ParamError};
use crate::utils::WrapResult;
#[allow(unused_imports)]
use clap::{value_t, values_t};
use clap::{App, ArgMatches};
Expand Down Expand Up @@ -78,7 +77,7 @@ impl<'a> MultiConfig<'a> {
_ => return Err(Self::make_configurator_error(e)),
},
};
MultiConfig { arg_matches }.wrap_to_ok()
Ok(MultiConfig { arg_matches })
}

pub fn make_configurator_error(e: clap::Error) -> ConfiguratorError {
Expand Down
2 changes: 1 addition & 1 deletion masq_lib/src/ui_traffic_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ mod tests {

#[test]
fn new_unmarshaling_handles_badly_typed_json() {
let json = r#"[1, 2, 3, 4]"#;
let json = "[1, 2, 3, 4]";

let result = UiTrafficConverter::new_unmarshal_from_ui(json, 1234);

Expand Down
19 changes: 0 additions & 19 deletions masq_lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,25 +314,6 @@ fn expect_value_panic(subject: &str, found: Option<&dyn fmt::Debug>) -> ! {
)
}

pub trait WrapResult {
fn wrap_to_ok<E>(self) -> Result<Self, E>
where
Self: Sized;
fn wrap_to_err<T>(self) -> Result<T, Self>
where
Self: Sized;
}

impl<T> WrapResult for T {
fn wrap_to_ok<E>(self) -> Result<Self, E> {
Ok(self)
}

fn wrap_to_err<V>(self) -> Result<V, Self> {
Err(self)
}
}

pub fn type_name_of<T>(_examined: T) -> &'static str {
std::any::type_name::<T>()
}
Expand Down
2 changes: 1 addition & 1 deletion multinode_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "multinode_integration_tests"
version = "0.7.1"
version = "0.7.2"
authors = ["Dan Wiebe <dnwiebe@gmail.com>", "MASQ"]
license = "GPL-3.0-only"
copyright = "Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."
Expand Down
2 changes: 1 addition & 1 deletion multinode_integration_tests/docker_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

OUTPUT_DIR="$1"
mkdir -p "$OUTPUT_DIR"
for container in $(docker ps -a | tail -n +2 | cut -c 128- | grep test_node_)
for container in $(docker ps -a | tail -n +2 | cut -c 177- | grep test_node_)
do
./docker_logs.sh "$container" > "$OUTPUT_DIR"/"$container".log
done
Loading

0 comments on commit fca1b15

Please sign in to comment.