Skip to content

Commit 13380af

Browse files
arijitADnoot
authored andcommitted
fix(dot/types): fix max value for digest (ChainSafe#1687)
Co-authored-by: noot <[email protected]>
1 parent b224f10 commit 13380af

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

dot/digest/digest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package digest
1919
import (
2020
"context"
2121
"errors"
22+
"math"
2223
"math/big"
2324

2425
"github.com/ChainSafe/gossamer/dot/types"
@@ -28,7 +29,7 @@ import (
2829
log "github.com/ChainSafe/log15"
2930
)
3031

31-
var maxUint64 = uint64(2^64) - 1
32+
var maxUint64 = uint64(math.MaxUint64)
3233

3334
var (
3435
_ services.Service = &Handler{}

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
273273
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
274274
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
275275
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
276-
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
277276
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
278277
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
279278
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=

lib/grandpa/grandpa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,11 @@ func (s *Service) determinePreVote() (*Vote, error) {
710710

711711
nextChange := s.digestHandler.NextGrandpaAuthorityChange()
712712
if uint64(vote.number) > nextChange {
713-
header, err := s.blockState.GetHeaderByNumber(big.NewInt(int64(nextChange)))
713+
headerNum := new(big.Int).SetUint64(nextChange)
714+
header, err := s.blockState.GetHeaderByNumber(headerNum)
714715
if err != nil {
715716
return nil, err
716717
}
717-
718718
vote = NewVoteFromHeader(header)
719719
}
720720

0 commit comments

Comments
 (0)