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

Adds BlockNumberProvider in multisig, proxy and nft pallets #5723

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

Conversation

gupnik
Copy link
Contributor

@gupnik gupnik commented Sep 16, 2024

Step in #3268

This would allow these pallets to use the relay chain block number when deployed on a parachain. We would need migrations if the deployed pallets are upgraded, but not sure how to plan that yet.

@gupnik gupnik added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Sep 16, 2024
@gupnik gupnik requested a review from a team as a code owner September 16, 2024 11:24
@@ -392,7 +397,7 @@ pub mod pallet {
let announcement = Announcement {
real: real.clone(),
call_hash,
height: system::Pallet::<T>::block_number(),
height: T::BlockNumberProvider::current_block_number(),
Copy link
Contributor

Choose a reason for hiding this comment

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

The migration would need to convert all old block numbers into new ones. We could provide a migration for teams upgrading these pallets that assumes the old times were 12 seconds and the new ones 6 seconds since it's the relay chain?

Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't you just define three consts in the migration type (e.g. here)? They would be old_block_time (12s), new_block_time (6s), and offset (to account for the different block heights).

Copy link
Contributor

Choose a reason for hiding this comment

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

#5656 (comment)
^^ This would be a better strategy than migration.

@@ -168,6 +168,9 @@ pub mod pallet {

/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;

/// Provider for the block number. Normally this is the `frame_system` pallet.
Copy link
Contributor

Choose a reason for hiding this comment

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

It is quite unfortunate that we cannot add this to parachain_system and be done with it. The underlying issue is that all of our pallets rely on frame_system, not parachain_system. In other words, I pallets are written mostly with the intention to be used as a solochain, which in retrospect is not how it should have been.

TLDR, adding the type to all pallets is as good as we can do this.

wdyt about marking frame_system::block_number as deprecated and explicitly asking everyone to decide on their block number source?

doc:
- audience: Runtime Dev
description: |
This would allow these pallets to use the relay chain block number when deployed on a parachain.
Copy link
Contributor

Choose a reason for hiding this comment

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

What this PR in fact is doing is adding the ability for pallets to specify their source of block number.

Then, you should describe in which case this change is deployed backwards compatible: RC -> RC, or Para -> Para.

Then, you should describe if otherwise (RC -> Para, Para -> RC), what migratiion should be used.

@davidk-pt is trying to introduce such a migration in #5656, I suggest you two to work together, first polish the type BlockNumberProvider, then work on a reusable migration, then move individual pallets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants