mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 13:37:57 +00:00
Use parameter_types instead of thread_local for test-setup (#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>
This commit is contained in:
@@ -39,15 +39,14 @@ use sp_runtime::{
|
||||
#[frame_support::pallet]
|
||||
pub mod logger {
|
||||
use super::{OriginCaller, OriginTrait};
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support::{pallet_prelude::*, parameter_types};
|
||||
use frame_system::pallet_prelude::*;
|
||||
use std::cell::RefCell;
|
||||
|
||||
thread_local! {
|
||||
static LOG: RefCell<Vec<(OriginCaller, u32)>> = RefCell::new(Vec::new());
|
||||
parameter_types! {
|
||||
static Log: Vec<(OriginCaller, u32)> = Vec::new();
|
||||
}
|
||||
pub fn log() -> Vec<(OriginCaller, u32)> {
|
||||
LOG.with(|log| log.borrow().clone())
|
||||
Log::get().clone()
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -76,8 +75,8 @@ pub mod logger {
|
||||
#[pallet::weight(*weight)]
|
||||
pub fn log(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {
|
||||
Self::deposit_event(Event::Logged(i, weight));
|
||||
LOG.with(|log| {
|
||||
log.borrow_mut().push((origin.caller().clone(), i));
|
||||
Log::mutate(|log| {
|
||||
log.push((origin.caller().clone(), i));
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
@@ -85,8 +84,8 @@ pub mod logger {
|
||||
#[pallet::weight(*weight)]
|
||||
pub fn log_without_filter(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {
|
||||
Self::deposit_event(Event::Logged(i, weight));
|
||||
LOG.with(|log| {
|
||||
log.borrow_mut().push((origin.caller().clone(), i));
|
||||
Log::mutate(|log| {
|
||||
log.push((origin.caller().clone(), i));
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user