Skip to content

Commit

Permalink
fix(native): use rpc_port as default (#1950)
Browse files Browse the repository at this point in the history
* fix(native): use rpc_port as default

* ci, bump version of action

* eslint
  • Loading branch information
pepoviola authored Feb 4, 2025
1 parent 236781b commit 3fa9e76
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Upload build artifacts
if: ${{ matrix.node-version == '18.x' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-build-${{ github.sha }}
path: |
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
# with:
# name: ${{ runner.os }}-build-${{ github.sha }}
# path: ./javascript/packages

# - name: Install dependencies
# run: npm install --ignore-scripts
# working-directory: ./javascript
Expand Down
10 changes: 6 additions & 4 deletions javascript/packages/orchestrator/src/cmdGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ export async function genCumulusCollatorCmd(

if (validator) fullCmd.push(...["--collator"]);

// ports passed to the relaychain part of the collator binary
const collatorPorts: PortsInterface = {
"--port": 0,
"--rpc-port": 0,
"--prometheus-port": 0,
};

if (nodeSetup.args.length > 0) {
Expand Down Expand Up @@ -341,10 +343,10 @@ const getPortFlagsByCliArgsVersion = (nodeSetup: Node) => {
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;
// use rpc_port as default (since ws_port was deprecated in https://github.com/paritytech/substrate/pull/13384)
const portToUse = nodeSetup.rpcPort
? nodeSetup.rpcPort
: nodeSetup.wsPort || RPC_HTTP_PORT;
portFlags["--rpc-port"] = portToUse.toString();
}

Expand Down
6 changes: 6 additions & 0 deletions javascript/packages/orchestrator/src/configGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,12 @@ function sanitizeArgs(
async function getPorts(provider: string, nodeSetup: any): Promise<any> {
let ports = DEFAULT_PORTS;

if (nodeSetup.ws_port) {
console.warn(
"'ws-port flag was deprecated in https://github.com/paritytech/substrate/pull/13384 (v0.9.43).\nIf you are using a recent version please use 'rpc_port' to set the port",
);
}

if (provider === "native") {
ports = {
p2pPort: nodeSetup.p2p_port || (await getRandomPort()),
Expand Down
4 changes: 3 additions & 1 deletion javascript/packages/orchestrator/src/spawner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
LOCALHOST,
METRICS_URI_PATTERN,
PROMETHEUS_PORT,
RPC_HTTP_PORT,
RPC_WS_PORT,
WS_URI_PATTERN,
} from "./constants";
Expand Down Expand Up @@ -121,7 +122,8 @@ export const spawnNode = async (

let networkNode: NetworkNode;

const endpointPort = RPC_WS_PORT;
const endpointPort =
node.substrateCliArgsVersion == 0 ? RPC_WS_PORT : RPC_HTTP_PORT;
if (opts.inCI) {
// UPDATE: 04-10-2024 Since we have several reports of failures related to
// can't access metrics by dns, we switch back to use the pod ip.
Expand Down

0 comments on commit 3fa9e76

Please sign in to comment.