Skip to content

Commit

Permalink
fix(orchestrator): set undying/adder collators not validators by defa…
Browse files Browse the repository at this point in the history
…ult (#1247)

* fix(orchestrator): set undying/adder collators not validators by default

* fmt

* fix cmd generator for undying/adder collators

* fmt cmdGenerator

* better comments about ternary
  • Loading branch information
pepoviola authored Aug 16, 2023
1 parent 6c946de commit e72f4f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion javascript/packages/orchestrator/src/cmdGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export async function genCmd(
const parachainIdArgIndex = args.findIndex((arg) =>
arg.includes("--parachain-id"),
);
args.splice(parachainIdArgIndex, 1);
if (parachainIdArgIndex >= 0) args.splice(parachainIdArgIndex, 1);
args.push(`--parachain-id ${parachainId}`);
}

Expand Down
12 changes: 11 additions & 1 deletion javascript/packages/orchestrator/src/configGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,21 @@ async function getCollatorNodeFromConfig(
const ports = await getPorts(provider, collatorConfig);
const externalPorts = await getExternalPorts(provider, ports, collatorConfig);

// IFF the collator have explicit set the validator field we use that value,
// if not we set by default cumulus collators as `validators`, this implies that we will
// run those with this flag `--collator`.
const isValidator =
collatorConfig.validator !== undefined
? collatorConfig.validator
: cumulusBased
? true
: false;

const node: Node = {
name: collatorName,
key: getSha256(collatorName),
accounts: accountsForNode,
validator: collatorConfig.validator !== false ? true : false, // --collator and --force-authoring by default
validator: isValidator,
invulnerable: collatorConfig.invulnerable,
balance: collatorConfig.balance,
image: collatorConfig.image || DEFAULT_COLLATOR_IMAGE,
Expand Down

0 comments on commit e72f4f7

Please sign in to comment.