From bca86a9a591bee46c4f0cdd6d82881a4f3eefba2 Mon Sep 17 00:00:00 2001 From: jimboj <jamesdjohnson218@gmail.com> Date: Thu, 26 Oct 2023 13:39:43 -0600 Subject: [PATCH] use finalityGrandpa.Message type for checkMsgSig --- client/consensus/grandpa/lib.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/client/consensus/grandpa/lib.go b/client/consensus/grandpa/lib.go index 4fd5f803da..f90c872857 100644 --- a/client/consensus/grandpa/lib.go +++ b/client/consensus/grandpa/lib.go @@ -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" @@ -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, @@ -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)