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

[MBM] Create runtime API #6327

Open
ggwpez opened this issue Nov 1, 2024 · 0 comments
Open

[MBM] Create runtime API #6327

ggwpez opened this issue Nov 1, 2024 · 0 comments
Labels
I5-enhancement An additional feature request. T4-runtime_API This PR/Issue is related to runtime APIs.

Comments

@ggwpez
Copy link
Member

ggwpez commented Nov 1, 2024

We should probably add a runtime API to expose information about current MBMs.

There are lots of events to follow what is happening, but for just querying whether a migration is ongoing, it is required to read storage directly.

The RAPI should expose something like this:

trait Mbm {
    /// Whether there are migrations currently running.
    fn ongoing() -> MbmIsOngoing;

    /// The current progress. Returns `Some(_)` iff `ongoing()` is either `Ongoing` or `Stuck`.
    fn progress() -> Option<MbmProgress>;

    /// The prefices that are being migrated and possibly not decodable during this time.
    fn affected_prefices() -> Vec<Vec<u8>>;  // from https://github.com/paritytech/polkadot-sdk/issues/6128
}

enum MbmIsOngoing {
    Ongoing,
    NotOngoing,
    Stuck,
}

struct MbmProgress {
    /// Index of the currently running migration.
    current_migration: u32,

    /// Number of total migrations that will run.
    total_migrations: u32,

    /// Number of steps that the current migration already took.
    current_migration_steps: u32,

    /// Number of steps that the current migration is allowed to take at most.
    current_migration_max_steps: u32,
}

I woul wait with this issue once #6128 is settled.

@ggwpez ggwpez added I5-enhancement An additional feature request. T4-runtime_API This PR/Issue is related to runtime APIs. labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. T4-runtime_API This PR/Issue is related to runtime APIs.
Projects
Status: Backlog
Development

No branches or pull requests

1 participant