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

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
}
}

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.

@bkchr bkchr added A5-grumble and removed A0-please_review Pull request needs code review. labels Mar 10, 2020
/// 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 <[email protected]>

* Added docs

* Fixed build

* Fixed build

Co-authored-by: Bastian Köcher <[email protected]>
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 <[email protected]>

* Added docs

* Fixed build

* Fixed build

Co-authored-by: Bastian Köcher <[email protected]>
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