-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error for missing index in CRV2 #4643
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to have a test!
bot fmt |
@gupnik https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6358853 was started for your command Comment |
@gupnik Command |
The CI pipeline was cancelled due to failure one of the required jobs. |
@@ -187,6 +187,13 @@ impl Def { | |||
} | |||
} | |||
|
|||
if pallet_index.is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if pallet_index.is_none() { | |
let Some(pallet_index) = pallet_index else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pallet_index
can be None for all items other than type aliases.
@@ -187,6 +187,13 @@ impl Def { | |||
} | |||
} | |||
|
|||
if pallet_index.is_none() { | |||
if let syn::Item::Type(item) = item { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if doesn't make sense? I mean the index can only be set when the item is a type, at least judging based on the code above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if doesn't make sense? I mean the index can only be set when the item is a type, at least judging based on the code above.
So, the module marked with #[frame_support::runtime] can have arbitrary items. For example,
#[frame_support::runtime]
mod runtime {
use super::*;
pub type System = frame_system;
}
In this case, you only want this check for pub type System = frame_system;
and not for use super::*;
.
Basically, this change requires all type aliases within the runtime macro to be annotated with #[runtime::pallet_index]
while the other items are preserved.
* master: (106 commits) [ci] Delete unused flow (#4676) Fix umbrella CI check and fix the C&P message (#4670) Add Dockerfiles to the templates (#4637) Revamp the Readme of the minimal template (#4649) Add chain-spec-builder docker image (#4655) Update Amforc bootnodes for Kusama and Polkadot (#4668) make all storage items in parachain-system public (#4645) [Pools] Refactors and runtime apis for DelegateStake (#4537) update amforc westend and its parachain bootnodes (#4641) Better error for missing index in CRV2 (#4643) Implement `XcmPaymentApi` and `DryRunApi` on all system parachains (#4634) Use Unlicense for templates (#4628) collator-protocol: remove `elastic-scaling-experimental` feature (#4595) Update `runtime_type` ref doc with the new "Associated Type Bounds" (#4624) Adds ability to specify chain type in chain-spec-builder (#4542) Fix broken windows build (#4636) Beefy client generic on aduthority Id (#1816) pallet-staking: Put tests behind `cfg(debug_assertions)` (#4620) Broker new price adapter (#4521) Change `XcmDryRunApi::dry_run_extrinsic` to take a call instead (#4621) ...
Fixes paritytech#4552 --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <info@kchr.de>
Fixes paritytech#4552 --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <info@kchr.de>
Fixes #4552