This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Emit error when Config part is imported but without the std feature #9225
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a25390d
Emit error when Config part is imported but without the std feature
KiChjang 0e4c7f1
Add UI test for missing std feature on GenesisConfig
KiChjang ff254ab
Update frame/support/test/Cargo.toml
KiChjang d6ee521
Remove unused imports
KiChjang a87029c
Unify all dummy party checker macros
KiChjang 10b528a
Fix
KiChjang c915d75
Dispaly pallet_path::GenesisConfig instead of PalletConfig in error m…
KiChjang f74127e
Revert changes to construct_runtime_ui.rs
KiChjang b7fd27d
Add additional parameter for dummy part checker macro
KiChjang ca91345
Apply suggestions from code review
gui1117 c63bfbe
Merge remote-tracking branch 'origin/master' into kckyeung/error-on-g…
gui1117 8f8c326
fix master merge: update version
gui1117 6fb619d
update Cargo.lock
gui1117 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| [package] | ||
| name = "frame-support-test-pallet" | ||
| version = "4.0.0-dev" | ||
| authors = ["Parity Technologies <admin@parity.io>"] | ||
| edition = "2018" | ||
| license = "Apache-2.0" | ||
| publish = false | ||
| homepage = "https://substrate.dev" | ||
| repository = "https://github.com/paritytech/substrate/" | ||
|
|
||
| [package.metadata.docs.rs] | ||
| targets = ["x86_64-unknown-linux-gnu"] | ||
|
|
||
| [dependencies] | ||
| codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } | ||
| frame-support = { version = "4.0.0-dev", default-features = false, path = "../../" } | ||
| frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../system" } | ||
|
|
||
| [features] | ||
| default = ["std"] | ||
| std = [ | ||
| "codec/std", | ||
| "frame-support/std", | ||
| "frame-system/std", | ||
| ] | ||
KiChjang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2021 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. | ||
| pub use pallet::*; | ||
|
|
||
| #[frame_support::pallet] | ||
| pub mod pallet { | ||
| #[allow(unused_imports)] | ||
| use frame_support::pallet_prelude::*; | ||
| #[allow(unused_imports)] | ||
| use frame_system::pallet_prelude::*; | ||
|
|
||
| #[pallet::pallet] | ||
| pub struct Pallet<T>(_); | ||
|
|
||
| #[pallet::config] | ||
| pub trait Config: frame_system::Config {} | ||
|
|
||
| #[pallet::genesis_config] | ||
| pub struct GenesisConfig {} | ||
|
|
||
| #[cfg(feature = "std")] | ||
| impl Default for GenesisConfig { | ||
| fn default() -> Self { | ||
| Self {} | ||
| } | ||
| } | ||
|
|
||
| #[pallet::genesis_build] | ||
| impl<T: Config> GenesisBuild<T> for GenesisConfig { | ||
| fn build(&self) {} | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
frame/support/test/tests/construct_runtime_ui/no_std_genesis_config.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| use frame_support::construct_runtime; | ||
| use sp_runtime::{generic, traits::BlakeTwo256}; | ||
| use sp_core::sr25519; | ||
|
|
||
| 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, Call, Signature, ()>; | ||
|
|
||
| impl test_pallet::Config for Runtime {} | ||
|
|
||
| construct_runtime! { | ||
| pub enum Runtime where | ||
| Block = Block, | ||
| NodeBlock = Block, | ||
| UncheckedExtrinsic = UncheckedExtrinsic | ||
| { | ||
| System: system::{Pallet, Call, Storage, Config, Event<T>}, | ||
| Pallet: test_pallet::{Pallet, Config}, | ||
| } | ||
| } | ||
|
|
||
| fn main() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.