mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-12 09:55:43 +00:00
39a776cd00
* Basic weights builder. * Fixing WiP * Make the tests work. * Fix weights in node/runtime. * WiP. * Update pallets with new weights parameters. * Validate returns a Result now. * Count mandatory weight separately. * DRY * BREAKING: Updating state root, because of the left-over weight-tracking stuff * Update tests affected by Mandatory tracking. * Fixing tests. * Fix defaults for simple_max * Update frame/system/src/weights.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Rework the API a bit. * Fix compilation & tests. * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Add extra docs & rename few things. * Fix whitespace in ASCII art. * Update frame/system/src/limits.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fix max_extrinsic calculations. * Fix conflicts. * Fix compilation. * Fix new code. * re-remove generic asset * Fix usage. * Update state root. * Update proxy. * Fix tests. * Move weights validity to integrity_test * Remove redundant BlockWeights. * Add all/non_mandatory comment * Add test. * Remove fn block_weights * Make the macro prettier. * Fix some docs. * Make max_total behave more predictabily. * Add BlockWeights to metadata. * fix balances test * Fix utility test. Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
83 lines
2.2 KiB
Rust
83 lines
2.2 KiB
Rust
// This file is part of Substrate.
|
|
|
|
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//! 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 Config = ();
|
|
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::Config for Test {
|
|
type BaseCallFilter = ();
|
|
type BlockWeights = ();
|
|
type BlockLength = ();
|
|
type DbWeight = ();
|
|
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 Version = ();
|
|
type PalletInfo = ();
|
|
type AccountData = ();
|
|
type OnNewAccount = ();
|
|
type OnKilledAccount = ();
|
|
type SystemWeightInfo = ();
|
|
}
|
|
|
|
impl crate::Config 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)
|
|
}
|