-
Notifications
You must be signed in to change notification settings - Fork 870
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
frame: Expose on_genesis
hook
#7948
Draft
skunert
wants to merge
13
commits into
master
Choose a base branch
from
skunert/expose-on-genesis
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+118
−55
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pepoviola
approved these changes
Mar 18, 2025
/cmd prdoc --audience runtime_dev --bump major |
…time_dev --bump major'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables parachain onboarding directly in the initial session. Previously, we had to wait one full session before a parachain could produce blocks, which created unnecessary delays in zombienet tests during local debugging and CI runs.
Enhanced
on_genesis
HookA trait for executing code after genesis storage initialization already existed in frame:
polkadot-sdk/substrate/frame/support/src/traits/hooks.rs
Lines 162 to 165 in 6be4467
However, this trait was not exposed to users through the
Hooks
trait and was only utilized internally by macros:polkadot-sdk/substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs
Lines 220 to 229 in 6be4467
This PR adds an
on_genesis
method to theHooks
trait, allowing developers to define custom behavior that executes after each pallet has completed its genesis build process.Session Handlers Now Called in
on_genesis
HookThe previous inability to onboard parachains at genesis came from an initialization sequence issue. Parachain consensus-related pallets are initialized via the Initializer pallet here, which uses a
SessionHandlers
implementation. Previously, session handlers were called during the genesis build process, before parachain-related storage items were fully set up.With this PR, session handlers are now called after the complete genesis state is established, enabling seamless parachain onboarding from the very first session.