Skip to content

Commit

Permalink
add skeleton test for bad signature share request
Browse files Browse the repository at this point in the history
  • Loading branch information
xoloki committed Dec 17, 2024
1 parent 246e9c3 commit 17e5e63
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/state_machine/coordinator/fire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,9 @@ pub mod test {
coordinator::{
fire::Coordinator as FireCoordinator,
test::{
check_signature_shares, coordinator_state_machine, equal_after_save_load,
feedback_messages, feedback_mutated_messages, new_coordinator, run_dkg_sign,
setup, setup_with_timeouts, start_dkg_round,
bad_signature_share_request, check_signature_shares, coordinator_state_machine,
equal_after_save_load, feedback_messages, feedback_mutated_messages,
new_coordinator, run_dkg_sign, setup, setup_with_timeouts, start_dkg_round,
},
Config, Coordinator as CoordinatorTrait, State,
},
Expand Down Expand Up @@ -2812,4 +2812,14 @@ pub mod test {
assert_eq!(coordinator.current_sign_id, id);
}
}

#[test]
fn bad_signature_share_request_v1() {
bad_signature_share_request::<FireCoordinator<v1::Aggregator>, v1::Signer>(5, 2);
}

#[test]
fn bad_signature_share_request_v2() {
bad_signature_share_request::<FireCoordinator<v2::Aggregator>, v2::Signer>(5, 2);
}
}
14 changes: 14 additions & 0 deletions src/state_machine/coordinator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,4 +972,18 @@ pub mod test {

assert_eq!(signers, loaded_signers);
}

pub fn bad_signature_share_request<Coordinator: CoordinatorTrait, SignerType: SignerTrait>(
num_signers: u32,
keys_per_signer: u32,
) {
let (mut coordinators, mut signers) =

Check failure on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

unused variable: `coordinators`

Check failure on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

unused variable: `signers`

Check failure on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

variable does not need to be mutable

Check failure on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

variable does not need to be mutable

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / check

unused variable: `coordinators`

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / check

unused variable: `signers`

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / check

variable does not need to be mutable

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / check

variable does not need to be mutable

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / test-all

unused variable: `coordinators`

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / test-all

unused variable: `signers`

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / test-all

variable does not need to be mutable

Check warning on line 980 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / test-all

variable does not need to be mutable
run_dkg::<Coordinator, SignerType>(num_signers, keys_per_signer);

let msg = "It was many and many a year ago, in a kingdom by the sea"

Check failure on line 983 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

unused variable: `msg`

Check warning on line 983 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / check

unused variable: `msg`

Check warning on line 983 in src/state_machine/coordinator/mod.rs

View workflow job for this annotation

GitHub Actions / test-all

unused variable: `msg`
.as_bytes()
.to_vec();


}
}

0 comments on commit 17e5e63

Please sign in to comment.