# EPF6 - Week 7
## Overview
- Attended core dev call and shared updates
- Coordinated with mentor: Determined the best way to port assertions over to Kurtosis SDK implementation
- Ran existing sim tests with the new Kurtosis config
## Main points
- Met with project mentor and defined the main workflows for sim tests migration:
- At this stage, no Assertoor tool will be used: **Lodestar assertions** will be used with Kurtosis instead
- Investigated the [ethereum-package parameters](https://github.com/ethpandaops/ethereum-package?tab=readme-ov-file#configuration) to determine how to accurately replicate the `multiFork.test.ts` - clientOption [parameters](https://github.com/ChainSafe/lodestar/blob/dea6b945c2a258c9739d279a3140d9f19c2b5583/packages/cli/test/sim/multiFork.test.ts#L45):

with `cl_extra_params: []` field
- Researched how to replicate [nodeAssertion](https://github.com/ChainSafe/lodestar/blob/dea6b945c2a258c9739d279a3140d9f19c2b5583/packages/cli/test/sim/multiFork.test.ts#L108C6-L108C19) logic
- Replicated the `multiFork.test.ts` behavior with **multiFork.ts** file based on Kurtosis SDK
- Learned how to fetch end expose Kurtosis beacon URLs from the enclave
They are fetched similarly to the way endpoints are accessed in [routes/node.ts](https://github.com/ChainSafe/lodestar/blob/unstable/packages/api/src/beacon/routes/node.ts):
- e.g. line 198 in this code snippet exposes beacon URLs from Kurtosis eclave as `"http://localhost:port"`:

CLI output of *beaconUrls*:

- Kurtosis endpoints can then be tested exposing `/eth/v1/*` (e.g. `/eth/v1/node/identity`), similarly to the current code [setting](https://github.com/ChainSafe/lodestar/blob/3626b6ada054099c2592e848c23d381260f220ce/packages/api/src/beacon/routes/node.ts#L188).
Tests executed to emulate *nodeAssertion* logic and stress-test the Kurtosis endpoint:

- Output of Kurtosis endpoints stress-test:

Tests with **replaced** Kurtosis URLs executed successfully 🎉
## Learnings & Outcomes
- `cl_image: []` field in the [ethereum-package parameters](https://github.com/ethpandaops/ethereum-package?tab=readme-ov-file#configuration) will be dynamically populated by Lodestar [Dockerfile.dev](https://github.com/ChainSafe/lodestar/blob/unstable/Dockerfile.dev)
- Confirmed that the Simulation.initWithDefaults() function logic will be replaced by a **Kurtosis Runner** to generate a kurtosis network config from the configuration currently used in [sim tests](https://github.com/ChainSafe/lodestar/tree/dea6b945c2a258c9739d279a3140d9f19c2b5583/packages/cli/test/sim)
- All the `*.test.ts` will have a `*.yml` file with the related Kurtosis network config (`multiFork.test.ts` → `multifork.yml`)
- At this point, *Assertoor* will not be adopted and instead **proprietary assertions** will be maintained, the replication of [nodeAssertion](https://github.com/ChainSafe/lodestar/blob/dea6b945c2a258c9739d279a3140d9f19c2b5583/packages/cli/test/sim/multiFork.test.ts#L108C6-L108C19) logic will be limited to partial implementation (network config `.yml` file)
- Key outcomes from mentor meeting:
- [crucible/assertions](https://github.com/ChainSafe/lodestar/tree/unstable/packages/cli/test/utils/crucible/assertions): **no code changes**
- [crucible/clients](https://github.com/ChainSafe/lodestar/tree/unstable/packages/cli/test/utils/crucible/clients) completely **removed**, its logic migrated to Kurtosis Runner
- [crucicle/runner](https://github.com/ChainSafe/lodestar/tree/unstable/packages/cli/test/utils/crucible/runner): completely **removed**, the new runner/orchestrator will be the Kurtosis Runner
- [Simulation file](https://github.com/ChainSafe/lodestar/blob/unstable/packages/cli/test/utils/crucible/simulation.ts) will be connected to Kurtosis endpoints URLs
## Week 8 TODOs
- Research and evaluation of different approaches for optimal Kurtosis Runner implementation and integration
- Ongoing feedback from mentor throughout the project
- Attend core dev call
### Useful resources checked
- [Kurtosis SDK](https://github.com/kurtosis-tech/kurtosis/tree/main/api/typescript)
- [GitHub branch](https://github.com/ChainSafe/lodestar/compare/nh/kurtosis-sim) on Lodestar repo dedicated to Kurtosis test