Skip to content
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

feat: Support participants_matrix #620

Merged
merged 6 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/tests/apache.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
participants:
- count: 1
additional_services:
- apache
3 changes: 3 additions & 0 deletions .github/tests/mev-mock.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
participants:
- el_type: geth
cl_type: lighthouse
network_params:
seconds_per_slot: 3
additional_services: []
Expand Down
3 changes: 3 additions & 0 deletions .github/tests/mev.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
participants:
- el_type: geth
cl_type: lighthouse
mev_type: flashbots
additional_services:
- tx_spammer
Expand Down
9 changes: 9 additions & 0 deletions .github/tests/participants-matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
participants_matrix:
el:
- el_type: besu
cl:
- cl_type: prysm
vc:
- vc_type: nimbus
participants:
- count: 1
15 changes: 13 additions & 2 deletions .github/tests/peerdas-fork.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
participants:
- el_type: geth
el_image: ethpandaops/geth:master
cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDASE2E
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
cl_max_mem: 2048
- el_type: geth
el_image: ethpandaops/geth:master
cl_type: lighthouse
cl_extra_args: [
cl_extra_params: [
--subscribe-all-data-column-subnets,
]
cl_image: ethpandaops/lighthouse:das
- el_type: geth
cl_type: lighthouse
cl_image: ethpandaops/lighthouse:das
- el_type: geth
el_image: ethpandaops/geth:master
cl_type: teku
cl_image: ethpandaops/teku:das
- el_type: geth
el_image: ethpandaops/geth:master
cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:wip-peerdas
validator_count: 1
network_params:
eip7594_fork_epoch: 0
eip7594_fork_version: "0x50000038"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/per-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
kurtosis analytics disable

- name: Run Starlark
run: kurtosis run ${{ github.workspace }}
run: kurtosis run ${{ github.workspace }} --args-file network_params.yaml

run_with_args:
strategy:
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,20 @@ participants:
# Defaults null and then set to default global keymanager_enabled (false)
keymanager_enabled: null

# Participants matrix creates a participant for each combination of EL, CL and VC clients
# Each EL/CL/VC item can provide the same parameters as a standard participant
participants_matrix: {}
# el:
# - el_type: geth
# - el_type: besu
# cl:
# - cl_type: prysm
# - cl_type: lighthouse
# vc:
# - vc_type: prysm
# - vc_type: lighthouse


# Default configuration parameters for the network
network_params:
# Network name, used to enable syncing of alternative networks
Expand Down
40 changes: 39 additions & 1 deletion src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,42 @@ def parse_network_params(plan, input_args):
result = default_input_args()
if input_args.get("network_params", {}).get("preset") == "minimal":
result["network_params"] = default_minimal_network_params()

# Ensure we handle matrix participants before standard participants are handled.
if "participants_matrix" in input_args:
participants_matrix = []
participants = []

el_matrix = []
if "el" in input_args["participants_matrix"]:
el_matrix = input_args["participants_matrix"]["el"]
cl_matrix = []
if "cl" in input_args["participants_matrix"]:
cl_matrix = input_args["participants_matrix"]["cl"]
vc_matrix = []
if "vc" in input_args["participants_matrix"]:
vc_matrix = input_args["participants_matrix"]["vc"]

participants = []

for el in el_matrix:
for cl in cl_matrix:
participant = {k: v for k, v in el.items()}
for k, v in cl.items():
participant[k] = v

participants.append(participant)

for index, participant in enumerate(participants):
for vc in vc_matrix:
for k, v in vc.items():
participants[index][k] = v

if "participants" in input_args:
input_args["participants"].extend(participants)
else:
input_args["participants"] = participants

for attr in input_args:
value = input_args[attr]
# if its insterted we use the value inserted
Expand Down Expand Up @@ -664,9 +700,11 @@ def get_client_node_selectors(participant_node_selectors, global_node_selectors)

def default_input_args():
network_params = default_network_params()
participants = [default_participant()]
participants = []
participants_matrix = []
return {
"participants": participants,
"participants_matrix": participants_matrix,
"network_params": network_params,
"wait_for_finalization": False,
"global_log_level": "info",
Expand Down
4 changes: 2 additions & 2 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def launch_participant_network(
)
all_snooper_beacon_contexts.append(snooper_beacon_context)
full_name = (
"{0}-{1}-{2}".format(index_str, el_type, cl_type) + "-{0}".format(vc_type)
"{0}-{1}-{2}-{3}".format(index_str, el_type, cl_type, vc_type)
if participant.cl_type != participant.vc_type
else "{0}-{1}-{2}".format(index_str, el_type, cl_type)
)
Expand All @@ -319,7 +319,7 @@ def launch_participant_network(
plan=plan,
launcher=vc.new_vc_launcher(el_cl_genesis_data=el_cl_data),
keymanager_file=keymanager_file,
service_name="vc-{0}-{1}-{2}".format(index_str, vc_type, el_type),
service_name="vc-{0}".format(full_name),
vc_type=vc_type,
image=participant.vc_image,
participant_log_level=participant.vc_log_level,
Expand Down