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

Track and accumulate ingress roots in runtime #287

Merged
merged 4 commits into from
Jun 17, 2019
Merged

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Jun 10, 2019

The previous routing implementation in the runtime only tracked the unrouted messages from a single block (i.e. assuming that messages were always routed within one block). This new implementation introduces the concept of a watermark, which is the last block a parachain has routed messages from. Beyond the watermark, message queue roots are accumulated and tracked. Additionally, after this PR messages from unregistered parachains will continue to be routed.

Technically, the only thing that the runtime needs to be responsible for is tracking watermarks so that we can impose rules on watermark raising (see #286). All the actual queue root tracking could be done in an off-chain worker (and should eventually be moved to one), but for the moment it's easier to do the tracking in the runtime.

@rphmeier rphmeier added A0-please_review Pull request needs code review. A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Jun 10, 2019
@rphmeier rphmeier added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jun 12, 2019
<Heads<T>>::insert(id, &head.candidate.head_data.0);

let last_watermark = <Watermarks<T>>::mutate(id, |mark| {
rstd::mem::replace(mark, Some(watermark))
Copy link
Member

Choose a reason for hiding this comment

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

why is this not just *mark = Some(watermark)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since we want to store the last value of it and assign to last_watermark

Copy link
Member

@gavofyork gavofyork left a comment

Choose a reason for hiding this comment

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

Looks ok to me. More eyes would be better though.

Co-Authored-By: Gavin Wood <github@gavwood.com>
@rphmeier rphmeier merged commit 4924efe into master Jun 17, 2019
@rphmeier rphmeier deleted the rh-runtime-ingress branch June 17, 2019 12:38
lsaether pushed a commit to lsaether/k that referenced this pull request Jul 4, 2019
* runtime: refactor Checkable and BlindCheckable traits

* fix impl BlindCheckable for Extrinsic

* fix impl Checkable for TestXt

* fix impl Checkable for UncheckedExtrinsic

* fix tabs

* add ::Address to system::Trait since its no longer in Checkable trait

* replace tab by space in comment

* replace occurences of Checkable::check with ::check_with

* tx-pool: replace CheckedIntrinsic type alias since it now would require type param

* make more uses of Checkable compile

* adapt Executive impl to new Checkable trait

* fix that CheckedExtrinsic takes AccountId not Address as first type param

* Checkable trait: return error again since it's required in some cases

* Checkable: improve docstrings

* consistent punctuation and capitalization in docstrings

* Ctx -> Context

addresses paritytech/polkadot#287 (comment)

* reduce trait bounds for impl Checkable for TestXt

addresses paritytech/polkadot#287 (comment)

* use <UncheckedExtrinsic as Checkable>::Checked

addresses paritytech/polkadot#287 (comment)

* Revert "add ::Address to system::Trait since its no longer in Checkable trait"

This reverts commit 02eb103015b833c995c9f9067aac2542bb7ce5ea.

* runtime/executive: properly fix that Address no longer in Checkable

* return `Result<Self::Checked, &'static str>` from `Checkable::check`
tomusdrw pushed a commit that referenced this pull request Mar 26, 2021
* Add header-chain primitive crate

* Make MinimalHeaderChain functionaly the same as PeerBlockchain

* Use a better doc comment for MinimalHeaderChain

* Fix benchmark compilation

* Rust Fmt

* Remove Substrate based dependencies

* Rename MinimalHeaderChain to BaseHeaderChain
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants