mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Fix bls signature batch unit test (#12602)
We randomly observe this failure when running unit test
go test -test.v -run=^TestSignatureBatch_AggregateBatch/common_and_uncommon_messages_in_batch_with_multiple_messages
=== RUN TestSignatureBatch_AggregateBatch
=== RUN TestSignatureBatch_AggregateBatch/common_and_uncommon_messages_in_batch_with_multiple_messages
signature_batch_test.go:643: AggregateBatch() Descriptions got = [test signature bls aggregated signature test signature bls aggregated signature test signature bls aggregated signature], want [bls aggregated signature test signature bls aggregated signature test signature bls aggregated signature test signature]
--- FAIL: TestSignatureBatch_AggregateBatch (0.02s)
--- FAIL: TestSignatureBatch_AggregateBatch/common_and_uncommon_messages_in_batch_with_multiple_messages (0.02s)
The problem is that the signature sort forgets to swap the description when a
swap occurs. This commit adds the description swap when swap occurs.
Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
@@ -737,6 +737,7 @@ func (s sorter) Swap(i, j int) {
|
||||
s.set.Signatures[i], s.set.Signatures[j] = s.set.Signatures[j], s.set.Signatures[i]
|
||||
s.set.PublicKeys[i], s.set.PublicKeys[j] = s.set.PublicKeys[j], s.set.PublicKeys[i]
|
||||
s.set.Messages[i], s.set.Messages[j] = s.set.Messages[j], s.set.Messages[i]
|
||||
s.set.Descriptions[i], s.set.Descriptions[j] = s.set.Descriptions[j], s.set.Descriptions[i]
|
||||
}
|
||||
|
||||
func (s sorter) Less(i, j int) bool {
|
||||
|
||||
Reference in New Issue
Block a user