Skip to content

Commit

Permalink
allow language specific decimal precision error
Browse files Browse the repository at this point in the history
  • Loading branch information
yun-yeo authored and hanjukim committed Nov 10, 2020
1 parent 54ca036 commit 4ae926c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/auth/vesting/types/schedule.go
Expand Up @@ -144,7 +144,10 @@ func (vs VestingSchedule) Validate() error {
sumRatio = sumRatio.Add(lazySchedule.GetRatio())
}

if !sumRatio.Equal(sdk.OneDec()) {
// add rounding to allow language specific calculation errors
const fixedPointDecimals = 1000000000
if !sumRatio.MulInt64(fixedPointDecimals).RoundInt().
ToDec().QuoInt64(fixedPointDecimals).Equal(sdk.OneDec()) {
return errors.New("vesting total ratio must be one")
}

Expand Down

0 comments on commit 4ae926c

Please sign in to comment.