mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
b301451c85
* Frame System Benchmarking * Add to substrate node, avoid divide by zero errors in analysis * reduce features * some fixes * copy pasta
83 lines
2.3 KiB
Rust
83 lines
2.3 KiB
Rust
// Copyright 2020 Parity Technologies (UK) Ltd.
|
|
// This file is part of Substrate.
|
|
|
|
// Substrate is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Substrate is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Mock file for system benchmarking.
|
|
|
|
#![cfg(test)]
|
|
|
|
use sp_runtime::traits::IdentityLookup;
|
|
use frame_support::{
|
|
impl_outer_origin,
|
|
dispatch::{Dispatchable, DispatchInfo, PostDispatchInfo},
|
|
};
|
|
|
|
type AccountId = u64;
|
|
type AccountIndex = u32;
|
|
type BlockNumber = u64;
|
|
|
|
impl_outer_origin! {
|
|
pub enum Origin for Test where system = frame_system {}
|
|
}
|
|
|
|
#[derive(Debug, codec::Encode, codec::Decode)]
|
|
pub struct Call;
|
|
|
|
impl Dispatchable for Call {
|
|
type Origin = ();
|
|
type Trait = ();
|
|
type Info = DispatchInfo;
|
|
type PostInfo = PostDispatchInfo;
|
|
fn dispatch(self, _origin: Self::Origin)
|
|
-> sp_runtime::DispatchResultWithInfo<Self::PostInfo> {
|
|
panic!("Do not use dummy implementation for dispatch.");
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
|
pub struct Test;
|
|
|
|
impl frame_system::Trait for Test {
|
|
type Origin = Origin;
|
|
type Index = AccountIndex;
|
|
type BlockNumber = BlockNumber;
|
|
type Call = Call;
|
|
type Hash = sp_core::H256;
|
|
type Hashing = ::sp_runtime::traits::BlakeTwo256;
|
|
type AccountId = AccountId;
|
|
type Lookup = IdentityLookup<Self::AccountId>;
|
|
type Header = sp_runtime::testing::Header;
|
|
type Event = ();
|
|
type BlockHashCount = ();
|
|
type MaximumBlockWeight = ();
|
|
type DbWeight = ();
|
|
type BlockExecutionWeight = ();
|
|
type ExtrinsicBaseWeight = ();
|
|
type AvailableBlockRatio = ();
|
|
type MaximumBlockLength = ();
|
|
type Version = ();
|
|
type ModuleToIndex = ();
|
|
type AccountData = ();
|
|
type OnNewAccount = ();
|
|
type OnKilledAccount = ();
|
|
}
|
|
|
|
impl crate::Trait for Test {}
|
|
|
|
pub fn new_test_ext() -> sp_io::TestExternalities {
|
|
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
|
sp_io::TestExternalities::new(t)
|
|
}
|