flow-core-contracts
flow-core-contracts copied to clipboard
Refactor rewards calculation and payment to be done in batches
Issue To Be Solved
The rewards payment transaction currently is a very long and costly transaction and should be made more efficient.
Suggest A Solution
And ideal solution would dynamically split up the rewards payments into batches that are a reasonable size based on number of delegators, expected gas usage, etc.
The FlowEpoch.EpochMetadata.rewardAmounts still needs to be stored in the current epoch's metadata every time in the same format as usual.
In FlowEpoch.heartbeat(), pay these batches over the course of successive blocks.
Open questions
Specifics about how and where to split these up most efficiently.
How do we determine the ideal size for a batch of rewards payments?
Can we make the batch size dynamically determined so we don't have to update it as the network grows and shrinks?