When adding a pallet to construct_runtime!, an index for this pallet can be passed:
|
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8, |
In this case it would be 8. It would be nice to declare this 8 as a const value. Because I have seen requests like this more often recently. We will probably first need to fix parity-scale-codec to be able to accept a const value there. The main blocker will probably be the check for duplicate indices. However, we can probably work around this by creating some const function that is evaluating all the indices and panics in case of an error. We should check on the UX of this solution.
So the final solution would look the following:
const MY_PALLET_INDEX: usize = 10;
---
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = MY_PALLET_INDEX,
When adding a pallet to
construct_runtime!, an index for this pallet can be passed:polkadot-sdk/polkadot/runtime/westend/src/lib.rs
Line 1418 in 814b938
In this case it would be
8. It would be nice to declare this8as a const value. Because I have seen requests like this more often recently. We will probably first need to fixparity-scale-codecto be able to accept aconst valuethere. The main blocker will probably be the check for duplicate indices. However, we can probably work around this by creating some const function that is evaluating all the indices and panics in case of an error. We should check on the UX of this solution.So the final solution would look the following: