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

pallet_staking: Introduce Additional Account for Inflation Distribution Alongside PBR #2958

Closed
wants to merge 16 commits into from

Conversation

TarekkMA
Copy link
Contributor

@TarekkMA TarekkMA commented Sep 19, 2024

Todo

  • Write tests for the new changes
  • Fix/Add all required rustdocs
  • Write a migration
  • Discuss the possibility of moving to pallet_parameters
  • Write benchmark for the new ext

What does it do?

What important points reviewers should know?

Is there something left for follow-up PRs?

What alternative implementations were considered?

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

What value does it bring to the blockchain users?

Copy link
Contributor

github-actions bot commented Sep 19, 2024

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2188 KB (no changes) ✅

Moonbeam runtime: 2152 KB (no changes) ✅

Moonriver runtime: 2152 KB (no changes) ✅

Compared to latest release (runtime-3200)

Moonbase runtime: 2188 KB (+228 KB compared to latest release) ⚠️

Moonbeam runtime: 2152 KB (+228 KB compared to latest release) ⚠️

Moonriver runtime: 2152 KB (+228 KB compared to latest release) ⚠️

@TarekkMA TarekkMA added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited breaking Needs to be mentioned in breaking changes labels Sep 19, 2024
Copy link
Contributor

github-actions bot commented Sep 20, 2024

Coverage Report

@@                       Coverage Diff                        @@
##           master   tarekkma/staking-add-address      +/-   ##
================================================================
+ Coverage   79.31%                         79.34%   +0.03%     
  Files         298                            298              
+ Lines       87140                          87193      +53     
================================================================
+ Hits        69114                          69183      +69     
- Misses      18026                          18010      -16     
Files Changed Coverage
/pallets/parachain-staking/src/lib.rs 91.61% (-0.13%) 🔽
/pallets/parachain-staking/src/tests.rs 91.04% (-0.32%) 🔽
/pallets/parachain-staking/src/types.rs 78.08% (-0.24%) 🔽
/pallets/parachain-staking/src/weights.rs 39.67% (+0.83%) 🔼
/runtime/common/src/weights/pallet_parachain_staking.rs 20.29% (+0.43%) 🔼

Coverage generated Mon Sep 23 14:11:08 UTC 2024

/// Parachain bond config info { account, percent_of_inflation }
pub(crate) type ParachainBondInfo<T: Config> =
StorageValue<_, ParachainBondConfig<T::AccountId>, ValueQuery>;
pub(crate) type InflationDistributionInfo<T: Config> = StorageMap<
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's too complex and less efficient to use a StorageMap here.
Please go back to a StorageValue, and create instead a struct InflationDistributionConfig that contains all the field you need

Copy link
Collaborator

Choose a reason for hiding this comment

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

@TarekkMA also, the StorageMap imply more reads at round change block, more complex code in staking pallet that is already too complex, and more complex and costly benchmarks.
We need to reduce the complexity of this pallet, as it was the place of many critical bugs in the past, It is very important not to add unnecessary complexity!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will work on the new impl in this PR: #2976

@TarekkMA
Copy link
Contributor Author

Closed in favor of #2976

@TarekkMA TarekkMA closed this Sep 25, 2024
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 D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants