1

I want a "Mainnet" and "Testnet" for my network. It's forked off https://github.com/paritytech/substrate. Mainnet and Testnet will have some parameters set differently, many of which need to be set in Runtime and not in GenesisConfig - things like LaunchPeriod for democracy. Looking at different projects, the accepted solution to this seems to be multiple runtimes with different parameters.

My question is: is there a recommended best-practice way or some template of supporting many runtimes in a single node codebase? https://github.com/substrate-developer-hub/substrate-node-template and https://github.com/paritytech/substrate doesn't seem to have any infrastructure in place to do that. Structure of https://github.com/paritytech/polkadot is very different from the substrate-node-template, so doing it their way requires lots of effort.

I've tried abstracting runtimes away in each place as I go and it's definitely doable, but it feels like reinventing the wheel, so I want to make sure I'm not missing something obvious here.

1 Answer 1

0

You can duplicate the runtime and then modify the configurations.

Or use the Rust feature like this https://github.com/darwinia-network/darwinia-parachain/blob/d86d876a106d09030606dc7fda7311716b276184/runtime/pangolin-parachain/src/lib.rs#L120-L146.

2
  • Duplicating is the way I'd like to go, but it means each Runtime needs it's own ChainSpec, Executor, Service, Client etc, which seems excessive and requires lots of boilerplate code. Take this macro for example: github.com/darwinia-network/darwinia-parachain/blob/… . Do you happen to know where it comes from originally? Is it the recommended best-practice? I also worry about licensing, as I've seen this exact code in multiple projects.
    – Mexke
    Commented Feb 14, 2023 at 15:15
  • I think it comes from the cumulus repo. You could use it.
    – AurevoirXavier
    Commented Feb 15, 2023 at 5:36

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.