Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starlight: Wire ContainerRegistrar and Registrar pallets #653

Merged
merged 59 commits into from
Sep 4, 2024

Conversation

Agusrodri
Copy link
Contributor

@Agusrodri Agusrodri commented Aug 16, 2024

What does it do?

This PR combines the way in which ContainerRegistrar and Registrar pallets work together inside the starlight runtime.

It does so by introducing a new config type to the ContainerRegistrar pallet called InnerRegistrar, which acts as a callback that executes different behaviors depending on the function context we are situating on.

For instance:

  • When calling ContainerRegistrar::register(), the InnerRegistrar internally calls Registrar::register() after performing the necessary checks and building the proper components (HeadData and ValidationCode).
  • When calling ContainerRegistrar::deregister(), the InnerRegistrar takes care of also deregistering the paraId inside Registrar pallet.
  • When calling ContainerRegistrar::mark_valid_for_collating(), the InnerRegistrar automatically upgrades the paraId to a parachain (in case it was a parathread) at the end of the function execution.

Other changes

  • Added a new head_data parameter to ContainerRegistrar::register function and related ones that is used at the moment of registering a paraId in Registrar relay pallet.

Note for reviewers

There are a lot of changes in different tests, but the most important are the ones related to starlight itself (inisde solo-chains/runtime/starlight/src/tests).

The rest of the test changes are mostly to adapt to the new head_data parameter inside ContainerRegistrar::register and related functions.

solo-chains/runtime/starlight/src/lib.rs Outdated Show resolved Hide resolved
solo-chains/runtime/starlight/src/lib.rs Outdated Show resolved Hide resolved
@Agusrodri Agusrodri marked this pull request as ready for review August 21, 2024 14:39
@Agusrodri Agusrodri added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Aug 22, 2024
pallets/registrar/src/lib.rs Outdated Show resolved Hide resolved
pallets/registrar/src/lib.rs Outdated Show resolved Hide resolved
pallets/registrar/src/lib.rs Outdated Show resolved Hide resolved
solo-chains/runtime/starlight/src/lib.rs Outdated Show resolved Hide resolved
pallets/registrar/src/lib.rs Show resolved Hide resolved
solo-chains/runtime/starlight/src/tests/relay_registrar.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

Good job @Agusrodri

@Agusrodri Agusrodri merged commit bbb45d0 into master Sep 4, 2024
37 checks passed
@Agusrodri Agusrodri deleted the agustin-wire-registrars branch September 4, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants