-
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
Coretime Sale ID #6626
base: master
Are you sure you want to change the base?
Coretime Sale ID #6626
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,13 @@ | ||||||
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||||||
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||||||
|
||||||
title: coretime sale id | ||||||
|
||||||
doc: | ||||||
- audience: Runtime Dev | ||||||
description: | | ||||||
This pull request adds a `sale_id` in the event emitted when coretime sale starts. | ||||||
|
||||||
crates: | ||||||
- name: pallet-broker | ||||||
bump: minor | ||||||
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.
Suggested change
Adding a new field to an enum variant is a breaking change |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,15 @@ impl<T: Config> Pallet<T> { | |
cores_offered: 0, | ||
cores_sold: 0, | ||
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. Maybe we could just add the Also we will need a migration that sets 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. We would not need to include Runtime devs and users should query the 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. Is there a way to know how many sales have elapsed since? this is for migration purposes. 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. The migration would need to require to know when the first sale happened and then it can calculate the current sale number 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. On Kusama that might be fiddly because we re-started sales (we have a "sale" which is one week long) - raises the question: do we count that as sale 0 or just ignore it as the symptom of a bug? Would be interesting to see how others have labelled it. I guess you could just have an input 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.
We just ignore. By restarting we have voided any sales etc any way? (don't remember the exact details) 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.
The start block has to be specific to the relaychain(i.e Westend, Kusama and Polkadot)? |
||
}; | ||
Self::deposit_event(Event::<T>::SalesStarted { price: end_price, core_count }); | ||
|
||
// Get current sale_id and increment it | ||
let current_sale_id = SaleId::<T>::get(); | ||
let new_sale_id = current_sale_id.saturating_add(1); | ||
|
||
// Store the new sale_id for the next sale | ||
SaleId::<T>::put(new_sale_id); | ||
|
||
Self::deposit_event(Event::<T>::SalesStarted { price: end_price, core_count, sale_id: new_sale_id }); | ||
Self::rotate_sale(old_sale, &config, &status); | ||
Status::<T>::put(&status); | ||
Ok(()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,6 +194,10 @@ pub mod pallet { | |
#[pallet::storage] | ||
pub type RevenueInbox<T> = StorageValue<_, OnDemandRevenueRecordOf<T>, OptionQuery>; | ||
|
||
/// Id of the current sale. | ||
#[pallet::storage] | ||
pub type SaleId<T> = StorageValue<_, u32, ValueQuery>; | ||
|
||
#[pallet::event] | ||
#[pallet::generate_deposit(pub(super) fn deposit_event)] | ||
pub enum Event<T: Config> { | ||
|
@@ -346,6 +350,8 @@ pub mod pallet { | |
price: BalanceOf<T>, | ||
/// The maximum number of cores which this pallet will attempt to assign. | ||
core_count: CoreIndex, | ||
/// Identifier for the current sale. | ||
sale_id: u32, | ||
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.
|
||
}, | ||
/// The act of claiming revenue has begun. | ||
RevenueClaimBegun { | ||
|
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.
Also relevant for Runtime Users