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

Refactor rewards calculation and payment to be done in batches #360

Open
joshuahannan opened this issue Apr 3, 2023 · 1 comment
Open
Assignees
Labels
Architecture Feedback help wanted Extra attention is needed Performance SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board Smart Contract

Comments

@joshuahannan
Copy link
Member

joshuahannan commented Apr 3, 2023

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?

@joshuahannan
Copy link
Member Author

In this PR, , I moved the rewards calculation to the beginning of the epoch commit phase so that it freed up some computation at the end of the epoch, but haven't done it in batches yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture Feedback help wanted Extra attention is needed Performance SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board Smart Contract
Projects
Status: 🧊 Backlog
Development

No branches or pull requests

2 participants