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

Update Pallet Referenda to support Block Number Provider #6338

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dharjeezy
Copy link
Contributor

This PR introduces BlockNumberProvider config for the referenda pallet.
closes part of #6297

@dharjeezy dharjeezy requested a review from a team as a code owner November 2, 2024 11:19
@@ -239,6 +240,9 @@ pub mod pallet {

/// The preimage provider.
type Preimages: QueryPreimage<H = Self::Hashing> + StorePreimage;

/// Provider for the block number. Normally this is the `frame_system` pallet.
type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we force the block number to be the one in system?
If the block number provider is RelayChainDataProvider, then the block number can be different.

It would be more clean to keep it generic here.
Then we should use a new type:

type BlockNumberFor<T> = <<Self as Config>::BlockNumberProvider as BlockNumberProvider>::BlockNumber;
Suggested change
type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
type BlockNumberProvider: BlockNumberProvider;

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we should not require the same block number type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gui1117 shouldn't it be

pub type BlockNumberFor<T, I> = <<T as Config<I>>::BlockNumberProvider as BlockNumberProvider>::BlockNumber;

since the referenda pallet is an Instantiable one?

@gui1117 gui1117 added the T2-pallets This PR/Issue is related to a particular pallet. label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants