-
-
Notifications
You must be signed in to change notification settings - Fork 410
chore(testing): initial Kurtosis integration for exploratory migration #8296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/kurtosis-sim-tests
Are you sure you want to change the base?
Changes from all commits
b33fb3c
41b9c35
2ec1b92
2ca92a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| import path from "node:path"; | ||
| import {createBlobsAssertion} from "../utils/crucible/assertions/blobsAssertion.js"; | ||
| import {BeaconClient, ExecutionClient, ValidatorClient} from "../utils/crucible/interfaces.js"; | ||
| import {Simulation} from "../utils/crucible/simulation.js"; | ||
| import {Simulation} from "../utils/crucible/kurtosis/simulation/simulation-kurtosis.js"; | ||
| import {defineSimTestConfig, logFilesDir} from "../utils/crucible/utils/index.js"; | ||
| import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js"; | ||
| import {assertCheckpointSync, assertRangeSync} from "../utils/crucible/utils/syncing.js"; | ||
|
|
@@ -19,36 +18,13 @@ const {estimatedTimeoutMs, forkConfig} = defineSimTestConfig({ | |
| additionalSlotsForTTD: 0, | ||
| }); | ||
|
|
||
| const env = await Simulation.initWithDefaults( | ||
| const env = await Simulation.initWithKurtosisConfig( | ||
| { | ||
| id: "deneb", | ||
| logsDir: path.join(logFilesDir, "deneb"), | ||
| forkConfig, | ||
| }, | ||
| [ | ||
| { | ||
| id: "node-1", | ||
| beacon: BeaconClient.Lodestar, | ||
| validator: { | ||
| type: ValidatorClient.Lodestar, | ||
| options: {}, | ||
| }, | ||
| execution: ExecutionClient.Geth, | ||
| keysCount: 32, | ||
| mining: true, | ||
| }, | ||
| { | ||
| id: "node-2", | ||
| beacon: BeaconClient.Lodestar, | ||
| validator: { | ||
| type: ValidatorClient.Lodestar, | ||
| options: {}, | ||
| }, | ||
| execution: ExecutionClient.Geth, | ||
| keysCount: 32, | ||
| remote: true, | ||
| }, | ||
| ] | ||
| "deneb.yml" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest to keep |
||
| ); | ||
|
|
||
| await env.start({runTimeoutMs: estimatedTimeoutMs}); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,26 @@ | ||
| import {ChildProcess} from "node:child_process"; | ||
| //import {ChildProcess} from "node:child_process"; | ||
| import {SecretKey} from "@chainsafe/blst"; | ||
| import {ApiClient} from "@lodestar/api"; | ||
| import {ApiClient as KeyManagerApi} from "@lodestar/api/keymanager"; | ||
| import {ChainForkConfig} from "@lodestar/config"; | ||
| import {LogLevel, Logger} from "@lodestar/logger"; | ||
| import {ForkName} from "@lodestar/params"; | ||
| import {Epoch, SignedBeaconBlock, Slot} from "@lodestar/types"; | ||
| import {ServiceContext} from "kurtosis-sdk"; | ||
| import {Web3} from "web3"; | ||
| import {BeaconArgs} from "../../../src/cmds/beacon/options.js"; | ||
| import {IValidatorCliArgs} from "../../../src/cmds/validator/options.js"; | ||
| import {GlobalArgs} from "../../../src/options/index.js"; | ||
| import {EpochClock} from "./epochClock.js"; | ||
| import { KurtosisNetworkConfig, KurtosisServicesMap } from "./kurtosis/runner/kurtosisTypes.js"; | ||
|
|
||
| export type NodeId = string; | ||
|
|
||
| export type SimulationInitOptions = { | ||
| id: string; | ||
| logsDir: string; | ||
| forkConfig: ChainForkConfig; | ||
| trustedSetup?: boolean; | ||
| }; | ||
|
|
||
| export type SimulationOptions = { | ||
|
|
@@ -26,6 +29,7 @@ export type SimulationOptions = { | |
| rootDir: string; | ||
| controller: AbortController; | ||
| genesisTime: number; | ||
| trustedSetup?: boolean; | ||
| logLevel?: LogLevel; | ||
| }; | ||
|
|
||
|
|
@@ -45,11 +49,6 @@ export enum ExecutionClient { | |
| Nethermind = "execution-nethermind", | ||
| } | ||
|
|
||
| export enum ExecutionStartMode { | ||
| PreMerge = "pre-merge", | ||
| PostMerge = "post-merge", | ||
| } | ||
|
|
||
| export type BeaconClientsOptions = { | ||
| [BeaconClient.Lodestar]: Partial<BeaconArgs & GlobalArgs>; | ||
| [BeaconClient.Lighthouse]: Record<string, unknown>; | ||
|
|
@@ -136,7 +135,7 @@ export interface ExecutionGenesisOptions<E extends ExecutionClient = ExecutionCl | |
| export interface ExecutionGeneratorOptions<E extends ExecutionClient = ExecutionClient> | ||
| extends ExecutionGenesisOptions<E>, | ||
| GeneratorOptions { | ||
| mode: ExecutionStartMode; | ||
| //mode: ExecutionStartMode; //✅ REMOVED - ExecutionStartMode not needed anymore | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes remove that line completely. |
||
| mining: boolean; | ||
| paths: ExecutionPaths; | ||
| clientOptions: ExecutionClientsOptions[E]; | ||
|
|
@@ -164,52 +163,37 @@ export type LighthouseAPI = Omit<ApiClient, "lodestar"> & { | |
| }; | ||
| }; | ||
|
|
||
| // NEW - Kurtosis-specific BeaconNode | ||
| export interface BeaconNode<C extends BeaconClient = BeaconClient> { | ||
| readonly client: C; | ||
| readonly id: string; | ||
| /** | ||
| * Beacon Node Rest API URL accessible form the host machine if the process is running in private network inside docker | ||
| */ | ||
| readonly restPublicUrl: string; | ||
| /** | ||
| * Beacon Node Rest API URL accessible within private network | ||
| */ | ||
| readonly restPrivateUrl: string; | ||
| readonly restPublicUrl: string; //🔄 From Kurtosis? | ||
| readonly restPrivateUrl: string; //🔄 From Kurtosis? | ||
| readonly api: C extends BeaconClient.Lodestar ? LodestarAPI : LighthouseAPI; | ||
| readonly job: Job; | ||
| readonly serviceContext: ServiceContext; // ✅ NEW - Kurtosis-native | ||
| } | ||
|
|
||
| // NEW - Kurtosis-specific ValidatorNode | ||
| export interface ValidatorNode<C extends ValidatorClient = ValidatorClient> { | ||
| readonly client: C; | ||
| readonly id: string; | ||
| readonly keyManager: KeyManagerApi; | ||
| readonly keys: ValidatorClientKeys; | ||
| readonly job: Job; | ||
| readonly serviceContext: ServiceContext; // ✅ NEW - Kurtosis-native | ||
| } | ||
|
|
||
| // NEW - Kurtosis-specific executionNode | ||
| export interface ExecutionNode<E extends ExecutionClient = ExecutionClient> { | ||
| readonly client: E; | ||
| readonly id: string; | ||
| readonly ttd: bigint; | ||
| /** | ||
| * Engine URL accessible form the host machine if the process is running in private network inside docker | ||
| */ | ||
| readonly engineRpcPublicUrl: string; | ||
| /** | ||
| * Engine URL accessible within private network inside docker | ||
| */ | ||
| readonly engineRpcPrivateUrl: string; | ||
| /** | ||
| * RPC URL accessible form the host machine if the process is running in private network inside docker | ||
| */ | ||
| readonly ethRpcPublicUrl: string; | ||
| /** | ||
| * RPC URL accessible within private network inside docker | ||
| */ | ||
| readonly ethRpcPrivateUrl: string; | ||
| readonly jwtSecretHex: string; | ||
| readonly engineRpcPublicUrl: string; //🔄 From Kurtosis? | ||
| readonly engineRpcPrivateUrl: string; //🔄 From Kurtosis? | ||
| readonly ethRpcPublicUrl: string; //🔄 From Kurtosis? | ||
| readonly ethRpcPrivateUrl: string; //🔄 From Kurtosis? | ||
| readonly jwtSecretHex?: string; | ||
| readonly provider: E extends ExecutionClient.Mock ? null : Web3; | ||
| readonly job: Job; | ||
| readonly serviceContext: ServiceContext; // ✅ NEW - Kurtosis-native | ||
| } | ||
|
|
||
| export interface NodePair { | ||
|
|
@@ -287,17 +271,19 @@ export type RunnerOptions = { | |
| }; | ||
| }; | ||
|
|
||
| //✅ New Kurtosis Runner | ||
| export interface IRunner { | ||
| create: (jobOptions: JobOptions[]) => Job; | ||
| on(event: RunnerEvent, cb: (id: string) => void | Promise<void>): void; | ||
| start(): Promise<void>; | ||
| stop(): Promise<void>; | ||
| getNextIp(): string; | ||
| } | ||
| // Takes a structured config and instantiates the network | ||
| create: (config: KurtosisNetworkConfig) => Promise<KurtosisServicesMap>; // ✅ NEW - Kurtosis-native | ||
|
|
||
| // Starts the environment (e.g., enclave) | ||
| start: (enclaveName: string) => Promise<void>; // ✅ NEW - Kurtosis-native | ||
|
|
||
| export interface RunnerEnv<T extends RunnerType> { | ||
| type: T; | ||
| create: (jobOption: Omit<JobOptions<T>, "children">) => Job; | ||
| // Stops or tears down the environment | ||
| stop: () => Promise<void>; | ||
|
|
||
| // Attach listeners for events, such as service start, stop, crash, etc. | ||
| on(event: RunnerEvent, cb: (id: string) => void | Promise<void>): void; | ||
| } | ||
|
|
||
| export type RunnerEvent = "starting" | "started" | "stopping" | "stop"; | ||
|
|
@@ -383,7 +369,6 @@ export interface AssertionError { | |
| message: string; | ||
| data?: Record<string, unknown>; | ||
| } | ||
| export type ChildProcessWithJobOptions = {jobOptions: JobOptions; childProcess: ChildProcess}; | ||
|
|
||
| export type Eth1GenesisBlock = { | ||
| config: { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would remove this line when this PR get ready.