Skip to content

Commit 263e66a

Browse files
authored
Fix signature payload determination for partial messages (#1017)
Use the provided value key for signature payload when message is partial.
1 parent 28d4e73 commit 263e66a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gpbft/validator.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,12 @@ func (v *cachingValidator) validateMessageWithVoteValueKey(ctx context.Context,
257257
}
258258

259259
// Check vote signature.
260-
sigPayload := msg.Vote.MarshalForSigning(v.networkName)
260+
var sigPayload []byte
261+
if partial {
262+
sigPayload = msg.Vote.MarshalForSigningWithValueKey(v.networkName, *valueKey)
263+
} else {
264+
sigPayload = msg.Vote.MarshalForSigning(v.networkName)
265+
}
261266
if err := v.verifier.Verify(senderPubKey, sigPayload, msg.Signature); err != nil {
262267
return fmt.Errorf("invalid signature on %v, %v: %w", msg, err, ErrValidationInvalid)
263268
}

0 commit comments

Comments
 (0)