-
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for EL Clients to sim tests (#4710)
* Update sim tests structure to add new nodes * Add new node to work to test sync * Add sim test for checkpoint sync * Update the checkpoint sync root * Update seconds per slot for the simulation tests * Update the assertion for attestaion count * Update expectedMinParticipationRate and expectedMinSyncParticipationRate to 90% * Update genesis delay * Increase genesisSlotsDelay for ci * Increase genesisSlotsDelay for ci * Update test timeout * Add support for EL * Update support for multiple nodes * Increase tcp inactivity timeout for sim tests * Add sync assertions for range and checkpoint * Add an estimated timeout for the sim tests * Add support to pull geth in CI * Update the CI for geth image * Update the geth working directory path * Fix sync configuration * Fix linter warnings * Revert "Increase tcp inactivity timeout for sim tests" This reverts commit 3b10de8. * Add deterministic TTD for bellatrix * Fix geth peer connection * Add new structure for the sim assertions * Add new sim assertion framework * Update error logging * Add range sync and checkpoint sync to new structure * Update error message logging * Fix finality assertion check * Fix lint error * Rename few variable names * Fix linter errors
- Loading branch information
1 parent
e1d4b1a
commit 1d0b7d5
Showing
30 changed files
with
1,822 additions
and
1,143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
import {join} from "node:path"; | ||
import {SIM_TESTS_SECONDS_PER_SLOT} from "../utils/simulation/constants.js"; | ||
import {CLClient, ELClient} from "../utils/simulation/interfaces.js"; | ||
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js"; | ||
import {getEstimatedTimeInSecForRun, logFilesDir} from "../utils/simulation/utils/index.js"; | ||
import {connectAllNodes, connectNewNode} from "../utils/simulation/utils/network.js"; | ||
import {nodeAssertion} from "../utils/simulation/assertions/nodeAssertion.js"; | ||
import {mergeAssertion} from "../utils/simulation/assertions/mergeAssertion.js"; | ||
|
||
const genesisSlotsDelay = 10; | ||
const altairForkEpoch = 2; | ||
const bellatrixForkEpoch = 4; | ||
const runTillEpoch = 6; | ||
const syncWaitEpoch = 2; | ||
|
||
const timeout = | ||
getEstimatedTimeInSecForRun({ | ||
genesisSlotDelay: genesisSlotsDelay, | ||
secondsPerSlot: SIM_TESTS_SECONDS_PER_SLOT, | ||
runTill: runTillEpoch + syncWaitEpoch, | ||
graceExtraTimeFraction: 0.1, // 10% extra time | ||
}) * 1000; | ||
|
||
const env = SimulationEnvironment.initWithDefaults( | ||
{ | ||
id: "multi-fork", | ||
logsDir: join(logFilesDir, "multi-fork"), | ||
chainConfig: { | ||
ALTAIR_FORK_EPOCH: altairForkEpoch, | ||
BELLATRIX_FORK_EPOCH: bellatrixForkEpoch, | ||
GENESIS_DELAY: genesisSlotsDelay, | ||
}, | ||
}, | ||
[ | ||
{id: "node-1", cl: CLClient.Lodestar, el: ELClient.Geth, keysCount: 32}, | ||
{id: "node-2", cl: CLClient.Lodestar, el: ELClient.Geth, keysCount: 32}, | ||
{id: "node-3", cl: CLClient.Lodestar, el: ELClient.Geth, keysCount: 32}, | ||
{id: "node-4", cl: CLClient.Lodestar, el: ELClient.Geth, keysCount: 32}, | ||
] | ||
); | ||
|
||
env.tracker.register({ | ||
...nodeAssertion, | ||
match: ({slot}) => { | ||
return slot === 1 ? {match: true, remove: true} : false; | ||
}, | ||
}); | ||
|
||
env.tracker.register({ | ||
...mergeAssertion, | ||
match: ({slot}) => { | ||
// Check at the end of bellatrix fork, merge should happen by then | ||
return slot === env.clock.getLastSlotOfEpoch(bellatrixForkEpoch) - 1 ? {match: true, remove: true} : false; | ||
}, | ||
}); | ||
|
||
await env.start(timeout); | ||
await connectAllNodes(env.nodes); | ||
await env.waitForSlot(env.clock.getLastSlotOfEpoch(bellatrixForkEpoch), env.nodes, true); | ||
|
||
const { | ||
data: {finalized}, | ||
} = await env.nodes[0].cl.api.beacon.getStateFinalityCheckpoints("head"); | ||
|
||
const rangeSync = env.createNodePair({ | ||
id: "range-sync-node", | ||
cl: CLClient.Lodestar, | ||
el: ELClient.Geth, | ||
keysCount: 0, | ||
}); | ||
|
||
const checkpointSync = env.createNodePair({ | ||
id: "checkpoint-sync-node", | ||
cl: CLClient.Lodestar, | ||
el: ELClient.Geth, | ||
keysCount: 0, | ||
wssCheckpoint: `${finalized.root}:${finalized.epoch}`, | ||
}); | ||
|
||
await rangeSync.jobs.el.start(); | ||
await rangeSync.jobs.cl.start(); | ||
await connectNewNode(rangeSync.nodePair, env.nodes); | ||
|
||
await checkpointSync.jobs.el.start(); | ||
await checkpointSync.jobs.cl.start(); | ||
await connectNewNode(checkpointSync.nodePair, env.nodes); | ||
|
||
await env.waitForNodeSync(rangeSync.nodePair); | ||
await env.waitForNodeSync(checkpointSync.nodePair); | ||
|
||
await env.stop(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.