namada icon indicating copy to clipboard operation
namada copied to clipboard

Fractional amounts of tokens when applying rewards products and slashes at withdrawals

Open brentstone opened this issue 2 years ago • 1 comments

When an an account withdraws tokens from the PoS module after the maturation of an unbond, the rewards products (stored as Decimal type) and slashes are used to determine the number of tokens to actually credit the account. Currently, the number of tokens to credit is obtained by truncating the product of rewards, slashes, and the unbond amount to the integer from below.

Over time, the fractional remainder of tokens not credited in withdrawals can add up to leave whole numbers of tokens left in the PoS address unaccounted for. We should think whether or not this is a concern, and if so, what should be done with these remainder tokens. It should be possible to keep track of the remainder tokens send them to an account like a slash pool on occasion, if desired.

brentstone avatar Nov 17 '22 18:11 brentstone

As long as we use full integer precision (sub-whole-number "token") I think we can probably not worry too much about this - but tracking the remainder explicitly would be prudent.

cwgoes avatar Nov 21 '22 14:11 cwgoes