Conversation
kianenigma
left a comment
There was a problem hiding this comment.
I generally like this direction. Such simplifications, especially when backwards compatible, can help reduce the hassle of setting up tests and simple runtimes a lot.
I would imagine a syntax like this, avoiding furthe "shady Rust":
// Valid, no migration, no need for executive.
construct_runtime_next {
struct Runtime { ... }
}// Valid, some custom migration.
construct_runtime_next {
type Migration = ..
struct Runtime { ... }
}// Valid, custom executive
construct_runtime_next {
type Executive = ..
struct Runtime { ... }
}I am also suggesting that we somewhat make this be a new macro, as I can't find an easy way to make it fully backwards compatible. But this can be solved in different ways.
Regardless of my suggestion above, I think the struct Runtime<<Migration> is a bit iffy, but there could be multiple different alternatives.
|
@kianenigma I have updated the syntax as per your suggestion. Now, we just need to provide a tuple Please let me know your thoughts. |
| block: &TokenStream, | ||
| executive_section: ExecutiveSection, | ||
| ) -> Result<TokenStream> { | ||
| let executive = generate_crate_access_2018("frame-executive")?; |
There was a problem hiding this comment.
This will play nicely with the new frame crate, it should re-export the frame-executive.
| pub type Executive = #executive::Executive< | ||
| #runtime, | ||
| #block, | ||
| #system::ChainContext<#runtime>, |
There was a problem hiding this comment.
This is kinda cheating, if you want to be pedantic. There's now no good way to configure this. But I am not sure if this is all that useful.
There was a problem hiding this comment.
Yeah, I will add the support to provide a custom Executive as well, using the syntax you suggested above.
|
Why don't we start working on a new |
|
|
||
| construct_runtime! { | ||
| pub struct Runtime<Dummy> | ||
| type Migrations = (Dummy); |
There was a problem hiding this comment.
Does it work if you use (Dummy,)?
There was a problem hiding this comment.
Yes, it parses correctly and throws the correct error.
I agree, the |
This PR adds the ability to auto-generate the
Executiveinsideconstruct_runtime. It also creates wrappers onRuntimethat internally call the Executive's APIs.In order to enable this, simply provide a
Migrationstuple like so:Extension:
We should be able to generate a number of Runtime APIs internally.