diff --git a/docs/src/network-definition-spec.md b/docs/src/network-definition-spec.md index 301d2524a..ccbe3f10f 100644 --- a/docs/src/network-definition-spec.md +++ b/docs/src/network-definition-spec.md @@ -37,7 +37,7 @@ The network config can be provided both in `json` or `toml` format and each sect - `random_nominators_count`: (number, optional), if is set _and the stacking pallet is enabled_ zombienet will generate `x` nominators and will be injected in the genesis. - `max_nominations`: (number, default 24), the max allowed number of nominations by a nominator. This should match the value set in the runtime (e.g Kusama is 24 and Polkadot 16). - `nodes`: - - `*name`: (String) Name of the node. + - `*name`: (String) Name of the node. *Note*: Any whitespace in the name will be replaced with a dash (e.g 'new alice' -> 'new-alice'). - `image`: (String) Override default docker image to use for this node. - `command`: (String) Override default command. - `command_with_args`: (String) Override default command and args. @@ -59,7 +59,7 @@ The network config can be provided both in `json` or `toml` format and each sect - `prometheus_prefix`: A parameter for customizing the metric's prefix for the specific node. Will apply only to this node; Defaults to 'substrate'. - `keystore_key_types`: Defines which keystore keys should be created, for more details checkout details below. - `node_groups`: - - `*name`: (String) Group name, used for naming the nodes (e.g name-1) + - `*name`: (String) Group name, used for naming the nodes (e.g name-1) *Note*: Any whitespace in the name will be replaced with a dash (e.g 'new group' -> 'new-group'). - `*count` (Number), Number of `nodes` to launch for this group. - `image`: (String) Override default docker image to use for this node. - `command`: (String) Override default command. @@ -86,7 +86,7 @@ The network config can be provided both in `json` or `toml` format and each sect - `prometheus_prefix`: A parameter for customizing the metric's prefix for the specific node. Will apply only to all parachain nodes/collators; Defaults to 'substrate'. - `collator`: - - `*name`: (String) Name of the collator. + - `*name`: (String) Name of the collator. *Note*: Any whitespace in the name will be replaced with a dash (e.g 'new alice' -> 'new-alice'). - `image`: (String) Image to use. - `command`: (String, default `polkadot-parachain`) Command to run. - `args`: (Array of strings) An array of arguments to use as default to pass to the `command`. @@ -99,7 +99,7 @@ The network config can be provided both in `json` or `toml` format and each sect - `collator_groups`: - - `*name`: (String) Name of the collator. + - `*name`: (String) Name of the collator. *Note*: Any whitespace in the name will be replaced with a dash (e.g 'new alice' -> 'new-alice'). - `*count`: (Number) Number of `collators` to launch for this group. - `image`: (String) Image to use. - `command`: (String, default `polkadot-parachain`) Command to run. diff --git a/javascript/packages/orchestrator/src/configGenerator.ts b/javascript/packages/orchestrator/src/configGenerator.ts index f4067a8d5..fc8720562 100644 --- a/javascript/packages/orchestrator/src/configGenerator.ts +++ b/javascript/packages/orchestrator/src/configGenerator.ts @@ -205,7 +205,9 @@ export async function generateNetworkSpec( for (const nodeGroup of config.relaychain.node_groups || []) { for (let i = 0; i < (nodeGroup.count as number); i++) { const node: NodeConfig = { - name: `${nodeGroup.name}-${i}`, + // Replace whitespaces with dashes for node names + // see https://github.com/paritytech/zombienet/issues/1659 + name: `${nodeGroup.name.replaceAll(" ", "-")}-${i}`, image: nodeGroup.image || networkSpec.relaychain.defaultImage, command: nodeGroup.command, args: sanitizeArgs(nodeGroup.args || []), @@ -289,7 +291,9 @@ export async function generateNetworkSpec( for (const collatorGroup of parachain.collator_groups || []) { for (let i = 0; i < (collatorGroup.count as number); i++) { const node: NodeConfig = { - name: `${collatorGroup.name}-${i}`, + // Replace whitespaces with dashes for node names + // see https://github.com/paritytech/zombienet/issues/1659 + name: `${collatorGroup.name.replaceAll(" ", "-")}-${i}`, image: collatorGroup.image || DEFAULT_COLLATOR_IMAGE, command: collatorGroup.command || DEFAULT_CUMULUS_COLLATOR_BIN, args: sanitizeArgs(collatorGroup.args || [], { "listen-addr": 2 }), @@ -502,6 +506,10 @@ interface UsedNames { const mUsedNames: UsedNames = {}; export function getUniqueName(name: string): string { + // Transform whitespaces to dashes in name, since + // whitespaces in names are not supported + // see https://github.com/paritytech/zombienet/issues/1659 + name = name.replaceAll(" ", "-"); let uniqueName; if (!mUsedNames[name]) { mUsedNames[name] = 1; diff --git a/tests/smoke/0001-smoke.toml b/tests/smoke/0001-smoke.toml index 116a99403..7653de485 100644 --- a/tests/smoke/0001-smoke.toml +++ b/tests/smoke/0001-smoke.toml @@ -15,7 +15,7 @@ command = "polkadot" name = "alice" [[relaychain.nodes]] - name = "bob" + name = "new bob" [[relaychain.nodes]] name = "charlie" diff --git a/tests/smoke/0001-smoke.zndsl b/tests/smoke/0001-smoke.zndsl index f7d0383f5..a973e1500 100644 --- a/tests/smoke/0001-smoke.zndsl +++ b/tests/smoke/0001-smoke.zndsl @@ -3,7 +3,7 @@ Network: ./0001-smoke.toml Creds: config alice: is up -bob: is up +new-bob: is up alice: reports block height is at least 4 within 200 seconds