-
Notifications
You must be signed in to change notification settings - Fork 542
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 auto-renew #4424
base: master
Are you sure you want to change the base?
Coretime auto-renew #4424
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.
If it is the sovereign account of the para, why don't we implement auto renew on the para itself? Major reason, I guess: It would be impossible to mess up the timing. Otherwise each para would need to keep track of the sale cycle on Coretime.
But what if the parachain has multiple cores assigned to it? For example, perhaps the parachain wants to keep renewing only one core but has acquired an additional core for this bulk period due to higher demand. The reason I am storing the |
@eskimor I would appreciate a review to see if what I implemented here is sensible before writing benchmarks. |
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/kusama-coretime-renewal/8219/1 |
Could you please explain why this PR wasn't addressed with the comment, "This is out of scope for the broker pallet," similar to how it was done in this PR: link to PR? |
I think this PR is totally in scope for the broker pallet, renewals are a first-class operation supported directly on the coretime chain and this is a UX improvement for teams who want to renew regularly. |
pub trait TaskAccountInterface { | ||
/// The type for representing accounts. | ||
type AccountId; | ||
|
||
/// The overarching origin type. | ||
type OuterOrigin: Into<Result<Self::TaskOrigin, Self::OuterOrigin>>; | ||
|
||
/// The custom task origin. Given that all tasks on Polkadot are parachains this will most | ||
/// likely be the `Parachain` origin. | ||
type TaskOrigin; | ||
|
||
/// Ensures that the origin is a task origin and returns the associated `TaskId`. | ||
fn ensure_task_sovereign_account(o: Self::OuterOrigin) -> Result<TaskId, BadOrigin>; | ||
|
||
/// Returns the associated account of a task. | ||
fn sovereign_account(task: TaskId) -> Option<Self::AccountId>; | ||
} |
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 just realized we don't need this at all. We can deal with sovereign accounts just as simple signed origin so there is no need to use the parachains custom origin.
polkadot-sdk/polkadot/xcm/xcm-builder/src/origin_conversion.rs
Lines 27 to 29 in d539778
/// Sovereign accounts use the system's `Signed` origin with an account ID derived from the | |
/// `LocationConverter`. | |
pub struct SovereignSignedViaLocation<LocationConverter, RuntimeOrigin>( |
This will simplify a lot of the code.
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.
OK cool, I'll abandon my review for now then - I'm not all the way through but just have some comments
cumulus/parachains/runtimes/coretime/coretime-rococo/src/coretime.rs
Outdated
Show resolved
Hide resolved
pub trait TaskAccountInterface { | ||
/// The type for representing accounts. | ||
type AccountId; | ||
|
||
/// The overarching origin type. | ||
type OuterOrigin: Into<Result<Self::TaskOrigin, Self::OuterOrigin>>; | ||
|
||
/// The custom task origin. Given that all tasks on Polkadot are parachains this will most | ||
/// likely be the `Parachain` origin. | ||
type TaskOrigin; | ||
|
||
/// Ensures that the origin is a task origin and returns the associated `TaskId`. | ||
fn ensure_task_sovereign_account(o: Self::OuterOrigin) -> Result<TaskId, BadOrigin>; | ||
|
||
/// Returns the associated account of a task. | ||
fn sovereign_account(task: TaskId) -> Option<Self::AccountId>; | ||
} |
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.
OK cool, I'll abandon my review for now then - I'm not all the way through but just have some comments
Co-authored-by: Dónal Murray <donalm@seadanda.dev>
Co-authored-by: Dónal Murray <donalm@seadanda.dev>
Co-authored-by: Dónal Murray <donalm@seadanda.dev>
The CI pipeline was cancelled due to failure one of the required jobs. |
This PR adds functionality that allows tasks to enable auto-renewal. Each task eligible for renewal can enable auto-renewal.
A new storage value is added to track all the cores with auto-renewal enabled and the associated task running on the core. The
BoundedVec
is sorted byCoreIndex
to make disabling auto-renewal more efficient.Cores are renewed at the start of a new bulk sale. If auto-renewal fails(e.g. due to the sovereign account of the task not holding sufficient balance), an event will be emitted, and the renewal will continue for the other cores.
The two added extrinsics are:
enable_auto_renew
: Extrinsic for enabling auto renewal.disable_auto_renew
: Extrinsic for disabling auto renewal.TODOs:
Closes: #4351