Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
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
2 changes: 1 addition & 1 deletion masq/src/commands/setup_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ mod tests {
"zero-hop".to_string(),
"--log-level".to_string(),
"--chain".to_string(),
"polygon-mainnet".to_string(),
DEFAULT_CHAIN.rec().literal_identifier.to_string(),
"--scan-intervals".to_string(),
"123|111|228".to_string(),
"--scans".to_string(),
Expand Down
8 changes: 4 additions & 4 deletions masq/tests/chain_specific_directory_test_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn ensure_data_directory_has_specific_chain_directory_within_integration() {
let mut masq_handle2 = MasqProcess::new().start_interactive(port, true);
let mut stdin_handle = masq_handle2.create_stdin_handle();

stdin_handle.type_command("setup --data-directory /home/booga/masqhome/polygon-mainnet");
stdin_handle.type_command("setup --data-directory /home/booga/masqhome/base-mainnet");

thread::sleep(Duration::from_millis(1000));

Expand All @@ -29,12 +29,12 @@ fn ensure_data_directory_has_specific_chain_directory_within_integration() {
let (stdout2, _stderr2, _exit_code2) = masq_handle2.stop();
let expected = format!(
"{:29} {:64} {}",
"data-directory", "/home/booga/masqhome/polygon-mainnet", "Set"
"data-directory", "/home/booga/masqhome/base-mainnet", "Set"
);

assert!(
!stdout.contains("MASQ/polygon-mainnet/MASQ/polygon-mainnet Default"),
"Wrong directory: duplication of /MASQ/polygon-mainnet when Default"
!stdout.contains("MASQ/base-mainnet/MASQ/base-mainnet Default"),
"Wrong directory: duplication of /MASQ/base-mainnet when Default"
);
assert!(
stdout2.contains(&expected),
Expand Down
4 changes: 2 additions & 2 deletions masq_lib/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::blockchains::chains::Chain;
use crate::data_version::DataVersion;
use const_format::concatcp;

pub const DEFAULT_CHAIN: Chain = Chain::PolyMainnet;
pub const DEFAULT_CHAIN: Chain = Chain::BaseMainnet;
pub const CURRENT_SCHEMA_VERSION: usize = 11;

pub const HIGHEST_RANDOM_CLANDESTINE_PORT: u16 = 9999;
Expand Down Expand Up @@ -113,7 +113,7 @@ mod tests {

#[test]
fn constants_have_correct_values() {
assert_eq!(DEFAULT_CHAIN, Chain::PolyMainnet);
assert_eq!(DEFAULT_CHAIN, Chain::BaseMainnet);
assert_eq!(HIGHEST_RANDOM_CLANDESTINE_PORT, 9999);
assert_eq!(HTTP_PORT, 80);
assert_eq!(TLS_PORT, 443);
Expand Down
4 changes: 2 additions & 2 deletions masq_lib/src/multi_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::shared_schema::{ConfiguratorError, ParamError};
#[allow(unused_imports)]
use clap::{value_t, values_t};
use clap::{App, ArgMatches};
use clap::{App, ArgMatches, Error};
use regex::Regex;
use std::collections::HashSet;
use std::fmt::{Debug, Display, Formatter};
Expand Down Expand Up @@ -102,7 +102,7 @@ impl<'a> MultiConfig<'a> {
}
}

pub fn make_configurator_error(e: clap::Error) -> ConfiguratorError {
pub fn make_configurator_error(e: Error) -> ConfiguratorError {
let invalid_value_patterns = vec![
("Invalid value for '--(.*?) <.*>': (.*)$", 1, 2),
("error: (.*) isn't a valid value for '--(.*?) <.*>'", 2, 1),
Expand Down
20 changes: 14 additions & 6 deletions masq_lib/src/shared_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ use lazy_static::lazy_static;
pub const BLOCKCHAIN_SERVICE_HELP: &str =
"The Ethereum client you wish to use to provide Blockchain \
exit services from your MASQ Node (e.g. http://localhost:8545, \
https://ropsten.infura.io/v3/YOUR-PROJECT-ID, https://mainnet.infura.io/v3/YOUR-PROJECT-ID), \
https://base-mainnet.g.alchemy.com/v2/d66UL0lPrltmweEqVsv3opBSVI3wkL8I, \
https://polygon-mainnet.infura.io/v3/YOUR-PROJECT-ID";
https://ropsten.infura.io/v3/<api-key>, https://mainnet.infura.io/v3/<api-key>), \
https://base-mainnet.g.alchemy.com/<api-key>, https://polygon-mainnet.infura.io/v3/<api-key> \n \
This argument is mandatory, to ensure that you will not be deliquency banned due to being unable to \
pay your debts to MASQ network. If you are in a region where you have no access to blockchain \
services, to create your own app, use one of following the public endpoints for Base Mainnet \
(you need to specify `--chain base-mainnet` as the chain argument): \n\
https://mainnet.base.org \nhttps://base.llamarpc.com \nhttps://1rpc.io/base \nhttps://base-rpc.publicnode.com";
pub const CHAIN_HELP: &str =
"The blockchain network MASQ Node will configure itself to use. You must ensure the \
Ethereum client specified by --blockchain-service-url communicates with the same blockchain network.";
Expand Down Expand Up @@ -733,9 +737,13 @@ mod tests {
BLOCKCHAIN_SERVICE_HELP,
"The Ethereum client you wish to use to provide Blockchain \
exit services from your MASQ Node (e.g. http://localhost:8545, \
https://ropsten.infura.io/v3/YOUR-PROJECT-ID, https://mainnet.infura.io/v3/YOUR-PROJECT-ID), \
https://base-mainnet.g.alchemy.com/v2/d66UL0lPrltmweEqVsv3opBSVI3wkL8I, \
https://polygon-mainnet.infura.io/v3/YOUR-PROJECT-ID"
https://ropsten.infura.io/v3/<api-key>, https://mainnet.infura.io/v3/<api-key>), \
https://base-mainnet.g.alchemy.com/<api-key>, https://polygon-mainnet.infura.io/v3/<api-key> \n \
This argument is mandatory, to ensure that you will not be deliquency banned due to being unable to \
pay your debts to MASQ network. If you are in a region where you have no access to blockchain \
services, to create your own app, use one of following the public endpoints for Base Mainnet \
(you need to specify `--chain base-mainnet` as the chain argument): \n\
https://mainnet.base.org \nhttps://base.llamarpc.com \nhttps://1rpc.io/base \nhttps://base-rpc.publicnode.com"
);
assert_eq!(
CHAIN_HELP,
Expand Down
10 changes: 10 additions & 0 deletions multinode_integration_tests/tests/bookkeeping_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use multinode_integration_tests_lib::utils::{payable_dao, receivable_dao};
use node_lib::accountant::db_access_objects::payable_dao::PayableAccount;
use node_lib::accountant::db_access_objects::receivable_dao::ReceivableAccount;
use node_lib::accountant::db_access_objects::utils::CustomQuery;
use node_lib::sub_lib::neighborhood::RatePack;
use node_lib::sub_lib::wallet::Wallet;
use std::collections::HashMap;
use std::thread;
Expand Down Expand Up @@ -116,6 +117,15 @@ pub fn start_real_node(cluster: &mut MASQNodeCluster, neighbor: NodeReference) -
.neighbor(neighbor)
.earning_wallet_info(make_earning_wallet_info(&index.to_string()))
.chain(cluster.chain)
.rate_pack(RatePack {
//TODO in case we are going to test more scenarios with need of higher RatePack:
// create method in RatePack to return Default RatePack increased by some value or factor
// make sure there is a test for this method
routing_byte_rate: 2000000000,
routing_service_rate: 2000000000,
exit_byte_rate: 2000000000,
exit_service_rate: 2000000000,
})
.build(),
)
}
5 changes: 3 additions & 2 deletions node/src/accountant/db_access_objects/receivable_dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ impl ReceivableDao for ReceivableDaoReal {
}

fn custom_query(&self, custom_query: CustomQuery<i64>) -> Option<Vec<ReceivableAccount>> {
let variant_top = TopStmConfig{
let variant_top = TopStmConfig {
limit_clause: "limit :limit_count",
gwei_min_resolution_clause: "where (balance_high_b > 0) or ((balance_high_b = 0) and (balance_low_b >= 1000000000))",
gwei_min_resolution_clause:
"where (balance_high_b > 0) or ((balance_high_b = 0) and (balance_low_b >= 1000000000))",
age_ordering_clause: "last_received_timestamp asc",
};
let variant_range = RangeStmConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ mod tests {
result,
HashAndAmount {
hash: H256::from_str(
"94881436a9c89f48b01651ff491c69e97089daf71ab8cfb240243d7ecf9b38b2"
"1931f78f7ce5b43ffae11a2c22f18765508a2b2d4810e84744f53b10f7072c7f"
)
.unwrap(),
amount: account.balance_wei
Expand Down Expand Up @@ -453,14 +453,14 @@ mod tests {
vec![
HashAndAmount {
hash: H256::from_str(
"94881436a9c89f48b01651ff491c69e97089daf71ab8cfb240243d7ecf9b38b2"
"1931f78f7ce5b43ffae11a2c22f18765508a2b2d4810e84744f53b10f7072c7f"
)
.unwrap(),
amount: 1000000000
},
HashAndAmount {
hash: H256::from_str(
"3811874d2b73cecd51234c94af46bcce918d0cb4de7d946c01d7da606fe761b5"
"0d6daf751e62b89e79cac26d6376cf259d58e996cfccd63f3f43bb6408d1bae8"
)
.unwrap(),
amount: 2000000000
Expand Down Expand Up @@ -648,14 +648,14 @@ mod tests {
Correct(PendingPayable {
recipient_wallet: accounts[0].wallet.clone(),
hash: H256::from_str(
"35f42b260f090a559e8b456718d9c91a9da0f234ed0a129b9d5c4813b6615af4",
"7bff7fd8e627d317203742a40f77be1a4155b4c3a29dfd4f96088775f0237023",
)
.unwrap(),
}),
Correct(PendingPayable {
recipient_wallet: accounts[1].wallet.clone(),
hash: H256::from_str(
"7f3221109e4f1de8ba1f7cd358aab340ecca872a1456cb1b4f59ca33d3e22ee3",
"5bc60cce367d9698b8dbdb340e2af3a3166bb4469e69db899f5074938ea0d61b",
)
.unwrap(),
}),
Expand All @@ -678,8 +678,8 @@ mod tests {
let expected_result = Err(Sending {
msg: format!("Transport error: Error(Connect, Os {{ code: {}, kind: ConnectionRefused, message: {:?} }})", os_code, os_msg).to_string(),
hashes: vec![
H256::from_str("35f42b260f090a559e8b456718d9c91a9da0f234ed0a129b9d5c4813b6615af4").unwrap(),
H256::from_str("7f3221109e4f1de8ba1f7cd358aab340ecca872a1456cb1b4f59ca33d3e22ee3").unwrap()
H256::from_str("7bff7fd8e627d317203742a40f77be1a4155b4c3a29dfd4f96088775f0237023").unwrap(),
H256::from_str("5bc60cce367d9698b8dbdb340e2af3a3166bb4469e69db899f5074938ea0d61b").unwrap()
],
});

Expand Down Expand Up @@ -719,7 +719,7 @@ mod tests {
data: None,
}),
recipient_wallet: accounts[0].wallet.clone(),
hash: H256::from_str("35f42b260f090a559e8b456718d9c91a9da0f234ed0a129b9d5c4813b6615af4").unwrap(),
hash: H256::from_str("7bff7fd8e627d317203742a40f77be1a4155b4c3a29dfd4f96088775f0237023").unwrap(),
}),
Failed(RpcPayableFailure {
rpc_error: Rpc(Error {
Expand All @@ -728,7 +728,7 @@ mod tests {
data: None,
}),
recipient_wallet: accounts[1].wallet.clone(),
hash: H256::from_str("7f3221109e4f1de8ba1f7cd358aab340ecca872a1456cb1b4f59ca33d3e22ee3").unwrap(),
hash: H256::from_str("5bc60cce367d9698b8dbdb340e2af3a3166bb4469e69db899f5074938ea0d61b").unwrap(),
}),
]);

Expand Down Expand Up @@ -758,7 +758,7 @@ mod tests {
let expected_result = Ok(vec![
Correct(PendingPayable {
recipient_wallet: accounts[0].wallet.clone(),
hash: H256::from_str("35f42b260f090a559e8b456718d9c91a9da0f234ed0a129b9d5c4813b6615af4").unwrap(),
hash: H256::from_str("7bff7fd8e627d317203742a40f77be1a4155b4c3a29dfd4f96088775f0237023").unwrap(),
}),
Failed(RpcPayableFailure {
rpc_error: Rpc(Error {
Expand All @@ -767,7 +767,7 @@ mod tests {
data: None,
}),
recipient_wallet: accounts[1].wallet.clone(),
hash: H256::from_str("7f3221109e4f1de8ba1f7cd358aab340ecca872a1456cb1b4f59ca33d3e22ee3").unwrap(),
hash: H256::from_str("5bc60cce367d9698b8dbdb340e2af3a3166bb4469e69db899f5074938ea0d61b").unwrap(),
}),
]);

Expand Down
2 changes: 1 addition & 1 deletion node/src/blockchain/blockchain_interface_initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mod tests {

#[test]
#[should_panic(expected = "Invalid blockchain service URL \"http://λ:8545\". \
Error: Transport(\"InvalidUri(InvalidUriChar)\"). Chain: polygon-mainnet")]
Error: Transport(\"InvalidUri(InvalidUriChar)\"). Chain: base-mainnet")]
fn invalid_blockchain_url_for_produces_panic_for_web3_interface() {
let blockchain_service_url = "http://λ:8545";
let subject = BlockchainInterfaceInitializer {};
Expand Down
35 changes: 32 additions & 3 deletions node/src/bootstrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,8 @@ mod tests {
subject
.initialize_as_unprivileged(
&make_simplified_multi_config([
"--blockchain-service-url",
"https://booga.com",
"--ip",
"1.2.3.4",
"--clandestine-port",
Expand Down Expand Up @@ -1276,7 +1278,14 @@ mod tests {

subject
.initialize_as_unprivileged(
&make_simplified_multi_config(["--ip", "1.2.3.4", "--clandestine-port", "5123"]),
&make_simplified_multi_config([
"--blockchain-service-url",
"https://booga.com",
"--ip",
"1.2.3.4",
"--clandestine-port",
"5123",
]),
&mut FakeStreamHolder::new().streams(),
)
.unwrap();
Expand Down Expand Up @@ -1323,6 +1332,8 @@ mod tests {
subject
.initialize_as_unprivileged(
&make_simplified_multi_config([
"--blockchain-service-url",
"https://booga.com",
"--data-directory",
data_dir.to_str().unwrap(),
"--clandestine-port",
Expand Down Expand Up @@ -1361,7 +1372,14 @@ mod tests {

subject
.initialize_as_unprivileged(
&make_simplified_multi_config(["--ip", "1.2.3.4", "--gas-price", "11"]),
&make_simplified_multi_config([
"--blockchain-service-url",
"https://booga.com",
"--ip",
"1.2.3.4",
"--gas-price",
"11",
]),
&mut FakeStreamHolder::new().streams(),
)
.unwrap();
Expand Down Expand Up @@ -1436,6 +1454,8 @@ mod tests {
"init_as_privileged_stores_dns_servers_and_passes_them_to_actor_system_factory_for_proxy_client_in_init_as_unprivileged",
);
let args = [
"--blockchain-service-url",
"https://booga.com",
"--dns-servers",
"1.2.3.4,2.3.4.5",
"--ip",
Expand Down Expand Up @@ -1495,7 +1515,12 @@ mod tests {
.build();

subject
.initialize_as_privileged(&make_simplified_multi_config(["--ip", "111.111.111.111"]))
.initialize_as_privileged(&make_simplified_multi_config([
"--blockchain-service-url",
"https://booga.com",
"--ip",
"111.111.111.111",
]))
.unwrap();
}

Expand Down Expand Up @@ -1622,6 +1647,8 @@ mod tests {
subject
.initialize_as_unprivileged(
&make_simplified_multi_config([
"--blockchain-service-url",
"https://booga.com",
"--clandestine-port",
"1234",
"--ip",
Expand Down Expand Up @@ -1649,6 +1676,8 @@ mod tests {
let data_dir = ensure_node_home_directory_exists("bootstrapper", "initialize_as_unprivileged_moves_streams_from_listener_handlers_to_stream_handler_pool");
init_test_logging();
let args = [
"--blockchain-service-url",
"https://booga.com",
"--ip",
"111.111.111.111",
"--data-directory",
Expand Down
Loading
Loading