Skip to content

Commit

Permalink
configure sims with multiple produceblock opts
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Oct 4, 2023
1 parent 68838ea commit 08d3fc0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/cli/test/sim/mixed_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
Expand Down
59 changes: 55 additions & 4 deletions packages/cli/test/sim/multi_fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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},
]
);
Expand Down

0 comments on commit 08d3fc0

Please sign in to comment.