I would like to initiate discussion and share some suggestions regarding the future direction of try-runtime
and try-runtime-cli
.
The objective of the discussion is to help establish goals for try-runtime
and the CLI, and ultimately help to determine which features and fixes should be prioritised.
Subtopics
I suggest dividing this discussion into 3 sub-topics:
- Explicit product goals of
try-runtime
and its fit in the broader test tooling ecosystem - Shortcomings of the existing try-runtime functionality
- The next evolution of
try-runtime
1. Explicit goals & test tooling ecosystem fit
Should try-runtime complement other tools like chopsticks, or be an all-in-one testing tool?
The try-runtime-cli docs currently describe try-runtime as:
Substrate’s ultimate testing framework for power users.
A question I have is: should we continue developing try-runtime
as an all-in-one “ultimate” testing framework, or view it as a part of the broader testing ecosystem complemented by other tools like chopsticks? I would appreciate input from @xlc, @kianenigma, and others familiar with both tools about:
- Aspects in which chopsticks excels and try-runtime might struggle
- Aspects in which try-runtime excels and chopsticks might struggle
Both approaches have merits:
- Continuing to develop
try-runtime
as an all-in-one testing tool offers redundancy in the test tooling ecosystem and encourages healthy competition, ultimately leading to better tooling. - Clearly defined and segmented responsibilities of tools reduce duplicated work and could lessen confusion for new developers when choosing testing tools, and allow each tool to optimise for their strengths.
2. Shortcomings of existing try-runtime functionality
Which improvements to existing functionality should be prioritized?
Several developer experience issues with try-runtime currently include:
2a. Long storage download times
Running try-runtime
can be time-consuming due to the need to download & construct a test-externalities
environment each time it’s run.
I have discussed some possible improvements with @kianenigma:
Lazy download
- Fetch data as needed instead of all at once up-front
- There’s already substantial discussion on this
Persistent data cache
- Provide try-runtime its own persistent data cache. The data fetching flow could be: 1. attempt to get data from in-memory, 2. attempt to get data from persistent data store, 3. get data from the node
- This could be useful for developers who want to repeatedly run
try-runtime
against the same block state (e.g., when developing a runtime upgrade), significantly speeding up the development process - Implementation requires careful consideration; developers would likely need a simple way to manage creating/reviewing/removing storage for specific blocks of interest.
Lazy download seems to be a sensible initial improvement. Once stable, we can consider adding a persistent cache.
2b. Monitoring try_state
invariants feels cumbersome
Checking try_states
invariants can be somewhat involved, it would be helpful to simplify the process.
@kianenigma and I briefly discussed the idea of allowing a node to run with something like a --try-state-checks-I-KNOW-WHAT-IM-DOING
flag that would enable the checks during regular block processing. try-runtime
enabled runtimes will be available in S3 shortly, so they could be automatically downloaded by the node and executed alongside the regular runtime without the user needing to follow any complicated steps.
2c. Inherents (fast-forward
sub-command)
We currently lack a good pattern to determine which inherents should be included at the beginning of each block when running fast-forward
.
This makes the fast-forward
command cumbersome and requires a manual code change for each chain its run against.
The optimal solution here is unclear and requires further thought and discussion.
2d. Easier usage of try-runtime apis by other tools
try-runtime apis are important, and could provide value to many testing tools including chopsticks.
Creating a try-runtime enabled runtime is currently a manual process, making it a bit cumbersome to use for other projects to integrate with the api.
The Parity release engineering team is working on automating the publishing of the latest try-runtime enabled runtime, which should help with this.
2e. Multiple sets of docs & hard-to-find quality docs
Currently, if you search for “try runtime docs”, the first result is the substrate.io docs, which are not as informative as the docs at paritytech.github.io. It’s unfortunate that the more comprehensive documentation exists but is harder to find. The SEO on the paritytech.github.io docs is also lacking: the site title and page title don’t even mention docs, I think most people would completely overlook them.
Hopefully, @kianenigma can find a solution to this issue (which likely exists for other tools in Parity) in his efforts to improve documentation this year.
Please comment if you can think of anything I may have missed here
3. What does the next evolution of try-runtime
look like?
What are the highest impact new features that should be prioritized, aligning with the product goals for try-runtime?
3a. Standalone CLI
There are plans to pull the CLI out of substrate into a separate Rust project, making it generally more chain-agnostic and easier to use across the substrate chain ecosystem.
3b. Open RPC after fast-forward
It would be convenient if, after fast-forward
is run, the CLI exposed an RPC allowing users to query state in the Polkadot.js apps UI and ensure everything is as expected.
3c. Allow forking chain state and mining new transactions on top of it
Similar to what is already possible with chopsticks, it would be useful to allow forking the chain with a new runtime and opening an RPC to it allowing developers to view the chain’s state, craft and instantly mine transactions, fast-forward blocks, etc., all from the Polkadot.js apps.
Please comment if you have ideas for any other capabilities that could be added to try-runtime
Final thoughts & next steps
Lazy download seems to be the most obvious place to start with improvements, it’s high impact and relatively straight forward.
By the time that lazy download is shipped hopefully we’ll have a rough roadmap laid out, and it’ll be clear what to prioritise next.