Change maxBitLen of sdk.Int to handle max Erc20 value.
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->
## Description
Closes: #XXXX
<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->
---
### Author Checklist
*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*
I have...
- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed
### Reviewers Checklist
*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*
I have...
- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
Simplify the code in Dec.Power to unconditionally divide by 2, since:
x /= 2
is the same result for both even and odd integers, and produces the
floor of the result of x/2 -> ⌊x/2⌋:
99/2 ~> 49.5 ⌊49.5⌋ = 49
98/2 ~> 49.0 ⌊49.0⌋ = 49
aka "integer truncation".
Fixes#7924
Added a maximum number of iterations (100) to ApproxRoot
(and ApproxSqrt) to serve as a hard limit on the number of
iterations that the algorithm performs. If the answer converges
before the maximum iterations, it returns immediately. Otherwise,
if the answer never converges enough to satisfy the primary loop
condition, the looping stops after a hundred iterations.
Closes: #7038
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Use big.Int.Cmp() and compare against zeroInt instead
of checking Bytes() against a 0-length byte slice.
Closes: #6680
Thanks: @odeke-em for the patch.
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
x/staking: Fix all linter warnings.
Fixed warnings across base packages.
New linters:
- unparam
- nolintlint
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Fixes regression introduced by #2984.
Continuiation of #3033 , which didn't fix the simulation issues.
(candidate) Complete solution for #3019, 9002 halt bug.
From #2984, it isn't sufficient to take the fee pool rewards of a validator. Since we don't track delegator accums (as we do with validator accums), and because onValidatorModified >updateValidatorDistInfoFromPool is also being called upon delegation updates (or at least I believe this is the reason), it is necessary to also withdraw self delegation.
TODO: I don't think self-delegation should be required to be modified here... consider using a delegation hook to do the self-delegation withdraw part instead, e.g. splitting the updateValidatorDistInfoFromPool function into two. It might not result in cleaner code, however. Think hard.
* Update validator commission fields
* Remove CommissionChangeToday and update to use CommissionChangeTime
* Implement commission as a first class citizen type
* Implement stringer for Comission
* Move commission type and logic to new file
* Add new commission errors
* Add commission to create validator message
* Implement and call UpdateValidatorCommission
* Update godoc for UpdateValidatorCommission
* Add Abs to the decimal type
* Implement new SetValidatorCommission
* Update decimal short godocs
* Move set initial commission logic
* Move initial commission validation to Commission type
* Update initial validator commission logic and unit tests
* Remove commission update time from struct and move to validator
* Update validator create handler tests
* Implement commission logic for CLI
* Fix make lint failure
* Fix make cover failure
* Update edit validator logic to handle new commission rate
* Fix lint and cover
* Update create/edit validator simulation to include commission params
* Update MsgEditValidator godoc
* Update pending log
* Update staking tx docs
* Fix CLI create validator test
* Update variables names for commission strings
* Merge UpdateTime into Commission type
* Update create-validator usage in docs
* Update more docs with examples
* More doc updates
* changelog
* ...
* decimal func working
* decimal complete, untested
* fixing tests
* decimal compile errors resolved
* test compile errors
* precision multiplier test
* 1% laptop battery
* fixed TestNewDecFromStr
* equalities working
* fix bankers round chop
* ...
* working, some decimal issues resolved
* fix rounding error
* rounding works
* decimal works
* ...
* deleted rational
* rational conversion working
* revert changelog
* code compiles (not tests)
* went through all NewDec, made sure they were converted from NewRat properly
* test debugging
* all testing bugs besides the json marshalling fixed
* json unmarshal
* lint
* document update
* fix lcd test
* cli test fix
* mostly undo Dece -> Rate
* val comments
* Efficiency improvements
This now caches all of the precision multipliers (as they were all
used in non-mutative functions), and caches the precisionInt calculation.
(Now it just copies the already calculated value)
* Cache another precisionInt() call.
* Improve banker rounding efficiency
* remove defer, make negation in-place.
* chris val comments
* bez comments
* Aditya comments
* ...
* val comments
* rebasing start
* ...
* compiling
* tests pass
* cli fix
* anton, cwgoes, val comments
* val and jae comments
* type
* undo reuse quo