Skip to content

Commit

Permalink
use finalityGrandpa.Message type for checkMsgSig
Browse files Browse the repository at this point in the history
  • Loading branch information
jimjbrettj committed Oct 26, 2023
1 parent 14b0a1a commit bca86a9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions client/consensus/grandpa/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
package grandpa

import (
"fmt"

"github.com/ChainSafe/gossamer/internal/log"
finalityGrandpa "github.com/ChainSafe/gossamer/pkg/finality-grandpa"
"github.com/ChainSafe/gossamer/pkg/scale"
Expand Down Expand Up @@ -49,17 +47,12 @@ type messageData[H comparable, N constraints.Unsigned] struct {
// The encoding necessary to verify the signature will be done using the given
// buffer, the original content of the buffer will be cleared.
func checkMessageSignature[H comparable, N constraints.Unsigned, ID AuthorityID](
message any,
message finalityGrandpa.Message[H, N],
id ID,
signature any,
round uint64,
setID uint64) (bool, error) {

msg, ok := message.(finalityGrandpa.Message[H, N])
if !ok {
return false, fmt.Errorf("invalid cast to finalityGrandpa.Message[H, N]")
}

sig, ok := signature.([]byte)

// Verify takes []byte, but string is a valid signature type,
Expand All @@ -72,7 +65,7 @@ func checkMessageSignature[H comparable, N constraints.Unsigned, ID AuthorityID]
m := messageData[H, N]{
round,
setID,
msg,
message,
}

enc, err := scale.Marshal(m)
Expand Down

0 comments on commit bca86a9

Please sign in to comment.