forked from ethpandaops/ethereum-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add commit-boost support (ethpandaops#779)
Initial support for Commit-Boost, adding for now only the PBS module (equivalent to MEV-Boost). Note that this depends on [this PR](Commit-Boost/commit-boost-client#138) being merged and released. There is sometimes some ambiguity between mev-boost (go client) and mev-boost (protocol via the Builder API), so to disambiguate within commit boost we call the PBS module the sidecar implementing the mev-boost protocol. Here I followed the existing convention as much as possible even if it sounds somewhat repetitive at times (commit-boost-mev-boost). EDIT: the blocking PR is now merged and released in `0.3.0` --------- Co-authored-by: Barnabas Busa <[email protected]> Co-authored-by: Barnabas Busa <[email protected]>
- Loading branch information
1 parent
1825dbf
commit ebbbe83
Showing
9 changed files
with
215 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
participants: | ||
- el_type: geth | ||
cl_type: lighthouse | ||
mev_type: commit-boost | ||
additional_services: | ||
- tx_spammer | ||
- blob_spammer | ||
- custom_flood | ||
- el_forkmon | ||
- beacon_metrics_gazer | ||
- dora | ||
- prometheus_grafana | ||
mev_params: | ||
mev_boost_image: ghcr.io/commit-boost/pbs:latest | ||
mev_relay_image: flashbots/mev-boost-relay:latest | ||
network_params: | ||
seconds_per_slot: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def new_mev_boost_context(private_ip_address, port): | ||
return struct( | ||
private_ip_address=private_ip_address, | ||
port=port, | ||
) | ||
|
||
|
||
def mev_boost_endpoint(mev_boost_context): | ||
return "http://{0}:{1}".format( | ||
mev_boost_context.private_ip_address, mev_boost_context.port | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
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") | ||
static_files = import_module("../../../static_files/static_files.star") | ||
constants = import_module("../../../package_io/constants.star") | ||
|
||
CB_CONFIG_FILENAME = "cb-config.toml" | ||
CB_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config" | ||
CB_CONFIG_FILES_ARTIFACT_NAME = "commit-boost-config" | ||
|
||
USED_PORTS = { | ||
"http": shared_utils.new_port_spec( | ||
input_parser.MEV_BOOST_PORT, shared_utils.TCP_PROTOCOL | ||
) | ||
} | ||
|
||
# The min/max CPU/memory that mev-boost can use | ||
MIN_CPU = 10 | ||
MAX_CPU = 500 | ||
MIN_MEMORY = 16 | ||
MAX_MEMORY = 256 | ||
|
||
|
||
def launch( | ||
plan, | ||
mev_boost_launcher, | ||
service_name, | ||
network, | ||
mev_params, | ||
relays, | ||
el_cl_genesis_data, | ||
global_node_selectors, | ||
): | ||
network = ( | ||
network | ||
if network in constants.PUBLIC_NETWORKS | ||
else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/config.yaml" | ||
) | ||
|
||
image = mev_params.mev_boost_image | ||
template_data = new_config_template_data( | ||
network, | ||
input_parser.MEV_BOOST_PORT, | ||
relays, | ||
) | ||
|
||
mev_rs_boost_config_template = read_file(static_files.COMMIT_BOOST_CONFIG_FILEPATH) | ||
|
||
template_and_data = shared_utils.new_template_and_data( | ||
mev_rs_boost_config_template, template_data | ||
) | ||
|
||
template_and_data_by_rel_dest_filepath = {} | ||
template_and_data_by_rel_dest_filepath[CB_CONFIG_FILENAME] = template_and_data | ||
|
||
config_files_artifact_name = plan.render_templates( | ||
template_and_data_by_rel_dest_filepath, | ||
CB_CONFIG_FILES_ARTIFACT_NAME + service_name, | ||
) | ||
|
||
config_file_path = shared_utils.path_join( | ||
CB_CONFIG_MOUNT_DIRPATH_ON_SERVICE, CB_CONFIG_FILENAME | ||
) | ||
|
||
config = get_config( | ||
mev_boost_launcher, | ||
image, | ||
config_file_path, | ||
config_files_artifact_name, | ||
el_cl_genesis_data, | ||
global_node_selectors, | ||
) | ||
|
||
mev_boost_service = plan.add_service(service_name, config) | ||
|
||
return mev_boost_context_module.new_mev_boost_context( | ||
mev_boost_service.ip_address, input_parser.MEV_BOOST_PORT | ||
) | ||
|
||
|
||
def get_config( | ||
mev_boost_launcher, | ||
image, | ||
config_file_path, | ||
config_file, | ||
el_cl_genesis_data, | ||
node_selectors, | ||
): | ||
return ServiceConfig( | ||
image=image, | ||
ports=USED_PORTS, | ||
cmd=[], | ||
env_vars={ | ||
"CB_CONFIG": config_file_path, | ||
}, | ||
files={ | ||
CB_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_file, | ||
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, | ||
}, | ||
min_cpu=MIN_CPU, | ||
max_cpu=MAX_CPU, | ||
min_memory=MIN_MEMORY, | ||
max_memory=MAX_MEMORY, | ||
node_selectors=node_selectors, | ||
) | ||
|
||
|
||
def new_mev_boost_launcher(should_check_relay, relay_end_points): | ||
return struct( | ||
should_check_relay=should_check_relay, relay_end_points=relay_end_points | ||
) | ||
|
||
|
||
def new_config_template_data(network, port, relays): | ||
return { | ||
"Network": network, | ||
"Port": port, | ||
"Relays": relays, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
chain = "{{ .Network }}" | ||
|
||
[pbs] | ||
port = {{ .Port }} | ||
|
||
{{ range $index, $relay := .Relays }} | ||
[[relays]] | ||
id = "mev_relay_{{$index}}" | ||
url = "{{ $relay }}" | ||
{{- end }} | ||
|
||
[logs] | ||
log_level = "debug" | ||
max_log_files = 7 |