mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
Fix flaky messed signature test (#4819)
When messing with the signature, we need to make sure that we acutally mess-up the signature. As the generated private/public key is random, the signature is random as well. It can happen that `bytes[0] == bytes[2]` which makes the test fail. We fix this problem by just inverting the bytes at `0` and `2`.
This commit is contained in:
@@ -735,7 +735,8 @@ mod test {
|
|||||||
let public = pair.public();
|
let public = pair.public();
|
||||||
let message = b"Signed payload";
|
let message = b"Signed payload";
|
||||||
let Signature(mut bytes) = pair.sign(&message[..]);
|
let Signature(mut bytes) = pair.sign(&message[..]);
|
||||||
bytes[0] = bytes[2];
|
bytes[0] = !bytes[0];
|
||||||
|
bytes[2] = !bytes[2];
|
||||||
let signature = Signature(bytes);
|
let signature = Signature(bytes);
|
||||||
assert!(!Pair::verify(&signature, &message[..], &public));
|
assert!(!Pair::verify(&signature, &message[..], &public));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user