forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into release/v0.30.0
- Loading branch information
Showing
22 changed files
with
454 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Reference Counting in F1 Fee Distribution | ||
|
||
In F1 fee distribution, in order to calculate the rewards a delegator ought to receive when they | ||
withdraw their delegation, we must read the terms of the summation of rewards divided by tokens from | ||
the period which they ended when they delegated, and the final period (created when they withdraw). | ||
|
||
Additionally, as slashes change the amount of tokens a delegation will have (but we calculate this lazily, | ||
only when a delegator un-delegates), we must calculate rewards in separate periods before / after any slashes | ||
which occurred in between when a delegator delegated and when they withdrew their rewards. Thus slashes, like | ||
delegations, reference the period which was ended by the slash event. | ||
|
||
All stored historical rewards records for periods which are no longer referenced by any delegations | ||
or any slashes can thus be safely removed, as they will never be read (future delegations and future | ||
slashes will always reference future periods). This is implemented by tracking a `ReferenceCount` | ||
along with each historical reward storage entry. Each time a new object (delegation or slash) | ||
is created which might need to reference the historical record, the reference count is incremented. | ||
Each time one object which previously needed to reference the historical record is deleted, the reference | ||
count is decremented. If the reference count hits zero, the historical record is deleted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.