paritytech / zombienet

A cli tool to easily spawn ephemeral Polkadot/Substrate networks and perform tests against them.
https://paritytech.github.io/zombienet/
GNU General Public License v3.0
162 stars 91 forks source link

Run non-parachain networks #1903

Closed iulianbarbu closed 1 month ago

iulianbarbu commented 1 month ago

I was curious what's the best setup for running minimal template in a multi node setup (e.g. at least 2 nodes), which doesn't need relay chain args to be passed to the nodes and defining a relaychain spec.

At this time starting multiple omni nodes with manual seal and chain specs generated based on minimal runtime development preset would start the nodes but they'll not see each others as peers. However, starting locally two minimal-template-nodes with minimal-template-node --tmp will show each other having 1 peer. I am not sure whether this is a zombienet or a polkadot-parachain issue. We can't use minimal-template-node with zombienet (to compare them) because it lacks some required subcommands (export-genesis-head & export-genesis-wasm), but it will also receive --parachain-id which is not relevant to it.

Raising the issue here because of three things:

  1. I had trouble making a multi node (polkadot-parachain based, aka omni node) zombienet.toml network spec that is able to run minimal runtime with manual seal, and having nodes connected as peers.
  2. Feels like zombienet is opinionated towards parachain nodes networks, with relay chain spec mandatory, and this is not representative for some templates, where we'll struggle using zombienet with.
  3. The first two points assume zombienet is something that should evolve towards running more than multi node parachains, which might not be the case.

    cc @kianenigma

pepoviola commented 1 month ago

Hi @iulianbarbu, thanks for the feedback. Can you share the config you are using? Did you want to use polkadot-parachain without passing any argument to the relay-chain side?

Thx!

kianenigma commented 1 month ago

What I am curious to learn here i if generally ZN can be used to run a normal alice + bob solochain as well? This can be explored both with the solochain template, or the minimal template.

Similarly, this should work both with the provided nodes in the template, and in the case of the minimal template, possibly with polkadot-omni-node --dev-block-time.

All ZN needs to do under the hood is to run two nodes with the given flags, and pass one as the bootnode of the other.

iulianbarbu commented 1 month ago

I discussed with @pepoviola offline and I got some answers for you:

if generally ZN can be used to run a normal alice + bob solochain as well? This can be explored both with the solochain template, or the minimal template.

This is possible, and the way it is done currently is by using the relaychain spec to define non-parachain nodes network as relaychains. This is already the case in some tests here (using zombienet-sdk): https://github.com/paritytech/polkadot-sdk/blob/master/templates/zombienet/tests/smoke.rs#L64, https://github.com/paritytech/polkadot-sdk/blob/master/templates/zombienet/tests/smoke.rs#L81. We should be able to add toml network specs as examples for minimal, while for solochain not sure (we already tried running it manually and it failed, so I would wait a bit longer with it, meaning first running it manually as a single node network, and then focusing on it if we deem it necessary in the future - not strictly as a dependency for omni node milestone 0 - lmk if you don't agree).

Similarly, this should work both with the provided nodes in the template, and in the case of the minimal template, possibly with polkadot-omni-node --dev-block-time.

This is something we can assert on for minimal (and parachain) template in the same rust tests from templates directory. These tests can also be added to the CI.

All ZN needs to do under the hood is to run two nodes with the given flags, and pass one as the bootnode of the other.

This is also something ZN already does. Relaychain nodes can be started as bootnodes, and then ZN will set up the IP of those nodes in the bootnode config of the other nodes. It can also update a passed chainspec (as is the case with polkadot-parachain node) with the bootnodes specified in the zombienet network spec, so we should be able to run multi-node testnets. I want to add a zombienet spec in minimal template that showcases the above.

@kianenigma not sure if all you wanted to clarify has been answered, but I would close this issue for now since we should be unblocked (in theory) from doing everything we wanted with zombienet (why it didn't work in the past should be because I did not write correct network specs). Please reopen this issue if there are things unclear or that work in unexpected ways, and I'll do the same for what I will be looking into.