Skip to content

rpc_port ignored in the configuration #1219

@Dinonard

Description

@Dinonard

Issue Description

In case of a configuration such as this one:

  [[parachains.collators]]
  name = "collator1"
  command = "./some-collator"
  rpc_port = 6969

The RPC port value will be ignored, and instead a random one will be used.

I assume it's due to this code:

if (nodeSetup.substrateCliArgsVersion === SubstrateCliArgsVersion.V0) {
    portFlags["--rpc-port"] = (nodeSetup.rpcPort || RPC_HTTP_PORT).toString();
    portFlags["--ws-port"] = (nodeSetup.wsPort || RPC_WS_PORT).toString();
  } else {
    // use ws port as default
    const portToUse = nodeSetup.wsPort
      ? nodeSetup.wsPort
      : nodeSetup.rpcPort || RPC_HTTP_PORT;
    portFlags["--rpc-port"] = portToUse.toString();
  }

wsPort will always be defined, since in case it's omitted, a random one will be generated at that point.

It's also a bit confusing to specify ws_port in the config file - both WS & HTTP are RPC ports.
Maybe it would be better to use rpc_port and stop using the ws_port?

Steps to reproduce the issue

Just specify rpc_port in the config file, as explained in the issue description.

Describe the results you received

Random RPC port was used.

Describe the results you expected

The one I specified to be used.

Zombienet version

1.3.63

Provider

Native

Provider version

## For binaries
polkadot 0.9.43-a2b62fb872b

Upstream Latest Release

Yes

Additional environment details

None

Additional information

No response

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions