Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[meta] try-runtime-cli fast-forward #13887

Closed
2 tasks
liamaharon opened this issue Apr 12, 2023 · 6 comments
Closed
2 tasks

[meta] try-runtime-cli fast-forward #13887

liamaharon opened this issue Apr 12, 2023 · 6 comments
Assignees
Labels
J1-meta A specific issue for grouping tasks or bugs of a specific category. T1-runtime This PR/Issue is related to the topic “runtime”.

Comments

@liamaharon
Copy link
Contributor

liamaharon commented Apr 12, 2023

Partial paritytech/polkadot-sdk#178

High-ish priority improvements to get fast-forward into a healthy state

  • Support arbitrary inherents required by the runtime. ideas:
    • allow configuration of inherents using cli args (probably simplest, but least flexible and bad developer UX)
    • when try-runtime feature is enabled, add a special runtime api (or some other method) to expose some information about which basic inherents are expected by the runtime. this way, fast-forward can query that api when it boots up and know which inherents it needs to apply in its otherwise empty blocks (more complex but would support any runtime, seems like a good option if it's possible)
    • How I am going to approach solving this in the new try-runtime-cli repo:
      • Create a file inherents_configurations.rs containing inherent configurations similar to https://github.com/paritytech/substrate/blob/master/utils/frame/try-runtime/cli/src/block_building_info.rs
      • When a command like fast-forward that requires inherents is used, the CLI will attempt to build blocks using each of these inherent options until it finds one that works
      • If it finds one that works, it will memoize it for the rest of the run
      • If it cannot find one that works it exits with a helpful message to the user linking to documentation explaining how to add their inherent configuration to inherents_configurations.rs
  • Needs documentation
@liamaharon liamaharon added the J1-meta A specific issue for grouping tasks or bugs of a specific category. label Apr 12, 2023
@liamaharon liamaharon self-assigned this Apr 12, 2023
@liamaharon liamaharon moved this from Backlog to To Do in Runtime / FRAME Apr 12, 2023
@liamaharon liamaharon moved this from To Do to Backlog in Runtime / FRAME Apr 12, 2023
@liamaharon liamaharon moved this from Backlog to In progress in Runtime / FRAME Apr 12, 2023
@liamaharon liamaharon moved this from In progress to To Do in Runtime / FRAME Apr 12, 2023
@liamaharon liamaharon changed the title try-runtime follow-chain high-ish priority improvements [meta] try-runtime follow-chain Apr 12, 2023
@liamaharon liamaharon added U2-some_time_soon Issue is worth doing soon. and removed U2-some_time_soon Issue is worth doing soon. labels Apr 12, 2023
@liamaharon liamaharon changed the title [meta] try-runtime follow-chain [meta] try-runtime fast-forward Apr 13, 2023
@liamaharon liamaharon moved this from To Do to Backlog in Runtime / FRAME Apr 21, 2023
@juangirini juangirini added the T1-runtime This PR/Issue is related to the topic “runtime”. label Jun 7, 2023
@ggwpez
Copy link
Member

ggwpez commented Jun 20, 2023

when try-runtime feature is enabled, add a special runtime api (or some other method) to expose some information about which basic inherents are expected by the runtime.

Isnt this exactly what the BlockBuilder does?

In general just building a generic block in substrate is rather difficult IMHO.
I dont think a config TOML file will work, rather it needs some code injected that provides the inherents. Note that inherents can depend on the block number. In the benchmarking this is solved by using the BlockBuilderProvider from the client itself.
It is slightly hacky, but 10x easier than trying to rebuild it. Not sure if you can use that though, since the try-runtime CLI is independent of the node.

So it will probably need some custom code integration for the fast-forward command for each chain that wants to support it, that provides the inherent data.
Tagging @bkchr, since maybe i am over complicating something.

@liamaharon
Copy link
Contributor Author

I dont think a config TOML file will work, rather it needs some code injected that provides the inherents.

Yeah, when I say config here I am referring to a file containing injected code for different para/relaychains, like the custom code integration you described.

Isnt this exactly what the BlockBuilder does?

I'll take a look at this, thanks.

Note that inherents can depend on the block number. In the benchmarking this is solved by using the BlockBuilderProvider from the client itself.

I wasn't aware of this, thanks.

@ggwpez
Copy link
Member

ggwpez commented Jun 20, 2023

Yea I think the BlockBuilderProvider trait has the right abstraction (since it can account for the block-number).
So that would have to be injected. But please double-check this with someone from the SDK node team. I am not that proficient with the process myself.

@bkchr
Copy link
Member

bkchr commented Jun 20, 2023

So it will probably need some custom code integration for the fast-forward command for each chain that wants to support it, that provides the inherent data.

Yeah sounds correct to me and there not being any more easier way for this.

@liamaharon liamaharon moved this from Backlog to In Progress in Runtime / FRAME Aug 10, 2023
@liamaharon liamaharon changed the title [meta] try-runtime fast-forward fix try-runtime-cli fast-forward Aug 10, 2023
@liamaharon liamaharon changed the title fix try-runtime-cli fast-forward [meta] try-runtime-cli fast-forward Aug 10, 2023
@liamaharon
Copy link
Contributor Author

liamaharon commented Aug 10, 2023

How I am going to approach solving this in the new try-runtime-cli repo:

  • Create a file inherent_configurations.rs containing inherent configurations, similar to https://github.com/paritytech/substrate/blob/master/utils/frame/try-runtime/cli/src/block_building_info.rs
  • When a command like fast-forward that requires inherents is used, the CLI will attempt to build blocks using each of these inherent options until it finds one that works
    • If it finds one that works, it will memoize it for the rest of the run
    • Else it exits with a helpful message to the user linking to documentation explaining how to add their inherent configuration to inherent_configurations.rs

@liamaharon
Copy link
Contributor Author

Moved to paritytech/try-runtime-cli#12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J1-meta A specific issue for grouping tasks or bugs of a specific category. T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
Status: Done
Development

No branches or pull requests

4 participants