@@ -13,6 +13,7 @@ import (
13
13
obskeyperdatabase "github.com/shutter-network/rolling-shutter/rolling-shutter/chainobserver/db/keyper"
14
14
corekeyperdatabase "github.com/shutter-network/rolling-shutter/rolling-shutter/keyper/database"
15
15
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/gnosis/database"
16
+ "github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/gnosis/gnosisssztypes"
16
17
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/identitypreimage"
17
18
"github.com/shutter-network/rolling-shutter/rolling-shutter/p2pmsg"
18
19
"github.com/shutter-network/rolling-shutter/rolling-shutter/shdb"
@@ -76,14 +77,17 @@ func (h *DecryptionKeySharesHandler) ValidateMessage(ctx context.Context, msg p2
76
77
identityPreimage := identitypreimage .IdentityPreimage (share .EpochID )
77
78
identityPreimages = append (identityPreimages , identityPreimage )
78
79
}
79
- slotDecryptionSignatureData := SlotDecryptionSignatureData {
80
- InstanceID : keyShares .InstanceID ,
81
- Eon : keyShares .Eon ,
82
- Slot : extra .Gnosis .Slot ,
83
- TxPointer : extra .Gnosis .TxPointer ,
84
- IdentityPreimages : identityPreimages ,
80
+ slotDecryptionSignatureData , err := gnosisssztypes .NewSlotDecryptionSignatureData (
81
+ keyShares .InstanceID ,
82
+ keyShares .Eon ,
83
+ extra .Gnosis .Slot ,
84
+ extra .Gnosis .TxPointer ,
85
+ identityPreimages ,
86
+ )
87
+ if err != nil {
88
+ return pubsub .ValidationReject , errors .Wrap (err , "failed to create slot decryption signature data object" )
85
89
}
86
- signatureValid , err := CheckSlotDecryptionSignature ( & slotDecryptionSignatureData , extra .Gnosis .Signature , keyperAddress )
90
+ signatureValid , err := slotDecryptionSignatureData . CheckSignature ( extra .Gnosis .Signature , keyperAddress )
87
91
if err != nil {
88
92
return pubsub .ValidationReject , errors .Wrap (err , "failed to check slot decryption signature" )
89
93
}
@@ -247,17 +251,20 @@ func (h *DecryptionKeysHandler) ValidateMessage(ctx context.Context, msg p2pmsg.
247
251
identityPreimage := identitypreimage .IdentityPreimage (key .Identity )
248
252
identityPreimages = append (identityPreimages , identityPreimage )
249
253
}
250
- slotDecryptionSignatureData := SlotDecryptionSignatureData {
251
- InstanceID : keys .InstanceID ,
252
- Eon : keys .Eon ,
253
- Slot : extra .Gnosis .Slot ,
254
- TxPointer : extra .Gnosis .TxPointer ,
255
- IdentityPreimages : identityPreimages ,
254
+ slotDecryptionSignatureData , err := gnosisssztypes .NewSlotDecryptionSignatureData (
255
+ keys .InstanceID ,
256
+ keys .Eon ,
257
+ extra .Gnosis .Slot ,
258
+ extra .Gnosis .TxPointer ,
259
+ identityPreimages ,
260
+ )
261
+ if err != nil {
262
+ return pubsub .ValidationReject , errors .Wrap (err , "failed to create slot decryption signature data object" )
256
263
}
257
264
for signatureIndex := 0 ; signatureIndex < len (extra .Gnosis .Signatures ); signatureIndex ++ {
258
265
signature := extra .Gnosis .Signatures [signatureIndex ]
259
266
signer := signers [signatureIndex ]
260
- signatureValid , err := CheckSlotDecryptionSignature ( & slotDecryptionSignatureData , signature , signer )
267
+ signatureValid , err := slotDecryptionSignatureData . CheckSignature ( signature , signer )
261
268
if err != nil {
262
269
return pubsub .ValidationReject , errors .Wrap (err , "failed to check slot decryption signature" )
263
270
}
0 commit comments