Skip to content

Commit

Permalink
fix: roll out persistence for postgres on ethereum-package (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rk3y committed Dec 20, 2023
1 parent f957f85 commit ed3982b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools-mev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ snooper_enabled: true
mev_type: full
mev_params:
mev_relay_image: flashbots/mev-boost-relay:0.27
persistent: True
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ disable_peer_scoring: false
# A list of locators for grafana dashboards to be loaded be the grafana service
grafana_additional_dashboards: []

# Whether the environment should be persistent; this is WIP and is slowly being rolled out accross services
# Note this requires Kurtosis greater than 0.85.49 to work
# Defaults to False
persistent: False

# Supports three valeus
# Default: "null" - no mev boost, mev builder, mev flood or relays are spun up
# "mock" - mock-builder & mev-boost are spun up
Expand Down
4 changes: 4 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def run(plan, args={}):
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
persistent = args_with_right_defaults.persistent

grafana_datasource_config_template = read_file(
static_files.GRAFANA_DATASOURCE_CONFIG_TEMPLATE_FILEPATH
Expand Down Expand Up @@ -222,6 +223,7 @@ def run(plan, args={}):
genesis_validators_root,
builder_uri,
network_params.seconds_per_slot,
persistent,
)
mev_flood.spam_in_background(
plan,
Expand Down Expand Up @@ -345,6 +347,7 @@ def run(plan, args={}):
all_cl_client_contexts,
all_el_client_contexts,
network_params.network_id,
persistent,
)
plan.print("Successfully launched blobscan")
elif additional_service == "full_beaconchain_explorer":
Expand All @@ -357,6 +360,7 @@ def run(plan, args={}):
full_beaconchain_explorer_config_template,
all_cl_client_contexts,
all_el_client_contexts,
persistent,
)
plan.print("Successfully launched full-beaconchain-explorer")
elif additional_service == "prometheus_grafana":
Expand Down
1 change: 1 addition & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ mev_params:
mev_flood_extra_args: []
mev_flood_seconds_per_bundle: 15
grafana_additional_dashboards: []
persistent: False
3 changes: 2 additions & 1 deletion src/blobscan/blobscan_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def launch_blobscan(
cl_client_contexts,
el_client_contexts,
chain_id,
persistent,
):
beacon_node_rpc_uri = "http://{0}:{1}".format(
cl_client_contexts[0].ip_addr, cl_client_contexts[0].http_port_num
Expand All @@ -73,7 +74,7 @@ def launch_blobscan(
max_cpu=POSTGRES_MAX_CPU,
min_memory=POSTGRES_MIN_MEMORY,
max_memory=POSTGRES_MAX_MEMORY,
persistent=False,
persistent=persistent,
)
api_config = get_api_config(postgres_output.url, beacon_node_rpc_uri, chain_id)
blobscan_config = plan.add_service(API_SERVICE_NAME, api_config)
Expand Down
3 changes: 2 additions & 1 deletion src/full_beaconchain/full_beaconchain_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def launch_full_beacon(
config_template,
cl_client_contexts,
el_client_contexts,
persistent,
):
postgres_output = postgres.run(
plan,
Expand All @@ -108,7 +109,7 @@ def launch_full_beacon(
max_cpu=POSTGRES_MAX_CPU,
min_memory=POSTGRES_MIN_MEMORY,
max_memory=POSTGRES_MAX_MEMORY,
persistent=False,
persistent=persistent,
)
redis_output = redis.run(
plan,
Expand Down
4 changes: 2 additions & 2 deletions src/mev/mev_relay/mev_relay_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ NETWORK_ID_TO_NAME = {
"3": "ropsten",
}

DONT_PERSIST_TO_DISK = False
LAUNCH_ADMINER = True

# The min/max CPU/memory that mev-relay can use
Expand Down Expand Up @@ -48,6 +47,7 @@ def launch_mev_relay(
validator_root,
builder_uri,
seconds_per_slot,
persistent,
):
redis = redis_module.run(
plan,
Expand All @@ -64,7 +64,7 @@ def launch_mev_relay(
user="postgres",
database="postgres",
service_name="mev-relay-postgres",
persistent=DONT_PERSIST_TO_DISK,
persistent=persistent,
launch_adminer=LAUNCH_ADMINER,
min_cpu=POSTGRES_MIN_CPU,
max_cpu=POSTGRES_MAX_CPU,
Expand Down
2 changes: 2 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def input_parser(plan, input_args):
result["tx_spammer_params"] = get_default_tx_spammer_params()
result["custom_flood_params"] = get_default_custom_flood_params()
result["disable_peer_scoring"] = False
result["persistent"] = False

for attr in input_args:
value = input_args[attr]
Expand Down Expand Up @@ -216,6 +217,7 @@ def input_parser(plan, input_args):
parallel_keystore_generation=result["parallel_keystore_generation"],
grafana_additional_dashboards=result["grafana_additional_dashboards"],
disable_peer_scoring=result["disable_peer_scoring"],
persistent=result["persistent"],
)


Expand Down

0 comments on commit ed3982b

Please sign in to comment.