Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Configuration Test for Runtime #5570

@kianenigma

Description

@kianenigma

Here are a number of cases in pallet configs (via their Trait) that we pretty much rely on comments and the author to not make mistakes.

// for a sane configuration, this should always be less than `AvailableBlockRatio`.
pub const TargetBlockFullness: Perbill = Perbill::from_percent(25);

pub const ElectionLookahead: BlockNumber = 25; // 10 minutes per session => 100 block.

^^ must be less than the length of one session per block. (although we cannot know this from just Trait and system::Trait)

All the SomethingBonds must be above MinimumBalance.

And these are only ones that I have seen. We probably have more that I don't know.

We can do better. A module can expose some tests that generally depend on <T: Trait + system::Trait> in their own source code. a call to construct_runtime!{} will check that this function won't panic with the created Runtime, hence we can know upon initialisation of a runtime if it has been configured correctly or not.

Metadata

Metadata

Assignees

Labels

J0-enhancementAn additional feature request.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions