Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c022339
feat: add rbuilder remove old geth builder - flashbots
barnabasbusa Oct 2, 2024
82644ad
update rbuilder
barnabasbusa Oct 3, 2024
386bedc
update rbuilder
barnabasbusa Oct 3, 2024
77fae4c
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Oct 10, 2024
149064b
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Oct 15, 2024
44d70cf
fix some cl names
barnabasbusa Oct 16, 2024
9a7120b
bump relay version
barnabasbusa Oct 16, 2024
4518ca0
drop 0x prefix, and add array for cl endpoints
barnabasbusa Oct 16, 2024
b58c7da
fix lint
barnabasbusa Oct 16, 2024
7795f7e
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Oct 17, 2024
3447181
fix lint
barnabasbusa Oct 17, 2024
5514b17
fix: add extra cmd for reth if its builder
barnabasbusa Oct 22, 2024
ce20c04
add flashbots
barnabasbusa Oct 25, 2024
3878edf
add flashbots
barnabasbusa Oct 25, 2024
854c7fb
add flashbots if builder is flashbots
barnabasbusa Oct 25, 2024
40ab3ad
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Oct 28, 2024
6a77972
update rbuilder image
barnabasbusa Oct 28, 2024
73b996d
fix final-genesis-timestamp, and add it to mev-boost
barnabasbusa Oct 28, 2024
ca4a3ef
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Oct 29, 2024
67bc1cb
add electra fork to mev relay
barnabasbusa Oct 30, 2024
b3742e0
Merge branch 'bbusa/rbuilder' of github.com:ethpandaops/ethereum-pack…
barnabasbusa Oct 30, 2024
1a824f1
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Oct 31, 2024
37072de
Merge branch 'main' into bbusa/rbuilder
barnabasbusa Nov 1, 2024
96a4459
update tests
barnabasbusa Nov 1, 2024
6dd4a2d
Merge branch 'bbusa/rbuilder' of github.com:ethpandaops/ethereum-pack…
barnabasbusa Nov 1, 2024
66335e1
update tests
barnabasbusa Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/tests/mev-pectra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
participants:
- el_type: reth
cl_type: teku
additional_services:
- dora
- tx_spammer
mev_type: flashbots

mev_params:
mev_relay_image: jtraglia/mev-boost-relay:electra
mev_boost_image: jtraglia/mev-boost:electra
mev_builder_image: ethpandaops/rbuilder:develop-1b578f5
mev_builder_cl_image: ethpandaops/lighthouse:pawan-electra-alpha7-0dd215c

network_params:
electra_fork_epoch: 1
6 changes: 2 additions & 4 deletions .github/tests/mev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ additional_services:
- tx_spammer
- blob_spammer
- custom_flood
- el_forkmon
- goomy_blob
- beacon_metrics_gazer
- dora
- prometheus_grafana
mev_params:
mev_relay_image: flashbots/mev-boost-relay:latest
network_params:
seconds_per_slot: 3
seconds_per_slot: 6
25 changes: 21 additions & 4 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ mev_rs_mev_relay = import_module("./src/mev/mev-rs/mev_relay/mev_relay_launcher.
mev_rs_mev_builder = import_module(
"./src/mev/mev-rs/mev_builder/mev_builder_launcher.star"
)
flashbots_mev_rbuilder = import_module(
"./src/mev/flashbots/mev_builder/mev_builder_launcher.star"
)

flashbots_mev_boost = import_module(
"./src/mev/flashbots/mev_boost/mev_boost_launcher.star"
)
Expand Down Expand Up @@ -119,7 +123,7 @@ def run(plan, args={}):

if args_with_right_defaults.mev_type == constants.MEV_RS_MEV_TYPE:
plan.print("Generating mev-rs builder config file")
mev_rs__builder_config_file = mev_rs_mev_builder.new_builder_config(
mev_rs_builder_config_file = mev_rs_mev_builder.new_builder_config(
plan,
constants.MEV_RS_MEV_TYPE,
network_params.network,
Expand All @@ -128,6 +132,18 @@ def run(plan, args={}):
args_with_right_defaults.mev_params.mev_builder_extra_data,
global_node_selectors,
)
elif args_with_right_defaults.mev_type == constants.FLASHBOTS_MEV_TYPE:
plan.print("Generating flashbots builder config file")
flashbots_builder_config_file = flashbots_mev_rbuilder.new_builder_config(
plan,
constants.FLASHBOTS_MEV_TYPE,
network_params,
constants.VALIDATING_REWARDS_ACCOUNT,
network_params.preregistered_validator_keys_mnemonic,
args_with_right_defaults.mev_params.mev_builder_extra_data,
enumerate(args_with_right_defaults.participants),
global_node_selectors,
)

plan.print(
"Launching participant network with {0} participants and the following network params {1}".format(
Expand Down Expand Up @@ -156,6 +172,7 @@ def run(plan, args={}):
args_with_right_defaults.checkpoint_sync_enabled,
args_with_right_defaults.checkpoint_sync_url,
args_with_right_defaults.port_publisher,
args_with_right_defaults.mev_type,
)

plan.print(
Expand Down Expand Up @@ -248,7 +265,7 @@ def run(plan, args={}):
or args_with_right_defaults.mev_type == constants.MEV_RS_MEV_TYPE
or args_with_right_defaults.mev_type == constants.COMMIT_BOOST_MEV_TYPE
):
builder_uri = "http://{0}:{1}".format(
blocksim_uri = "http://{0}:{1}".format(
all_el_contexts[-1].ip_addr, all_el_contexts[-1].rpc_port_num
)
beacon_uri = all_cl_contexts[-1].beacon_http_url
Expand Down Expand Up @@ -290,7 +307,7 @@ def run(plan, args={}):
network_id,
beacon_uris,
genesis_validators_root,
builder_uri,
blocksim_uri,
network_params.seconds_per_slot,
persistent,
global_node_selectors,
Expand Down Expand Up @@ -349,7 +366,7 @@ def run(plan, args={}):
plan,
mev_boost_launcher,
mev_boost_service_name,
network_id,
final_genesis_timestamp,
mev_params.mev_boost_image,
mev_params.mev_boost_args,
global_node_selectors,
Expand Down
3 changes: 2 additions & 1 deletion src/el/el_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def launch(
network_id,
num_participants,
port_publisher,
mev_builder_type,
):
el_launchers = {
constants.EL_TYPE.geth: {
Expand Down Expand Up @@ -75,7 +76,7 @@ def launch(
el_cl_data,
jwt_file,
network_params.network,
builder=True,
builder_type=mev_builder_type,
),
"launch_method": reth.launch,
},
Expand Down
63 changes: 50 additions & 13 deletions src/el/reth/reth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ el_shared = import_module("../el_shared.star")
node_metrics = import_module("../../node_metrics_info.star")
constants = import_module("../../package_io/constants.star")
mev_rs_builder = import_module("../../mev/mev-rs/mev_builder/mev_builder_launcher.star")
lighthouse = import_module("../../cl/lighthouse/lighthouse_launcher.star")
flashbots_rbuilder = import_module(
"../../mev/flashbots/mev_builder/mev_builder_launcher.star"
)

RPC_PORT_NUM = 8545
WS_PORT_NUM = 8546
DISCOVERY_PORT_NUM = 30303
ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001

RBUILDER_PORT_NUM = 8645
# Paths
METRICS_PATH = "/metrics"

# The dirpath of the execution data directory on the client container
EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/reth/execution-data"

ENTRYPOINT_ARGS = ["sh", "-c"]

VERBOSITY_LEVELS = {
constants.GLOBAL_LOG_LEVEL.error: "v",
Expand Down Expand Up @@ -132,10 +135,16 @@ def get_config(
constants.WS_PORT_ID: WS_PORT_NUM,
constants.METRICS_PORT_ID: METRICS_PORT_NUM,
}

if launcher.builder_type == "flashbots":
used_port_assignments[constants.RBUILDER_PORT_ID] = RBUILDER_PORT_NUM

used_ports = shared_utils.get_port_specs(used_port_assignments)

cmd = [
"/usr/local/bin/mev build" if launcher.builder else "reth",
"{0}".format(
"/usr/local/bin/mev" if launcher.builder_type == "mev-rs" else "reth"
),
"node",
"-{0}".format(log_level),
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
Expand All @@ -150,7 +159,9 @@ def get_config(
"--http.corsdomain=*",
# WARNING: The admin info endpoint is enabled so that we can easily get ENR/enode, which means
# that users should NOT store private information in these Kurtosis nodes!
"--http.api=admin,net,eth,web3,debug,trace",
"--http.api=admin,net,eth,web3,debug,trace{0}".format(
",flashbots" if launcher.builder_type == "flashbots" else ""
),
"--ws",
"--ws.addr=0.0.0.0",
"--ws.port={0}".format(WS_PORT_NUM),
Expand Down Expand Up @@ -191,8 +202,6 @@ def get_config(
# this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in participant.el_extra_params])

cmd_str = " ".join(cmd)

files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
Expand All @@ -207,20 +216,48 @@ def get_config(
constants.EL_TYPE.reth + "_volume_size"
],
)

if launcher.builder:
cmd_str = " ".join(cmd)
env_vars = {
"RETH_CMD": cmd_str,
}
entrypoint_args = ["sh", "-c"]
env_vars = env_vars | participant.el_extra_env_vars
image = participant.el_image
rbuilder_cmd = []
if launcher.builder_type == "mev-rs":
files[
mev_rs_builder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE
] = mev_rs_builder.MEV_BUILDER_FILES_ARTIFACT_NAME
elif launcher.builder_type == "flashbots":
cl_client_name = service_name.split("-")[4]
cmd.append("--engine.legacy")
cmd_str = " ".join(cmd)
files[
flashbots_rbuilder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE
] = flashbots_rbuilder.MEV_BUILDER_FILES_ARTIFACT_NAME
env_vars["RETH_CMD"] = cmd_str
env_vars.update(
{
"RBUILDER_CONFIG": flashbots_rbuilder.MEV_FILE_PATH_ON_CONTAINER,
"CL_ENDPOINT": "http://cl-{0}-{1}-{2}:{3}".format(
participant_index + 1,
cl_client_name,
constants.EL_TYPE.reth_builder,
lighthouse.BEACON_HTTP_PORT_NUM,
),
}
)
image = constants.DEFAULT_FLASHBOTS_BUILDER_IMAGE
cmd_str = "./app/entrypoint.sh"
entrypoint_args = []

env_vars = participant.el_extra_env_vars
config_args = {
"image": participant.el_image,
"image": image,
"ports": used_ports,
"public_ports": public_ports,
"cmd": [cmd_str],
"files": files,
"entrypoint": ENTRYPOINT_ARGS,
"entrypoint": entrypoint_args,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
Expand All @@ -246,10 +283,10 @@ def get_config(
return ServiceConfig(**config_args)


def new_reth_launcher(el_cl_genesis_data, jwt_file, network, builder=False):
def new_reth_launcher(el_cl_genesis_data, jwt_file, network, builder_type=False):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
builder=builder,
builder_type=builder_type,
)
15 changes: 6 additions & 9 deletions src/mev/flashbots/mev_boost/mev_boost_launcher.star
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
shared_utils = import_module("../../../shared_utils/shared_utils.star")
mev_boost_context_module = import_module("../mev_boost/mev_boost_context.star")
input_parser = import_module("../../../package_io/input_parser.star")
constants = import_module("../../../package_io/constants.star")

FLASHBOTS_MEV_BOOST_PROTOCOL = "TCP"

Expand All @@ -27,14 +28,14 @@ def launch(
plan,
mev_boost_launcher,
service_name,
network_id,
genesis_timestamp,
mev_boost_image,
mev_boost_args,
global_node_selectors,
):
config = get_config(
mev_boost_launcher,
network_id,
genesis_timestamp,
mev_boost_image,
mev_boost_args,
global_node_selectors,
Expand All @@ -49,7 +50,7 @@ def launch(

def get_config(
mev_boost_launcher,
network_id,
genesis_timestamp,
mev_boost_image,
mev_boost_args,
node_selectors,
Expand All @@ -61,13 +62,9 @@ def get_config(
ports=USED_PORTS,
cmd=command,
env_vars={
# TODO(maybe) remove the hardcoding
# This is set to match this file https://github.com/ethpandaops/ethereum-package/blob/main/static_files/genesis-generation-config/cl/config.yaml.tmpl#L11
# latest-notes
# does this need genesis time to be set as well
"GENESIS_FORK_VERSION": "0x10000038",
"GENESIS_FORK_VERSION": constants.GENESIS_FORK_VERSION,
"GENESIS_TIMESTAMP": "{0}".format(genesis_timestamp),
"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],
},
Expand Down
91 changes: 91 additions & 0 deletions src/mev/flashbots/mev_builder/mev_builder_launcher.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
shared_utils = import_module("../../../shared_utils/shared_utils.star")
input_parser = import_module("../../../package_io/input_parser.star")
static_files = import_module("../../../static_files/static_files.star")
constants = import_module("../../../package_io/constants.star")
flashbots_relay = import_module("../mev_relay/mev_relay_launcher.star")
lighthouse = import_module("../../../cl/lighthouse/lighthouse_launcher.star")
# MEV Builder flags

MEV_BUILDER_CONFIG_FILENAME = "config.toml"
MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE = "/config/"
MEV_BUILDER_FILES_ARTIFACT_NAME = "mev-rbuilder-config"
MEV_FILE_PATH_ON_CONTAINER = (
MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE + MEV_BUILDER_CONFIG_FILENAME
)


def new_builder_config(
plan,
service_name,
network_params,
fee_recipient,
mnemonic,
extra_data,
participants,
global_node_selectors,
):
num_of_participants = shared_utils.zfill_custom(
len(participants), len(str(len(participants)))
)
builder_template_data = new_builder_config_template_data(
network_params,
constants.DEFAULT_MEV_PUBKEY,
constants.DEFAULT_MEV_SECRET_KEY[2:], # drop the 0x prefix
mnemonic,
fee_recipient,
extra_data,
num_of_participants,
)
flashbots_builder_config_template = read_file(
static_files.FLASHBOTS_RBUILDER_CONFIG_FILEPATH
)

template_and_data = shared_utils.new_template_and_data(
flashbots_builder_config_template, builder_template_data
)

template_and_data_by_rel_dest_filepath = {}
template_and_data_by_rel_dest_filepath[
MEV_BUILDER_CONFIG_FILENAME
] = template_and_data

config_files_artifact_name = plan.render_templates(
template_and_data_by_rel_dest_filepath, MEV_BUILDER_FILES_ARTIFACT_NAME
)

config_file_path = shared_utils.path_join(
MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE, MEV_BUILDER_CONFIG_FILENAME
)

return config_files_artifact_name


def new_builder_config_template_data(
network_params,
pubkey,
secret,
mnemonic,
fee_recipient,
extra_data,
num_of_participants,
):
return {
"Network": network_params.network
if network_params.network in constants.PUBLIC_NETWORKS
else "/network-configs/genesis.json",
"DataDir": "/data/reth/execution-data",
"CLEndpoint": "http://cl-{0}-{1}-{2}:{3}".format(
num_of_participants,
constants.CL_TYPE.lighthouse,
constants.EL_TYPE.reth_builder,
lighthouse.BEACON_HTTP_PORT_NUM,
),
"GenesisForkVersion": constants.GENESIS_FORK_VERSION,
"Relay": "mev-relay-api",
"RelayPort": flashbots_relay.MEV_RELAY_ENDPOINT_PORT,
"PublicKey": pubkey,
"SecretKey": secret,
"Mnemonic": mnemonic,
"FeeRecipient": fee_recipient,
"ExtraData": extra_data,
}
Loading