Skip to content

Commit ab9e55f

Browse files
dzobbebarnabasbusa
andauthored
feat: Add cl_devices parameter for mounting host devices to CL containers (#1251)
# Update This PR requires you to run the latest (1.14.1+) version of kurtosis! ## Summary This PR adds support for mounting host devices (e.g., `/dev/tpm0`) into Consensus Layer (CL) containers. This enables use cases such as TPM (Trusted Platform Module) access for hardware-backed security features in CL clients like Lighthouse. ## Changes ### Configuration (`network_params.yaml`) - Added `cl_devices: []` parameter to participant structure - Accepts a list of device paths (e.g., `["/dev/tpm0"]`) ### Input Parser (`src/package_io/input_parser.star`) - Added `cl_devices: []` to default participant structure - Added `cl_devices` to participant struct creation ### Validation (`src/package_io/sanity_check.star`) - Added `cl_devices` to participant validation lists - Added to both `PARTICIPANT_CATEGORIES` and `PARTICIPANT_MATRIX_PARAMS` ### CL Launchers Updated all CL client launchers to pass devices to `ServiceConfig`: - `src/cl/lighthouse/lighthouse_launcher.star` - `src/cl/lodestar/lodestar_launcher.star` - `src/cl/nimbus/nimbus_launcher.star` - `src/cl/prysm/prysm_launcher.star` - `src/cl/teku/teku_launcher.star` - `src/cl/grandine/grandine_launcher.star` Each launcher now includes: if len(participant.cl_devices) > 0: config_args["devices"] = participant.cl_devices### Package Configuration (`kurtosis.yml`) - Updated package name to match repository location ## Usage Users can now specify devices in their `network_params.yaml`: aml participants: - el_type: geth cl_type: lighthouse cl_devices: ["/dev/tpm0"] # ... other configOr for multiple devices: cl_devices: ["/dev/tpm0", "/dev/tpm1"] ## Requirements **This feature requires a patched version of Kurtosis** that includes device mounting support in `ServiceConfig`. The standard Kurtosis release does not yet support the `devices` field. A PR has been opened there. ## Implementation Details - Devices are passed through to Kurtosis `ServiceConfig` as a list of strings - Each device path is mounted at the same path inside the container - Empty list (default) results in no device mounts - Works with all supported CL clients (Lighthouse, Lodestar, Nimbus, Prysm, Teku, Grandine) ## Testing - [x] Added parameter to configuration structure - [x] Updated all CL launchers - [x] Added validation - [ ] Requires testing with patched Kurtosis build ## Related This change enables hardware device access for CL containers, particularly useful for: - TPM-based key management - Hardware security modules (HSM) - Other device-specific use cases --------- Signed-off-by: Barnabas Busa <[email protected]> Co-authored-by: Barnabas Busa <[email protected]> Co-authored-by: Barnabas Busa <[email protected]>
1 parent ba855e0 commit ab9e55f

24 files changed

+73
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ participants:
224224
# Example: el_extra_mounts: {"/config": "my_config_file"} # Creates /config/my_config_file
225225
el_extra_mounts: {}
226226

227+
# A list of host devices to mount into the EL client container
228+
# Useful for hardware device access like TPM, HSM, etc.
229+
# Example: el_devices: ["/dev/tpm0"]
230+
# Defaults to empty list
231+
el_devices: []
232+
227233
# A list of tolerations that will be passed to the EL client container
228234
# Only works with Kubernetes
229235
# Example: el_tolerations:
@@ -289,6 +295,12 @@ participants:
289295
# Example: cl_extra_mounts: {"/config": "my_config_file"} # Creates /config/my_config_file
290296
cl_extra_mounts: {}
291297

298+
# A list of host devices to mount into the CL client container
299+
# Useful for hardware device access like TPM, HSM, etc.
300+
# Example: cl_devices: ["/dev/tpm0"]
301+
# Defaults to empty list
302+
cl_devices: []
303+
292304
# A list of tolerations that will be passed to the CL client container
293305
# Only works with Kubernetes
294306
# Example: el_tolerations:
@@ -365,6 +377,12 @@ participants:
365377
# Example: vc_extra_mounts: {"/config": "my_validator_config"} # Creates /config/my_validator_config
366378
vc_extra_mounts: {}
367379

380+
# A list of host devices to mount into the validator client container
381+
# Useful for hardware device access like TPM, HSM, etc.
382+
# Example: vc_devices: ["/dev/tpm0"]
383+
# Defaults to empty list
384+
vc_devices: []
385+
368386
# A list of tolerations that will be passed to the validator container
369387
# Only works with Kubernetes
370388
# Example: el_tolerations:

network_params.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ participants:
77
el_extra_labels: {}
88
el_extra_params: []
99
el_extra_mounts: {}
10+
el_devices: []
1011
el_tolerations: []
1112
el_volume_size: 0
1213
el_min_cpu: 0
@@ -21,6 +22,7 @@ participants:
2122
cl_extra_labels: {}
2223
cl_extra_params: []
2324
cl_extra_mounts: {}
25+
cl_devices: []
2426
cl_tolerations: []
2527
cl_volume_size: 0
2628
cl_min_cpu: 0
@@ -37,6 +39,7 @@ participants:
3739
vc_extra_labels: {}
3840
vc_extra_params: []
3941
vc_extra_mounts: {}
42+
vc_devices: []
4043
vc_tolerations: []
4144
vc_min_cpu: 0
4245
vc_max_cpu: 0

src/cl/grandine/grandine_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ def get_beacon_config(
361361
"user": User(uid=0, gid=0),
362362
}
363363

364+
if len(participant.cl_devices) > 0:
365+
config_args["devices"] = participant.cl_devices
364366
# Only add ready_conditions if not skipping start
365367
if not participant.skip_start:
366368
config_args["ready_conditions"] = cl_node_ready_conditions.get_ready_conditions(

src/cl/lighthouse/lighthouse_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ def get_beacon_config(
334334
"node_selectors": node_selectors,
335335
}
336336

337+
if len(participant.cl_devices) > 0:
338+
config_args["devices"] = participant.cl_devices
337339
# Only add ready_conditions if not skipping start
338340
if not participant.skip_start:
339341
config_args["ready_conditions"] = cl_node_ready_conditions.get_ready_conditions(

src/cl/lodestar/lodestar_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ def get_beacon_config(
313313
"node_selectors": node_selectors,
314314
}
315315

316+
if len(participant.cl_devices) > 0:
317+
config_args["devices"] = participant.cl_devices
316318
# Only add ready_conditions if not skipping start
317319
if not participant.skip_start:
318320
config_args["ready_conditions"] = cl_node_ready_conditions.get_ready_conditions(

src/cl/nimbus/nimbus_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ def get_beacon_config(
371371
"user": User(uid=0, gid=0),
372372
}
373373

374+
if len(participant.cl_devices) > 0:
375+
config_args["devices"] = participant.cl_devices
374376
# Only add ready_conditions if not skipping start
375377
if not participant.skip_start:
376378
config_args["ready_conditions"] = cl_node_ready_conditions.get_ready_conditions(

src/cl/prysm/prysm_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ def get_beacon_config(
350350
"tty_enabled": True,
351351
}
352352

353+
if len(participant.cl_devices) > 0:
354+
config_args["devices"] = participant.cl_devices
353355
# Only add ready_conditions if not skipping start (port checks are already disabled via wait="disable")
354356
if not participant.skip_start:
355357
config_args["ready_conditions"] = cl_node_ready_conditions.get_ready_conditions(

src/cl/teku/teku_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ def get_beacon_config(
372372
"user": User(uid=0, gid=0),
373373
}
374374

375+
if len(participant.cl_devices) > 0:
376+
config_args["devices"] = participant.cl_devices
375377
# Only add ready_conditions if not skipping start
376378
if not participant.skip_start:
377379
config_args["ready_conditions"] = cl_node_ready_conditions.get_ready_conditions(

src/el/besu/besu_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ def get_config(
277277
config_args["min_memory"] = participant.el_min_mem
278278
if participant.el_max_mem > 0:
279279
config_args["max_memory"] = participant.el_max_mem
280+
if len(participant.el_devices) > 0:
281+
config_args["devices"] = participant.el_devices
280282
return ServiceConfig(**config_args)
281283

282284

src/el/erigon/erigon_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ def get_config(
282282
config_args["min_memory"] = participant.el_min_mem
283283
if participant.el_max_mem > 0:
284284
config_args["max_memory"] = participant.el_max_mem
285+
if len(participant.el_devices) > 0:
286+
config_args["devices"] = participant.el_devices
285287
return ServiceConfig(**config_args)
286288

287289

0 commit comments

Comments
 (0)