Skip to content

Commit

Permalink
add blinded local combinations to sim
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Dec 26, 2023
1 parent e1b5a52 commit 1f7aad0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
36 changes: 27 additions & 9 deletions packages/cli/test/sim/multi_fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ const env = await SimulationEnvironment.initWithDefaults(
validator: {
type: ValidatorClient.Lodestar,
options: {
// this will cause race in beacon but since builder is not attached will
// return with engine full block and publish via publishBlockV2
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
"builder.selection": "maxprofit",
},
},
},
Expand All @@ -82,12 +83,12 @@ const env = await SimulationEnvironment.initWithDefaults(
validator: {
type: ValidatorClient.Lodestar,
options: {
// this will make the beacon respond with blinded version of the local block as no
// builder is attached to beacon, and publish via publishBlindedBlockV2
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
useProduceBlockV3: true,
"builder.selection": "maxprofit",
blindedLocal: true,
},
},
},
Expand All @@ -101,17 +102,34 @@ const env = await SimulationEnvironment.initWithDefaults(
validator: {
type: ValidatorClient.Lodestar,
options: {
// this builder selection will make it use produceBlockV2 and respond with full block
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},
{
id: "node-4",
beacon: BeaconClient.Lodestar,
validator: {
type: ValidatorClient.Lodestar,
options: {
// this builder selection will make it use produceBlindedBlockV2 and respond with blinded version
// of local block and subsequent publishing via publishBlindedBlock
clientOptions: {
useProduceBlockV3: false,
"builder.selection": "maxprofit",
},
},
},
execution: ExecutionClient.Nethermind,
keysCount: 32,
},
{id: "node-5", beacon: BeaconClient.Lighthouse, execution: ExecutionClient.Geth, keysCount: 32},
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {getNodePorts} from "../utils/ports.js";
export const generateLodestarValidatorNode: ValidatorNodeGenerator<ValidatorClient.Lodestar> = (opts, runner) => {
const {paths, id, keys, forkConfig, genesisTime, nodeIndex, beaconUrls, clientOptions} = opts;
const {rootDir, keystoresDir, keystoresSecretFilePath, logFilePath} = paths;
const {useProduceBlockV3, "builder.selection": builderSelection} = clientOptions ?? {};
const {useProduceBlockV3, "builder.selection": builderSelection, blindedLocal} = clientOptions ?? {};
const ports = getNodePorts(nodeIndex);
const rcConfigPath = path.join(rootDir, "rc_config.json");
const paramsPath = path.join(rootDir, "params.json");
Expand All @@ -41,6 +41,7 @@ export const generateLodestarValidatorNode: ValidatorNodeGenerator<ValidatorClie
importKeystoresPassword: keystoresSecretFilePath,
useProduceBlockV3: useProduceBlockV3 ?? defaultOptions.useProduceBlockV3,
"builder.selection": builderSelection ?? defaultOptions.builderSelection,
blindedLocal: blindedLocal ?? defaultOptions.blindedLocal,
} as unknown as IValidatorCliArgs & GlobalArgs;

const job = runner.create([
Expand Down

0 comments on commit 1f7aad0

Please sign in to comment.