Skip to content

Commit

Permalink
Another multisig test (#72)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew <andrewburger1991@gmail.com>
  • Loading branch information
JoshOrndorff and coax1d authored Apr 20, 2023
1 parent b696cd1 commit fd7b07b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tuxedo-core/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,32 @@ mod test {
assert!(!threshold_multisig.verify(simplified_tx, redeemer));
}

#[test]
fn threshold_multisig_extra_sigs_still_passes() {
let threshold = 2;
let pairs = generate_n_pairs(threshold + 1);

let signatories: Vec<H256> = pairs.iter().map(|p| H256::from(p.public())).collect();

let simplified_tx = b"hello_world".as_slice();
let sigs: Vec<_> = pairs
.iter()
.enumerate()
.map(|(i, p)| SignatureAndIndex {
signature: p.sign(simplified_tx),
index: i.try_into().unwrap(),
})
.collect();

let redeemer: &[u8] = &sigs.encode()[..];
let threshold_multisig = ThresholdMultiSignature {
threshold,
signatories,
};

assert!(threshold_multisig.verify(simplified_tx, redeemer));
}

#[test]
fn threshold_multisig_replay_sig_attack_fails() {
let threshold = 2;
Expand Down

0 comments on commit fd7b07b

Please sign in to comment.