diff --git a/CHANGELOG.md b/CHANGELOG.md index c98332bea..22a49edab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -209,9 +209,9 @@ to detail this new feature and how state transitions occur. * (docs/interfaces/) Add documentation on building interfaces for the Cosmos SDK. * Redesigned user interface that features new dynamically generated sidebar, build-time code embedding from GitHub, new homepage as well as many other improvements. - ### Bug Fixes +* (types) [\#5395](https://github.com/cosmos/cosmos-sdk/issues/5395) Fix `Uint#LTE` * (client) [\#5303](https://github.com/cosmos/cosmos-sdk/issues/5303) Fix ignored error in tx generate only mode. * (iavl) [\#5276](https://github.com/cosmos/cosmos-sdk/issues/5276) Fix potential race condition in `iavlIterator#Close`. * (cli) [\#4763](https://github.com/cosmos/cosmos-sdk/issues/4763) Fix flag `--min-self-delegation` for staking `EditValidator` @@ -221,8 +221,6 @@ to detail this new feature and how state transitions occur. * (baseapp) [\#5350](https://github.com/cosmos/cosmos-sdk/issues/5350) Allow a node to restart successfully after a `halt-height` or `halt-time` has been triggered. - - ## [v0.37.4] - 2019-11-04 ### Improvements diff --git a/types/uint.go b/types/uint.go index a6c4a0abf..da43f5fb9 100644 --- a/types/uint.go +++ b/types/uint.go @@ -74,7 +74,7 @@ func (u Uint) GTE(u2 Uint) bool { return u.GT(u2) || u.Equal(u2) } func (u Uint) LT(u2 Uint) bool { return lt(u.i, u2.i) } // LTE returns true if first Uint is lesser than or equal to the second -func (u Uint) LTE(u2 Uint) bool { return !u.GTE(u2) } +func (u Uint) LTE(u2 Uint) bool { return !u.GT(u2) } // Add adds Uint from another func (u Uint) Add(u2 Uint) Uint { return NewUintFromBigInt(new(big.Int).Add(u.i, u2.i)) } diff --git a/types/uint_test.go b/types/uint_test.go index 34fc1780b..d371c8136 100644 --- a/types/uint_test.go +++ b/types/uint_test.go @@ -141,7 +141,7 @@ func TestArithUint(t *testing.T) { } func TestCompUint(t *testing.T) { - for d := 0; d < 1000; d++ { + for d := 0; d < 10000; d++ { n1 := rand.Uint64() i1 := NewUint(n1) n2 := rand.Uint64() @@ -156,6 +156,8 @@ func TestCompUint(t *testing.T) { {i1.LT(i2), n1 < n2}, {i1.GTE(i2), !i1.LT(i2)}, {!i1.GTE(i2), i1.LT(i2)}, + {i1.LTE(i2), n1 <= n2}, + {i2.LTE(i1), n2 <= n1}, } for tcnum, tc := range cases {