Cardano-db-sync: Come up with a way to calculate pool profitability

Created on 6 Jan 2021  ·  3Comments  ·  Source: input-output-hk/cardano-db-sync

From @dmitrystas 's comment https://github.com/input-output-hk/cardano-db-sync/issues/415#issuecomment-755156671 .

Specifically the pool profitability calculation should not be affected by the possibility that some stake addresses that delegated to the pool may not be valid (and hence rewards to that invalid stake address got back to the reserves).

Most helpful comment

Another way to represent it might be to keep it in the rewards table but make the addr_id field NULLABLE and use a NULL in that column to indicate that there is no valid address in that column. Alternatively, there could be another boolean column indicating whether the reward could be distributed.

Open to feedback on how this should be handled.

All 3 comments

Maybe an orphaned_rewards table is the best solution. Will keep that in mind when implementing the fix for #415 .

Another way to represent it might be to keep it in the rewards table but make the addr_id field NULLABLE and use a NULL in that column to indicate that there is no valid address in that column. Alternatively, there could be another boolean column indicating whether the reward could be distributed.

Open to feedback on how this should be handled.

PR #469 adds an OrphanReward table and splits the rewards retrieved from ledger state into either the Reward or OrphanReward tables depending on whether the stake address is valid or invalid.

Was this page helpful?
0 / 5 - 0 ratings