Delegations and Validator Shares
In order to reduce the cost of updating delegation and validator ownership of staked coins whenever slashing and
TakeRate deductions are performed, the concept of shares is used. Similar to the shares implementation of the Cosmos
x/staking module, shares are used to keep track of validator assets as proportions of a whole, rather than individual coin balances per account.
Conversions between coins and shares use the following formula:
Whenever coins are deducted after applying the take rate, only
Asset.TotalTokens needs to be updated. All delegation shares will accordingly claim a smaller pool of coins, effectively reducing the total across all delegations proportionally.
When a validator is slashed, their coin totals are not directly slashed. Instead, the validator’s shares are slashed, causing the offending validator to claim a smaller share of the pool. This process effectively distributes the slashed coins proportionally to other non-offending validators.
To calculate the coins staked by a delegator, a two-step formula is used. The first step determines the total coins owned by the validator by multiplying the total amount of coins by the ratio of a validator’s shares over the total number of shares.
To determine the amount of coins a delegator owns, the delegation shares are multiplied by the total amount of validator coins, divided by the total amount of validator shares.