Skip to content

Commit

Permalink
fix(dot/types): fix max value for digest (ChainSafe#1687)
Browse files Browse the repository at this point in the history
Co-authored-by: noot <36753753+noot@users.noreply.github.com>
  • Loading branch information
2 people authored and timwu20 committed Dec 6, 2021
1 parent b224f10 commit 13380af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dot/digest/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package digest
import (
"context"
"errors"
"math"
"math/big"

"github.com/ChainSafe/gossamer/dot/types"
Expand All @@ -28,7 +29,7 @@ import (
log "github.com/ChainSafe/log15"
)

var maxUint64 = uint64(2^64) - 1
var maxUint64 = uint64(math.MaxUint64)

var (
_ services.Service = &Handler{}
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
Expand Down
4 changes: 2 additions & 2 deletions lib/grandpa/grandpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,11 @@ func (s *Service) determinePreVote() (*Vote, error) {

nextChange := s.digestHandler.NextGrandpaAuthorityChange()
if uint64(vote.number) > nextChange {
header, err := s.blockState.GetHeaderByNumber(big.NewInt(int64(nextChange)))
headerNum := new(big.Int).SetUint64(nextChange)
header, err := s.blockState.GetHeaderByNumber(headerNum)
if err != nil {
return nil, err
}

vote = NewVoteFromHeader(header)
}

Expand Down

0 comments on commit 13380af

Please sign in to comment.