Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ethereum-package
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
ethereum-package
Commits
049b7bb8
Commit
049b7bb8
authored
Nov 04, 2022
by
Gyanendra Mishra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaner
parent
fba3f128
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
main.star
main.star
+21
-9
No files found.
main.star
View file @
049b7bb8
...
...
@@ -16,12 +16,19 @@ def main(input_args):
return output
default_el_images = {
"geth": "ethereum/client-go:latest",
"erigon": "thorax/erigon:devel",
"nethermind": "nethermind/nethermind:latest",
"besu": "hyperledger/besu:develop"
}
# TODO check enum values are valid or make sure protobfu does
def replace_with_defaults(input_args):
default_input = default_module_input()
result = {}
for attr in dir(input_args):
value = getattr(input_args, attr)
print(attr, value, type(value))
if type(value) == "int" and value == 0:
result[attr] = default_input[attr]
elif type(value) == "string" and value == "":
...
...
@@ -41,22 +48,22 @@ def replace_with_defaults(input_args):
result[attr] = value.name
# no participants are assigned at all
elif attr == "participants" and len(value) == 0:
result["participant"] = default_input["participants"]
result["participant
s
"] = default_input["participants"]
elif attr == "participants":
participants = []
for participant in participants:
participant = {}
for participant in
input_args.
participants:
participant
_value
= {}
for attr_ in dir(participant):
value_ = getattr(
input_args.network_params
, attr_)
value_ = getattr(
participant
, attr_)
if type(attr_) == "int" and value_ == 0:
participant[attr_] = getattr(default_input[participants][0], attr_, 0)
participant
_value
[attr_] = getattr(default_input[participants][0], attr_, 0)
elif type(attr_) == "str" and value_ == "":
participant[attr_] = getattr(default_input[participants][0], attr_, "")
participant
_value
[attr_] = getattr(default_input[participants][0], attr_, "")
elif type(value_) in ("int", "string", "bool"):
result["participants"][attr_] = value_
elif type(value_) in "proto.EnumValueDescriptor":
result
[attr_] = value.name
participants.append(participant)
participant_value
[attr_] = value.name
participants.append(participant
_value
)
result["participants"] = participants
# if there are some string, int values we assign it
elif type(value) in ("int", "string", "bool"):
...
...
@@ -64,6 +71,11 @@ def replace_with_defaults(input_args):
elif type(value) in "proto.EnumValueDescriptor":
result[attr] = value.name
for index, participant in enumerate(result["participants"]):
# this is really ugly we need some primitive to throw an error
if index == 0 and participant["el_client_type"] in ("besu", "nethermind"):
fail("besu/nethermind cant be the first participant")
encoded_json = json.encode(result)
print(json.indent(encoded_json))
return result
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment