forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add set_partial_params dispatchable function (paritytech#3843)
# ISSUE - Link to issue: paritytech#3617 # Description > Any set parameter / update config call with multiple arguments should have each argument to be an Option field. Please put this to some best practice document. This allows new update config call does not need to duplicate the fields that does not need to update. It also makes concurrent votes of update call possible, otherwise there will be race condition. It also helps with review such proposal otherwise reviewers need to check the other fields should remain the same. - [ ] Concurrent call & race condition testing - [x] Each argument of the `ParamsType` is an `Option` field. Introduce through ```rust pub type PartialParamsOf<T, I> = ParamsType<Option<<T as Config<I>>::Balance>, Option<BlockNumberFor<T>>, RANK_COUNT>; ``` # Outcome ```rust let params = ParamsType { active_salary: [None; 9], passive_salary: [None; 9], demotion_period: [None, Some(10), None, None, None, None, None, None, None], min_promotion_period: [None; 9], offboard_timeout: Some(1), }; CoreFellowship::set_partial_params(signed(2), Box::new(params.clone())), ``` Test coverage ```diff running 21 tests test tests::unit::__construct_runtime_integrity_test::runtime_integrity_tests ... ok test tests::unit::basic_stuff ... ok test tests::integration::test_genesis_config_builds ... ok test tests::integration::__construct_runtime_integrity_test::runtime_integrity_tests ... ok test tests::unit::auto_demote_offboard_works ... ok test tests::unit::auto_demote_works ... ok test tests::unit::get_salary_works ... ok test tests::unit::active_changing_get_salary_works ... ok test tests::integration::swap_bad_noops ... ok test tests::unit::promote_postpones_auto_demote ... ok test tests::unit::infinite_demotion_period_works ... ok test tests::unit::proof_postpones_auto_demote ... ok test tests::unit::induct_works ... ok test tests::unit::set_params_works ... ok test tests::unit::test_genesis_config_builds ... ok test tests::unit::offboard_works ... ok test tests::unit::sync_works ... ok + test tests::unit::set_partial_params_works ... ok test tests::integration::swap_exhaustive_works ... ok test tests::unit::promote_works ... ok test tests::integration::swap_simple_works ... ok test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s Doc-tests pallet_core_fellowship running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` polkadot address: 19nSqFQorfF2HxD3oBzWM3oCh4SaCRKWt1yvmgaPYGCo71J --------- Co-authored-by: Dónal Murray <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Bastian Köcher <[email protected]>
- Loading branch information
1 parent
490fbb7
commit 196761c
Showing
7 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
||
title: Introduce a new dispatchable function `set_partial_params` in `pallet-core-fellowship` | ||
|
||
doc: | ||
- audience: Runtime Dev | ||
description: | | ||
This PR adds a new dispatchable function `set_partial_params` | ||
to update config with multiple arguments without duplicating the | ||
fields that does not need to update. | ||
|
||
crates: | ||
- name: pallet-core-fellowship | ||
bump: major | ||
- name: collectives-westend-runtime | ||
bump: patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.