2

After a runtime is complete and all the macros are expanded, what kind of data structure is the runtime?

e.g. Is the Runtime a struct? If so, what are some of the fields? I want to be able to build a mental model of what exactly I am building; when trying to "see definition" for the runtime I am told it is a struct in some cases and enum in others, i suspect this has to do with the macros.

1 Answer 1

5

Yes, the Runtime is a struct which implements a bunch of traits, for example all the Config traits required by the pallets you include in your runtime.

You can look at the Runtime generated by the substrate-node-template here:

https://crates.parity.io/node_template_runtime/struct.Runtime.html

If so, what are some of the fields?

The Runtime struct has no fields. It just holds of all the trait implementations, and exposes the metadata() function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.