Skip to content

Commit

Permalink
cr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
timwu20 committed Sep 5, 2024
1 parent 0aea946 commit 9214c26
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/client/consensus/grandpa/justification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func makePrecommit(t *testing.T,
TargetNumber: targetNumber,
}
msg := grandpa.NewMessage(precommit)
encoded := primitives.LocalizedPayload(primitives.RoundNumber(round), primitives.SetID(setID), msg)
encoded := primitives.NewLocalizedPayload(primitives.RoundNumber(round), primitives.SetID(setID), msg)
signature := voter.Sign(encoded)

return grandpa.SignedPrecommit[hash.H256, uint64, primitives.AuthoritySignature, primitives.AuthorityID]{
Expand Down
4 changes: 2 additions & 2 deletions internal/primitives/consensus/grandpa/grandpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func CheckMessageSignature[H comparable, N constraints.Unsigned](
round RoundNumber,
setID SetID) bool {

buf := LocalizedPayload(round, setID, message)
buf := NewLocalizedPayload(round, setID, message)
valid := id.Verify(signature, buf)

if !valid {
Expand All @@ -89,7 +89,7 @@ func CheckMessageSignature[H comparable, N constraints.Unsigned](
}

// LocalizedPayload will encode round message localised to a given round and set id.
func LocalizedPayload(round RoundNumber, setID SetID, message any) []byte {
func NewLocalizedPayload(round RoundNumber, setID SetID, message any) []byte {
return scale.MustMarshal(struct {
Message any
RoundNumber
Expand Down
2 changes: 1 addition & 1 deletion internal/primitives/consensus/grandpa/grandpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func makePrecommit(t *testing.T,
) grandpa.SignedPrecommit[hash.H256, uint64, AuthoritySignature, AuthorityID] {
t.Helper()
msg := grandpa.NewMessage(precommit)
encoded := LocalizedPayload(RoundNumber(round), SetID(setID), msg)
encoded := NewLocalizedPayload(RoundNumber(round), SetID(setID), msg)
signature := voter.Sign(encoded)

return grandpa.SignedPrecommit[hash.H256, uint64, AuthoritySignature, AuthorityID]{
Expand Down

0 comments on commit 9214c26

Please sign in to comment.