Skip to content

Commit

Permalink
refactor!: merge eth-network-package onto eth2-package (#228)
Browse files Browse the repository at this point in the history
Notes for reviewer - perhaps @leoporoli ?

1. src/el & src/cl & src/node_metrics_info & src/participant.star &
src/participant_network.star & src/prelaunch_data_generator/ &
src/snooper & static_files have just been lifted and shifted
2. constants is just a union of the two
3. ⚠️ parse input is a best effort union of the two; needs some 👀 
4. shared_utils.star is a best effort union of the two
5. package_io, shared_utils etc used to be at root level they have been
shifted
6. eth-network-package has been changed to eth2-package throughout all
`.star` files

Pending after PR - perhaps @leeederek ?
1. Get the README's to make sense together
2. Get the run.gif over here?

⚠️  Note to testers

1. Clone the package
2. Check out this PR
3. Run `kurtosis run .` with args of choice
  • Loading branch information
h4ck3rk3y authored Sep 27, 2023
1 parent b943370 commit b72dad3
Show file tree
Hide file tree
Showing 46 changed files with 5,671 additions and 129 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ executors:

parameters:
# To enable/disabled the check_latest_version workflow execution which will be triggered by this scheduled pipeline: https://app.circleci.com/settings/project/github/kurtosis-tech/eth2-package/triggers
# TODO revert this - setting this to true to get all existing tests to run on CI during merge
should-enable-check-latest-version-workflow:
type: boolean
default: false
default: true
# To enable/disabled the check_code workflow execution which will be triggered by the PR's checkers
should-enable-build-workflow:
type: boolean
Expand Down
29 changes: 21 additions & 8 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ parse_input = import_module(
"github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star"
)

participant_network = import_module(
"github.com/kurtosis-tech/eth2-package/src/participant_network.star"
)

static_files = import_module(
"github.com/kurtosis-tech/eth2-package/src/static_files/static_files.star"
)
genesis_constants = import_module(
"github.com/kurtosis-tech/eth-network-package/src/prelaunch_data_generator/genesis_constants/genesis_constants.star"
"github.com/kurtosis-tech/eth2-package/src/prelaunch_data_generator/genesis_constants/genesis_constants.star"
)

eth_network_module = import_module(
"github.com/kurtosis-tech/eth-network-package/main.star"
)
transaction_spammer = import_module(
"github.com/kurtosis-tech/eth2-package/src/transaction_spammer/transaction_spammer.star"
)
Expand Down Expand Up @@ -66,13 +67,12 @@ PATH_TO_PARSED_BEACON_STATE = "/genesis/output/parsedBeaconState.json"


def run(plan, args={}):
args_with_right_defaults, args_with_defaults_dict = parse_input.parse_input(
plan, args
)
args_with_right_defaults = parse_input.parse_input(plan, args)

num_participants = len(args_with_right_defaults.participants)
network_params = args_with_right_defaults.network_params
mev_params = args_with_right_defaults.mev_params
parallel_keystore_generation = args_with_right_defaults.parallel_keystore_generation

grafana_datasource_config_template = read_file(
static_files.GRAFANA_DATASOURCE_CONFIG_TEMPLATE_FILEPATH
Expand All @@ -95,7 +95,20 @@ def run(plan, args={}):
all_participants,
cl_genesis_timestamp,
genesis_validators_root,
) = eth_network_module.run(plan, args_with_defaults_dict)
) = participant_network.launch_participant_network(
plan,
args_with_right_defaults.participants,
network_params,
args_with_right_defaults.global_client_log_level,
parallel_keystore_generation,
)

plan.print(
"NODE JSON RPC URI: '{0}:{1}'".format(
all_participants[0].el_client_context.ip_addr,
all_participants[0].el_client_context.rpc_port_num,
)
)

all_el_client_contexts = []
all_cl_client_contexts = []
Expand Down
26 changes: 26 additions & 0 deletions src/cl/cl_client_context.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def new_cl_client_context(
client_name,
enr,
ip_addr,
http_port_num,
cl_nodes_metrics_info,
beacon_service_name,
validator_service_name="",
multiaddr="",
peer_id="",
snooper_enabled=False,
snooper_engine_context=None,
):
return struct(
client_name=client_name,
enr=enr,
ip_addr=ip_addr,
http_port_num=http_port_num,
cl_nodes_metrics_info=cl_nodes_metrics_info,
beacon_service_name=beacon_service_name,
validator_service_name=validator_service_name,
multiaddr=multiaddr,
peer_id=peer_id,
snooper_enabled=snooper_enabled,
snooper_engine_context=snooper_engine_context,
)
12 changes: 12 additions & 0 deletions src/cl/cl_node_ready_conditions.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def get_ready_conditions(port_id):
recipe = GetHttpRequestRecipe(endpoint="/eth/v1/node/health", port_id=port_id)

ready_conditions = ReadyCondition(
recipe=recipe,
field="code",
assertion="IN",
target_value=[200, 206],
timeout="15m",
)

return ready_conditions
Loading

0 comments on commit b72dad3

Please sign in to comment.