Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct handling of rewards #469

Merged
merged 3 commits into from
Jan 8, 2021
Merged

Correct handling of rewards #469

merged 3 commits into from
Jan 8, 2021

Conversation

erikd
Copy link
Contributor

@erikd erikd commented Jan 7, 2021

No description provided.

@erikd erikd force-pushed the erikd/issue-415 branch 2 times, most recently from 96f54e9 to f42a1c0 Compare January 7, 2021 07:33
@erikd
Copy link
Contributor Author

erikd commented Jan 7, 2021

Still testing this.

We have been pulling rewards from the ledger-state, *before* those rewards
are distributed and its only when they are distributed that a reward
address can be determined to be valid or not (and this happens inside
ledger-state).

What *can* happen is that a stake address is valid at the start of an
given epoch (when the stake distribution snapshot is taken) but is then
de-registered before the rewards for the epoch have been distributed. When
this is the case these rewards go back to the reserves.

However, to correctly calculate pool profitability we need to store both
valid and invalid rewards in the database. We therefore need to separate
the complete rewards set (actually a map) into two sets; the valid and the
invalid rewards and store these in two separate tables.
This table contains rewards that could not be distributed to the relevant
stake address because the stake address had been de-registered after the
epoch started but before the rewards is distributed. Rewards listed in this
table go back to the reserves.

We need to keep both a 'Reward' and an 'OrphanedReward' table so that pool
profitiabilty can be correctly calculated.

Closes: #415
Closes: #467
@erikd erikd merged commit 8eacf04 into master Jan 8, 2021
@iohk-bors iohk-bors bot deleted the erikd/issue-415 branch January 8, 2021 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant