Make NoOpPoll generic over Moment#8938
Merged
bkontur merged 14 commits intoparitytech:masterfrom Jun 25, 2025
Merged
Conversation
added 2 commits
June 23, 2025 13:20
bkontur
approved these changes
Jun 23, 2025
Contributor
bkontur
left a comment
There was a problem hiding this comment.
Will this fix this: polkadot-fellows/runtimes#347 (comment), right?
bkchr
approved these changes
Jun 24, 2025
Member
|
@Doordashcon tests are still failing. |
Co-authored-by: Bastian Köcher <git@kchr.de>
Contributor
Author
Contributor
Author
Yes! ran the changes on the runtime repo as well. |
bkontur
reviewed
Jun 25, 2025
Contributor
|
/cmd prdoc --audience runtime_dev |
Contributor
|
Command "prdoc --audience runtime_dev" has failed ❌! See logs here |
Contributor
|
/cmd prdoc --audience runtime_dev --force |
…time_dev --force'
bkontur
reviewed
Jun 25, 2025
alvicsam
pushed a commit
that referenced
this pull request
Oct 17, 2025
# Description
This PR enhances the flexibility of the `NoOpPoll` implementation by
introducing a generic `Moment` parameter. This change enables support
for diverse clock configurations across different runtimes, allowing
`NoOpPoll` to work seamlessly with various block number implementations
(e.g., `u32`, `u64`, or custom block number types).
### Integration
Downstream projects using `NoOpPoll` must make these adjustments:
- Add generic parameter: Specify the Moment type when using `NoOpPoll`
- Update type annotations: Modify existing references to include the
generic parameter
### Example Migration:
```diff
// Before
use frame_support::traits::NoOpPoll;
let _ = NoOpPoll;
// After
use frame_support::traits::NoOpPoll;
use frame_system::pallet_prelude::BlockNumberFor;
```
### Generic struct update:
```diff
- pub struct NoOpPoll;
+ pub struct NoOpPoll<Moment>(core::marker::PhantomData<Moment>);
```
### Polling trait implementation:
```diff
- impl<Tally> Polling<Tally> for NoOpPoll {
+ impl<Tally, Moment> Polling<Tally> for NoOpPoll<Moment> {
type Index = u8;
type Votes = u32;
type Class = u16;
- type Moment = u64;
+ type Moment = Moment;
```
---------
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or 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
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.
Description
This PR enhances the flexibility of the
NoOpPollimplementation by introducing a genericMomentparameter. This change enables support for diverse clock configurations across different runtimes, allowingNoOpPollto work seamlessly with various block number implementations (e.g.,u32,u64, or custom block number types).Integration
Downstream projects using
NoOpPollmust make these adjustments:Add generic parameter: Specify the Moment type when using
NoOpPollUpdate type annotations: Modify existing references to include the generic parameter
Example Migration:
Generic struct update:
Polling trait implementation: