Feature/Incremental slot_duration
#10022
Draft
+499
β74
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.
β -----------------------------------------------------------------------------
Thank you for your Pull Request! π Please make sure it follows the contribution guidelines outlined in this
document and fill out the
sections below. Once you're ready to submit your PR for review, please delete this section and leave only the text under
the "Description" heading.
Description
What Was Done
The main change involves transitioning from time-based slot calculation logic to incremental slot calculation logic in the AURA consensus for parachains. Instead of calculating slots based on time (S_i = T/D), an incremental logic (S_i = S_{i-1} + 1) is now used.
Key Changes:
Created new IncrementalSlotTracker module for client-side slot tracking
Implements S_i = S_{i-1} + 1 logic on the client side
Uses atomic operations for thread-safety
Supports initialization from storage and fallback to timestamp-based calculation
claim_slot function now accepts IncrementalSlotTracker instead of slot_duration
Removed time-based slot calculation logic, replaced with slot_tracker.current_slot()
Added comments about client-side slot calculation
Added global slot tracker initialization
Initialization happens once with storage reading
Fallback to zero slot on initialization error
Passing tracker to claim_slot
Similar slot tracker initialization
Modified can_build_upon logic to use tracker
Removed time-based slot calculation logic
slot_now function now first tries to use global tracker
Fallback to timestamp-based calculation if tracker not initialized
Removed parachain slot alignment check with relay chain slot
Removed time-based slot calculation logic
Kept only velocity management and relay chain synchronization logic
Removed LastParachainSlot storage - tracking moved to client side
Added comments about moving logic to client
Added comment that timing remains timestamp-based, but slot index comes from incremental API
Added frame-support dependency in Cargo.toml
Integration
In depth notes about how this PR should be integrated by downstream projects. This part is
mandatory, and should be reviewed by reviewers, if the PR does NOT have the
R0-no-crate-publish-required
label. In case of aR0-no-crate-publish-required
, it can beignored.
Review Notes
In depth notes about the implementation details of your PR. This should be the main guide for reviewers to
understand your approach and effectively review it. If too long, use
<details>
.Imagine that someone who is depending on the old code wants to integrate your new code and the only information that
they get is this section. It helps to include example usage and default value here, with a
diff
code-block to showpossibly integration.
Include your leftover TODOs, if any, here.
Checklist
T
required)You can remove the "Checklist" section once all have been checked. Thank you for your contribution!
β -----------------------------------------------------------------------------