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

Conversation

@bkchr
Copy link
Member

@bkchr bkchr commented May 17, 2021

Instead of using well known keys to communicate information about a
collation between the runtime and the collator, we now use a runtime api
for this.

Fixes: #344

Instead of using well known keys to communicate information about a
collation between the runtime and the collator, we now use a runtime api
for this.
@bkchr bkchr requested a review from pepyakin May 17, 2021 13:29
Copy link
Contributor

@pepyakin pepyakin left a comment

Choose a reason for hiding this comment

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

Looks good. I really love this change.

A couple of nits and typos.

sp_api::decl_runtime_apis! {
/// Runtime api to collect information about a collation.
pub trait CollectCollationInfo {
/// Collect information about a collation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we write a proper docs on this? I.e. what's is expected from the implementer? When this is supposed to be called? etc

Can push to a follow up as well

ValidationResult {
head_data,
new_validation_code,
new_validation_code: new_validation_code.map(Into::into),
Copy link
Contributor

Choose a reason for hiding this comment

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

What's are the types that particupate in this conversion? Is it convenient to switch to Type::from here?


/// New validation code that was set in a block.
///
/// This will be cleared in `on_initialize` of each new block.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not so simple here due to the DidSetValidationCode check.

bkchr and others added 2 commits May 17, 2021 16:18
@bkchr bkchr merged commit 6674430 into master May 17, 2021
@bkchr bkchr deleted the bkchr-use-runtime-api-to-fetch-collation-info branch May 17, 2021 14:33
bkchr added a commit that referenced this pull request May 17, 2021
* Introduce `CollectCollationInfo` runtime api

Instead of using well known keys to communicate information about a
collation between the runtime and the collator, we now use a runtime api
for this.

* Fixes bug

* Apply suggestions from code review

Co-authored-by: Sergei Shulepov <[email protected]>

* Doc update

Co-authored-by: Sergei Shulepov <[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.

Extract data for collation via runtime api

3 participants