-
Notifications
You must be signed in to change notification settings - Fork 0
Allow Datil restore test to work with unequal node counts #83
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
base: keysets
Are you sure you want to change the base?
Changes from all commits
cf9af02
d7df690
869d8f2
2bbd0e1
07dd9ae
d5d4cae
1b2aa8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -85,6 +85,7 @@ async fn end_to_end_test(number_of_nodes: usize, recovery_party_size: usize) { | |||||
| .num_staked_and_joined_validators(number_of_nodes) | ||||||
| .epoch_length(epoch_length) | ||||||
| .include_datil_testnet(DatilTestnetType::NoKeyOverride) | ||||||
| .force_deploy(true) | ||||||
| .build() | ||||||
| .await; | ||||||
|
|
||||||
|
|
@@ -206,6 +207,7 @@ async fn end_to_end_test(number_of_nodes: usize, recovery_party_size: usize) { | |||||
| &client, | ||||||
| &validator_collection2, | ||||||
| &backup_directory, | ||||||
| recovery_party_size, | ||||||
| ) | ||||||
| .await; | ||||||
|
|
||||||
|
|
@@ -358,6 +360,7 @@ async fn upload_key_backups_to_nodes( | |||||
| client: &Client, | ||||||
| validator_collection: &ValidatorCollection, | ||||||
| backup_directory: &PathBuf, | ||||||
| recovery_party_size: usize, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the number of key shares being restored or the number of parties being restored to? Can we restore 4 key shares to 6 parties? If so is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes and no. Each backup share ( ie, the ones downloaded by the node ops ) can only go to a single new node. In this test, things are a little convoluted since the backup parties and the node ops with backups are equivalent. In your example, if we have 4 backup shares and 6 nodes, and run this test it will pass. But only because the network receiving the shares will kick the 2 nodes that don't have them - because those 2 nodes can't participate in the DKG. It's all relatively clever. ;-)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we don't have the test where the backups < recovery parties so no one gets kicked in the existing test. Can we add this additional test as well
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Naga Prod we only have 6 backup shares, from what I understand. This means we'll need to reduce the network size, regardless of the number of backup parties. However, I can write a test that uses 5 backup shares, 5 new nodes and 3 recovery parties. This should work as I believe we only need a threshold of the recovery parties to authorize the recovery to proceed. It won't be a short task though - most of these tests to Mike and Ege days to write, and they had prior knowledge of the backup system. I'm going in cold ;-) |
||||||
| ) { | ||||||
| let validators = validator_collection.get_active_validators().await.unwrap(); | ||||||
| let mut join_set = JoinSet::new(); | ||||||
|
|
@@ -376,7 +379,15 @@ async fn upload_key_backups_to_nodes( | |||||
|
|
||||||
| let tar_file = | ||||||
| backup_directory.join(format!("{public_address}{BACKUP_ENCRYPTED_KEYS}")); | ||||||
| let file = tokio::fs::File::open(tar_file).await.unwrap(); | ||||||
| let file = tokio::fs::File::open(tar_file).await; | ||||||
|
|
||||||
| let file = match file { | ||||||
| Ok(file) => file, | ||||||
| Err(e) => { | ||||||
| error!("No file for: {}", e); | ||||||
|
||||||
| error!("No file for: {}", e); | |
| error!("Failed to open backup file {}: {}", tar_file.display(), e); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion assert!(success_count == recovery_party_size) should use the equality assertion assert_eq!(success_count, recovery_party_size) for better error messages. When the assertion fails, assert_eq! will show the actual values of both sides, making debugging easier.
| assert!(success_count == recovery_party_size); | |
| assert_eq!(success_count, recovery_party_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the test to simulate a 4 -> 6 restore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all pre-existing tests. I just made them work when the backup ##s don't match the restore nodes.
Currently we don't have enough blinders - I'm trying to generate more tomorrow, and can update the test, but there isn't any good reason to do so. 3 -> 5 is no different than 4 -> 6 in terms of what the software does - it's just slower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but we should still have a test that validates the kicking of the remaining nodes and the eventual success of the DKG which seems to be missing rn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this test does just that .... though you'd have to change the paramaters. I flipped them back to "normal" since it's more efficient to run in CI.
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semicolon after the closing brace on this line is unnecessary. An 'if' statement does not require a semicolon after its closing brace unless it's part of an expression context. Remove the semicolon for cleaner code.
| }; | |
| } |
Uh oh!
There was an error while loading. Please reload this page.