Skip to content

Commit 4674027

Browse files
feat: allow decryption keys message with no signatures
1 parent d4c3a50 commit 4674027

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rolling-shutter/keyperimpl/shutterservice/handlers.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func ValidateDecryptionKeysSignatures(
182182
extra *p2pmsg.ShutterServiceDecryptionKeysExtra,
183183
keyperSet *obskeyperdatabase.KeyperSet,
184184
) (pubsub.ValidationResult, error) {
185+
// Allow for empty signatures and signer indices
186+
if len(extra.SignerIndices) == 0 || len(extra.Signature) == 0 {
187+
return pubsub.ValidationAccept, nil
188+
}
189+
185190
if int32(len(extra.SignerIndices)) != keyperSet.Threshold {
186191
return pubsub.ValidationReject, errors.Errorf("expected %d signers, got %d", keyperSet.Threshold, len(extra.SignerIndices))
187192
}
@@ -248,12 +253,7 @@ func (h *DecryptionKeysHandler) HandleMessage(ctx context.Context, msg p2pmsg.Me
248253
extra := keys.Extra.(*p2pmsg.DecryptionKeys_Service).Service
249254
serviceDB := database.New(h.dbpool)
250255

251-
identityPreimages := []identitypreimage.IdentityPreimage{}
252-
for _, key := range keys.Keys {
253-
identityPreimage := identitypreimage.IdentityPreimage(key.IdentityPreimage)
254-
identityPreimages = append(identityPreimages, identityPreimage)
255-
}
256-
identitiesHash := computeIdentitiesHash(identityPreimages)
256+
identitiesHash := computeIdentitiesHashFromKeys(keys.GetKeys())
257257
for i, keyperIndex := range extra.SignerIndices {
258258
err := serviceDB.InsertDecryptionSignature(ctx, database.InsertDecryptionSignatureParams{
259259
Eon: int64(keys.Eon),

0 commit comments

Comments
 (0)