Skip to content

Commit

Permalink
Merge pull request #1 from QYuQianchen/q/metaclear-mev-relay
Browse files Browse the repository at this point in the history
Merge current changes
  • Loading branch information
QYuQianchen authored Jul 8, 2024
2 parents 2d1cab5 + 0e37633 commit 384652b
Show file tree
Hide file tree
Showing 9 changed files with 1,219 additions and 24 deletions.
17 changes: 16 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ assertoor = import_module("./src/assertoor/assertoor_launcher.star")
get_prefunded_accounts = import_module(
"./src/prefunded_accounts/get_prefunded_accounts.star"
)
syn_flood = import_module(
"./src/syn_flood.star"
)

GRAFANA_USER = "admin"
GRAFANA_PASSWORD = "admin"
Expand Down Expand Up @@ -275,7 +278,7 @@ def run(plan, args={}):
service_name=first_client_beacon_name,
)
if args_with_right_defaults.mev_type == constants.FLASHBOTS_MEV_TYPE:
endpoint = flashbots_mev_relay.launch_mev_relay(
endpoint, mev_relay_api_prometheus_job, mev_relay_postgres_private_url = flashbots_mev_relay.launch_mev_relay(
plan,
mev_params,
network_id,
Expand All @@ -286,6 +289,10 @@ def run(plan, args={}):
persistent,
global_node_selectors,
)
# add prometheus metrics to the list
prometheus_additional_metrics_jobs.append(
mev_relay_api_prometheus_job
)
elif args_with_right_defaults.mev_type == constants.MEV_RS_MEV_TYPE:
endpoint, relay_ip_address, relay_port = mev_rs_mev_relay.launch_mev_relay(
plan,
Expand Down Expand Up @@ -625,6 +632,13 @@ def run(plan, args={}):
args_with_right_defaults.custom_flood_params,
global_node_selectors,
)
elif additional_service == "syn_flood":
plan.print("Launching syn flood tool")
syn_flood.add_syn_flood(
plan,
global_node_selectors,
)
plan.print("Successfully launched syn flood tool")
else:
fail("Invalid additional service %s" % (additional_service))
if launch_prometheus_grafana:
Expand All @@ -646,6 +660,7 @@ def run(plan, args={}):
grafana_datasource_config_template,
grafana_dashboards_config_template,
prometheus_private_url,
mev_relay_postgres_private_url,
global_node_selectors,
additional_dashboards=args_with_right_defaults.grafana_additional_dashboards,
)
Expand Down
41 changes: 24 additions & 17 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,38 @@ participants:
el_max_mem: 0
# CL
cl_type: lighthouse
cl_image: sigp/lighthouse:latest-unstable
cl_log_level: ""
cl_image: hoprnet/metaclear-lighthouse:c9805b43f
cl_log_level: "debug"
cl_extra_env_vars: {}
cl_extra_labels: {}
cl_extra_params: []
cl_extra_params: [] #"--validator-monitor-auto"
cl_tolerations: []
cl_volume_size: 0
cl_min_cpu: 0
cl_max_cpu: 0
cl_min_mem: 0
cl_max_mem: 0
cl_max_mem: 0 #300
use_separate_vc: true
# Validator
vc_type: lighthouse
vc_image: sigp/lighthouse:latest-unstable
vc_log_level: ""
vc_count: 1
vc_image: hoprnet/metaclear-lighthouse:c9805b43f
vc_log_level: "debug"
vc_extra_env_vars: {}
vc_extra_labels: {}
vc_extra_params: []
vc_tolerations: []
vc_min_cpu: 0
vc_max_cpu: 0
vc_max_cpu: 0 #200
vc_min_mem: 0
vc_max_mem: 0
vc_max_mem: 0 #384
validator_count: null
# participant specific
node_selectors: {}
tolerations: []
count: 2
snooper_enabled: false
ethereum_metrics_exporter_enabled: false
xatu_sentry_enabled: false
snooper_enabled: true
ethereum_metrics_exporter_enabled: true
xatu_sentry_enabled: true
prometheus_config:
scrape_interval: 15s
labels: {}
Expand Down Expand Up @@ -84,7 +83,15 @@ network_params:
additional_preloaded_contracts: {}
devnet_repo: ethpandaops
checkpoint_sync_enabled: false
additional_services: []
additional_services:
- tx_spammer
- blob_spammer
- custom_flood
- el_forkmon
- beacon_metrics_gazer
- dora
- prometheus_grafana
- syn_flood
dora_params:
image: ""
tx_spammer_params:
Expand All @@ -108,11 +115,11 @@ parallel_keystore_generation: false
disable_peer_scoring: false
grafana_additional_dashboards: []
persistent: false
mev_type: null
mev_type: flashbots
mev_params:
mev_relay_image: flashbots/mev-boost-relay
mev_relay_image: hoprnet/metaclear-mev-relayer:1edd2e6
mev_builder_image: ethpandaops/flashbots-builder:main
mev_builder_cl_image: sigp/lighthouse:latest
mev_builder_cl_image: hoprnet/metaclear-lighthouse:c9805b43f
mev_boost_image: flashbots/mev-boost
mev_boost_args: ["mev-boost", "--relay-check"]
mev_relay_api_extra_args: []
Expand All @@ -129,7 +136,7 @@ mev_params:
interval_between_transactions: 1
xatu_sentry_enabled: false
xatu_sentry_params:
xatu_sentry_image: ethpandaops/xatu-sentry
xatu_sentry_image: ethpandaops/xatu:latest
xatu_server_addr: localhost:8000
xatu_server_tls: false
xatu_server_headers: {}
Expand Down
15 changes: 12 additions & 3 deletions src/grafana/grafana_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def launch_grafana(
datasource_config_template,
dashboard_providers_config_template,
prometheus_private_url,
mev_relay_postgres_private_url,
global_node_selectors,
additional_dashboards=[],
):
Expand All @@ -62,6 +63,7 @@ def launch_grafana(
datasource_config_template,
dashboard_providers_config_template,
prometheus_private_url,
mev_relay_postgres_private_url,
additional_dashboards=additional_dashboards,
)

Expand All @@ -85,9 +87,10 @@ def get_grafana_config_dir_artifact_uuid(
datasource_config_template,
dashboard_providers_config_template,
prometheus_private_url,
mev_relay_postgres_private_url,
additional_dashboards=[],
):
datasource_data = new_datasource_config_template_data(prometheus_private_url)
datasource_data = new_datasource_config_template_data(prometheus_private_url, mev_relay_postgres_private_url)
datasource_template_and_data = shared_utils.new_template_and_data(
datasource_config_template, datasource_data
)
Expand Down Expand Up @@ -153,8 +156,14 @@ def get_config(
)


def new_datasource_config_template_data(prometheus_url):
return {"PrometheusURL": prometheus_url}
def new_datasource_config_template_data(prometheus_url, postgres_url):
return {
"PrometheusURL": prometheus_url,
"PostgresURL": postgres_url,
"PostgresDatabase": "postgres",
"PostgresUser": "postgres",
"PostgresPassword": "postgres"
}


def new_dashboard_providers_config_template_data(dashboards_dirpath):
Expand Down
3 changes: 2 additions & 1 deletion src/mev/flashbots/mev_boost/mev_boost_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def get_config(
"BOOST_LISTEN_ADDR": "0.0.0.0:{0}".format(input_parser.MEV_BOOST_PORT),
# maybe this is breaking; this isn't verifyign the bid and not sending it to the validator
"SKIP_RELAY_SIGNATURE_CHECK": "1",
"RELAYS": mev_boost_launcher.relay_end_points[0],
# "RELAYS": mev_boost_launcher.relay_end_points[0],
"RELAYS": ",".join(mev_boost_launcher.relay_end_points),
},
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
Expand Down
18 changes: 16 additions & 2 deletions src/mev/flashbots/mev_relay/mev_relay_launcher.star
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
redis_module = import_module("github.com/kurtosis-tech/redis-package/main.star")
postgres_module = import_module("github.com/kurtosis-tech/postgres-package/main.star")
prometheus = import_module("../../../prometheus/prometheus_launcher.star")
constants = import_module("../../../package_io/constants.star")

MEV_RELAY_WEBSITE = "mev-relay-website"
Expand All @@ -8,6 +9,7 @@ MEV_RELAY_HOUSEKEEPER = "mev-relay-housekeeper"

MEV_RELAY_ENDPOINT_PORT = 9062
MEV_RELAY_WEBSITE_PORT = 9060
MEV_RELAY_POSTGRES_PORT = 5432

NETWORK_ID_TO_NAME = {
"1": "mainnet",
Expand Down Expand Up @@ -90,7 +92,7 @@ def launch_mev_relay(

redis_url = "{}:{}".format(redis.hostname, redis.port_number)
postgres_url = postgres.url + "?sslmode=disable"
plan.add_service(
housekeeper = plan.add_service(
name=MEV_RELAY_HOUSEKEEPER,
config=ServiceConfig(
image=image,
Expand Down Expand Up @@ -151,6 +153,13 @@ def launch_mev_relay(
),
)

api_prometheus = prometheus.new_metrics_job(
job_name=MEV_RELAY_ENDPOINT,
endpoint="{0}:{1}".format(api.ip_address, MEV_RELAY_ENDPOINT_PORT),
metrics_path="/metrics",
labels={"service": MEV_RELAY_ENDPOINT},
)

plan.add_service(
name=MEV_RELAY_WEBSITE,
config=ServiceConfig(
Expand Down Expand Up @@ -186,6 +195,11 @@ def launch_mev_relay(
),
)

return "http://{0}@{1}:{2}".format(
mev_relay_endpoint="http://{0}@{1}:{2}".format(
constants.DEFAULT_MEV_PUBKEY, api.ip_address, MEV_RELAY_ENDPOINT_PORT
)

postgres_endpoint="{0}:{1}".format(
postgres.service.ip_address, MEV_RELAY_POSTGRES_PORT
)
return (mev_relay_endpoint, api_prometheus, postgres_endpoint)
1 change: 1 addition & 0 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ MEV_RS_MEV_TYPE = "mev-rs"

DEFAULT_SNOOPER_IMAGE = "ethpandaops/rpc-snooper:latest"
DEFAULT_FLASHBOTS_RELAY_IMAGE = "flashbots/mev-boost-relay:0.27"
MODIFIED_FLASHBOTS_RELAY_IMAGE = "hoprnet/modified-mev-relayer"
DEFAULT_FLASHBOTS_BUILDER_IMAGE = "flashbots/builder:latest"
DEFAULT_FLASHBOTS_MEV_BOOST_IMAGE = "flashbots/mev-boost"
DEFAULT_MEV_RS_IMAGE = "ethpandaops/mev-rs:main"
Expand Down
80 changes: 80 additions & 0 deletions src/syn_flood.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
SERVICE_NAME = "syn-flood"

# The min/max CPU/memory that syn_flood can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 1000

ENTRYPOINT_ARGS = [
"sleep",
"99999",
]


# def launch_syn_flood(
# plan,
# vitcim_ip,
# syn_flood_extra_args,
# node_selectors,
# ):
# config = get_config(
# vitcim_ip,
# syn_flood_extra_args,
# node_selectors,
# )

# plan.add_service(SERVICE_NAME, config)

# def get_config(
# vitcim_ip,
# syn_flood_extra_args,
# node_selectors,
# ):
# syn_flood_image = "utkudarilmaz/hping3:latest"

# cmd = [
# "hping3",
# vitcim_ip,
# ]

# if len(syn_flood_extra_args) > 0:
# cmd.extend([param for param in syn_flood_extra_args])

# return ServiceConfig(
# image=syn_flood_image,
# cmd=cmd,
# min_cpu=MIN_CPU,
# max_cpu=MAX_CPU,
# min_memory=MIN_MEMORY,
# max_memory=MAX_MEMORY,
# node_selectors=node_selectors,
# )

def add_syn_flood(
plan,
node_selectors,
):
syn_flood_image = "mik9/hping3:arm64"

plan.add_service(
SERVICE_NAME,
ServiceConfig(
image=syn_flood_image,
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
entrypoint=ENTRYPOINT_ARGS,
),
)

# run the command
command_result = plan.exec(
service_name=SERVICE_NAME,
description="Show hping3 version",
recipe=ExecRecipe(command=["hping3", "--version"]),
)

return command_result
Loading

0 comments on commit 384652b

Please sign in to comment.