Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
fix: deep copy participant before adding it into the participants list (
Browse files Browse the repository at this point in the history
#133)

participants list had elements that were sharing mutable lists, now, it
creates a new object for each new participant on the list with this
change.

It's related to this issue:
bazelbuild/starlark#192 (comment)

it's should fix:
ethpandaops/ethereum-package#227
  • Loading branch information
leoporoli committed Sep 26, 2023
1 parent 0e94653 commit 8380599
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def parse_input(input_args):
# if the value is set in input we set it in participant
new_participant[sub_attr] = sub_value
for _ in range(0, new_participant["count"]):
participant_copy = deep_copy_participant(new_participant)
participants.append(new_participant)
result["participants"] = participants

Expand Down Expand Up @@ -177,6 +178,15 @@ def parse_input(input_args):

return result

def deep_copy_participant(participant):
part = {}
for k, v in participant.items():
if type(v) == type([]):
part[k] = list(v)
else:
part[k] = v
return part

def get_client_log_level_or_default(participant_log_level, global_log_level, client_log_levels):
log_level = participant_log_level
if log_level == "":
Expand Down

0 comments on commit 8380599

Please sign in to comment.