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

Coretime Sale ID #6626

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

Conversation

FereMouSiopi
Copy link

Resolves #6354

@cla-bot-2021
Copy link

cla-bot-2021 bot commented Nov 24, 2024

User @FereMouSiopi, please sign the CLA here.

@FereMouSiopi FereMouSiopi marked this pull request as ready for review November 25, 2024 12:53
@FereMouSiopi FereMouSiopi requested a review from a team as a code owner November 25, 2024 12:53
@@ -105,7 +105,15 @@ impl<T: Config> Pallet<T> {
cores_offered: 0,
cores_sold: 0,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could just add the sale_id to the SaleInfoRecord?

Also we will need a migration that sets sale_id to the correct value.

Copy link
Author

@FereMouSiopi FereMouSiopi Dec 1, 2024

Choose a reason for hiding this comment

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

We would not need to include sale_index in the event emitted when sale starts, instead when SaleInitialized?

Runtime devs and users should query the SaleInfo for the current sale Id?

Copy link
Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

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 require to know when the first sale happened and then it can calculate the current sale number

Copy link
Contributor

Choose a reason for hiding this comment

The 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 sales_at_block along with the start block and current block or whatever. I'm sure you could simplify that too, but that's the fully general one for which the upgrade wouldn't need to be timed.

Copy link
Member

Choose a reason for hiding this comment

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

do we count that as sale 0 or just ignore it as the symptom of a bug?

We just ignore. By restarting we have voided any sales etc any way? (don't remember the exact details)

Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

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

Looks good so far, I agree that it would be better as part of SaleInfo instead of in its own storage value

@@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

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

sale_index might be a better name for this (and throughout the PR)


crates:
- name: pallet-broker
bump: minor
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bump: minor
bump: major

Adding a new field to an enum variant is a breaking change

title: coretime sale id

doc:
- audience: Runtime Dev
Copy link
Contributor

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

@paritytech-review-bot paritytech-review-bot bot requested a review from a team December 2, 2024 03:32
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

@FereMouSiopi still misses a migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pallet-broker] Add sale id in the event emitted when a coretime sale starts
3 participants