From ec0960098e7923909628368c20213cf4c6a78f92 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Wed, 04 May 2022 09:01:42 +0000 Subject: [PATCH] test: upgrade to new polkadot --- --- a/pallets/scheduler/src/lib.rs +++ b/pallets/scheduler/src/lib.rs @@ -704,45 +704,64 @@ use frame_system::{EnsureRoot, EnsureSignedBy}; use crate as scheduler; - mod logger { - use super::*; + #[frame_support::pallet] + pub mod logger { + use super::{OriginCaller, OriginTrait}; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; use std::cell::RefCell; thread_local! { static LOG: RefCell> = RefCell::new(Vec::new()); } - pub trait Config: system::Config { - type Event: From + Into<::Event>; + pub fn log() -> Vec<(OriginCaller, u32)> { + LOG.with(|log| log.borrow().clone()) } - decl_event! { - pub enum Event { - Logged(u32, Weight), - } + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(PhantomData); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::config] + pub trait Config: frame_system::Config { + type Event: From> + IsType<::Event>; } - decl_module! { - pub struct Module for enum Call - where - origin: ::Origin, - ::Origin: OriginTrait - { - fn deposit_event() = default; - #[weight = *weight] - fn log(origin, i: u32, weight: Weight) { - Self::deposit_event(Event::Logged(i, weight)); - LOG.with(|log| { - log.borrow_mut().push((origin.caller().clone(), i)); - }) - } + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + Logged(u32, Weight), + } - #[weight = *weight] - fn log_without_filter(origin, i: u32, weight: Weight) { - Self::deposit_event(Event::Logged(i, weight)); - LOG.with(|log| { - log.borrow_mut().push((origin.caller().clone(), i)); - }) - } + #[pallet::call] + impl Pallet + where + ::Origin: OriginTrait, + { + #[pallet::weight(*weight)] + pub fn log(origin: OriginFor, i: u32, weight: Weight) -> DispatchResult { + Self::deposit_event(Event::Logged(i, weight)); + LOG.with(|log| { + log.borrow_mut().push((origin.caller().clone(), i)); + }); + Ok(()) } + + #[pallet::weight(*weight)] + pub fn log_without_filter( + origin: OriginFor, + i: u32, + weight: Weight, + ) -> DispatchResult { + Self::deposit_event(Event::Logged(i, weight)); + LOG.with(|log| { + log.borrow_mut().push((origin.caller().clone(), i)); + }); + Ok(()) + } } } @@ -756,7 +775,7 @@ UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - Logger: logger::{Pallet, Call, Event}, + Logger: logger::{Pallet, Call, Event}, Scheduler: scheduler::{Pallet, Call, Storage, Event}, } ); --- a/pallets/unique/src/mock.rs +++ b/pallets/unique/src/mock.rs @@ -101,13 +101,12 @@ } parameter_types! { - pub const TransactionByteFee: u64 = 1; pub const OperationalFeeMultiplier: u8 = 5; } impl pallet_transaction_payment::Config for Test { type OnChargeTransaction = CurrencyAdapter, ()>; - type TransactionByteFee = TransactionByteFee; + type LengthToFee = IdentityFee; type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); type OperationalFeeMultiplier = OperationalFeeMultiplier; @@ -176,12 +175,7 @@ pub struct TestEtheremTransactionSender; impl pallet_ethereum::EthereumTransactionSender for TestEtheremTransactionSender { - fn submit_logs_transaction( - _source: H160, - _tx: pallet_ethereum::Transaction, - _logs: Vec, - ) { - } + fn submit_logs_transaction(_source: H160, _logs: Vec) {} } impl pallet_evm_coder_substrate::Config for Test { --- a/pallets/unique/src/tests.rs +++ b/pallets/unique/src/tests.rs @@ -18,7 +18,6 @@ use super::*; use crate::mock::*; use crate::{AccessMode, CollectionMode}; -use sp_runtime::AccountId32; use up_data_structs::{ COLLECTION_NUMBER_LIMIT, CollectionId, CreateItemData, CreateFungibleData, CreateNftData, CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, -- gitstuff