-
Notifications
You must be signed in to change notification settings - Fork 32
GH-623: Direct Node to pick new public key on the command line #679
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
Open
dnwiebe
wants to merge
40
commits into
master
Choose a base branch
from
GH-623
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 02e059c
Temporary commit
dnwiebe b49606b
All tests apparently passing
dnwiebe c3d18a3
Starting to deal with the consequences of removing CryptDE as a static
dnwiebe c6887b9
About two-thirds done.
dnwiebe 0b5a864
All unit tests passing
dnwiebe c66e762
New integration test is passing
dnwiebe a42c445
Merged in master
dnwiebe 7295793
Unit, integration, and multinode tests passing
dnwiebe e3d2126
Review issues
dnwiebe b89a378
Removed two fields from BootstrapperConfig
dnwiebe 2468554
Formatting
dnwiebe 4437d36
Review issues
dnwiebe 1bba5fe
Removed unused second parameter to CrashTestDummy constructor
dnwiebe 828a354
Formatting
dnwiebe 55334db
Changing the way database passwords are established
dnwiebe 04c0365
Formatting
dnwiebe 2f16112
Trying to find issue with --fake-public-key and chain
dnwiebe e6707e3
Multinode tests and unit tests are working.
dnwiebe 4dfb97f
Formatting and removing debug logs
dnwiebe 4671266
Removed unused import
dnwiebe 09f953e
Clippy appeasement
dnwiebe c76a5bb
Review issues
dnwiebe ccd602d
Formatting
dnwiebe e52c338
Switched test from example.com to testingmcafeesites.com
dnwiebe 83e37fa
Made running single integration tests easier; added TLS retries to in…
dnwiebe 8d060fe
Formatting
dnwiebe 7cf6856
Race in setup_reporter removed
dnwiebe 843570b
Increased a timeout
dnwiebe c5c94db
Formatting
dnwiebe 2fc19f1
example.com -> www.example.com
dnwiebe 45f2e17
Review issues
dnwiebe 49ac096
SetupReporter tests are modified and passing
dnwiebe b10a1d1
Parsing command-line parameter
dnwiebe fc0092a
Implemented --new-public-key
dnwiebe f8e49d9
--new-public-key default is now '' / Blank
dnwiebe f2fded4
Review issues
dnwiebe 2de18ad
Merged in master
dnwiebe dabeddb
Now we know what to do, but there's a missing test
dnwiebe 0692008
Now the GH-623 problem should be fixed
dnwiebe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -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 {}), | ||
|
@@ -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(), | ||
|
@@ -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"))] | ||
|
@@ -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"))] | ||
|
@@ -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"))] | ||
|
@@ -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"))] | ||
|
@@ -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"))] | ||
|
@@ -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"))] | ||
|
@@ -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 | ||
|
@@ -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(); | ||
czarte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
config_file | ||
.write_all(b"rate-pack = \"55|50|60|61\"\n") | ||
.unwrap(); | ||
|
@@ -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", | ||
|
@@ -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)| { | ||
|
@@ -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"))] | ||
|
@@ -1937,6 +1971,7 @@ mod tests { | |
"min-hops", | ||
"neighborhood-mode", | ||
"neighbors", | ||
"new-public-key", | ||
"payment-thresholds", | ||
"rate-pack", | ||
#[cfg(not(target_os = "windows"))] | ||
|
@@ -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"))] | ||
|
@@ -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"))] | ||
|
@@ -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() { | ||
|
@@ -3719,6 +3769,7 @@ mod tests { | |
assert_eq!(MinHops::new().is_required(¶ms), false); | ||
assert_eq!(NeighborhoodMode {}.is_required(¶ms), true); | ||
assert_eq!(Neighbors {}.is_required(¶ms), true); | ||
assert_eq!(NewPublicKey {}.is_required(¶ms), false); | ||
assert_eq!( | ||
setup_reporter::PaymentThresholds {}.is_required(¶ms), | ||
true | ||
|
@@ -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" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.