-
Notifications
You must be signed in to change notification settings - Fork 754
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 BlockNumberProvider to salary pallet config #7000
base: master
Are you sure you want to change the base?
Add BlockNumberProvider to salary pallet config #7000
Conversation
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.
Looks good to me, with the pre and post upgrade implementation
@@ -1,6 +1,6 @@ | |||
[package] | |||
name = "collectives-westend-runtime" | |||
version = "3.0.0" | |||
version = "3.1.0" |
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.
same as the other PR, I think crate versions are handled upon release with prdoc information
/// local moment in time (system block number) | ||
fn equivalent_moment_in_time(local: SalaryLocalBlockNumber) -> SalaryNewBlockNumber { | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
same maybe better to make it general if local > block_number
, to be safe if this code gets copied and pasted.
where | ||
BC: ConvertBlockNumber<LocalBlockNumberFor<T>, NewBlockNumberFor<T, I>>, | ||
{ | ||
fn on_runtime_upgrade() -> frame_support::weights::Weight { |
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.
could be better to implement some pre_upgrade
and post_upgrade
ensuring that Status
value is some if it was some, and claimant count is same before and after the migration.
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.
Looks very clean, thanks. Only had some minor comments, going to take a closer look after that.
@@ -126,7 +128,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, |
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 think these are bumped in the release branches, or in special merge requests, but not here.
@@ -177,7 +177,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { | |||
// implementation changes and behavior does not, then leave spec_version as | |||
// is and increment impl_version. | |||
spec_version: 268, | |||
impl_version: 0, | |||
impl_version: 1, |
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.
impl_version: 1, | |
impl_version: 0, |
The kitchensink runtime needs to bumping.
/// Provides the current block number. | ||
/// | ||
/// This is usually `cumulus_pallet_parachain_system::RelaychainDataProvider` if a | ||
/// parachain, or `frame_system::Pallet` if a solochain. |
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.
/// parachain, or `frame_system::Pallet` if a solochain. | |
/// parachain, or `frame_system::Pallet` if a solo- or relaychain. |
|
||
/// Converts previous (local) block number into the new one. May just be identity functions | ||
/// if sticking with local block number as the provider. | ||
pub trait ConvertBlockNumber<L, N> { |
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.
Can you put some example in the doc of this please? Just some pseudo code of how it is supposed to be called.
I can imagine it is easy to call it the other way around of how its meant to be 🙈
use super::{BlockNumberFor as NewBlockNumberFor, *}; | ||
use frame_system::pallet_prelude::BlockNumberFor as LocalBlockNumberFor; | ||
|
||
/// Converts previous (local) block number into the new one. May just be identity functions |
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.
/// Converts previous (local) block number into the new one. May just be identity functions | |
/// Converts old block number into the new one. May just be identity functions |
Is there an inherent local/remote duality, or is it just old/new?
/// | ||
/// For instance - if your new version uses the relay chain number, you'll want to | ||
/// use relay current - ((current local - local) * equivalent_block_duration) | ||
fn equivalent_moment_in_time(local: L) -> N; |
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.
Can you put some example in the doc of this please? Just some pseudo code of how it is supposed to be called.
I can imagine it is easy to call it the other way around of how its meant to be 🙈
Following #3617, salary pallet is to be made async backing friendly. This PR adds the block number provider config parameter to pallet-salary.
In addition it
TODO:
Once Westend is updated I will write the migration for polkadot collectives.
@xlc