Cosmos-sdk: Negative coin amount during fee allocation

Created on 24 Feb 2019  路  4Comments  路  Source: cosmos/cosmos-sdk

Summary of Bug

Error during fee allocation(distr module). At some point, the total sum of allocated token > initial fees. Seems, problems with truncating.

Steps to Reproduce

I reproduced this error on https://github.com/cosmos/cosmos-sdk/pull/3722 .


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
bug critical distribution

Most helpful comment

The issue here is that we weren't truncating multiplication and division (particularly the latter), so token amounts paid to validators could have been rounded up, resulting in more tokens allocated in total than had been collected in fees and generated by inflation.

I've implemented the appropriate truncation in #3728.

All 4 comments

Thanks for the report, we'll investigate this.

The issue here is that we weren't truncating multiplication and division (particularly the latter), so token amounts paid to validators could have been rounded up, resulting in more tokens allocated in total than had been collected in fees and generated by inflation.

I've implemented the appropriate truncation in #3728.

I think #3728 is a more sensible approach here using already existing APIs.

3728 seems a more natural solution.

Was this page helpful?
0 / 5 - 0 ratings