referrerpolicy=no-referrer-when-downgrade

frame_support_test_compile_pass/
lib.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Test that `construct_runtime!` also works when `frame-support` or `frame-system` are renamed in
19//! the `Cargo.toml`.
20
21#![cfg_attr(not(feature = "std"), no_std)]
22
23extern crate alloc;
24
25use frame_support::{
26	construct_runtime, derive_impl, parameter_types,
27	traits::{ConstU16, ConstU32, ConstU64, Everything},
28};
29use sp_core::{sr25519, H256};
30use sp_runtime::{
31	generic,
32	traits::{BlakeTwo256, IdentityLookup, Verify},
33};
34use sp_version::RuntimeVersion;
35
36pub const VERSION: RuntimeVersion = RuntimeVersion {
37	spec_name: alloc::borrow::Cow::Borrowed("frame-support-test-compile-pass"),
38	impl_name: alloc::borrow::Cow::Borrowed("substrate-frame-support-test-compile-pass-runtime"),
39	authoring_version: 0,
40	spec_version: 0,
41	impl_version: 0,
42	apis: sp_version::create_apis_vec!([]),
43	transaction_version: 0,
44	system_version: 0,
45};
46
47pub type Signature = sr25519::Signature;
48pub type AccountId = <Signature as Verify>::Signer;
49pub type BlockNumber = u64;
50
51parameter_types! {
52	pub const Version: RuntimeVersion = VERSION;
53}
54
55#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
56impl frame_system::Config for Runtime {
57	type BaseCallFilter = Everything;
58	type BlockWeights = ();
59	type BlockLength = ();
60	type Nonce = u128;
61	type Hash = H256;
62	type Hashing = BlakeTwo256;
63	type Block = Block;
64	type Lookup = IdentityLookup<Self::AccountId>;
65	type BlockHashCount = ConstU64<2400>;
66	type Version = Version;
67	type AccountData = ();
68	type RuntimeOrigin = RuntimeOrigin;
69	type AccountId = AccountId;
70	type RuntimeEvent = RuntimeEvent;
71	type PalletInfo = PalletInfo;
72	type RuntimeCall = RuntimeCall;
73	type DbWeight = ();
74	type OnNewAccount = ();
75	type OnKilledAccount = ();
76	type OnSetCode = ();
77	type MaxConsumers = ConstU32<16>;
78	type SystemWeightInfo = ();
79	type SS58Prefix = ConstU16<0>;
80}
81
82pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
83pub type Block = generic::Block<Header, UncheckedExtrinsic>;
84pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
85
86construct_runtime!(
87	pub enum Runtime {
88		System: frame_system,
89	}
90);