diff --git a/packages/cli/test/utils/simulation/SimulationEnvironment.ts b/packages/cli/test/utils/simulation/SimulationEnvironment.ts index cf2d1fd8b76e..532b7e0f02a8 100644 --- a/packages/cli/test/utils/simulation/SimulationEnvironment.ts +++ b/packages/cli/test/utils/simulation/SimulationEnvironment.ts @@ -164,7 +164,7 @@ export class SimulationEnvironment { } await Promise.all(this.nodes.map((node) => node.beacon.job.start())); - await Promise.all(this.nodes.map((node) => node.validator.job.start())); + await Promise.all(this.nodes.map((node) => node.validator?.job.start())); if (this.nodes.some((node) => node.validator?.keys.type === "remote")) { console.log("Starting external signer..."); @@ -201,7 +201,7 @@ export class SimulationEnvironment { process.removeAllListeners("SIGINT"); console.log(`Simulation environment "${this.options.id}" is stopping: ${message}`); await this.tracker.stop(); - await Promise.all(this.nodes.map((node) => node.validator.job.stop())); + await Promise.all(this.nodes.map((node) => node.validator?.job.stop())); await Promise.all(this.nodes.map((node) => node.beacon.job.stop())); await Promise.all(this.nodes.map((node) => node.execution.job.stop())); await this.externalSigner.stop(); @@ -282,6 +282,11 @@ export class SimulationEnvironment { paths: getNodePaths({id, logsDir: this.options.logsDir, client: beaconType, root: this.options.rootDir}), }); + if (keys.type === "no-keys") { + this.nodePairCount += 1; + return {id, execution: executionNode, beacon: beaconNode}; + } + // If no validator configuration is specified we will consider that beacon type is also same as validator type const validatorType = typeof validator === "object" diff --git a/packages/cli/test/utils/simulation/assertions/nodeAssertion.ts b/packages/cli/test/utils/simulation/assertions/nodeAssertion.ts index 7c6f030be781..184fe54e1767 100644 --- a/packages/cli/test/utils/simulation/assertions/nodeAssertion.ts +++ b/packages/cli/test/utils/simulation/assertions/nodeAssertion.ts @@ -11,13 +11,16 @@ export const nodeAssertion: SimulationAssertion<"node", {health: number; keyMana match: neverMatcher, capture: async ({node}) => { const {status: health} = await node.beacon.api.node.getHealth(); - let keyManagerKeys: string[]; + if (!node.validator) { + return {health, keyManagerKeys: []}; + } + let keyManagerKeys: string[]; // There is an authentication issue with the lighthouse keymanager client if (node.beacon.client == BeaconClient.Lighthouse || getAllKeys(node.validator.keys).length === 0) { keyManagerKeys = []; } else { - const res = await node.validator?.keyManager.listKeys(); + const res = await node.validator.keyManager.listKeys(); ApiError.assert(res); keyManagerKeys = res.response.data.map((k) => k.validatingPubkey); } @@ -36,7 +39,9 @@ export const nodeAssertion: SimulationAssertion<"node", {health: number; keyMana errors.push(["node health is neither READY or SYNCING", {node: node.beacon.id}]); } - const expectedPublicKeys = getAllKeys(node.validator?.keys).map((k) => k.toPublicKey().toHex()); + const expectedPublicKeys = node.validator + ? getAllKeys(node.validator.keys).map((k) => k.toPublicKey().toHex()) + : []; if (!arrayEquals(keyManagerKeys.sort(), expectedPublicKeys.sort())) { errors.push([ diff --git a/packages/cli/test/utils/simulation/interfaces.ts b/packages/cli/test/utils/simulation/interfaces.ts index ed75509c09ef..f30185e746f7 100644 --- a/packages/cli/test/utils/simulation/interfaces.ts +++ b/packages/cli/test/utils/simulation/interfaces.ts @@ -194,7 +194,7 @@ export interface NodePair { readonly id: string; readonly beacon: BeaconNode; readonly execution: ExecutionNode; - readonly validator: ValidatorNode; + readonly validator?: ValidatorNode; } export type BeaconNodeGenerator = (