Use parameter_types instead of thread_local for test-setup#12036
Use parameter_types instead of thread_local for test-setup#12036paritytech-processbot[bot] merged 38 commits intoparitytech:masterfrom
Conversation
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
There was a problem hiding this comment.
Good direction, but:
- naming needs fixing
- Please add https://github.com/paritytech/substrate/pull/12002/files#diff-31d6476b566f793c17f32f9fdefeb487988af58c61ba752d0275b91f6c8aaccaR433 to your PR and use it instead of
:getand:setwhen appropriate
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
frame/im-online/src/tests.rs
Outdated
|
|
||
| // then | ||
| let offences = OFFENCES.with(|l| l.replace(vec![])); | ||
| let offences = OFFENCES::get(); |
frame/im-online/src/tests.rs
Outdated
| let offences = OFFENCES::get(); | ||
| OFFENCES::mutate(|l| l.clear()); |
There was a problem hiding this comment.
| let offences = OFFENCES::get(); | |
| OFFENCES::mutate(|l| l.clear()); | |
| let offences = Offences::take(); |
frame/offences/src/mock.rs
Outdated
| pub static ON_OFFENCE_PERBILL: RefCell<Vec<Perbill>> = RefCell::new(Default::default()); | ||
| pub static OFFENCE_WEIGHT: RefCell<Weight> = RefCell::new(Default::default()); | ||
| parameter_types! { | ||
| pub static OnOffencePerBill: Vec<Perbill> = Default::default(); |
There was a problem hiding this comment.
| pub static OnOffencePerBill: Vec<Perbill> = Default::default(); | |
| pub static OnOffencePerbill: Vec<Perbill> = Default::default(); |
frame/offences/src/mock.rs
Outdated
| ) -> Weight { | ||
| ON_OFFENCE_PERBILL.with(|f| { | ||
| *f.borrow_mut() = slash_fraction.to_vec(); | ||
| OnOffencePerBill::mutate(|f| { |
There was a problem hiding this comment.
| OnOffencePerBill::mutate(|f| { | |
| OnOffencePerbill::mutate(|f| { |
kianenigma
left a comment
There was a problem hiding this comment.
LGTM modulo some last nits, please make sure all open comments are addressed.
|
/tip large |
|
@kianenigma A large tip was successfully submitted for tifecool (1s51dYXziQwTnSnModErKfra3TeEsVipqzY846CLCTEXtHJ on polkadot). https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/treasury/tips |
|
Wow. Really appreciate the tip! Will round up immediately ❤️ |
|
@tifecool please merge master |
|
@athei please review |
|
The Let's do @bkchr's suggestion in #12036 (comment) and use Please document this in the |
Ok, let me try. |
| #[derive(Default)] | ||
| struct MockLoader { | ||
| #[derive(Default, Clone)] | ||
| pub struct MockLoader { |
There was a problem hiding this comment.
parameter_types requires it
| #[derive(Default, Debug, PartialEq, Eq)] | ||
| struct TestExt { | ||
| #[derive(Default, Debug, PartialEq, Eq, Clone)] | ||
| pub struct TestExt { |
There was a problem hiding this comment.
parameter_types requires it
|
Are we sure this closes #10479 too? |
|
bot merge |
|
Waiting for commit status. |
It still uses thread local under the hood. So I don't think so. |
…h#12036) * Edit to Assets. parameter_types * fixes * Test Fixes. WIP * Edits to pallet-aura * Camel Case Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Implementation of mutate fn * update to pallet-aura * Update to frame-system. Fixes * Update to frame-support-test. CamelCases * Updates to frame- contracts, offences, staking, bounties, child bounties * Edit to mutate fn. Changes to frame-contracts. CamelCase pallet-aura * Edits to frame-contracts & executive * cargo +nightly fmt * unused import removed * unused import removed * cargo +nightly fmt * minor adjustment * updates * updates * cargo +nightly fmt * cargo +nightly fmt * take fn implemented * update * update * Fixes to CallFilter * cargo +nightly fmt * final fixes * Default changed to $value * Update frame/support/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
PR for: #12020
WIP
Fixes: #12020
might close: #10479
polkadot address: 1s51dYXziQwTnSnModErKfra3TeEsVipqzY846CLCTEXtHJ