You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the with_state and with_mut_state simply execute the given closure in an externalities
provided environment.
It would be nice if the buider would pas a StateUtils struct to the closure. The StateUtils should provide some interface like:
implStateUtils{// Executes an extrinsic or maybe just a Call enum variant in the wasm environment. pubfnexec_wasm(&self,Block::Extrinsic) -> Result;// Get the block this state is build uponpubfnblock(&self) -> Block;// Maybe expose the API to the runtime to the closure, maybe something that allows actually working with the apipubfnAPI(&self) -> RuntimeAPi;}
Implementation Idea
As the runtime API of the chains differ and need different trait bounds providing such an API statically via the builders is impossible.
Probably the best approach would be to have a trait StateUtils<API> that each builder takes. The struct StateUtils implements this trait.
But via the generic API chains can introduce additional trait bounds for the API that are checked during compilation.
The text was updated successfully, but these errors were encountered:
Currently, the
with_state
andwith_mut_state
simply execute the given closure in an externalitiesprovided environment.
It would be nice if the buider would pas a
StateUtils
struct to the closure. TheStateUtils
should provide some interface like:Implementation Idea
As the runtime API of the chains differ and need different trait bounds providing such an API statically via the builders is impossible.
Probably the best approach would be to have a
trait StateUtils<API>
that each builder takes. Thestruct StateUtils
implements this trait.But via the generic
API
chains can introduce additional trait bounds for theAPI
that are checked during compilation.The text was updated successfully, but these errors were encountered: