onflow / onflow/flow-core-contracts

Refactor rewards calculation and payment to be done in batches

Open
#360 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Architecture Feedback help wanted Performance SC-Eng Smart Contract
Dominant language
Cadence
Stars
93
Forks
53
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.