From 298fdf301260fe2f50fcc529ab7c8390c026edb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 13 Apr 2022 17:01:36 +0200 Subject: [PATCH] authority-discovery: Fix flaky test (#11219) It can happen that `+ 1` overflows `p.signature[1]` ;D (I have seen this in the CI). --- substrate/client/authority-discovery/src/worker/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/authority-discovery/src/worker/tests.rs b/substrate/client/authority-discovery/src/worker/tests.rs index 904c674d26..a1a699bc30 100644 --- a/substrate/client/authority-discovery/src/worker/tests.rs +++ b/substrate/client/authority-discovery/src/worker/tests.rs @@ -625,7 +625,7 @@ fn reject_address_with_invalid_peer_signature() { )); // tamper with the signature let mut record = schema::SignedAuthorityRecord::decode(kv_pairs[0].1.as_slice()).unwrap(); - record.peer_signature.as_mut().map(|p| p.signature[1] += 1); + record.peer_signature.as_mut().map(|p| p.signature[1] = !p.signature[1]); record.encode(&mut kv_pairs[0].1).unwrap(); let cached_remote_addresses = tester.process_value_found(false, kv_pairs);