Cosmos-sdk: Interaction of mandatory reward-withdraw and reward truncation

Created on 27 Nov 2018  路  12Comments  路  Source: cosmos/cosmos-sdk

Ref https://github.com/cosmos/cosmos-sdk/issues/2764
Ref https://forum.cosmos.network/t/3-important-topics-to-discuss-on-fee-reward-distribution-logic/

Any delegator can force decimal truncation of a validators' or the validators' self-delegation rewards by delegating/undelegating a tiny amount (to cause a power change). As delegator rewards are truncated to integers and rewards are minted each block, this seems like a substantial attack vector, with which the reward of a validators' self-bond could be almost totally negated.

bug distribution

All 12 comments

cc @rigelrozanski @alexanderbez

I wonder if all of these hooks are quite necessary for the lazy calculation, I think a few of the ones we have might not be.

We do not require withdrawing a validator self-delegation when a 3rd party delegates-to/undelegates-from that validator. We do however require that that validator withdraw all of it's unclaimed rewards from the global pool to it's local pools when a 3rd party delegates-to/undelegates-from it (affecting its power)

The reason the code currently does this is out of convenience when this was being added if I'm not mistaken

Awesome. Mind if I tackle this?

no-t-at-tall :)

Discussed with @cwgoes and we agreed that the staking spec should first be reconciled prior to this. This is mainly motivated by some inconsistencies/inefficiencies in the staking hooks.

As in, we should correct anything incorrect in the spec, and then update the code to match (which it presently does not).

I'm not entirely sure that the _spec_ is the best way for us to spend our documentation efforts at the moment - For instance, I think diagram creation will do better to both explain the logic flow, as well as clarify hook calls. Diagrams fall more under description documentation than specs - we have very little description documentation in general

sry I meant - _Explanation_ documentation https://www.divio.com/blog/documentation/

Reopening this as we have reintroduced the attack.

I think we can close this due to F1, correct me if I'm wrong @cwgoes.

Let's leave it open for now; F1 should prevent forced-withdraws, but we haven't merged it yet.

Closed by #3099, which is about to be merged.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jackzampolin picture jackzampolin  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

ValarDragon picture ValarDragon  路  3Comments

ValarDragon picture ValarDragon  路  3Comments