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

ChainSpec trait #5185

Merged
merged 6 commits into from
Mar 11, 2020
Merged

ChainSpec trait #5185

merged 6 commits into from
Mar 11, 2020

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Mar 8, 2020

ChainSpec is now stored in Configuration as a trait object.
This simplifies configuring Service at run time with chain specs based on different native GenesisConfig. (e.g. polkadot and kusama)

@arkpar arkpar requested a review from tomusdrw March 8, 2020 08:30
@arkpar arkpar added A0-please_review Pull request needs code review. B1-apinoteworthy labels Mar 8, 2020
bin/node/inspect/src/command.rs Outdated Show resolved Hide resolved
client/chain-spec/src/chain_spec.rs Show resolved Hide resolved
client/chain-spec/src/chain_spec.rs Outdated Show resolved Hide resolved
client/chain-spec/src/extension.rs Outdated Show resolved Hide resolved
}
}

pub fn get_extension<T: 'static>(e: &dyn GetExtension) -> Option<&T> {
Copy link
Member

Choose a reason for hiding this comment

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

Docs missing.

client/service/src/builder.rs Outdated Show resolved Hide resolved
client/service/src/builder.rs Show resolved Hide resolved
client/service/src/builder.rs Outdated Show resolved Hide resolved
client/service/src/builder.rs Outdated Show resolved Hide resolved
utils/frame/benchmarking-cli/src/lib.rs Outdated Show resolved Hide resolved
@bkchr bkchr added A5-grumble and removed A0-please_review Pull request needs code review. labels Mar 10, 2020
arkpar and others added 3 commits March 10, 2020 15:43
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
/// Helper function that queries an extension by type from `GetExtension`
/// trait object.
pub fn get_extension<T: 'static>(e: &dyn GetExtension) -> Option<&T> {
Any::downcast_ref(GetExtension::get_any(e, TypeId::of::<T>()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this function needed and why can't we just use Extension::get instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Trait objects can't have generic methods.

@gavofyork gavofyork merged commit 22fd8ff into master Mar 11, 2020
@gavofyork gavofyork deleted the a-dyn-spec branch March 11, 2020 23:00
General-Beck pushed a commit to General-Beck/substrate that referenced this pull request Mar 12, 2020
* ChainSpec trait

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Added docs

* Fixed build

* Fixed build

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
General-Beck pushed a commit to General-Beck/substrate that referenced this pull request Mar 17, 2020
* ChainSpec trait

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Added docs

* Fixed build

* Fixed build

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants