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

Reward block author in Dancelight #784

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tmpolaczyk
Copy link
Contributor

@tmpolaczyk tmpolaczyk commented Dec 16, 2024

Previously we were only rewarding the Dancelight block author for including parachain candidates, but not for the block per se. So an empty block would get no reward.

This PR fixed that by rewarding 20 points to the block author, same as in polkadot.

https://github.com/paritytech/polkadot-sdk/blob/48c6574b1a32893e6a2113622d009cefda0a5f21/substrate/frame/staking/src/pallet/impls.rs#L1411

Copy link
Contributor

github-actions bot commented Dec 16, 2024

WASM runtime size check:

Compared to target branch

dancebox runtime: 1428 KB (no changes) ✅

flashbox runtime: 824 KB (no changes) ✅

dancelight runtime: 2136 KB (no changes) ✅

container chain template simple runtime: 1124 KB (no changes) ✅

container chain template frontier runtime: 1400 KB (no changes) ✅

@tmpolaczyk tmpolaczyk marked this pull request as ready for review December 16, 2024 13:06
@tmpolaczyk tmpolaczyk added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Dec 16, 2024
Copy link
Contributor

github-actions bot commented Dec 16, 2024

Coverage Report

(master)

@@                      Coverage Diff                       @@
##           master   tomasz-reward-block-author      +/-   ##
==============================================================
- Coverage   65.15%                       65.14%   -0.01%     
  Files         327                          327              
+ Lines       57299                        57308       +9     
==============================================================
+ Hits        37330                        37333       +3     
+ Misses      19969                        19975       +6     
Files Changed Coverage
/pallets/external-validators-rewards/src/lib.rs 88.19% (-1.39%)
/primitives/bridge/src/lib.rs 57.80% (-0.92%)
/solo-chains/runtime/dancelight/src/lib.rs 68.24% (-0.12%)
/solo-chains/runtime/dancelight/src/tests/common/mod.rs 97.27% (+0.02%)

Coverage generated Fri Dec 20 10:28:43 UTC 2024

const totalRewards = validatorRewards.total.toBigInt();

// Validators get 20 points for creating a block, so if they included a candidate, they will get more than 20
expect(totalRewards).to.be.greaterThan(20n);
Copy link
Collaborator

@girazoki girazoki Dec 18, 2024

Choose a reason for hiding this comment

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

wait they get 20 per candidate and per block created. So you will always have higher than 20?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess if so, you need to check the rewards totalRewards > num_blocks*20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants