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

(All Runtimes) Parametrize the deposit for pallet_randomness #2941

Merged
merged 22 commits into from
Oct 7, 2024

Conversation

TarekkMA
Copy link
Contributor

@TarekkMA TarekkMA commented Sep 11, 2024

What does it do?

The pull request parametrizes the deposit for the pallet_randomness. The deposit config can be changed later by a gov proposal, without a runtime upgrade.

Since the deposit is now a parameter controlled via governance proposals, we don't want the full range of the balance type [0, u128::MAX], since some values might not make sense or have security implications. We created a new type called BoundedU128 to limit the allowed range for changing the parameter.

What important points reviewers should know?

  • Created a BoundedU128<LOWER, UPPER> that will only decode if the value passed is within bounds.
    • Tests ensure the correctness of this struct.
  • Used pallet_parameters.
    • Tests ensure parameters can only be set by root.
  • Created a macro called expose_u128_get! that exposes a Get<u128> from a Get<BoundedU128>.
    • Unsure if there's a simpler way to achieve this.

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?

@TarekkMA TarekkMA changed the title Parametrize the deposit for pallet_randomness (moonbase) Parametrize the deposit for pallet_randomness Sep 11, 2024
@TarekkMA TarekkMA added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes labels Sep 11, 2024
Copy link
Contributor

github-actions bot commented Sep 11, 2024

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2192 KB (no changes) ✅

Moonbeam runtime: 2164 KB (no changes) ✅

Moonriver runtime: 2160 KB (no changes) ✅

Compared to latest release (runtime-3200)

Moonbase runtime: 2192 KB (+232 KB compared to latest release) ⚠️

Moonbeam runtime: 2164 KB (+240 KB compared to latest release) ⚠️

Moonriver runtime: 2160 KB (+236 KB compared to latest release) ⚠️

Copy link
Contributor

github-actions bot commented Sep 11, 2024

Coverage Report

@@                      Coverage Diff                      @@
##           master   tarekkma/randomness-param      +/-   ##
=============================================================
+ Coverage   79.18%                      79.24%   +0.06%     
+ Files         299                         302       +3     
+ Lines       87673                       87695      +22     
=============================================================
+ Hits        69419                       69486      +67     
- Misses      18254                       18209      -45     
Files Changed Coverage
/node/cli/src/command.rs 17.02% (-0.59%) 🔽
/node/service/src/lib.rs 61.77% (-0.48%) 🔽
/pallets/xcm-weight-trader/src/lib.rs 90.43% (+1.54%) 🔼
/precompiles/author-mapping/src/lib.rs 96.12% (+3.60%) 🔼
/precompiles/conviction-voting/src/lib.rs 91.28% (+0.83%) 🔼
/precompiles/crowdloan-rewards/src/lib.rs 92.96% (+3.77%) 🔼
/precompiles/gmp/src/lib.rs 16.02% (+0.15%) 🔼
/precompiles/parachain-staking/src/lib.rs 98.48% (+0.89%) 🔼
/precompiles/referenda/src/lib.rs 43.67% (+0.11%) 🔼
/primitives/xcm/src/filter_asset_max_fee.rs 38.46% (+2.75%) 🔼
/runtime/common/src/apis.rs 29.83% (+0.98%) 🔼
/runtime/common/src/weights/pallet_balances.rs 10.84% (+1.56%) 🔼
/runtime/moonbase/src/lib.rs 52.85% (+0.31%) 🔼
/runtime/moonbase/src/runtime_params.rs 42.86% (-7.14%) 🔽
/runtime/moonbeam/src/lib.rs 47.03% (+0.60%) 🔼
/runtime/moonriver/src/lib.rs 47.25% (+0.59%) 🔼

Coverage generated Mon Oct 7 08:53:15 UTC 2024

@noandrea noandrea added the A8-mergeoncegreen Pull request is reviewed well. label Sep 30, 2024
Copy link
Collaborator

@librelois librelois left a comment

Choose a reason for hiding this comment

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

@TarekkMA please write a short description that explain the feature

runtime/common/src/types.rs Outdated Show resolved Hide resolved
RomarQ
RomarQ previously approved these changes Oct 2, 2024
RomarQ
RomarQ previously approved these changes Oct 4, 2024
@TarekkMA TarekkMA changed the title (moonbase) Parametrize the deposit for pallet_randomness (All Runtimes) Parametrize the deposit for pallet_randomness Oct 4, 2024
Copy link
Collaborator

@librelois librelois left a comment

Choose a reason for hiding this comment

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

Please duplicate params config per runtime and not use another macro

@noandrea noandrea merged commit 23fbc7b into master Oct 7, 2024
38 of 39 checks passed
@noandrea noandrea deleted the tarekkma/randomness-param branch October 7, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A8-mergeoncegreen Pull request is reviewed well. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants