Skip to content

Commit bacdabc

Browse files
committed
Fix key and key share order check
Key and key shares in p2p messages are ordered according the the corresponding identity preimage. We used to check that they are strictly ordered which disallows duplicates. However, at least in Shutterized Gnosis Chain, duplicates are possible. We fix this by allowing duplicates.
1 parent d9d079e commit bacdabc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

rolling-shutter/keyper/epochkghandler/key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (handler *DecryptionKeyHandler) ValidateMessage(ctx context.Context, msg p2
7777
return pubsub.ValidationReject, errors.Errorf("epoch secret key for identity %x is not valid", k.Identity)
7878
}
7979

80-
if i > 0 && bytes.Compare(k.Identity, key.Keys[i-1].Identity) != 1 {
80+
if i > 0 && bytes.Compare(k.Identity, key.Keys[i-1].Identity) < 0 {
8181
return pubsub.ValidationReject, errors.Errorf("keys not ordered")
8282
}
8383
}

rolling-shutter/keyper/epochkghandler/keyshare.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (handler *DecryptionKeyShareHandler) ValidateMessage(ctx context.Context, m
8080
return pubsub.ValidationReject, errors.Errorf("cannot verify secret key share")
8181
}
8282

83-
if i > 0 && bytes.Compare(share.EpochID, shares[i-1].EpochID) != 1 {
83+
if i > 0 && bytes.Compare(share.EpochID, shares[i-1].EpochID) < 0 {
8484
return pubsub.ValidationReject, errors.Errorf("keyshares not ordered")
8585
}
8686
}

0 commit comments

Comments
 (0)