-
Notifications
You must be signed in to change notification settings - Fork 747
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
Add block provider to core-fellowship #6978
base: master
Are you sure you want to change the base?
Changes from all commits
ff8af08
7ac7223
5871063
4434d98
cdd6c92
b717aaf
0992736
ea932ff
1c6cc1a
78c05e6
c6faf72
d70ff75
ed0cad8
b3f5112
eb1d578
8bbd0ce
ae916de
c9f6274
8f53c22
963a121
8b78e1b
1f2a1c4
2a1b783
b9318a7
2e6268c
9992f1d
9c8b473
6a1ada8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { | |
spec_name: alloc::borrow::Cow::Borrowed("collectives-westend"), | ||
impl_name: alloc::borrow::Cow::Borrowed("collectives-westend"), | ||
authoring_version: 1, | ||
spec_version: 1_017_001, | ||
spec_version: 1_018_000, | ||
impl_version: 0, | ||
apis: RUNTIME_API_VERSIONS, | ||
transaction_version: 6, | ||
|
@@ -751,19 +751,56 @@ pub type UncheckedExtrinsic = | |
/// All migrations executed on runtime upgrade as a nested tuple of types implementing | ||
/// `OnRuntimeUpgrade`. Included migrations must be idempotent. | ||
type Migrations = ( | ||
// unreleased | ||
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>, | ||
// unreleased | ||
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>, | ||
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>, | ||
// permanent | ||
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>, | ||
// unreleased | ||
pallet_core_fellowship::migration::MigrateV0ToV1<Runtime, FellowshipCoreInstance>, | ||
// unreleased | ||
pallet_core_fellowship::migration::MigrateV0ToV1<Runtime, AmbassadorCoreInstance>, | ||
pallet_core_fellowship::migration::MigrateV1ToV2< | ||
Runtime, | ||
BlockNumberConverter, | ||
FellowshipCoreInstance, | ||
>, | ||
pallet_core_fellowship::migration::MigrateV1ToV2< | ||
Runtime, | ||
BlockNumberConverter, | ||
AmbassadorCoreInstance, | ||
>, | ||
); | ||
|
||
// Helpers for the core fellowship pallet v1->v2 storage migration. | ||
use sp_runtime::traits::BlockNumberProvider; | ||
type CoreFellowshipLocalBlockNumber = <System as BlockNumberProvider>::BlockNumber; | ||
type CoreFellowshipNewBlockNumber = <cumulus_pallet_parachain_system::RelaychainDataProvider< | ||
Runtime, | ||
> as BlockNumberProvider>::BlockNumber; | ||
pub struct BlockNumberConverter; | ||
impl | ||
pallet_core_fellowship::migration::v2::ConvertBlockNumber< | ||
CoreFellowshipLocalBlockNumber, | ||
CoreFellowshipNewBlockNumber, | ||
> for BlockNumberConverter | ||
{ | ||
/// The equivalent moment in time from the perspective of the relay chain, starting from a | ||
/// local moment in time (system block number) | ||
fn equivalent_moment_in_time( | ||
local: CoreFellowshipLocalBlockNumber, | ||
) -> CoreFellowshipNewBlockNumber { | ||
let block_number = System::block_number(); | ||
let local_duration = block_number.saturating_sub(local); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if Maybe we can handle the general case with a comparison |
||
let relay_duration = Self::equivalent_block_duration(local_duration); //6s to 6s | ||
let relay_block_number = ParachainSystem::last_relay_block_number(); | ||
relay_block_number.saturating_sub(relay_duration) | ||
} | ||
|
||
/// The equivalent duration from the perspective of the relay chain, starting from | ||
/// a local duration (number of block). Identity function for Westend, since both | ||
/// relay and collectives chain run 6s block times | ||
fn equivalent_block_duration( | ||
local: CoreFellowshipLocalBlockNumber, | ||
) -> CoreFellowshipNewBlockNumber { | ||
local | ||
} | ||
} | ||
|
||
/// Executive: handles dispatch to the various modules. | ||
pub type Executive = frame_executive::Executive< | ||
Runtime, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
title: 'Adds BlockNumberProvider to pallet-core-fellowship' | ||
doc: | ||
- audience: Runtime Dev | ||
description: |- | ||
This PR adds a parameter 'BlockNumberProvider' to the pallet-core-fellowship | ||
config such that a block provider can be set for use in the pallet. This would | ||
usually be the local system pallet or the appropriate relay chain. Previously | ||
it defaulted to the local system pallet. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. westend is a testnet, should we notify (More generally I wonder how easy it is for tools to differentiate between both types. Some tools have to be careful and get the correct meaning for the block number.) |
||
crates: | ||
- name: pallet-core-fellowship | ||
bump: major | ||
- name: sp-runtime | ||
bump: major | ||
- name: collectives-westend-runtime | ||
bump: minor | ||
- name: kitchensink-runtime | ||
bump: patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know exactly the process for versioning, but AFAIK we don't bump crate versions on
master
, instead we provide the prdoc, and from prdoc information crate versions will be changed on release