Cosmos-sdk: Fix decimals in Validator tokens for Gaia-lite

Created on 20 Aug 2018  Â·  10Comments  Â·  Source: cosmos/cosmos-sdk

Summary of Bug

Currently we have to parse the validator token value in order to handle decimals (See discussion).

According to @cwgoes, tokens are integers (i.e sdk.Dec) now that we changed the type from sdk.Rat.

  • [x] Remove and replace DelegationWithoutRat struct

Steps to Reproduce


For Admin Use

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

Most helpful comment

Not yet -just opened an issue: https://github.com/cosmos/cosmos-sdk/issues/2483

All 10 comments

Tokens are sdk.Int and never had decimals - but validator power is sdk.Dec, maybe that's what you're referring to?

@cwgoes validator tokens are sdk.Dec according to validator.go#L28

@cwgoes validator tokens are sdk.Dec according to validator.go#L28

Yup - regular tokens are sdk.Int, validator tokens are presently sdk.Dec, although @rigelrozanski is this still necessary?

Once fee distribution is implemented there will be no need for validator tokens to be decimal - only the fee-distribution mechanism will hold atom "pieces" (which is required for validator reward micro-payments like inflation)

Once fee distribution is implemented there will be no need for validator tokens to be decimal - only the fee-distribution mechanism will hold atom "pieces" (which is required for validator reward micro-payments like inflation)

Fantastic, that will simplify this point for Voyager too then. Note that we'll need to choose a rounding direction when slashing.

@cwgoes let's round to always slash more tokens

@cwgoes let's round to always slash more tokens

Agreed, and if we have fractional Atoms the impact will be pretty minor.

Didn't we get fractional atoms in?

Not yet -just opened an issue: https://github.com/cosmos/cosmos-sdk/issues/2483

Closing due to fee distribution being merged, and these are now Ints.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cwgoes picture cwgoes  Â·  3Comments

fedekunze picture fedekunze  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments