Skip to content

Commit 3a57467

Browse files
samcmbarnabasbusa
andauthored
feat: Support participants_matrix (ethereum#620)
This PR adds a new config argument called `participants_matrix`, which allows the user to easily spin up a matrix of EL/CL combos. The `el` and `cl` keys within this argument can be fully fledged normal `participants`, so they support the exact same arguments. For example: # Example 1 ``` participants_matrix: el: - el_type: geth - el_type: besu - el_type: reth cl: - cl_type: nimbus ``` This config would create the following participants: - `nimbus-geth` - `nimbus-besu` - `nimbus-reth` # Example 2 ``` participants_matrix: el: - el_type: geth - el_type: besu - el_type: reth cl: - cl_type: nimbus participants: - el_type: nethermind cl_type: lighthouse ``` This config would create the following participants: - `nimbus-geth` - `nimbus-besu` - `nimbus-reth` - `lighthouse-nethermind` # Example 3 ``` participants_matrix: el: - el_type: geth - el_type: besu - el_type: reth cl: - cl_type: nimbus count: 5 ``` This config would create the following participants: - `5x nimbus-geth` - `5x nimbus-besu` - `5x nimbus-reth` --------- Co-authored-by: Barnabas Busa <busa.barnabas@gmail.com>
1 parent 22f1498 commit 3a57467

File tree

9 files changed

+86
-6
lines changed

9 files changed

+86
-6
lines changed

.github/tests/apache.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
participants:
2+
- count: 1
13
additional_services:
24
- apache

.github/tests/mev-mock.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
participants:
2+
- el_type: geth
3+
cl_type: lighthouse
14
network_params:
25
seconds_per_slot: 3
36
additional_services: []

.github/tests/mev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
participants:
2+
- el_type: geth
3+
cl_type: lighthouse
14
mev_type: flashbots
25
additional_services:
36
- tx_spammer
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
participants_matrix:
2+
el:
3+
- el_type: besu
4+
cl:
5+
- cl_type: prysm
6+
vc:
7+
- vc_type: nimbus
8+
participants:
9+
- count: 1

.github/tests/peerdas-fork.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
participants:
22
- el_type: geth
3+
el_image: ethpandaops/geth:master
34
cl_type: prysm
4-
cl_image: ethpandaops/prysm-beacon-chain:peerDASE2E
5+
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
56
cl_max_mem: 2048
67
- el_type: geth
8+
el_image: ethpandaops/geth:master
79
cl_type: lighthouse
8-
cl_extra_args: [
10+
cl_extra_params: [
911
--subscribe-all-data-column-subnets,
1012
]
1113
cl_image: ethpandaops/lighthouse:das
1214
- el_type: geth
1315
cl_type: lighthouse
1416
cl_image: ethpandaops/lighthouse:das
17+
- el_type: geth
18+
el_image: ethpandaops/geth:master
19+
cl_type: teku
20+
cl_image: ethpandaops/teku:das
21+
- el_type: geth
22+
el_image: ethpandaops/geth:master
23+
cl_type: nimbus
24+
cl_image: ethpandaops/nimbus-eth2:wip-peerdas
25+
validator_count: 1
1526
network_params:
1627
eip7594_fork_epoch: 0
1728
eip7594_fork_version: "0x50000038"

.github/workflows/per-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
kurtosis analytics disable
2323
2424
- name: Run Starlark
25-
run: kurtosis run ${{ github.workspace }}
25+
run: kurtosis run ${{ github.workspace }} --args-file network_params.yaml
2626

2727
run_with_args:
2828
strategy:

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,20 @@ participants:
456456
# Defaults null and then set to default global keymanager_enabled (false)
457457
keymanager_enabled: null
458458

459+
# Participants matrix creates a participant for each combination of EL, CL and VC clients
460+
# Each EL/CL/VC item can provide the same parameters as a standard participant
461+
participants_matrix: {}
462+
# el:
463+
# - el_type: geth
464+
# - el_type: besu
465+
# cl:
466+
# - cl_type: prysm
467+
# - cl_type: lighthouse
468+
# vc:
469+
# - vc_type: prysm
470+
# - vc_type: lighthouse
471+
472+
459473
# Default configuration parameters for the network
460474
network_params:
461475
# Network name, used to enable syncing of alternative networks

src/package_io/input_parser.star

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,42 @@ def parse_network_params(plan, input_args):
371371
result = default_input_args()
372372
if input_args.get("network_params", {}).get("preset") == "minimal":
373373
result["network_params"] = default_minimal_network_params()
374+
375+
# Ensure we handle matrix participants before standard participants are handled.
376+
if "participants_matrix" in input_args:
377+
participants_matrix = []
378+
participants = []
379+
380+
el_matrix = []
381+
if "el" in input_args["participants_matrix"]:
382+
el_matrix = input_args["participants_matrix"]["el"]
383+
cl_matrix = []
384+
if "cl" in input_args["participants_matrix"]:
385+
cl_matrix = input_args["participants_matrix"]["cl"]
386+
vc_matrix = []
387+
if "vc" in input_args["participants_matrix"]:
388+
vc_matrix = input_args["participants_matrix"]["vc"]
389+
390+
participants = []
391+
392+
for el in el_matrix:
393+
for cl in cl_matrix:
394+
participant = {k: v for k, v in el.items()}
395+
for k, v in cl.items():
396+
participant[k] = v
397+
398+
participants.append(participant)
399+
400+
for index, participant in enumerate(participants):
401+
for vc in vc_matrix:
402+
for k, v in vc.items():
403+
participants[index][k] = v
404+
405+
if "participants" in input_args:
406+
input_args["participants"].extend(participants)
407+
else:
408+
input_args["participants"] = participants
409+
374410
for attr in input_args:
375411
value = input_args[attr]
376412
# if its insterted we use the value inserted
@@ -664,9 +700,11 @@ def get_client_node_selectors(participant_node_selectors, global_node_selectors)
664700

665701
def default_input_args():
666702
network_params = default_network_params()
667-
participants = [default_participant()]
703+
participants = []
704+
participants_matrix = []
668705
return {
669706
"participants": participants,
707+
"participants_matrix": participants_matrix,
670708
"network_params": network_params,
671709
"wait_for_finalization": False,
672710
"global_log_level": "info",

src/participant_network.star

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def launch_participant_network(
310310
)
311311
all_snooper_beacon_contexts.append(snooper_beacon_context)
312312
full_name = (
313-
"{0}-{1}-{2}".format(index_str, el_type, cl_type) + "-{0}".format(vc_type)
313+
"{0}-{1}-{2}-{3}".format(index_str, el_type, cl_type, vc_type)
314314
if participant.cl_type != participant.vc_type
315315
else "{0}-{1}-{2}".format(index_str, el_type, cl_type)
316316
)
@@ -319,7 +319,7 @@ def launch_participant_network(
319319
plan=plan,
320320
launcher=vc.new_vc_launcher(el_cl_genesis_data=el_cl_data),
321321
keymanager_file=keymanager_file,
322-
service_name="vc-{0}-{1}-{2}".format(index_str, vc_type, el_type),
322+
service_name="vc-{0}".format(full_name),
323323
vc_type=vc_type,
324324
image=participant.vc_image,
325325
participant_log_level=participant.vc_log_level,

0 commit comments

Comments
 (0)