-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Emit error when construct_runtime imports a non-existent pallet part #8949
Conversation
I wanted to add a UI test for this, and I had the following under the use frame_support::construct_runtime;
#[frame_support::pallet]
mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::pallet]
pub struct Pallet<T>(_);
}
construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Pallet},
Pallet: pallet::{Pallet, Call},
}
}
fn main() {} This does generate the compiler error that I expect, but with a lot more junk associated with it:
|
yes this is an improvment, a sidenote: when we implement this: #8084 use will only give part not to include, and construct_runtime should be able to get all the available part of a pallet. Thus we can check that the "part not to include" specified by the user are sensible. That makes me think of yet another improvement: currently when people forget to specify in their cargo.toml to compile the pallet crate with "std" feature, then the genesis config type is not available, when they are confused why the compiler say it can't find GenesisConfig. |
2c47b6c
to
d40b71e
Compare
So I'm really liking the suggestion made by @shawntabrizi over the FRAME steering call, where we create a brand new This has an intended side effect of telling people "hey, look at all the cool stuff you can do with FRAMEv2" and incentivizing them to migrate over to v2 as soon as possible. |
6dfd8c6
to
b977dc7
Compare
Ok, CI keeps choking on the |
de53045
to
e6ca013
Compare
This reverts commit 362b688.
bot merge |
Trying merge. |
Fixes #8945.
This PR causes an error to be thrown during compilation when Substrate detects that your
construct_runtime
is importing a pallet part that has not been declared by the pallet in question.The expected UI for this error looks like the following:
polkadot companion: paritytech/polkadot#3216