|
| 1 | +// Copyright 2019-2022 PureStake Inc. |
| 2 | +// This file is part of Nimbus. |
| 3 | + |
| 4 | +// Nimbus is free software: you can redistribute it and/or modify |
| 5 | +// it under the terms of the GNU General Public License as published by |
| 6 | +// the Free Software Foundation, either version 3 of the License, or |
| 7 | +// (at your option) any later version. |
| 8 | + |
| 9 | +// Nimbus is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +// GNU General Public License for more details. |
| 13 | + |
| 14 | +// You should have received a copy of the GNU General Public License |
| 15 | +// along with Nimbus. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | +use crate as pallet_testing; |
| 18 | +use frame_support::parameter_types; |
| 19 | +use frame_support::traits::ConstU32; |
| 20 | +use frame_support::weights::RuntimeDbWeight; |
| 21 | +use frame_system; |
| 22 | +use sp_core::H256; |
| 23 | +use sp_runtime::{ |
| 24 | + testing::Header, |
| 25 | + traits::{BlakeTwo256, IdentityLookup}, |
| 26 | +}; |
| 27 | + |
| 28 | +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; |
| 29 | +type Block = frame_system::mocking::MockBlock<Test>; |
| 30 | + |
| 31 | +frame_support::construct_runtime!( |
| 32 | + pub enum Test where |
| 33 | + Block = Block, |
| 34 | + NodeBlock = Block, |
| 35 | + UncheckedExtrinsic = UncheckedExtrinsic, |
| 36 | + { |
| 37 | + System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, |
| 38 | + AuthorInherent: pallet_testing::{Pallet, Call, Storage}, |
| 39 | + } |
| 40 | +); |
| 41 | + |
| 42 | +parameter_types! { |
| 43 | + pub const BlockHashCount: u64 = 250; |
| 44 | + pub Authors: Vec<u64> = vec![1, 2, 3, 4, 5]; |
| 45 | + pub const TestDbWeight: RuntimeDbWeight = RuntimeDbWeight { |
| 46 | + read: 1, |
| 47 | + write: 10, |
| 48 | + }; |
| 49 | +} |
| 50 | + |
| 51 | +impl frame_system::Config for Test { |
| 52 | + type BaseCallFilter = frame_support::traits::Everything; |
| 53 | + type BlockWeights = (); |
| 54 | + type BlockLength = (); |
| 55 | + type DbWeight = TestDbWeight; |
| 56 | + type Origin = Origin; |
| 57 | + type Call = Call; |
| 58 | + type Index = u64; |
| 59 | + type BlockNumber = u64; |
| 60 | + type Hash = H256; |
| 61 | + type Hashing = BlakeTwo256; |
| 62 | + type AccountId = u64; |
| 63 | + type Lookup = IdentityLookup<Self::AccountId>; |
| 64 | + type Header = Header; |
| 65 | + type Event = Event; |
| 66 | + type BlockHashCount = BlockHashCount; |
| 67 | + type Version = (); |
| 68 | + type PalletInfo = PalletInfo; |
| 69 | + type AccountData = (); |
| 70 | + type OnNewAccount = (); |
| 71 | + type OnKilledAccount = (); |
| 72 | + type SystemWeightInfo = (); |
| 73 | + type SS58Prefix = (); |
| 74 | + type OnSetCode = (); |
| 75 | + type MaxConsumers = ConstU32<16>; |
| 76 | +} |
| 77 | + |
| 78 | +pub struct DummyBeacon {} |
| 79 | +impl nimbus_primitives::SlotBeacon for DummyBeacon { |
| 80 | + fn slot() -> u32 { |
| 81 | + 0 |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +impl pallet_testing::Config for Test { |
| 86 | + type AccountLookup = (); |
| 87 | + type EventHandler = (); |
| 88 | + type CanAuthor = (); |
| 89 | + type SlotBeacon = DummyBeacon; |
| 90 | + type WeightInfo = (); |
| 91 | +} |
0 commit comments