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

[R4R] sidechain staking reward distribution #835

Merged
merged 13 commits into from
Mar 8, 2022

Conversation

forcodedancing
Copy link
Contributor

@forcodedancing forcodedancing commented Dec 13, 2021

Description

This pr tries to implement the staking reward distribution mechanism proposed in BEP128 - in short, staking reward will be distributed in normal blocks after breathe blocks.

overall workflow

Be noted, this pr will change the kafka message schema of distribution.

Rationale

As mentioned in BEP128, current reward distribution mechanism leads to a heavy load to breath blocks, and users' transactions/requests could be affected. Meanwhile, it could be also a bottleneck for further evolution of Binance Chain. Thus, we need to fix the issue and it will also benefit the evaluation of Binance Chain.

Example

N/A

Changes

Notable changes:

  • node version changes
  • kafka schema update
  • new BEP128hardfork height

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • integration tests passed (make integration_test)
  • manual transaction test passed (cli invoke)

Already reviewed by

No

Related issues

No

@forcodedancing forcodedancing changed the title [WIP] sidechain staking reward distribution [P4R] sidechain staking reward distribution Dec 14, 2021
@forcodedancing forcodedancing changed the title [P4R] sidechain staking reward distribution [R4R] sidechain staking reward distribution Jan 5, 2022
@unclezoro
Copy link
Collaborator

LGTM

app/app.go Outdated
// init new param RewardDistributionBatchSize
newCtx := ctx.WithSideChainKeyPrefix(storePrefix)
params := app.stakeKeeper.GetParams(newCtx)
params.RewardDistributionBatchSize = 100
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.RewardDistributionBatchSize has a default value, we can reuse that var. We need adjust the value according to the performance test result.

@@ -544,6 +546,7 @@ func defaultUpgradeConfig() *UpgradeConfig {
BEP67Height: 1,
BEP70Height: 1,
LaunchBscUpgradeHeight: 1,
BEP128Height: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set it to be MaxInt for the first time launch

Copy link
Collaborator

@unclezoro unclezoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the default upgrade height.

@forcodedancing forcodedancing requested a review from qinglin89 March 8, 2022 08:41
@forcodedancing forcodedancing merged commit 9237bb0 into develop Mar 8, 2022
forcodedancing added a commit that referenced this pull request Mar 8, 2022
* sidechain staking reward distribution
@unclezoro unclezoro deleted the staking_sidechain branch May 10, 2022 06:16
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
forcodedancing added a commit that referenced this pull request May 19, 2022
* sidechain staking reward distribution
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.

3 participants