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

TryState: automatically execute after each migration #12130

Closed
kianenigma opened this issue Aug 28, 2022 · 2 comments · Fixed by #12537
Closed

TryState: automatically execute after each migration #12130

kianenigma opened this issue Aug 28, 2022 · 2 comments · Fixed by #12537
Labels
J0-enhancement An additional feature request.

Comments

@kianenigma
Copy link
Contributor

Not automatically yet, I think it is okay to leave it up to the pallet to do so, which is what you are seeing here.

We can make a follow-up and once try_state is a bit more standard, make it execute upon all migrations.

Originally posted by @kianenigma in #10174 (comment)


Ofc, IFF feature = try-runtime

@kianenigma kianenigma added the J0-enhancement An additional feature request. label Aug 28, 2022
@bkchr bkchr changed the title TryState: automatically execute after each mogration TryState: automatically execute after each migration Aug 29, 2022
@kianenigma
Copy link
Contributor Author

wild dream: have a standard testing framework, call it automatically after each TEST.

@kianenigma
Copy link
Contributor Author

To achieve executing this after each test:

have a new macro construct_runtime_with_ext_builder.

This generates, per pallet (e.g. staking)

  1. For each filed of GenesisBuild, a struct StakingBuilder { genesis_field_1, genesis_filed_2, .. }
  2. For each type in Config that's Get<u32>, a parameter_types! { static Config1: _ = .., Config2: _ = .. }
  3. And setter functions for all of the above.

lastly, it implements functions such as build and execute_with on Runtime, so at the end we would do:

Runtime::build().exeucte_with(|| {
  
}) 

in each test.

and this Runtime::execute_with would execute try_state() of the pallet after each test.

I really like this idea. It solves legacy issues like paritytech/polkadot-sdk#367. The shitty thing about this is more hidden code, more magic, flying in the face of paritytech/polkadot-sdk#32.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant