Skip to content

Commit

Permalink
fix: constant overflow when compiling for 32bit machines (cosmos#318)
Browse files Browse the repository at this point in the history
on Go 1.x(x) all constants are ints by default which causing
build for 32bit machines to fail due to overflow
golang/go#23086

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored and erikgrinaker committed Oct 12, 2020
1 parent 48f41f0 commit 7175f5a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- [\#318](https://github.com/cosmos/iavl/pull/318) Fix constant overflow when compiling for 32bit machines.

## 0.14.1 (October 9, 2020)

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (ndb *nodeDB) DeleteVersionsFrom(version int64) error {
})

// Finally, delete the version root entries
ndb.traverseRange(rootKeyFormat.Key(version), rootKeyFormat.Key(math.MaxInt64), func(k, v []byte) {
ndb.traverseRange(rootKeyFormat.Key(version), rootKeyFormat.Key(int64(math.MaxInt64)), func(k, v []byte) {
ndb.batch.Delete(k)
})

Expand Down
2 changes: 1 addition & 1 deletion repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Repair013Orphans(db dbm.DB) (uint64, error) {
)
batch := db.NewBatch()
defer batch.Close()
ndb.traverseRange(orphanKeyFormat.Key(version), orphanKeyFormat.Key(math.MaxInt64), func(k, v []byte) {
ndb.traverseRange(orphanKeyFormat.Key(version), orphanKeyFormat.Key(int64(math.MaxInt64)), func(k, v []byte) {
// Sanity check so we don't remove stuff we shouldn't
var toVersion int64
orphanKeyFormat.Scan(k, &toVersion)
Expand Down

0 comments on commit 7175f5a

Please sign in to comment.