Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8aa7bed
PersistentConfiguration now handles CryptDEs
dnwiebe Apr 29, 2025
02e059c
Temporary commit
dnwiebe May 21, 2025
b49606b
All tests apparently passing
dnwiebe May 29, 2025
c3d18a3
Starting to deal with the consequences of removing CryptDE as a static
dnwiebe Jun 27, 2025
c6887b9
About two-thirds done.
dnwiebe Jun 27, 2025
0b5a864
All unit tests passing
dnwiebe Jun 30, 2025
c66e762
New integration test is passing
dnwiebe Jul 1, 2025
a42c445
Merged in master
dnwiebe Jul 1, 2025
7295793
Unit, integration, and multinode tests passing
dnwiebe Jul 2, 2025
e3d2126
Review issues
dnwiebe Jul 3, 2025
b89a378
Removed two fields from BootstrapperConfig
dnwiebe Jul 3, 2025
2468554
Formatting
dnwiebe Jul 3, 2025
4437d36
Review issues
dnwiebe Jul 4, 2025
1bba5fe
Removed unused second parameter to CrashTestDummy constructor
dnwiebe Jul 4, 2025
828a354
Formatting
dnwiebe Jul 4, 2025
55334db
Changing the way database passwords are established
dnwiebe Jul 10, 2025
04c0365
Formatting
dnwiebe Jul 10, 2025
2f16112
Trying to find issue with --fake-public-key and chain
dnwiebe Jul 16, 2025
e6707e3
Multinode tests and unit tests are working.
dnwiebe Jul 16, 2025
4dfb97f
Formatting and removing debug logs
dnwiebe Jul 16, 2025
4671266
Removed unused import
dnwiebe Jul 16, 2025
09f953e
Clippy appeasement
dnwiebe Jul 17, 2025
c76a5bb
Review issues
dnwiebe Jul 18, 2025
ccd602d
Formatting
dnwiebe Jul 18, 2025
e52c338
Switched test from example.com to testingmcafeesites.com
dnwiebe Jul 19, 2025
83e37fa
Made running single integration tests easier; added TLS retries to in…
dnwiebe Jul 21, 2025
8d060fe
Formatting
dnwiebe Jul 21, 2025
7cf6856
Race in setup_reporter removed
dnwiebe Jul 29, 2025
843570b
Increased a timeout
dnwiebe Jul 30, 2025
c5c94db
Formatting
dnwiebe Jul 30, 2025
2fc19f1
example.com -> www.example.com
dnwiebe Jul 30, 2025
45f2e17
Review issues
dnwiebe Jul 31, 2025
49ac096
SetupReporter tests are modified and passing
dnwiebe Aug 1, 2025
b10a1d1
Parsing command-line parameter
dnwiebe Aug 2, 2025
fc0092a
Implemented --new-public-key
dnwiebe Aug 3, 2025
f8e49d9
--new-public-key default is now '' / Blank
dnwiebe Aug 4, 2025
f2fded4
Review issues
dnwiebe Aug 5, 2025
2de18ad
Merged in master
dnwiebe Sep 1, 2025
dabeddb
Now we know what to do, but there's a missing test
dnwiebe Sep 17, 2025
0692008
Now the GH-623 problem should be fixed
dnwiebe Sep 17, 2025
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
33 changes: 31 additions & 2 deletions masq_lib/src/shared_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::constants::{
POLYGON_MAINNET_FULL_IDENTIFIER,
};
use crate::crash_point::CrashPoint;
use clap::{App, Arg};
use clap::{arg_enum, App, Arg};
use lazy_static::lazy_static;

pub const BLOCKCHAIN_SERVICE_HELP: &str =
Expand Down Expand Up @@ -77,6 +77,17 @@ pub const NEIGHBORS_HELP: &str = "One or more Node descriptors for running Nodes
if you don't specify a neighbor, your Node will start without being connected to any MASQ \
Network, although other Nodes will be able to connect to yours if they know your Node's descriptor. \
--neighbors is meaningless in --neighborhood-mode zero-hop.";
pub const NEW_PUBLIC_KEY_HELP: &str = "Whenever you start it, the Node will try to use the same public key \
it used last time. That's '--new-public-key off'. If you want it to select a new public key when it \
starts, then specify '--new-public-key on', and you'll get a different one this time...which it will \
reuse next time unless you specify '--new-public-key on' again.\n\n\
You should be careful about restarting your Node with the same public key too quickly. If your new \
Node tries to join the Network before the Network has forgotten your old Node, every Node you try \
to connect to will ignore you.\n\n\
There are some conditions under which the Node cannot use the same public key it used last time: \
for example, if there was no last time, or if you don't specify a `--db-password`. Normally, in \
these situations, the Node will select a new public key and store it for future use; but if you \
explicitly demand the old public key with `--new-public-key off`, the Node will refuse to start.";

// generated valid encoded keys for future needs
// UJNoZW5p/PDVqEjpr3b+8jZ/93yPG8i5dOAgE1bhK+A
Expand Down Expand Up @@ -222,6 +233,14 @@ lazy_static! {
DEFAULT_GAS_PRICE);
}

arg_enum! {
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum OnOff {
On,
Off,
}
}

// These Args are needed in more than one clap schema. To avoid code duplication, they're defined here and referred
// to from multiple places.
pub fn chain_arg<'a>() -> Arg<'a, 'a> {
Expand Down Expand Up @@ -463,13 +482,23 @@ pub fn shared_app(head: App<'static, 'static>) -> App<'static, 'static> {
.min_values(0)
.help(NEIGHBORS_HELP),
)
.arg(
Arg::with_name("new-public-key")
.long("new-public-key")
.value_name("NEW-PUBLIC-KEY")
.takes_value(true)
.possible_values(&OnOff::variants())
.case_insensitive(true)
.help(NEW_PUBLIC_KEY_HELP),
)
.arg(real_user_arg())
.arg(
Arg::with_name("scans")
.long("scans")
.value_name("SCANS")
.takes_value(true)
.possible_values(&["on", "off"])
.possible_values(&OnOff::variants())
.case_insensitive(true)
.help(SCANS_HELP),
)
.arg(common_parameter_with_separate_u64_values(
Expand Down
4 changes: 4 additions & 0 deletions node/src/actor_system_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ mod tests {
data_directory: PathBuf::new(),
node_descriptor: NodeDescriptor::default(),
mapping_protocol_opt: None,
new_public_key_opt: None,
real_user: RealUser::null(),
neighborhood_config: NeighborhoodConfig {
mode: NeighborhoodMode::Standard(
Expand Down Expand Up @@ -1211,6 +1212,7 @@ mod tests {
cryptde_pair: CRYPTDE_PAIR.clone(),
mapping_protocol_opt: Some(Igdp),
real_user: RealUser::null(),
new_public_key_opt: None,
neighborhood_config: NeighborhoodConfig {
mode: NeighborhoodMode::Standard(
NodeAddr::new(&IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), &[1234, 2345]),
Expand Down Expand Up @@ -1507,6 +1509,7 @@ mod tests {
cryptde_pair: CRYPTDE_PAIR.clone(),
mapping_protocol_opt: None,
real_user: RealUser::null(),
new_public_key_opt: None,
neighborhood_config: NeighborhoodConfig {
mode: NeighborhoodMode::ConsumeOnly(vec![]),
min_hops: MIN_HOPS_FOR_TEST,
Expand Down Expand Up @@ -1690,6 +1693,7 @@ mod tests {
cryptde_pair: CRYPTDE_PAIR.clone(),
mapping_protocol_opt: None,
real_user: RealUser::null(),
new_public_key_opt: None,
neighborhood_config: NeighborhoodConfig {
mode: NeighborhoodMode::Standard(
NodeAddr::new(&IpAddr::V4(Ipv4Addr::new(1, 2, 3, 4)), &[]),
Expand Down
2 changes: 2 additions & 0 deletions node/src/bootstrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ pub struct BootstrapperConfig {
pub node_descriptor: NodeDescriptor,
pub cryptde_pair: CryptDEPair,
pub mapping_protocol_opt: Option<AutomapProtocol>,
pub new_public_key_opt: Option<bool>,
pub real_user: RealUser,
pub payment_thresholds_opt: Option<PaymentThresholds>,

Expand Down Expand Up @@ -406,6 +407,7 @@ impl BootstrapperConfig {
Box::new(CryptDEReal::disabled()),
),
mapping_protocol_opt: None,
new_public_key_opt: None,
real_user: RealUser::new(None, None, None),
payment_thresholds_opt: Default::default(),

Expand Down
56 changes: 54 additions & 2 deletions node/src/daemon/setup_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,26 @@ impl ValueRetriever for Neighbors {
}
}

struct NewPublicKey {}
impl ValueRetriever for NewPublicKey {
fn value_name(&self) -> &'static str {
"new-public-key"
}

fn computed_default(
&self,
_bootstrapper_config: &BootstrapperConfig,
_persistent_config: &dyn PersistentConfiguration,
_db_password_opt: &Option<String>,
) -> Option<(String, UiSetupResponseValueStatus)> {
Some(("".to_string(), Blank))
}

fn is_required(&self, _params: &SetupCluster) -> bool {
false
}
}

struct PaymentThresholds {}
impl ValueRetriever for PaymentThresholds {
fn value_name(&self) -> &'static str {
Expand Down Expand Up @@ -1213,6 +1233,7 @@ fn value_retrievers(dirs_wrapper: &dyn DirsWrapper) -> Vec<Box<dyn ValueRetrieve
Box::new(MinHops::new()),
Box::new(NeighborhoodMode {}),
Box::new(Neighbors {}),
Box::new(NewPublicKey {}),
Box::new(PaymentThresholds {}),
Box::new(RatePack {}),
Box::new(ScanIntervals {}),
Expand Down Expand Up @@ -1454,6 +1475,7 @@ mod tests {
"masq://eth-mainnet:[email protected]:1234,masq://eth-mainnet:[email protected]:5678",
Configured,
),
("new-public-key", "", Blank),
(
"payment-thresholds",
&DEFAULT_PAYMENT_THRESHOLDS.to_string(),
Expand Down Expand Up @@ -1517,6 +1539,7 @@ mod tests {
("min-hops", "2", Set),
("neighborhood-mode", "originate-only", Set),
("neighbors", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678", Set),
("new-public-key", "on", Set),
("payment-thresholds","1234|50000|1000|1000|20000|20000",Set),
("rate-pack","1|3|3|8",Set),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1547,6 +1570,7 @@ mod tests {
("min-hops", "2", Set),
("neighborhood-mode", "originate-only", Set),
("neighbors", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678", Set),
("new-public-key", "on", Set),
("payment-thresholds","1234|50000|1000|1000|20000|20000",Set),
("rate-pack","1|3|3|8",Set),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1587,6 +1611,7 @@ mod tests {
("min-hops", "2"),
("neighborhood-mode", "originate-only"),
("neighbors", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678"),
("new-public-key", "on"),
("payment-thresholds","1234|50000|1000|1000|15000|15000"),
("rate-pack","1|3|3|8"),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1622,6 +1647,7 @@ mod tests {
("min-hops", "2", Set),
("neighborhood-mode", "originate-only", Set),
("neighbors", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678", Set),
("new-public-key", "on", Set),
("payment-thresholds","1234|50000|1000|1000|15000|15000",Set),
("rate-pack","1|3|3|8",Set),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1663,6 +1689,7 @@ mod tests {
("MASQ_MIN_HOPS", "2"),
("MASQ_NEIGHBORHOOD_MODE", "originate-only"),
("MASQ_NEIGHBORS", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678"),
("MASQ_NEW_PUBLIC_KEY", "on"),
("MASQ_PAYMENT_THRESHOLDS","12345|50000|1000|1234|19000|20000"),
("MASQ_RATE_PACK","1|3|3|8"),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1695,6 +1722,7 @@ mod tests {
("min-hops", "2", Configured),
("neighborhood-mode", "originate-only", Configured),
("neighbors", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678", Configured),
("new-public-key", "on", Configured),
("payment-thresholds","12345|50000|1000|1234|19000|20000",Configured),
("rate-pack","1|3|3|8",Configured),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1755,6 +1783,7 @@ mod tests {
config_file
.write_all(b"neighborhood-mode = \"standard\"\n")
.unwrap();
config_file.write_all(b"new-public-key = \"on\"\n").unwrap();
config_file.write_all(b"scans = \"off\"\n").unwrap();
config_file.write_all(b"rate-pack = \"2|2|2|2\"\n").unwrap();
config_file
Expand Down Expand Up @@ -1797,7 +1826,10 @@ mod tests {
config_file
.write_all(b"neighborhood-mode = \"zero-hop\"\n")
.unwrap();
config_file.write_all(b"scans = \"off\"\n").unwrap();
config_file
.write_all(b"new-public-key = \"off\"\n")
.unwrap();
config_file.write_all(b"scans = \"on\"\n").unwrap();
config_file
.write_all(b"rate-pack = \"55|50|60|61\"\n")
.unwrap();
Expand Down Expand Up @@ -1859,6 +1891,7 @@ mod tests {
("min-hops", "2", Configured),
("neighborhood-mode", "zero-hop", Configured),
("neighbors", "", Blank),
("new-public-key", "off", Configured),
(
"payment-thresholds",
"4000|1000|3000|3333|10000|20000",
Expand All @@ -1874,7 +1907,7 @@ mod tests {
Default,
),
("scan-intervals", "555|555|555", Configured),
("scans", "off", Configured),
("scans", "on", Configured),
]
.into_iter()
.map(|(name, value, status)| {
Expand Down Expand Up @@ -1912,6 +1945,7 @@ mod tests {
("MASQ_MIN_HOPS", "2"),
("MASQ_NEIGHBORHOOD_MODE", "originate-only"),
("MASQ_NEIGHBORS", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678"),
("MASQ_NEW_PUBLIC_KEY", "on"),
("MASQ_PAYMENT_THRESHOLDS","1234|50000|1000|1000|20000|20000"),
("MASQ_RATE_PACK","1|3|3|8"),
#[cfg(not(target_os = "windows"))]
Expand All @@ -1937,6 +1971,7 @@ mod tests {
"min-hops",
"neighborhood-mode",
"neighbors",
"new-public-key",
"payment-thresholds",
"rate-pack",
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -1976,6 +2011,7 @@ mod tests {
"masq://base-sepolia:[email protected]:9101",
Set,
),
("new-public-key", "off", Set),
("payment-thresholds", "4321|66666|777|987|123456|124444", Set),
("rate-pack", "10|30|13|28", Set),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -2010,6 +2046,7 @@ mod tests {
("min-hops", "2", Configured),
("neighborhood-mode", "originate-only", Configured),
("neighbors", "masq://base-sepolia:[email protected]:1234,masq://base-sepolia:[email protected]:5678", Configured),
("new-public-key", "on", Configured),
("payment-thresholds","1234|50000|1000|1000|20000|20000",Configured),
("rate-pack","1|3|3|8",Configured),
#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -3378,6 +3415,19 @@ mod tests {
assert_eq!(result, None);
}

#[test]
fn new_public_key_computed_default() {
let subject = NewPublicKey {};

let result = subject.computed_default(
&BootstrapperConfig::new(),
&PersistentConfigurationMock::new(),
&None,
);

assert_eq!(result, Some(("".to_string(), Blank)));
}

#[cfg(not(target_os = "windows"))]
#[test]
fn real_user_computed_default() {
Expand Down Expand Up @@ -3719,6 +3769,7 @@ mod tests {
assert_eq!(MinHops::new().is_required(&params), false);
assert_eq!(NeighborhoodMode {}.is_required(&params), true);
assert_eq!(Neighbors {}.is_required(&params), true);
assert_eq!(NewPublicKey {}.is_required(&params), false);
assert_eq!(
setup_reporter::PaymentThresholds {}.is_required(&params),
true
Expand Down Expand Up @@ -3752,6 +3803,7 @@ mod tests {
assert_eq!(MinHops::new().value_name(), "min-hops");
assert_eq!(NeighborhoodMode {}.value_name(), "neighborhood-mode");
assert_eq!(Neighbors {}.value_name(), "neighbors");
assert_eq!(NewPublicKey {}.value_name(), "new-public-key");
assert_eq!(
setup_reporter::PaymentThresholds {}.value_name(),
"payment-thresholds"
Expand Down
5 changes: 5 additions & 0 deletions node/src/database/config_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ mod tests {

#[test]
fn dump_config_does_not_migrate_obsolete_database() {
let _ = EnvironmentGuard::new();
let data_dir = ensure_node_home_directory_exists(
"config_dumper",
"dump_config_does_not_migrate_obsolete_database",
Expand Down Expand Up @@ -375,6 +376,7 @@ mod tests {

#[test]
fn dump_config_dumps_existing_database_without_password_and_data_dir_specified() {
let _ = EnvironmentGuard::new();
let home_dir = ensure_node_home_directory_exists(
"config_dumper",
"dump_config_dumps_existing_database_without_password_and_data_dir_specified",
Expand All @@ -392,6 +394,7 @@ mod tests {

#[test]
fn dump_config_dumps_existing_database_without_password_and_default_data_dir() {
let _ = EnvironmentGuard::new();
let home_dir = ensure_node_home_directory_exists(
"config_dumper",
"dump_config_dumps_existing_database_without_password_and_default_data_dir",
Expand All @@ -415,6 +418,7 @@ mod tests {

#[test]
fn dump_config_dumps_existing_database_with_correct_password() {
let _ = EnvironmentGuard::new();
let _clap_guard = ClapGuard::new();
let data_dir = ensure_node_home_directory_exists(
"config_dumper",
Expand Down Expand Up @@ -519,6 +523,7 @@ mod tests {

#[test]
fn dump_config_dumps_existing_database_with_incorrect_password() {
let _ = EnvironmentGuard::new();
let _clap_guard = ClapGuard::new();
let data_dir = ensure_node_home_directory_exists(
"config_dumper",
Expand Down
Loading
Loading