Skip to content

Investigate passing pallet index as const value #2665

Open
@bkchr

Description

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,

Metadata

Assignees

No one assigned

    Labels

    C1-mentorA task where a mentor is available. Please indicate in the issue who the mentor could be.D0-easyCan be fixed primarily by duplicating and adapting code by an intermediate coder.D2-substantialCan be fixed by an experienced coder with a working knowledge of the codebase.I5-enhancementAn additional feature request.

    Type

    No type

    Projects

    • Status

      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions