From 08d3fc0faaa26fde586616c83ea9f0d739ccd381 Mon Sep 17 00:00:00 2001 From: gajinder Date: Wed, 4 Oct 2023 22:27:31 +0530 Subject: [PATCH] configure sims with multiple produceblock opts --- packages/cli/test/sim/mixed_client.test.ts | 5 ++ packages/cli/test/sim/multi_fork.test.ts | 59 ++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/packages/cli/test/sim/mixed_client.test.ts b/packages/cli/test/sim/mixed_client.test.ts index 2a80f71fc8b6..35588f8d7c6f 100644 --- a/packages/cli/test/sim/mixed_client.test.ts +++ b/packages/cli/test/sim/mixed_client.test.ts @@ -66,6 +66,11 @@ const env = await SimulationEnvironment.initWithDefaults( options: { clientOptions: { useProduceBlockV3: false, + // this should cause usage of produceBlockV2 + // + // but if blinded production is enabled in lighthouse beacon then this should cause + // usage of produce blinded block which should return execution block in blinded format + // but only enable that after testing lighthouse beacon "builder.selection": "executiononly", }, }, diff --git a/packages/cli/test/sim/multi_fork.test.ts b/packages/cli/test/sim/multi_fork.test.ts index 117ad42e53eb..2cc07445ce95 100644 --- a/packages/cli/test/sim/multi_fork.test.ts +++ b/packages/cli/test/sim/multi_fork.test.ts @@ -3,7 +3,7 @@ import path from "node:path"; import {sleep, toHex, toHexString} from "@lodestar/utils"; import {ApiError} from "@lodestar/api"; import {CLIQUE_SEALING_PERIOD, SIM_TESTS_SECONDS_PER_SLOT} from "../utils/simulation/constants.js"; -import {AssertionMatch, BeaconClient, ExecutionClient} from "../utils/simulation/interfaces.js"; +import {AssertionMatch, BeaconClient, ExecutionClient, ValidatorClient} from "../utils/simulation/interfaces.js"; import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js"; import {getEstimatedTimeInSecForRun, getEstimatedTTD, logFilesDir} from "../utils/simulation/utils/index.js"; import { @@ -56,9 +56,60 @@ const env = await SimulationEnvironment.initWithDefaults( }, }, [ - {id: "node-1", beacon: BeaconClient.Lodestar, execution: ExecutionClient.Geth, keysCount: 32, mining: true}, - {id: "node-2", beacon: BeaconClient.Lodestar, execution: ExecutionClient.Nethermind, keysCount: 32, remote: true}, - {id: "node-3", beacon: BeaconClient.Lodestar, execution: ExecutionClient.Nethermind, keysCount: 32}, + // put 1 lodestar node on produceBlockV3, and 2nd on produceBlindedBlock and 3rd on produceBlockV2 + // specifying the useProduceBlockV3 options despite whatever default is set + { + id: "node-1", + beacon: BeaconClient.Lodestar, + validator: { + type: ValidatorClient.Lodestar, + options: { + clientOptions: { + useProduceBlockV3: true, + // default builder selection will cause a race try in beacon even if builder is not set + // but not to worry, execution block will be selected as fallback anyway + }, + }, + }, + execution: ExecutionClient.Geth, + keysCount: 32, + mining: true, + }, + { + id: "node-2", + beacon: BeaconClient.Lodestar, + validator: { + type: ValidatorClient.Lodestar, + options: { + clientOptions: { + useProduceBlockV3: false, + // default builder selection of max profit will make it use produceBlindedBlock + // but not to worry, execution block will be selected as fallback anyway + // but returned in blinded format for validator to use publish blinded block + // which assembles block beacon side from local cache before publishing + }, + }, + }, + execution: ExecutionClient.Nethermind, + keysCount: 32, + remote: true, + }, + { + id: "node-3", + beacon: BeaconClient.Lodestar, + validator: { + type: ValidatorClient.Lodestar, + options: { + clientOptions: { + useProduceBlockV3: false, + // this builder selection will make it use produceBlockV2 + "builder.selection": "executiononly", + }, + }, + }, + execution: ExecutionClient.Nethermind, + keysCount: 32, + }, {id: "node-4", beacon: BeaconClient.Lighthouse, execution: ExecutionClient.Geth, keysCount: 32}, ] );