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

List migrations included in a runtime #68

Closed
PierreBesson opened this issue May 8, 2023 · 8 comments
Closed

List migrations included in a runtime #68

PierreBesson opened this issue May 8, 2023 · 8 comments

Comments

@PierreBesson
Copy link

Recently, polkadot runtimes started to include migrations of past releases as well (eg. paritytech/polkadot#7168).

Would it be possible to list to those migrations with subwasm ?

@chevdor
Copy link
Owner

chevdor commented May 8, 2023

I am afraid not. This information is not in the runtime unless we decide to add new metadata to it.
It would be possible to write a CLI/script that analyses the code but this would be out of the scope of subwasm.
I can keep this issue open to track this idea down but don't expect to see this showing up in subwasm itself.

@PierreBesson
Copy link
Author

@ggwpez do you know if the list of migrations could be included in the runtime metadata ? If no then we can close this issue. Providing this feature by analysing the code might be a bad idea as outside of metadatas runtime code doesn't seem to be standardized.

@chevdor
Copy link
Owner

chevdor commented May 8, 2023

In general, we can add additional sections with whatever data we want in the wasm blob.
I am not sure we really want to add this data though and it does not bring much more than what we can see in the code.
For a rntime version 1000 for instance, you would see that it contains the last 10 migrations:

  • 999
  • 998
  • ...
  • 990

I have already ideas where adding a few information such as the rust compiler used, etc... used to build the runtime would be super helpful for deterministic checks but I don't think adding migration documenation would be very useful.

@ggwpez
Copy link

ggwpez commented May 8, 2023

We recently added a check in paritytech/substrate#13417 and it reported a lot of missing migrations paritytech/polkadot#7187.

It runs in the CI or locally (in try-runtime). I would argue that this is a better check, since we empirically verify all pallet versions after the migrations ran. So if there is one missing, it will fail. This does not need metadata or anything, it is just a test basically.
Even with metadata, it could be that the migrations have a wrong name or are faulty, and metadata does not know, but the test would fail.

Otherwise, i guess only parsing the code would work. But is a pain in the ass to implement and breaks easily 😆

@PierreBesson
Copy link
Author

Thank you for this very interesting discussion. In view of those improvements in Substrate. It doesn't seem too important to have this feature anymore.

@chevdor
Copy link
Owner

chevdor commented May 9, 2023

I did run the experiment mainly to see how long that can work :)
I published:

  • submig-lib: where the job is done
  • submig: a simple cli around it

tldr:

cargo install submig
submig list /your/path/to/polkadot

output:

Checking migrations in repo: /projects/polkadot
/projects/polkadot/runtime/westend/src/lib.rs:
  - V0940
  - V0941
  - V0942
  - Unreleased
/projects/polkadot/runtime/polkadot/src/lib.rs:
  - V0940
  - V0941
  - V0942
  - Unreleased
/projects/polkadot/runtime/kusama/src/lib.rs:
  - V0940
  - V0941
  - V0942
  - Unreleased
/projects/polkadot/runtime/rococo/src/lib.rs:
  - V0940
  - V0941
  - V0942
  - Unreleased

You can also filter to get a single runtime. See readme.
More at https://github.com/chevdor/submig

As mentioned in the readme and pointed out by @ggwpez, I would NOT rely on that solution too much as it may collapse when the code structure changes.

@PierreBesson
Copy link
Author

Wow @chevdor you did it again. You created yet another CLI !

@ggwpez
Copy link

ggwpez commented May 9, 2023

Lol nice. Lets see how long it works 🤣

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

No branches or pull requests

3 participants