feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
[package]
|
||||
name = "pezframe-support-test"
|
||||
version = "3.0.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
pezframe-benchmarking = { workspace = true }
|
||||
pezframe-executive = { workspace = true }
|
||||
frame-metadata = { features = ["current", "unstable"], workspace = true }
|
||||
pezframe-support = { features = ["experimental"], workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
rustversion = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["derive"], workspace = true }
|
||||
pezsp-api = { workspace = true }
|
||||
pezsp-arithmetic = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-io = { workspace = true }
|
||||
pezsp-metadata-ir = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-state-machine = { optional = true, workspace = true, default-features = true }
|
||||
pezsp-version = { workspace = true }
|
||||
static_assertions = { workspace = true, default-features = true }
|
||||
trybuild = { features = ["diff"], workspace = true }
|
||||
# The "std" feature for this pallet is never activated on purpose, in order to test construct_runtime error message
|
||||
test-pallet = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-benchmarking/std",
|
||||
"pezframe-executive/std",
|
||||
"frame-metadata/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"pezsp-api/std",
|
||||
"pezsp-arithmetic/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-version/std",
|
||||
"test-pallet/std",
|
||||
]
|
||||
experimental = ["pezframe-support/experimental", "pezframe-system/experimental"]
|
||||
runtime-benchmarks = [
|
||||
"pezframe-benchmarking/runtime-benchmarks",
|
||||
"pezframe-executive/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-api/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
"test-pallet/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"pezframe-executive/try-runtime",
|
||||
"pezframe-support/try-runtime",
|
||||
"pezframe-system/try-runtime",
|
||||
"pezsp-runtime/try-runtime",
|
||||
]
|
||||
# WARNING:
|
||||
# Only CI runs with this feature enabled. This feature is for testing stuff related to the FRAME macros
|
||||
# in conjunction with rust features.
|
||||
frame-feature-testing = []
|
||||
frame-feature-testing-2 = []
|
||||
# Disable ui tests
|
||||
disable-ui-tests = []
|
||||
no-metadata-docs = ["pezframe-support/no-metadata-docs"]
|
||||
@@ -0,0 +1,42 @@
|
||||
[package]
|
||||
name = "pezframe-support-test-compile-pass"
|
||||
version = "4.0.0-dev"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
pezframe-support = { workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-version = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-version/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
]
|
||||
@@ -0,0 +1,90 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
//! Test that `construct_runtime!` also works when `pezframe-support` or `pezframe-system` are renamed in
|
||||
//! the `Cargo.toml`.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use pezframe_support::{
|
||||
construct_runtime, derive_impl, parameter_types,
|
||||
traits::{ConstU16, ConstU32, ConstU64, Everything},
|
||||
};
|
||||
use pezsp_core::{sr25519, H256};
|
||||
use pezsp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, IdentityLookup, Verify},
|
||||
};
|
||||
use pezsp_version::RuntimeVersion;
|
||||
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: alloc::borrow::Cow::Borrowed("pezframe-support-test-compile-pass"),
|
||||
impl_name: alloc::borrow::Cow::Borrowed("bizinikiwi-pezframe-support-test-compile-pass-runtime"),
|
||||
authoring_version: 0,
|
||||
spec_version: 0,
|
||||
impl_version: 0,
|
||||
apis: pezsp_version::create_apis_vec!([]),
|
||||
transaction_version: 0,
|
||||
system_version: 0,
|
||||
};
|
||||
|
||||
pub type Signature = sr25519::Signature;
|
||||
pub type AccountId = <Signature as Verify>::Signer;
|
||||
pub type BlockNumber = u64;
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
}
|
||||
|
||||
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
|
||||
impl pezframe_system::Config for Runtime {
|
||||
type BaseCallFilter = Everything;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type Nonce = u128;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Block = Block;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type BlockHashCount = ConstU64<2400>;
|
||||
type Version = Version;
|
||||
type AccountData = ();
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type AccountId = AccountId;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type DbWeight = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ConstU16<0>;
|
||||
}
|
||||
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
construct_runtime!(
|
||||
pub enum Runtime {
|
||||
System: pezframe_system,
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
This is the best pallet
|
||||
@@ -0,0 +1 @@
|
||||
Very important information :D
|
||||
@@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "pezframe-support-test-pallet"
|
||||
version = "4.0.0-dev"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
pezframe-support = { workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["derive"], workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"pezsp-runtime/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
@@ -0,0 +1,56 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
//! A basic pallet that can be used to test `construct_runtime!`.
|
||||
|
||||
// Ensure docs are propagated properly by the macros.
|
||||
#![warn(missing_docs)]
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
/// I'm the documentation
|
||||
#[pallet::storage]
|
||||
pub type Value<T> = StorageValue<_, u32>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(pezframe_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
_config: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Something failed
|
||||
Test,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
//! Minimal pallet without `pezframe_system::Config`-super trait.
|
||||
|
||||
// Make sure we fail compilation on warnings
|
||||
#![warn(missing_docs)]
|
||||
#![deny(warnings)]
|
||||
|
||||
pub use pezframe_support::dispatch::RawOrigin;
|
||||
use pezframe_system::pezpallet_prelude::BlockNumberFor;
|
||||
|
||||
pub use self::pallet::*;
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use crate::{self as pezframe_system, pezpallet_prelude::*};
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
/// The configuration trait.
|
||||
#[pallet::config(pezframe_system_config)]
|
||||
#[pallet::disable_pezframe_system_supertrait_check]
|
||||
pub trait Config: 'static + Eq + Clone {
|
||||
/// The block number type.
|
||||
type BlockNumber: Parameter + Member + Default + MaybeSerializeDeserialize + MaxEncodedLen;
|
||||
/// The account type.
|
||||
type AccountId: Parameter + Member + MaxEncodedLen;
|
||||
/// The basic call filter to use in Origin.
|
||||
type BaseCallFilter: pezframe_support::traits::Contains<Self::RuntimeCall>;
|
||||
/// The runtime origin type.
|
||||
type RuntimeOrigin: Into<Result<RawOrigin<Self::AccountId>, Self::RuntimeOrigin>>
|
||||
+ From<RawOrigin<Self::AccountId>>;
|
||||
/// The runtime call type.
|
||||
type RuntimeCall;
|
||||
/// Contains an aggregation of all tasks in this runtime.
|
||||
type RuntimeTask;
|
||||
/// The runtime event type.
|
||||
type RuntimeEvent: Parameter
|
||||
+ Member
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>
|
||||
+ From<Event<Self>>;
|
||||
/// The information about the pallet setup in the runtime.
|
||||
type PalletInfo: pezframe_support::traits::PalletInfo;
|
||||
/// The db weights.
|
||||
type DbWeight: Get<pezframe_support::weights::RuntimeDbWeight>;
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// A noop call.
|
||||
pub fn noop(_origin: OriginFor<T>) -> DispatchResult {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// A empty method.
|
||||
pub fn deposit_event(_event: impl Into<T::RuntimeEvent>) {}
|
||||
}
|
||||
|
||||
/// The origin type.
|
||||
#[pallet::origin]
|
||||
pub type Origin<T> = RawOrigin<<T as Config>::AccountId>;
|
||||
|
||||
/// The error type.
|
||||
#[pallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Test error documentation
|
||||
TestError,
|
||||
/// Error documentation
|
||||
/// with multiple lines
|
||||
AnotherError,
|
||||
/// Required by construct_runtime
|
||||
CallFiltered,
|
||||
}
|
||||
|
||||
/// The event type.
|
||||
#[pallet::event]
|
||||
pub enum Event<T: Config> {
|
||||
/// The extrinsic is successful
|
||||
ExtrinsicSuccess,
|
||||
/// The extrinsic is failed
|
||||
ExtrinsicFailed,
|
||||
/// The ignored error
|
||||
Ignore(<T as Config>::BlockNumber),
|
||||
}
|
||||
}
|
||||
|
||||
/// Ensure that the origin `o` represents the root. Returns `Ok` or an `Err` otherwise.
|
||||
pub fn ensure_root<OuterOrigin, AccountId>(o: OuterOrigin) -> Result<(), &'static str>
|
||||
where
|
||||
OuterOrigin: Into<Result<RawOrigin<AccountId>, OuterOrigin>>,
|
||||
{
|
||||
o.into().map(|_| ()).map_err(|_| "bad origin: expected to be a root origin")
|
||||
}
|
||||
|
||||
/// Same semantic as [`pezframe_system`].
|
||||
// Note: we cannot use [`pezframe_system`] here since the pallet does not depend on
|
||||
// [`pezframe_system::Config`].
|
||||
pub mod pezpallet_prelude {
|
||||
pub use crate::ensure_root;
|
||||
|
||||
/// Type alias for the `Origin` associated type of system config.
|
||||
pub type OriginFor<T> = <T as crate::Config>::RuntimeOrigin;
|
||||
|
||||
/// Type alias for the `BlockNumber` associated type of system config.
|
||||
pub type BlockNumberFor<T> = <T as super::Config>::BlockNumber;
|
||||
}
|
||||
|
||||
/// Provides an implementation of [`pezframe_support::traits::Randomness`] that should only be used in
|
||||
/// tests!
|
||||
pub struct TestRandomness<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<Output: codec::Decode + Default, T>
|
||||
pezframe_support::traits::Randomness<Output, BlockNumberFor<T>> for TestRandomness<T>
|
||||
where
|
||||
T: pezframe_system::Config,
|
||||
{
|
||||
fn random(subject: &[u8]) -> (Output, BlockNumberFor<T>) {
|
||||
use pezsp_runtime::traits::TrailingZeroInput;
|
||||
|
||||
(
|
||||
Output::decode(&mut TrailingZeroInput::new(subject)).unwrap_or_default(),
|
||||
pezframe_system::Pallet::<T>::block_number(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
[package]
|
||||
name = "pezframe-support-test-stg-frame-crate"
|
||||
version = "0.1.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
frame = { features = ["runtime"], workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["codec/std", "frame/std", "scale-info/std"]
|
||||
runtime-benchmarks = ["frame/runtime-benchmarks"]
|
||||
@@ -0,0 +1,75 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
// ! A basic pallet to test it compiles along with a runtime using it when `pezframe_system` and
|
||||
// `pezframe_support` are reexported by a `frame` crate.
|
||||
|
||||
use frame::deps::{pezframe_support, pezframe_system};
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
// The only valid syntax here is the following or
|
||||
// ```
|
||||
// pub trait Config: frame::deps::pezframe_system::Config {}
|
||||
// ```
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(pezframe_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
_config: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
// Dummy test to make sure a runtime would compile.
|
||||
mod tests {
|
||||
use super::{
|
||||
pezframe_support::{construct_runtime, derive_impl},
|
||||
pezframe_system, pallet,
|
||||
};
|
||||
|
||||
type Block = pezframe_system::mocking::MockBlock<Runtime>;
|
||||
|
||||
impl crate::pallet::Config for Runtime {}
|
||||
|
||||
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
|
||||
impl pezframe_system::Config for Runtime {
|
||||
type Block = Block;
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: pezframe_system,
|
||||
Pallet: pallet,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,573 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use codec::Encode;
|
||||
use pezframe_support::{
|
||||
derive_impl,
|
||||
dispatch::GetDispatchInfo,
|
||||
pezpallet_prelude::{TransactionSource, Weight},
|
||||
};
|
||||
use pezsp_runtime::{
|
||||
testing::UintAuthorityId,
|
||||
traits::{Applyable, Checkable},
|
||||
transaction_validity::{
|
||||
InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,
|
||||
},
|
||||
BuildStorage, DispatchError,
|
||||
};
|
||||
|
||||
// test for instance
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet1 {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
pub const CALL_1_AUTH_WEIGHT: Weight = Weight::from_all(1);
|
||||
pub const CALL_1_WEIGHT: Weight = Weight::from_all(2);
|
||||
pub const CALL_2_AUTH_WEIGHT: Weight = Weight::from_all(3);
|
||||
pub const CALL_2_WEIGHT: Weight = Weight::from_all(5);
|
||||
pub const CALL_2_REFUND: Weight = Weight::from_all(4);
|
||||
pub const CALL_3_AUTH_WEIGHT: Weight = Weight::from_all(6);
|
||||
pub const CALL_3_WEIGHT: Weight = Weight::from_all(7);
|
||||
pub const CALL_3_REFUND: Weight = Weight::from_all(6);
|
||||
pub const CALL_4_AUTH_WEIGHT: Weight = Weight::from_all(10);
|
||||
pub const CALL_4_WEIGHT: Weight = Weight::from_all(11);
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn call1() -> Weight;
|
||||
fn call2() -> Weight;
|
||||
fn authorize_call2() -> Weight;
|
||||
fn call3() -> Weight;
|
||||
fn authorize_call3() -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn call1() -> Weight {
|
||||
CALL_1_WEIGHT
|
||||
}
|
||||
fn call2() -> Weight {
|
||||
CALL_2_WEIGHT
|
||||
}
|
||||
fn authorize_call2() -> Weight {
|
||||
CALL_2_AUTH_WEIGHT
|
||||
}
|
||||
fn call3() -> Weight {
|
||||
CALL_3_WEIGHT
|
||||
}
|
||||
fn authorize_call3() -> Weight {
|
||||
CALL_3_AUTH_WEIGHT
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {
|
||||
type SomeGeneric: Parameter;
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::call(weight = T::WeightInfo)]
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
#[pallet::authorize(|_source| Ok((ValidTransaction::default(), Weight::zero())))]
|
||||
#[pallet::weight_of_authorize(CALL_1_AUTH_WEIGHT)]
|
||||
#[pallet::call_index(0)]
|
||||
pub fn call1(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_authorized(origin)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::authorize(|_source, a, b, c, d, e, f, authorize_refund|
|
||||
if *a {
|
||||
let valid = ValidTransaction {
|
||||
priority: *b,
|
||||
requires: vec![c.encode()],
|
||||
provides: vec![d.encode()],
|
||||
longevity: *e,
|
||||
propagate: *f,
|
||||
};
|
||||
Ok((valid, *authorize_refund))
|
||||
} else {
|
||||
Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
|
||||
}
|
||||
)]
|
||||
#[pallet::call_index(1)]
|
||||
pub fn call2(
|
||||
origin: OriginFor<T>,
|
||||
a: bool,
|
||||
b: u64,
|
||||
c: u8,
|
||||
d: u8,
|
||||
e: u64,
|
||||
f: bool,
|
||||
authorize_refund: Weight,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_authorized(origin)?;
|
||||
|
||||
let _ = (a, b, c, d, e, f, authorize_refund);
|
||||
|
||||
Ok(Some(CALL_2_REFUND).into())
|
||||
}
|
||||
|
||||
#[pallet::authorize(Self::authorize_call3)]
|
||||
#[pallet::call_index(2)]
|
||||
pub fn call3(
|
||||
origin: OriginFor<T>,
|
||||
valid: bool,
|
||||
_some_gen: T::SomeGeneric,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_authorized(origin)?;
|
||||
|
||||
let _ = valid;
|
||||
|
||||
Err(pezsp_runtime::DispatchErrorWithPostInfo {
|
||||
post_info: Some(CALL_3_REFUND).into(),
|
||||
error: DispatchError::Other("Call3 failed"),
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "frame-feature-testing")]
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::authorize(|_source| Ok((ValidTransaction::default(), Weight::zero())))]
|
||||
#[pallet::weight_of_authorize(CALL_4_AUTH_WEIGHT)]
|
||||
#[pallet::weight(CALL_4_WEIGHT)]
|
||||
pub fn call4(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_authorized(origin)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
fn authorize_call3(
|
||||
_source: TransactionSource,
|
||||
valid: &bool,
|
||||
_some_gen: &T::SomeGeneric,
|
||||
) -> TransactionValidityWithRefund {
|
||||
if *valid {
|
||||
Ok(Default::default())
|
||||
} else {
|
||||
Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test for dev mode.
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
pub mod pallet2 {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
pub trait SomeTrait {}
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::authorize(|_source| Ok(Default::default()))]
|
||||
pub fn call1(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_authorized(origin)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test for no pallet info.
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet3 {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
pub const CALL_1_AUTH_WEIGHT: Weight = Weight::from_all(1);
|
||||
pub const CALL_1_WEIGHT: Weight = Weight::from_all(1);
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: crate::pallet1::Config + pezframe_system::Config {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::authorize(|_source| Ok(Default::default()))]
|
||||
#[pallet::weight_of_authorize(CALL_1_AUTH_WEIGHT)]
|
||||
#[pallet::weight(CALL_1_WEIGHT)]
|
||||
#[pallet::call_index(0)]
|
||||
pub fn call1(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_authorized(origin)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test for pallet with no authorized call
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
pub mod pallet4 {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
pub fn call1(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_authorized(origin)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
|
||||
impl pezframe_system::Config for Runtime {
|
||||
type Block = Block;
|
||||
}
|
||||
|
||||
impl pallet2::SomeTrait for RuntimeOrigin {}
|
||||
|
||||
impl pallet1::Config for Runtime {
|
||||
type SomeGeneric = u32;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet1::Config<pezframe_support::instances::Instance2> for Runtime {
|
||||
type SomeGeneric = u32;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
#[cfg(feature = "frame-feature-testing")]
|
||||
impl pallet1::Config<pezframe_support::instances::Instance3> for Runtime {
|
||||
type SomeGeneric = u32;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet2::Config for Runtime {}
|
||||
|
||||
impl pallet3::Config for Runtime {}
|
||||
|
||||
impl pallet4::Config for Runtime {}
|
||||
|
||||
pub type TransactionExtension = pezframe_system::AuthorizeCall<Runtime>;
|
||||
|
||||
pub type Header = pezsp_runtime::generic::Header<u32, pezsp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = pezsp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = pezsp_runtime::generic::UncheckedExtrinsic<
|
||||
u64,
|
||||
RuntimeCall,
|
||||
UintAuthorityId,
|
||||
TransactionExtension,
|
||||
>;
|
||||
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Runtime {
|
||||
System: pezframe_system,
|
||||
Pallet1: pallet1,
|
||||
Pallet1Instance2: pallet1::<Instance2>,
|
||||
Pallet2: pallet2,
|
||||
Pallet3: pallet3,
|
||||
#[cfg(feature = "frame-feature-testing")]
|
||||
Pallet1Instance3: pallet1::<Instance3>,
|
||||
Pallet4: pallet4,
|
||||
}
|
||||
);
|
||||
|
||||
pub fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
let t = RuntimeGenesisConfig { ..Default::default() }.build_storage().unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn valid_call_weight_test() {
|
||||
// Tests for valid successful calls and assert their weight
|
||||
|
||||
struct Test {
|
||||
call: RuntimeCall,
|
||||
dispatch_success: bool,
|
||||
call_weight: Weight,
|
||||
ext_weight: Weight,
|
||||
actual_weight: Weight,
|
||||
}
|
||||
|
||||
let call_2_auth_weight_refund = Weight::from_all(2);
|
||||
|
||||
let tests = vec![
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call1 {}),
|
||||
dispatch_success: true,
|
||||
call_weight: pallet1::CALL_1_WEIGHT,
|
||||
ext_weight: pallet1::CALL_1_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_1_WEIGHT + pallet1::CALL_1_AUTH_WEIGHT,
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call2 {
|
||||
a: true,
|
||||
b: 1,
|
||||
c: 2,
|
||||
d: 3,
|
||||
e: 4,
|
||||
f: true,
|
||||
authorize_refund: Weight::zero(),
|
||||
}),
|
||||
dispatch_success: true,
|
||||
call_weight: pallet1::CALL_2_WEIGHT,
|
||||
ext_weight: pallet1::CALL_2_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_2_REFUND + pallet1::CALL_2_AUTH_WEIGHT,
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call3 { valid: true, some_gen: 1 }),
|
||||
dispatch_success: false,
|
||||
call_weight: pallet1::CALL_3_WEIGHT,
|
||||
ext_weight: pallet1::CALL_3_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_3_REFUND + pallet1::CALL_3_AUTH_WEIGHT,
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1Instance2(pallet1::Call::call1 {}),
|
||||
dispatch_success: true,
|
||||
call_weight: pallet1::CALL_1_WEIGHT,
|
||||
ext_weight: pallet1::CALL_1_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_1_WEIGHT + pallet1::CALL_1_AUTH_WEIGHT,
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1Instance2(pallet1::Call::call2 {
|
||||
a: true,
|
||||
b: 1,
|
||||
c: 2,
|
||||
d: 3,
|
||||
e: 4,
|
||||
f: true,
|
||||
authorize_refund: call_2_auth_weight_refund,
|
||||
}),
|
||||
dispatch_success: true,
|
||||
call_weight: pallet1::CALL_2_WEIGHT,
|
||||
ext_weight: pallet1::CALL_2_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_2_REFUND + pallet1::CALL_2_AUTH_WEIGHT -
|
||||
call_2_auth_weight_refund,
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1Instance2(pallet1::Call::call3 { valid: true, some_gen: 1 }),
|
||||
dispatch_success: false,
|
||||
call_weight: pallet1::CALL_3_WEIGHT,
|
||||
ext_weight: pallet1::CALL_3_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_3_REFUND + pallet1::CALL_3_AUTH_WEIGHT,
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet2(pallet2::Call::call1 {}),
|
||||
dispatch_success: true,
|
||||
call_weight: Weight::zero(),
|
||||
ext_weight: Weight::zero(),
|
||||
actual_weight: Weight::zero(),
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet3(pallet3::Call::call1 {}),
|
||||
dispatch_success: true,
|
||||
call_weight: pallet3::CALL_1_WEIGHT,
|
||||
ext_weight: pallet3::CALL_1_AUTH_WEIGHT,
|
||||
actual_weight: pallet3::CALL_1_WEIGHT + pallet3::CALL_1_AUTH_WEIGHT,
|
||||
},
|
||||
#[cfg(feature = "frame-feature-testing")]
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1Instance3(pallet1::Call::call4 {}),
|
||||
dispatch_success: true,
|
||||
call_weight: pallet1::CALL_4_WEIGHT,
|
||||
ext_weight: pallet1::CALL_4_AUTH_WEIGHT,
|
||||
actual_weight: pallet1::CALL_4_WEIGHT + pallet1::CALL_4_AUTH_WEIGHT,
|
||||
},
|
||||
];
|
||||
|
||||
for (index, test) in tests.into_iter().enumerate() {
|
||||
let Test { call, dispatch_success, call_weight, ext_weight, actual_weight } = test;
|
||||
|
||||
println!("Running test {}", index);
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let tx_ext = pezframe_system::AuthorizeCall::<Runtime>::new();
|
||||
|
||||
let tx = UncheckedExtrinsic::new_transaction(call, tx_ext);
|
||||
|
||||
let info = tx.get_dispatch_info();
|
||||
let len = tx.using_encoded(|e| e.len());
|
||||
|
||||
let checked = Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
|
||||
.expect("Transaction is general so signature is good");
|
||||
|
||||
checked
|
||||
.validate::<Runtime>(TransactionSource::External, &info, len)
|
||||
.expect("call1 is always valid");
|
||||
|
||||
let dispatch_result =
|
||||
checked.apply::<Runtime>(&info, len).expect("Transaction is valid");
|
||||
|
||||
assert_eq!(dispatch_result.is_ok(), dispatch_success);
|
||||
|
||||
let post_info = dispatch_result.unwrap_or_else(|e| e.post_info);
|
||||
|
||||
assert_eq!(info.call_weight, call_weight);
|
||||
assert_eq!(info.extension_weight, ext_weight);
|
||||
assert_eq!(post_info.actual_weight, Some(actual_weight));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn call_validity() {
|
||||
struct Test {
|
||||
call: RuntimeCall,
|
||||
validate_res: TransactionValidity,
|
||||
}
|
||||
|
||||
let tests = vec![
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call1 {}),
|
||||
validate_res: Ok(Default::default()),
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call2 {
|
||||
a: true,
|
||||
b: 1,
|
||||
c: 2,
|
||||
d: 3,
|
||||
e: 4,
|
||||
f: true,
|
||||
authorize_refund: Weight::zero(),
|
||||
}),
|
||||
validate_res: Ok(ValidTransaction {
|
||||
priority: 1,
|
||||
requires: vec![2u8.encode()],
|
||||
provides: vec![3u8.encode()],
|
||||
longevity: 4,
|
||||
propagate: true,
|
||||
}),
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call2 {
|
||||
a: false,
|
||||
b: 1,
|
||||
c: 2,
|
||||
d: 3,
|
||||
e: 4,
|
||||
f: true,
|
||||
authorize_refund: Weight::zero(),
|
||||
}),
|
||||
validate_res: Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call3 { valid: true, some_gen: 1 }),
|
||||
validate_res: Ok(Default::default()),
|
||||
},
|
||||
Test {
|
||||
call: RuntimeCall::Pallet1(pallet1::Call::call3 { valid: false, some_gen: 1 }),
|
||||
validate_res: Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
|
||||
},
|
||||
];
|
||||
|
||||
for (index, test) in tests.into_iter().enumerate() {
|
||||
let Test { call, validate_res } = test;
|
||||
|
||||
println!("Running test {}", index);
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let tx_ext = pezframe_system::AuthorizeCall::<Runtime>::new();
|
||||
|
||||
let tx = UncheckedExtrinsic::new_transaction(call, tx_ext);
|
||||
|
||||
let info = tx.get_dispatch_info();
|
||||
let len = tx.using_encoded(|e| e.len());
|
||||
|
||||
let checked = Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
|
||||
.expect("Transaction is general so signature is good");
|
||||
|
||||
let res = checked.validate::<Runtime>(TransactionSource::External, &info, len);
|
||||
assert_eq!(res, validate_res);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signed_is_valid_but_dispatch_error() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = RuntimeCall::Pallet1(pallet1::Call::call1 {});
|
||||
let tx_ext = pezframe_system::AuthorizeCall::<Runtime>::new();
|
||||
|
||||
let tx = UncheckedExtrinsic::new_signed(call, 1u64, 1.into(), tx_ext);
|
||||
|
||||
let info = tx.get_dispatch_info();
|
||||
let len = tx.using_encoded(|e| e.len());
|
||||
|
||||
let checked = Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
|
||||
.expect("Signature is good");
|
||||
|
||||
checked
|
||||
.validate::<Runtime>(TransactionSource::External, &info, len)
|
||||
.expect("origin is signed, transaction is valid");
|
||||
|
||||
let dispatch_err = checked
|
||||
.apply::<Runtime>(&info, len)
|
||||
.expect("origin is signed, transaction is valid")
|
||||
.expect_err("origin is wrong for the dispatched call");
|
||||
|
||||
assert_eq!(dispatch_err.error, DispatchError::BadOrigin);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn call_without_authorization() {
|
||||
use pezframe_support::traits::Authorize;
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = RuntimeCall::Pallet4(pallet4::Call::call1 {});
|
||||
|
||||
// tests for trait implementation
|
||||
assert_eq!(call.weight_of_authorize(), Weight::zero());
|
||||
assert_eq!(call.authorize(TransactionSource::External), None);
|
||||
assert_eq!(call.authorize(TransactionSource::InBlock), None);
|
||||
assert_eq!(call.authorize(TransactionSource::Local), None);
|
||||
|
||||
// tests for transaction extension implementation
|
||||
let tx_ext = pezframe_system::AuthorizeCall::<Runtime>::new();
|
||||
|
||||
let tx = UncheckedExtrinsic::new_transaction(call, tx_ext);
|
||||
|
||||
let info = tx.get_dispatch_info();
|
||||
let len = tx.using_encoded(|e| e.len());
|
||||
|
||||
let checked = Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
|
||||
.expect("Transaction is general so signature is good");
|
||||
|
||||
let err = checked
|
||||
.validate::<Runtime>(TransactionSource::External, &info, len)
|
||||
.expect_err("Call is not authorized, transaction is invalid");
|
||||
|
||||
assert_eq!(err, TransactionValidityError::Invalid(InvalidTransaction::UnknownOrigin));
|
||||
|
||||
let err = checked
|
||||
.apply::<Runtime>(&info, len)
|
||||
.expect_err("Call is not authorized, transaction is invalid");
|
||||
|
||||
assert_eq!(err, TransactionValidityError::Invalid(InvalidTransaction::UnknownOrigin));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
#[rustversion::attr(not(stable), ignore)]
|
||||
#[cfg(not(feature = "disable-ui-tests"))]
|
||||
#[test]
|
||||
fn benchmark_ui() {
|
||||
// Only run the ui tests when `RUN_UI_TESTS` is set.
|
||||
if std::env::var("RUN_UI_TESTS").is_err() {
|
||||
return;
|
||||
}
|
||||
|
||||
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
|
||||
std::env::set_var("SKIP_WASM_BUILD", "1");
|
||||
|
||||
// Deny all warnings since we emit warnings as part of a Pallet's UI.
|
||||
std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings");
|
||||
|
||||
let t = trybuild::TestCases::new();
|
||||
t.compile_fail("tests/benchmark_ui/*.rs");
|
||||
t.pass("tests/benchmark_ui/pass/*.rs");
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(pov_mode = Wrong)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected one of: `MaxEncodedLen`, `Measured`, `Ignored`
|
||||
--> tests/benchmark_ui/bad_attr_pov_mode_1.rs:24:25
|
||||
|
|
||||
24 | #[benchmark(pov_mode = Wrong)]
|
||||
| ^^^^^
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(pov_mode = Measured {
|
||||
Key: Wrong
|
||||
})]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected one of: `MaxEncodedLen`, `Measured`, `Ignored`
|
||||
--> tests/benchmark_ui/bad_attr_pov_mode_2.rs:25:8
|
||||
|
|
||||
25 | Key: Wrong
|
||||
| ^^^^^
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(pov_mode)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected `=`
|
||||
--> tests/benchmark_ui/bad_attr_pov_mode_3.rs:24:22
|
||||
|
|
||||
24 | #[benchmark(pov_mode)]
|
||||
| ^
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(pov_mode =)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unexpected end of input, expected one of: `MaxEncodedLen`, `Measured`, `Ignored`
|
||||
--> tests/benchmark_ui/bad_attr_pov_mode_4.rs:24:24
|
||||
|
|
||||
24 | #[benchmark(pov_mode =)]
|
||||
| ^
|
||||
@@ -0,0 +1,35 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench(winton: Linear<1, 2>) {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Benchmark parameter names must consist of a single lowercase letter (a-z) and no other characters.
|
||||
--> tests/benchmark_ui/bad_param_name.rs:27:11
|
||||
|
|
||||
27 | fn bench(winton: Linear<1, 2>) {
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benchmarks {
|
||||
#[benchmark]
|
||||
fn bench(xx: Linear<1, 2>) {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Benchmark parameter names must consist of a single lowercase letter (a-z) and no other characters.
|
||||
--> tests/benchmark_ui/bad_param_name_too_long.rs:25:11
|
||||
|
|
||||
25 | fn bench(xx: Linear<1, 2>) {
|
||||
| ^^
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
#[benchmark]
|
||||
fn bench(D: Linear<1, 2>) {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Benchmark parameter names must consist of a single lowercase letter (a-z) and no other characters.
|
||||
--> tests/benchmark_ui/bad_param_name_upper_case.rs:25:11
|
||||
|
|
||||
25 | fn bench(D: Linear<1, 2>) {
|
||||
| ^
|
||||
@@ -0,0 +1,35 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench(y: Linear<1, 2>, x: u32) {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Invalid benchmark function param. A valid example would be `x: Linear<5, 10>`.
|
||||
--> tests/benchmark_ui/bad_params.rs:27:31
|
||||
|
|
||||
27 | fn bench(y: Linear<1, 2>, x: u32) {
|
||||
| ^^^
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> Result<(), BenchmarkException> {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
error: expected `BenchmarkError`
|
||||
--> tests/benchmark_ui/bad_return_non_benchmark_err.rs:27:27
|
||||
|
|
||||
27 | fn bench() -> Result<(), BenchmarkException> {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@@ -0,0 +1,34 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benchmarks {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> (String, u32) {
|
||||
#[block]
|
||||
{}
|
||||
(String::from("hey"), 23)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Only `Result<(), BenchmarkError>` or a blank return type is allowed on benchmark function definitions
|
||||
--> tests/benchmark_ui/bad_return_non_type_path.rs:27:16
|
||||
|
|
||||
27 | fn bench() -> (String, u32) {
|
||||
| ^^^^^^^^^^^^^
|
||||
@@ -0,0 +1,32 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benchmarks {
|
||||
#[benchmark]
|
||||
fn bench() -> Result<u32, BenchmarkError> {
|
||||
#[block]
|
||||
{}
|
||||
Ok(10)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected `()`
|
||||
--> tests/benchmark_ui/bad_return_non_unit_t.rs:25:23
|
||||
|
|
||||
25 | fn bench() -> Result<u32, BenchmarkError> {
|
||||
| ^^^
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
fn something() -> Result<(), BenchmarkError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
something()?;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
|
||||
--> tests/benchmark_ui/bad_return_type_blank_with_question.rs:32:14
|
||||
|
|
||||
22 | #[benchmarks]
|
||||
| ------------- this function should return `Result` or `Option` to accept `?`
|
||||
...
|
||||
32 | something()?;
|
||||
| ^ cannot use the `?` operator in a function that returns `()`
|
||||
|
|
||||
help: consider adding return type
|
||||
|
|
||||
31 | fn bench() -> Result<(), Box<dyn std::error::Error>> {
|
||||
| +++++++++++++++++++++++++++++++++++++++++
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> Result<(), BenchmarkError> {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
error: Benchmark `#[block]` or `#[extrinsic_call]` item cannot be the last statement of your benchmark function definition if you have defined a return type. You should return something compatible with Result<(), BenchmarkError> (i.e. `Ok(())`) as the last statement or change your signature to a blank return type.
|
||||
--> tests/benchmark_ui/bad_return_type_no_last_stmt.rs:27:43
|
||||
|
|
||||
27 | fn bench() -> Result<(), BenchmarkError> {
|
||||
| ______________________________________________^
|
||||
28 | | #[block]
|
||||
29 | | {}
|
||||
30 | | }
|
||||
| |_____^
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench(y: Linear<1, 2>) -> String {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
String::from("test")
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected `Result`
|
||||
--> tests/benchmark_ui/bad_return_type_non_result.rs:27:31
|
||||
|
|
||||
27 | fn bench(y: Linear<1, 2>) -> String {
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1,35 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> Option<BenchmarkError> {
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(2 + 2, 4);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected `Result`
|
||||
--> tests/benchmark_ui/bad_return_type_option.rs:27:16
|
||||
|
|
||||
27 | fn bench() -> Option<BenchmarkError> {
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1,32 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(pov_mode = Measured, pov_mode = MaxEncodedLen)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,14 @@
|
||||
error: unexpected end of input, `pov_mode` can only be specified once
|
||||
--> tests/benchmark_ui/dup_attr_pov_mode.rs:25:59
|
||||
|
|
||||
25 | #[benchmark(pov_mode = Measured, pov_mode = MaxEncodedLen)]
|
||||
| ^
|
||||
|
||||
error: unused import: `frame_support_test::Config`
|
||||
--> tests/benchmark_ui/dup_attr_pov_mode.rs:19:5
|
||||
|
|
||||
19 | use frame_support_test::Config;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D unused-imports` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(unused_imports)]`
|
||||
@@ -0,0 +1,37 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Only one #[extrinsic_call] or #[block] attribute is allowed per benchmark.
|
||||
--> tests/benchmark_ui/dup_block.rs:31:3
|
||||
|
|
||||
31 | #[block]
|
||||
| ^
|
||||
@@ -0,0 +1,37 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
let a = 2 + 2;
|
||||
#[extrinsic_call]
|
||||
_(stuff);
|
||||
#[extrinsic_call]
|
||||
_(other_stuff);
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Only one #[extrinsic_call] or #[block] attribute is allowed per benchmark.
|
||||
--> tests/benchmark_ui/dup_extrinsic_call.rs:31:3
|
||||
|
|
||||
31 | #[extrinsic_call]
|
||||
| ^
|
||||
@@ -0,0 +1,30 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: No valid #[extrinsic_call] or #[block] annotation could be found in benchmark function body.
|
||||
--> tests/benchmark_ui/empty_function.rs:27:13
|
||||
|
|
||||
27 | fn bench() {}
|
||||
| ^^
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(extra, extra)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unexpected end of input, `extra` can only be specified once
|
||||
--> tests/benchmark_ui/extra_extra.rs:26:26
|
||||
|
|
||||
26 | #[benchmark(extra, extra)]
|
||||
| ^
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(skip_meta, skip_meta)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unexpected end of input, `skip_meta` can only be specified once
|
||||
--> tests/benchmark_ui/extra_skip_meta.rs:26:34
|
||||
|
|
||||
26 | #[benchmark(skip_meta, skip_meta)]
|
||||
| ^
|
||||
@@ -0,0 +1,23 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
|
||||
#[extrinsic_call]
|
||||
mod stuff {}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,7 @@
|
||||
error: `#[extrinsic_call]` must be in a benchmark function definition labeled with `#[benchmark]`.
|
||||
--> tests/benchmark_ui/extrinsic_call_out_of_fn.rs:20:1
|
||||
|
|
||||
20 | #[extrinsic_call]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the attribute macro `extrinsic_call` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
@@ -0,0 +1,56 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
mod pallet {
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(Weight::default())]
|
||||
pub fn call_1(_origin: OriginFor<T>) -> DispatchResult {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
use pezframe_support::traits::OriginTrait;
|
||||
|
||||
#[benchmark]
|
||||
fn call_1() {
|
||||
let origin = 3u8;
|
||||
#[extrinsic_call]
|
||||
_(origin);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
error: unused import: `frame_support::traits::OriginTrait`
|
||||
--> tests/benchmark_ui/extrinsic_call_wrong_origin.rs:46:6
|
||||
|
|
||||
46 | use frame_support::traits::OriginTrait;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D unused-imports` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(unused_imports)]`
|
||||
|
||||
error[E0277]: the trait bound `<T as frame_system::Config>::RuntimeOrigin: From<u8>` is not satisfied
|
||||
--> tests/benchmark_ui/extrinsic_call_wrong_origin.rs:52:5
|
||||
|
|
||||
52 | _(origin);
|
||||
| ^^^^^^ the trait `From<u8>` is not implemented for `<T as frame_system::Config>::RuntimeOrigin`
|
||||
|
|
||||
= note: required for `u8` to implement `Into<<T as frame_system::Config>::RuntimeOrigin>`
|
||||
@@ -0,0 +1,34 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
use pezframe_support_test::Call;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
#[extrinsic_call]
|
||||
noop(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,18 @@
|
||||
error[E0277]: the trait bound `T: frame_system::Config` is not satisfied
|
||||
--> tests/benchmark_ui/invalid_origin.rs:30:8
|
||||
|
|
||||
30 | noop(1);
|
||||
| ^ the trait `frame_system::Config` is not implemented for `T`
|
||||
|
|
||||
help: consider further restricting type parameter `T` with trait `Config`
|
||||
|
|
||||
23 | #[benchmarks], T: frame_system::Config
|
||||
| +++++++++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `<T as frame_support_test::Config>::RuntimeOrigin: From<{integer}>` is not satisfied
|
||||
--> tests/benchmark_ui/invalid_origin.rs:30:8
|
||||
|
|
||||
30 | noop(1);
|
||||
| ^ the trait `From<{integer}>` is not implemented for `<T as frame_support_test::Config>::RuntimeOrigin`
|
||||
|
|
||||
= note: required for `{integer}` to implement `Into<<T as frame_support_test::Config>::RuntimeOrigin>`
|
||||
@@ -0,0 +1,32 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: No valid #[extrinsic_call] or #[block] annotation could be found in benchmark function body.
|
||||
--> tests/benchmark_ui/missing_call.rs:27:13
|
||||
|
|
||||
27 | fn bench() {
|
||||
| ________________^
|
||||
28 | | assert_eq!(2 + 2, 4);
|
||||
29 | | }
|
||||
| |_____^
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
#[extrinsic_call]
|
||||
thing();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Single-item extrinsic calls must specify their origin as the first argument.
|
||||
--> tests/benchmark_ui/missing_origin.rs:29:3
|
||||
|
|
||||
29 | thing();
|
||||
| ^^^^^
|
||||
@@ -0,0 +1,74 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(skip_meta, extra, pov_mode = Measured)]
|
||||
fn bench1() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
|
||||
#[benchmark(pov_mode = Measured, extra, skip_meta)]
|
||||
fn bench2() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
|
||||
#[benchmark(extra, pov_mode = Measured {
|
||||
Pallet: Measured,
|
||||
Pallet::Storage: MaxEncodedLen,
|
||||
}, skip_meta)]
|
||||
fn bench3() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
|
||||
#[benchmark(skip_meta, extra, pov_mode = Measured {
|
||||
Pallet::Storage: MaxEncodedLen,
|
||||
Pallet::StorageSubKey: Measured,
|
||||
})]
|
||||
fn bench4() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
|
||||
#[benchmark(pov_mode = MaxEncodedLen {
|
||||
Pallet::Storage: Measured,
|
||||
Pallet::StorageSubKey: Measured
|
||||
}, extra, skip_meta)]
|
||||
fn bench5() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
|
||||
#[benchmark(pov_mode = MaxEncodedLen {
|
||||
Pallet::Storage: Measured,
|
||||
Pallet::Storage::Nested: Ignored
|
||||
}, extra, skip_meta)]
|
||||
fn bench6() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,34 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(skip_meta, pov_mode = Measured, extra)]
|
||||
fn bench() {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> Result<(), pezframe_benchmarking::v2::BenchmarkError> {
|
||||
#[block]
|
||||
{}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support_test::Config;
|
||||
use pezframe_support::parameter_types;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
const MY_CONST: u32 = 100;
|
||||
|
||||
#[allow(dead_code)]
|
||||
const fn my_fn() -> u32 {
|
||||
200
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
const MyConst: u32 = MY_CONST;
|
||||
}
|
||||
|
||||
#[benchmark(skip_meta, extra)]
|
||||
fn bench(a: Linear<{MY_CONST * 2}, {my_fn() + MyConst::get()}>) {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> Result<(), pezframe_benchmarking::v2::BenchmarkError> {
|
||||
#[block]
|
||||
{}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,35 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench() -> Result<(), BenchmarkError> {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use pezframe_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark(skip_meta, extra, bad)]
|
||||
fn bench() {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected one of: `extra`, `skip_meta`, `pov_mode`
|
||||
--> tests/benchmark_ui/unrecognized_option.rs:26:32
|
||||
|
|
||||
26 | #[benchmark(skip_meta, extra, bad)]
|
||||
| ^^^
|
||||
@@ -0,0 +1,19 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
///! Common functionality between tests.
|
||||
pub mod outer_enums;
|
||||
@@ -0,0 +1,149 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
// Create 3 pallets for testing the outer error enum construction:
|
||||
//
|
||||
// - `pallet`: declares an error with `#[pallet::error]`
|
||||
// - `pallet2`: declares an error with `#[pallet::error]`
|
||||
// - `pallet3`: does not declare an error.
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
pub mod pallet {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
/// Something
|
||||
Something(u32),
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
phantom: PhantomData<(T, I)>,
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
fn default() -> Self {
|
||||
GenesisConfig { phantom: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum Error<T, I = ()> {
|
||||
/// doc comment put into metadata
|
||||
InsufficientProposersBalance,
|
||||
NonExistentStorageValue,
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet2 {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
/// Something
|
||||
Something(u32),
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
phantom: PhantomData<(T, I)>,
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
fn default() -> Self {
|
||||
GenesisConfig { phantom: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum Error<T, I = ()> {
|
||||
/// doc comment put into metadata
|
||||
OtherInsufficientProposersBalance,
|
||||
OtherNonExistentStorageValue,
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet3 {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
/// Something
|
||||
Something(u32),
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
phantom: PhantomData<(T, I)>,
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
fn default() -> Self {
|
||||
GenesisConfig { phantom: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
//! General tests for composite_enum macro and its handling, test for:
|
||||
//! * variant_count works
|
||||
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
use codec::Encode;
|
||||
use pezframe_support::{derive_impl, traits::VariantCount};
|
||||
use pezsp_core::sr25519;
|
||||
use pezsp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, Verify},
|
||||
};
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
mod module_single_instance {
|
||||
|
||||
#[pallet::composite_enum]
|
||||
pub enum HoldReason {
|
||||
ModuleSingleInstanceReason1,
|
||||
ModuleSingleInstanceReason2,
|
||||
}
|
||||
|
||||
#[pallet::composite_enum]
|
||||
pub enum FreezeReason {
|
||||
ModuleSingleInstanceReason1,
|
||||
ModuleSingleInstanceReason2,
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
type RuntimeHoldReason: From<HoldReason>;
|
||||
type RuntimeFreezeReason: From<FreezeReason>;
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
mod module_multi_instance {
|
||||
|
||||
#[pallet::composite_enum]
|
||||
pub enum HoldReason<I: 'static = ()> {
|
||||
ModuleMultiInstanceReason1,
|
||||
ModuleMultiInstanceReason2,
|
||||
ModuleMultiInstanceReason3,
|
||||
}
|
||||
|
||||
#[pallet::composite_enum]
|
||||
pub enum FreezeReason<I: 'static = ()> {
|
||||
ModuleMultiInstanceReason1,
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {
|
||||
type RuntimeHoldReason: From<HoldReason<I>>;
|
||||
type RuntimeFreezeReason: From<FreezeReason<I>>;
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
mod module_composite_enum_consumer {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {
|
||||
// consume `HoldReason` `composite_enum`
|
||||
type RuntimeHoldReason: VariantCount;
|
||||
// consume `FreezeReason` `composite_enum`
|
||||
type RuntimeFreezeReason: VariantCount;
|
||||
}
|
||||
}
|
||||
|
||||
pub type BlockNumber = u64;
|
||||
pub type Signature = sr25519::Signature;
|
||||
pub type AccountId = <Signature as Verify>::Signer;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
{
|
||||
System: pezframe_system,
|
||||
ModuleSingleInstance: module_single_instance,
|
||||
ModuleMultiInstance0: module_multi_instance,
|
||||
ModuleMultiInstance1: module_multi_instance::<Instance1>,
|
||||
ModuleMultiInstance2: module_multi_instance::<Instance2>,
|
||||
ModuleMultiInstance3: module_multi_instance::<Instance3>,
|
||||
ModuleCompositeEnumConsumer: module_composite_enum_consumer,
|
||||
}
|
||||
);
|
||||
|
||||
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
|
||||
impl pezframe_system::Config for Runtime {
|
||||
type Block = Block;
|
||||
}
|
||||
|
||||
impl module_single_instance::Config for Runtime {
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
|
||||
impl module_multi_instance::Config for Runtime {
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
impl module_multi_instance::Config<module_multi_instance::Instance1> for Runtime {
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
impl module_multi_instance::Config<module_multi_instance::Instance2> for Runtime {
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
impl module_multi_instance::Config<module_multi_instance::Instance3> for Runtime {
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
|
||||
impl module_composite_enum_consumer::Config for Runtime {
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
|
||||
fn list_all_hold_reason_variants() -> Vec<RuntimeHoldReason> {
|
||||
let variants = vec![
|
||||
RuntimeHoldReason::ModuleSingleInstance(module_single_instance::HoldReason::ModuleSingleInstanceReason1),
|
||||
RuntimeHoldReason::ModuleSingleInstance(module_single_instance::HoldReason::ModuleSingleInstanceReason2),
|
||||
RuntimeHoldReason::ModuleMultiInstance0(<module_multi_instance::HoldReason>::ModuleMultiInstanceReason1),
|
||||
RuntimeHoldReason::ModuleMultiInstance0(<module_multi_instance::HoldReason>::ModuleMultiInstanceReason2),
|
||||
RuntimeHoldReason::ModuleMultiInstance0(<module_multi_instance::HoldReason>::ModuleMultiInstanceReason3),
|
||||
RuntimeHoldReason::ModuleMultiInstance0(<module_multi_instance::HoldReason>::__Ignore(Default::default())),
|
||||
RuntimeHoldReason::ModuleMultiInstance1(module_multi_instance::HoldReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason1),
|
||||
RuntimeHoldReason::ModuleMultiInstance1(module_multi_instance::HoldReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason2),
|
||||
RuntimeHoldReason::ModuleMultiInstance1(module_multi_instance::HoldReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason3),
|
||||
RuntimeHoldReason::ModuleMultiInstance1(module_multi_instance::HoldReason::<module_multi_instance::Instance1>::__Ignore(Default::default())),
|
||||
RuntimeHoldReason::ModuleMultiInstance2(module_multi_instance::HoldReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason1),
|
||||
RuntimeHoldReason::ModuleMultiInstance2(module_multi_instance::HoldReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason2),
|
||||
RuntimeHoldReason::ModuleMultiInstance2(module_multi_instance::HoldReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason3),
|
||||
RuntimeHoldReason::ModuleMultiInstance2(module_multi_instance::HoldReason::<module_multi_instance::Instance2>::__Ignore(Default::default())),
|
||||
RuntimeHoldReason::ModuleMultiInstance3(module_multi_instance::HoldReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason1),
|
||||
RuntimeHoldReason::ModuleMultiInstance3(module_multi_instance::HoldReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason2),
|
||||
RuntimeHoldReason::ModuleMultiInstance3(module_multi_instance::HoldReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason3),
|
||||
RuntimeHoldReason::ModuleMultiInstance3(module_multi_instance::HoldReason::<module_multi_instance::Instance3>::__Ignore(Default::default())),
|
||||
];
|
||||
// check that we didn't miss any value
|
||||
for v in &variants {
|
||||
match v {
|
||||
RuntimeHoldReason::ModuleSingleInstance(inner) => match inner {
|
||||
module_single_instance::HoldReason::ModuleSingleInstanceReason1
|
||||
| module_single_instance::HoldReason::ModuleSingleInstanceReason2 => (),
|
||||
}
|
||||
RuntimeHoldReason::ModuleMultiInstance0(inner) => match inner {
|
||||
<module_multi_instance::HoldReason>::ModuleMultiInstanceReason1
|
||||
| <module_multi_instance::HoldReason>::ModuleMultiInstanceReason2
|
||||
| <module_multi_instance::HoldReason>::ModuleMultiInstanceReason3
|
||||
| module_multi_instance::HoldReason::<()>::__Ignore(_) => (),
|
||||
}
|
||||
RuntimeHoldReason::ModuleMultiInstance1(inner) => match inner {
|
||||
module_multi_instance::HoldReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason2
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason3
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance1>::__Ignore(_) => (),
|
||||
}
|
||||
RuntimeHoldReason::ModuleMultiInstance2(inner) => match inner {
|
||||
module_multi_instance::HoldReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason2
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason3
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance2>::__Ignore(_) => (),
|
||||
}
|
||||
RuntimeHoldReason::ModuleMultiInstance3(inner) => match inner {
|
||||
module_multi_instance::HoldReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason2
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason3
|
||||
| module_multi_instance::HoldReason::<module_multi_instance::Instance3>::__Ignore(_) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
variants
|
||||
}
|
||||
|
||||
fn list_all_freeze_reason_variants() -> Vec<RuntimeFreezeReason> {
|
||||
let variants = vec![
|
||||
RuntimeFreezeReason::ModuleSingleInstance(module_single_instance::FreezeReason::ModuleSingleInstanceReason1),
|
||||
RuntimeFreezeReason::ModuleSingleInstance(module_single_instance::FreezeReason::ModuleSingleInstanceReason2),
|
||||
RuntimeFreezeReason::ModuleMultiInstance0(<module_multi_instance::FreezeReason>::ModuleMultiInstanceReason1),
|
||||
RuntimeFreezeReason::ModuleMultiInstance0(<module_multi_instance::FreezeReason>::__Ignore(Default::default())),
|
||||
RuntimeFreezeReason::ModuleMultiInstance1(module_multi_instance::FreezeReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason1),
|
||||
RuntimeFreezeReason::ModuleMultiInstance1(module_multi_instance::FreezeReason::<module_multi_instance::Instance1>::__Ignore(Default::default())),
|
||||
RuntimeFreezeReason::ModuleMultiInstance2(module_multi_instance::FreezeReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason1),
|
||||
RuntimeFreezeReason::ModuleMultiInstance2(module_multi_instance::FreezeReason::<module_multi_instance::Instance2>::__Ignore(Default::default())),
|
||||
RuntimeFreezeReason::ModuleMultiInstance3(module_multi_instance::FreezeReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason1),
|
||||
RuntimeFreezeReason::ModuleMultiInstance3(module_multi_instance::FreezeReason::<module_multi_instance::Instance3>::__Ignore(Default::default())),
|
||||
];
|
||||
// check that we didn't miss any value
|
||||
for v in &variants {
|
||||
match v {
|
||||
RuntimeFreezeReason::ModuleSingleInstance(inner) => match inner {
|
||||
module_single_instance::FreezeReason::ModuleSingleInstanceReason1
|
||||
| module_single_instance::FreezeReason::ModuleSingleInstanceReason2 => (),
|
||||
}
|
||||
RuntimeFreezeReason::ModuleMultiInstance0(inner) => match inner {
|
||||
<module_multi_instance::FreezeReason>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::FreezeReason::<()>::__Ignore(_) => (),
|
||||
}
|
||||
RuntimeFreezeReason::ModuleMultiInstance1(inner) => match inner {
|
||||
module_multi_instance::FreezeReason::<module_multi_instance::Instance1>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::FreezeReason::<module_multi_instance::Instance1>::__Ignore(_) => (),
|
||||
}
|
||||
RuntimeFreezeReason::ModuleMultiInstance2(inner) => match inner {
|
||||
module_multi_instance::FreezeReason::<module_multi_instance::Instance2>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::FreezeReason::<module_multi_instance::Instance2>::__Ignore(_) => (),
|
||||
}
|
||||
RuntimeFreezeReason::ModuleMultiInstance3(inner) => match inner {
|
||||
module_multi_instance::FreezeReason::<module_multi_instance::Instance3>::ModuleMultiInstanceReason1
|
||||
| module_multi_instance::FreezeReason::<module_multi_instance::Instance3>::__Ignore(_) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
variants
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_hold_reason_variant_count_works() {
|
||||
assert_eq!(RuntimeHoldReason::VARIANT_COUNT as usize, list_all_hold_reason_variants().len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_freeze_reason_variant_count_works() {
|
||||
assert_eq!(
|
||||
RuntimeFreezeReason::VARIANT_COUNT as usize,
|
||||
list_all_freeze_reason_variants().len()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_unique_encodings_for_hold_reason() {
|
||||
let variants = list_all_hold_reason_variants();
|
||||
let unique_encoded_variants =
|
||||
variants.iter().map(|v| v.encode()).collect::<std::collections::HashSet<_>>();
|
||||
assert_eq!(unique_encoded_variants.len(), variants.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_unique_encodings_for_freeze_reason() {
|
||||
let variants = list_all_freeze_reason_variants();
|
||||
let unique_encoded_variants =
|
||||
variants.iter().map(|v| v.encode()).collect::<std::collections::HashSet<_>>();
|
||||
assert_eq!(unique_encoded_variants.len(), variants.len());
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
#[rustversion::attr(not(stable), ignore)]
|
||||
#[cfg(not(feature = "disable-ui-tests"))]
|
||||
#[test]
|
||||
fn ui() {
|
||||
// Only run the ui tests when `RUN_UI_TESTS` is set.
|
||||
if std::env::var("RUN_UI_TESTS").is_err() {
|
||||
return;
|
||||
}
|
||||
|
||||
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
|
||||
std::env::set_var("SKIP_WASM_BUILD", "1");
|
||||
|
||||
// Deny all warnings since we emit warnings as part of a Runtime's UI.
|
||||
std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings");
|
||||
|
||||
let t = trybuild::TestCases::new();
|
||||
t.compile_fail("tests/construct_runtime_ui/*.rs");
|
||||
t.pass("tests/construct_runtime_ui/pass/*.rs");
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
Block = Block1,
|
||||
UncheckedExtrinsic = Uxt,
|
||||
{}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
error: `Block` was declared above. Please use exactly one declaration for `Block`.
|
||||
--> tests/construct_runtime_ui/abundant_where_param.rs:24:3
|
||||
|
|
||||
24 | Block = Block1,
|
||||
| ^^^^^
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
use pezsp_runtime::{generic, traits::BlakeTwo256};
|
||||
use pezsp_core::sr25519;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
}
|
||||
|
||||
pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet exclude_parts { Pallet } use_parts { Pallet },
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
error: Unexpected tokens, expected one of `=`, `,`
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:43:43
|
||||
|
|
||||
43 | Pallet: pallet exclude_parts { Pallet } use_parts { Pallet },
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:35:64
|
||||
|
|
||||
35 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
|
||||
help: you might be missing a type parameter
|
||||
|
|
||||
35 | pub type UncheckedExtrinsic<RuntimeCall> = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| +++++++++++++
|
||||
|
||||
error[E0412]: cannot find type `Runtime` in this scope
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:37:25
|
||||
|
|
||||
37 | impl pallet::Config for Runtime {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
|
||||
help: there is an enum variant `sp_api::__private::TransactionType::Runtime`; try using the variant's enum
|
||||
|
|
||||
37 - impl pallet::Config for Runtime {}
|
||||
37 + impl pallet::Config for sp_api::__private::TransactionType {}
|
||||
|
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
{
|
||||
System: system::{},
|
||||
Pallet1: pallet1::{} = 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,11 @@
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet1 are at index 0
|
||||
--> tests/construct_runtime_ui/conflicting_index.rs:26:3
|
||||
|
|
||||
26 | System: system::{},
|
||||
| ^^^^^^
|
||||
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet1 are at index 0
|
||||
--> tests/construct_runtime_ui/conflicting_index.rs:27:3
|
||||
|
|
||||
27 | Pallet1: pallet1::{} = 0,
|
||||
| ^^^^^^^
|
||||
@@ -0,0 +1,33 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
{
|
||||
System: system::{} = 5,
|
||||
Pallet1: pallet1::{} = 3,
|
||||
Pallet2: pallet2::{},
|
||||
Pallet3: pallet3::{},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet3 are at index 5
|
||||
--> tests/construct_runtime_ui/conflicting_index_2.rs:26:3
|
||||
|
|
||||
26 | System: system::{} = 5,
|
||||
| ^^^^^^
|
||||
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet3 are at index 5
|
||||
--> tests/construct_runtime_ui/conflicting_index_2.rs:29:3
|
||||
|
|
||||
29 | Pallet3: pallet3::{},
|
||||
| ^^^^^^^
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Pallet},
|
||||
Balance: balances::{Pallet},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
error: Two pallets with the same name!
|
||||
--> tests/construct_runtime_ui/conflicting_module_name.rs:24:3
|
||||
|
|
||||
24 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
|
||||
error: Two pallets with the same name!
|
||||
--> tests/construct_runtime_ui/conflicting_module_name.rs:25:3
|
||||
|
|
||||
25 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
@@ -0,0 +1,30 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = Uxt,
|
||||
{
|
||||
System: pezframe_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+842
@@ -0,0 +1,842 @@
|
||||
error: use of deprecated constant `WhereSection::_w`:
|
||||
It is deprecated to use a `where` clause in `construct_runtime`.
|
||||
Please instead use `frame_system::Config` to set the `Block` type and delete this clause.
|
||||
It is planned to be removed in December 2023.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/bizinikiwi/pull/14437>
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(deprecated)]`
|
||||
= note: this error originates in the macro `frame_support::match_and_insert` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::Event`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub enum Event<T: Config> {
|
||||
| ^^^^^^ required by this bound in `Event`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| ^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `RawOrigin<_>: TryFrom<OriginCaller>` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `TryFrom<OriginCaller>` is not implemented for `RawOrigin<_>`
|
||||
|
|
||||
= help: the trait `TryFrom<OriginCaller>` is implemented for `RawOrigin<<Runtime as Config>::AccountId>`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `Callable<T>` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:26:3
|
||||
|
|
||||
26 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `GenesisConfig`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub struct GenesisConfig<T: Config> {
|
||||
| ^^^^^^ required by this bound in `GenesisConfig`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::Event`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub enum Event<T: Config> {
|
||||
| ^^^^^^ required by this bound in `Event`
|
||||
|
||||
error[E0369]: binary operation `==` cannot be applied to type `&frame_system::Event<Runtime>`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^
|
||||
|
|
||||
note: an implementation of `Config` might be missing for `Runtime`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
| |______________________^ must implement `Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the derive macro `PartialEq` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::Event`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub enum Event<T: Config> {
|
||||
| ^^^^^^ required by this bound in `Event`
|
||||
|
||||
error[E0277]: the trait bound `frame_system::Event<Runtime>: Encode` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Encode` is not implemented for `frame_system::Event<Runtime>`
|
||||
|
|
||||
= help: the trait `Encode` is implemented for `frame_system::Event<T>`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::__private::codec::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::Event`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub enum Event<T: Config> {
|
||||
| ^^^^^^ required by this bound in `Event`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::__private::codec::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `frame_system::Event<Runtime>: Decode` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Decode` is not implemented for `frame_system::Event<Runtime>`
|
||||
|
|
||||
= help: the trait `Decode` is implemented for `frame_system::Event<T>`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:26:11
|
||||
|
|
||||
26 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^^^^^^^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::Event`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub enum Event<T: Config> {
|
||||
| ^^^^^^ required by this bound in `Event`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `std::fmt::Debug` is implemented for `frame_system::Event<T>`
|
||||
= note: required for `frame_system::Event<Runtime>` to implement `std::fmt::Debug`
|
||||
= note: 1 redundant requirement hidden
|
||||
= note: required for `&frame_system::Event<Runtime>` to implement `std::fmt::Debug`
|
||||
= note: required for the cast from `&&frame_system::Event<Runtime>` to `&dyn std::fmt::Debug`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `std::fmt::Debug` is implemented for `frame_system::Error<T>`
|
||||
= note: required for `frame_system::Error<Runtime>` to implement `std::fmt::Debug`
|
||||
= note: 1 redundant requirement hidden
|
||||
= note: required for `&frame_system::Error<Runtime>` to implement `std::fmt::Debug`
|
||||
= note: required for the cast from `&&frame_system::Error<Runtime>` to `&dyn std::fmt::Debug`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:21:13
|
||||
|
|
||||
21 | pub struct Runtime where
|
||||
| ^^^^^^^ the trait `Config` is not implemented for `Runtime`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= note: required for `RawOrigin<_>` to implement `Into<RuntimeOrigin>`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:26:11
|
||||
|
|
||||
26 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^^^^^^^ the trait `Config` is not implemented for `Runtime`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `PalletInfoAccess` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `PalletInfoAccess`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `Callable<T>` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `Callable<T>` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
|
||||
error[E0369]: binary operation `==` cannot be applied to type `&frame_system::Call<Runtime>`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^
|
||||
|
|
||||
note: an implementation of `Config` might be missing for `Runtime`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
| |______________________^ must implement `Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the derive macro `PartialEq` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `frame_system::Call<Runtime>: Encode` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Encode` is not implemented for `frame_system::Call<Runtime>`
|
||||
|
|
||||
= help: the trait `Encode` is implemented for `frame_system::Call<T>`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::__private::codec::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::Call`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| #[pallet::call(weight = <T as Config>::SystemWeightInfo)]
|
||||
| ^^^^ required by this bound in `Call`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::__private::codec::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `frame_system::Call<Runtime>: Decode` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Decode` is not implemented for `frame_system::Call<Runtime>`
|
||||
|
|
||||
= help: the trait `Decode` is implemented for `frame_system::Call<T>`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `Callable<T>` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::__private::RuntimeDebug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the method `get_dispatch_info` exists for reference `&Call<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ method cannot be called on `&Call<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
::: $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| #[pallet::call(weight = <T as Config>::SystemWeightInfo)]
|
||||
| ---- doesn't satisfy `frame_system::Call<Runtime>: GetDispatchInfo`
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
which is required by `frame_system::Call<Runtime>: GetDispatchInfo`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the method `is_feeless` exists for reference `&Call<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ method cannot be called on `&Call<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
::: $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| #[pallet::call(weight = <T as Config>::SystemWeightInfo)]
|
||||
| ---- doesn't satisfy `frame_system::Call<Runtime>: CheckIfFeeless`
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
which is required by `frame_system::Call<Runtime>: CheckIfFeeless`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the method `get_call_name` exists for reference `&Call<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ method cannot be called on `&Call<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
::: $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| #[pallet::call(weight = <T as Config>::SystemWeightInfo)]
|
||||
| ---- doesn't satisfy `frame_system::Call<Runtime>: GetCallName`
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
which is required by `frame_system::Call<Runtime>: GetCallName`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:26:3
|
||||
|
|
||||
26 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `ViewFunctionIdPrefix` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `ViewFunctionIdPrefix`
|
||||
|
||||
error[E0599]: the function or associated item `storage_metadata` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the function or associated item `call_functions` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the function or associated item `pallet_view_functions_metadata` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the variant or associated item `event_metadata` exists for enum `Event<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ variant or associated item cannot be called on `Event<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the function or associated item `pallet_constants_metadata` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the function or associated item `error_metadata` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the function or associated item `pallet_documentation_metadata` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: the function or associated item `pallet_associated_types_metadata` exists for struct `Pallet<Runtime>`, but its trait bounds were not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
21 | || pub struct Runtime where
|
||||
| ||______________________- doesn't satisfy `Runtime: Config`
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |__^ function or associated item cannot be called on `Pallet<Runtime>` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`Runtime: Config`
|
||||
note: the trait `Config` must be implemented
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub trait Config: 'static + Eq + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the trait `Serialize` is implemented for `GenesisConfig<T>`
|
||||
= note: required for `GenesisConfig<Runtime>` to implement `Serialize`
|
||||
note: required by a bound in `frame_support::sp_runtime::serde::ser::SerializeStruct::serialize_field`
|
||||
--> $CARGO/serde_core-1.0.228/src/ser/mod.rs
|
||||
|
|
||||
| fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<(), Self::Error>
|
||||
| --------------- required by a bound in this associated function
|
||||
| where
|
||||
| T: ?Sized + Serialize;
|
||||
| ^^^^^^^^^ required by this bound in `SerializeStruct::serialize_field`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `GenesisConfig`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub struct GenesisConfig<T: Config> {
|
||||
| ^^^^^^ required by this bound in `GenesisConfig`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `GenesisConfig`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub struct GenesisConfig<T: Config> {
|
||||
| ^^^^^^ required by this bound in `GenesisConfig`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::__private::serde::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `GenesisConfig`
|
||||
--> $WORKSPACE/bizinikiwi/frame/system/src/lib.rs
|
||||
|
|
||||
| pub struct GenesisConfig<T: Config> {
|
||||
| ^^^^^^ required by this bound in `GenesisConfig`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= help: the following other types implement trait `OnGenesis`:
|
||||
()
|
||||
(TupleElement0, TupleElement1)
|
||||
(TupleElement0, TupleElement1, TupleElement2)
|
||||
(TupleElement0, TupleElement1, TupleElement2, TupleElement3)
|
||||
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)
|
||||
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)
|
||||
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)
|
||||
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)
|
||||
and $N others
|
||||
= note: required for `Pallet<Runtime>` to implement `OnGenesis`
|
||||
= note: 1 redundant requirement hidden
|
||||
= note: required for `(Pallet<Runtime>,)` to implement `OnGenesis`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:20:1
|
||||
|
|
||||
20 | / construct_runtime! {
|
||||
21 | | pub struct Runtime where
|
||||
22 | | Block = Block,
|
||||
23 | | NodeBlock = Block,
|
||||
... |
|
||||
28 | | }
|
||||
| |_^ cannot infer type
|
||||
|
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
@@ -0,0 +1,28 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Config, Call, Config<T>, Origin<T>},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: `Config` was already declared before. Please remove the duplicate declaration
|
||||
--> tests/construct_runtime_ui/double_module_parts.rs:24:37
|
||||
|
|
||||
24 | Balance: balances::{Config, Call, Config<T>, Origin<T>},
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1,30 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
{
|
||||
System: pezframe_system exclude_parts { Call, Call },
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: `Call` was already declared before. Please remove the duplicate declaration
|
||||
--> tests/construct_runtime_ui/duplicate_exclude.rs:26:46
|
||||
|
|
||||
26 | System: frame_system exclude_parts { Call, Call },
|
||||
| ^^^^
|
||||
@@ -0,0 +1,27 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
system: ,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: expected one of: `crate`, `self`, `super`, identifier
|
||||
--> tests/construct_runtime_ui/empty_pallet_path.rs:23:11
|
||||
|
|
||||
23 | system: ,
|
||||
| ^
|
||||
@@ -0,0 +1,30 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
{
|
||||
System: pezframe_system exclude_part { Call },
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Unexpected tokens, expected one of `::$ident` `::{`, `exclude_parts`, `use_parts`, `=`, `,`
|
||||
--> tests/construct_runtime_ui/exclude_missspell.rs:26:24
|
||||
|
|
||||
26 | System: frame_system exclude_part { Call },
|
||||
| ^^^^^^^^^^^^
|
||||
@@ -0,0 +1,52 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
use pezsp_runtime::{generic, traits::BlakeTwo256};
|
||||
use pezsp_core::sr25519;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
mod pallet {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::storage]
|
||||
type Foo<T> = StorageValue<Value=u8>;
|
||||
}
|
||||
|
||||
pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet exclude_parts { Call },
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
error: Invalid pallet part specified, the pallet `Pallet` doesn't have the `Call` part. Available parts are: `Pallet`, `Storage`.
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:48:34
|
||||
|
|
||||
48 | Pallet: pallet exclude_parts { Call },
|
||||
| ^^^^
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:40:64
|
||||
|
|
||||
40 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
|
||||
help: you might be missing a type parameter
|
||||
|
|
||||
40 | pub type UncheckedExtrinsic<RuntimeCall> = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| +++++++++++++
|
||||
|
||||
error[E0412]: cannot find type `Runtime` in this scope
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:42:25
|
||||
|
|
||||
42 | impl pallet::Config for Runtime {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
|
||||
help: there is an enum variant `sp_api::__private::TransactionType::Runtime`; try using the variant's enum
|
||||
|
|
||||
42 - impl pallet::Config for Runtime {}
|
||||
42 + impl pallet::Config for sp_api::__private::TransactionType {}
|
||||
|
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) 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.
|
||||
|
||||
use pezframe_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
#[cfg(test)]
|
||||
System: pezframe_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user