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

Do not use Option to wrap GenesisConfig fields #8275

Merged
2 commits merged into from
Mar 6, 2021

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Mar 5, 2021

Currently we wrap every GenesisConfig field in an Option, while
we require Default being implemented for all pallet genesisconfigs.
Passing None also results in the genesis not being initialized, which
is a bug as seen from the perspective of a pallet developer?

This pr changes the fields of the GenesisConfig to non Option types.

polkadot companion: paritytech/polkadot#2575

Currently we wrap every `GenesisConfig` field in an `Option`, while
we require `Default` being implemented for all pallet genesisconfigs.
Passing `None` also results in the genesis not being initialized, which
is a bug as seen from the perspective of a pallet developer?

This pr changes the fields of the `GenesisConfig` to non `Option` types.
@bkchr bkchr added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Mar 5, 2021
@bkchr bkchr requested a review from kianenigma as a code owner March 5, 2021 08:51
Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only usecase of this option is in case someone don't want to execute the genesis config of a pallet.
But I agree it doesn't seem very useful.

anyway code of this PR is good.

sidenote: we could also implement Default for the runtime GenesisConfig to allow ..Default::default() syntax

@bkchr
Copy link
Member Author

bkchr commented Mar 5, 2021

sidenote: we could also implement Default for the runtime GenesisConfig to allow ..Default::default() syntax

We already do this ;D

@bkchr bkchr requested a review from shawntabrizi March 5, 2021 18:44
bkchr added a commit to paritytech/polkadot that referenced this pull request Mar 5, 2021
@bkchr
Copy link
Member Author

bkchr commented Mar 6, 2021

bot merge force

@ghost
Copy link

ghost commented Mar 6, 2021

Trying merge.

@ghost ghost merged commit af998b2 into master Mar 6, 2021
@ghost ghost deleted the bkchr-genesis-config-no-option branch March 6, 2021 13:42
ghost pushed a commit to paritytech/polkadot that referenced this pull request Mar 6, 2021
* Substrate companion #8275

paritytech/substrate#8275

* "Update Substrate"

Co-authored-by: parity-processbot <>
HCastano added a commit to paritytech/parity-bridges-common that referenced this pull request Apr 6, 2021
HCastano added a commit to paritytech/parity-bridges-common that referenced this pull request Apr 7, 2021
* Bump Substrate

* Change usage of "Module" to "Pallet"

Related Substrate PR: paritytech/substrate#8372

* Add `OnSetCode` config param

Related Substrate PR: paritytech/substrate#8496

* Update Aura Slot duration time type

Related Substrate PR: paritytech/substrate#8386

* Add `OnSetCode` to mock runtimes

* Add support for multiple justifications

Related Substrate PR: paritytech/substrate#7640

* Use updated justification type in more places

* Make GenesisConfig type non-optional

Related Substrate PR: paritytech/substrate#8275

* Update service to use updated telemetry

Related Substrate PR: paritytech/substrate#8143

* Appease Clippy
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants