-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the project capable of handling multiple runtimes #721
Conversation
Co-authored-by: Chralt <chralt98@gmail.com>
Co-authored-by: Chralt <chralt98@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍
Some comments (in addition to the remars in the code):
- I think the
README.md
should be updated to reflect these changes. We should also update the documentation repository regarding compiling for Battery Station. - When I run
cargo build --release --features=with-zeitgeist-runtime
, both Zeitgeist and Battery Station get compiled. Is this as expected? - The standalone node seems to default to Battery Station, so even after building specifically with
with-zeitgeist-runtime
, runningtarget/release/zeitgeist
starts a Battery Station client. Is this as expected?
Edit. What worries me about the macro usage is that we cannot auto-format the code, and, that error messages may be become cryptic.
This is expected behavior. When we enter no chain or "dev", the node has to select which runtime it will execute the development (staging) configuration on. I assumed that Battery Station is the more advanced network (and it has sudo, which is useful in the development network), so it defaults to Battery Station. |
Yes. By default, both runtimes are built ( |
Ok, somehow I assumed that setting one of the features was necessary. Yeah, didn't think this through. We can leave the docs the way they are. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks for reviewing this monster of a PR guys! |
Closes #493
This PR splits the previous runtime crate into three different crates:
runtime/common
,runtime/battery-station
andruntime/zeitgeist
.runtime/common
contains common types, tests, API implementations and the common runtime. Theruntime/battery-station
andruntime/zeitgeist
crate utilize those through wrapping macros. Those macros copy the common parts over and in some cases also allow to extend those, for example to add new pallets to the runtime, extend the configuration or add new APIs. This might not be the cleanest approach, but the other approach to use one common create for everything, which will spare us copying fromcommon
to another runtime, does not work because it introduces circular dependencies and requires the node to build the same crate with different features, which is prohibited.In addition to that, this PR adjusts the
node
crate to be able to handle multiple runtimes. A new abstract client implementation is offered, which abstracts the client over the genericRuntimeAPI
andExecutor
(which is used to dispatch calls). The node can be built withwith-battery-station-runtime
and/orwith-zeitgeist-runtime
features to include the respective runtimes. By default, both runtimes are used. When creating a new chainspec (staging network), the respective runtime used to generate the chainspec must be included in the build. Currently thedev
chain option uses the battery station runtime with a development staging chainspec. The rationale behind this is that battery station should always be the most advanced network, hence be used for development work. However, this can be extended tozeitgeist-dev
andbattery-station-dev
if required.