Skip to content

Commit

Permalink
feat: add tracoor (#651)
Browse files Browse the repository at this point in the history
cc: @samcm

min config:
```yaml
 additional_services:
  - tracoor
```

---------

Co-authored-by: Sam Calder-Mason <[email protected]>
  • Loading branch information
barnabasbusa and samcm authored Jun 7, 2024
1 parent e79c510 commit b100cb6
Show file tree
Hide file tree
Showing 9 changed files with 202 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 @@ -25,6 +25,7 @@ additional_services:
- dugtrio
- blutgang
- apache
- tracoor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: flashbots
Expand Down
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ additional_services:
- dugtrio
- blutgang
- apache
- tracoor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ additional_services:
- dugtrio
- blutgang
- apache
- tracoor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ additional_services:
- blutgang
- forky
- apache
- tracoor

# Configuration place for dora the explorer - https://github.com/ethpandaops/dora
dora_params:
Expand Down
17 changes: 17 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dugtrio = import_module("./src/dugtrio/dugtrio_launcher.star")
blutgang = import_module("./src/blutgang/blutgang_launcher.star")
blobscan = import_module("./src/blobscan/blobscan_launcher.star")
forky = import_module("./src/forky/forky_launcher.star")
tracoor = import_module("./src/tracoor/tracoor_launcher.star")
apache = import_module("./src/apache/apache_launcher.star")
full_beaconchain_explorer = import_module(
"./src/full_beaconchain/full_beaconchain_launcher.star"
Expand Down Expand Up @@ -507,6 +508,22 @@ def run(plan, args={}):
final_genesis_timestamp,
)
plan.print("Successfully launched forky")
elif additional_service == "tracoor":
plan.print("Launching tracoor")
tracoor_config_template = read_file(
static_files.TRACOOR_CONFIG_TEMPLATE_FILEPATH
)
tracoor.launch_tracoor(
plan,
tracoor_config_template,
all_participants,
args_with_right_defaults.participants,
el_cl_data_files_artifact_uuid,
network_params,
global_node_selectors,
final_genesis_timestamp,
)
plan.print("Successfully launched tracoor")
elif additional_service == "apache":
plan.print("Launching apache")
apache.launch_apache(
Expand Down
4 changes: 3 additions & 1 deletion src/static_files/static_files.star
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ BLUTGANG_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/blutgang-config/config.toml.tmpl"
)
FORKY_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/forky-config/config.yaml.tmpl"

TRACOOR_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/tracoor-config/config.yaml.tmpl"
)
FULL_BEACONCHAIN_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/full-beaconchain-config/config.yaml.tmpl"
)
Expand Down
136 changes: 136 additions & 0 deletions src/tracoor/tracoor_launcher.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
shared_utils = import_module("../shared_utils/shared_utils.star")
constants = import_module("../package_io/constants.star")

IMAGE_NAME = "ethpandaops/tracoor:0.0.18"
SERVICE_NAME = "tracoor"

HTTP_PORT_ID = "http"
HTTP_PORT_NUMBER = 7007

TRACOOR_CONFIG_FILENAME = "tracoor-config.yaml"

TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"

# The min/max CPU/memory that tracoor can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048

USED_PORTS = {
HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
)
}


def launch_tracoor(
plan,
config_template,
participant_contexts,
participant_configs,
el_cl_data_files_artifact_uuid,
network_params,
global_node_selectors,
final_genesis_timestamp,
):
all_client_info = []
for index, participant in enumerate(participant_contexts):
full_name, cl_client, el_client, _ = shared_utils.get_client_names(
participant, index, participant_contexts, participant_configs
)

beacon = new_cl_client_info(cl_client.beacon_http_url, full_name)
execution = new_el_client_info(
"http://{0}:{1}".format(
el_client.ip_addr,
el_client.rpc_port_num,
),
full_name,
)

client_info = {
"Beacon": beacon,
"Execution": execution,
"Network": network_params.network,
}
all_client_info.append(client_info)
plan.print(network_params.network)
template_data = new_config_template_data(
HTTP_PORT_NUMBER,
all_client_info,
)

template_and_data = shared_utils.new_template_and_data(
config_template, template_data
)
template_and_data_by_rel_dest_filepath = {}
template_and_data_by_rel_dest_filepath[TRACOOR_CONFIG_FILENAME] = template_and_data

config_files_artifact_name = plan.render_templates(
template_and_data_by_rel_dest_filepath, "tracoor-config"
)
el_cl_data_files_artifact_uuid = el_cl_data_files_artifact_uuid
config = get_config(
config_files_artifact_name,
el_cl_data_files_artifact_uuid,
network_params,
global_node_selectors,
)

plan.add_service(SERVICE_NAME, config)


def get_config(
config_files_artifact_name,
el_cl_data_files_artifact_uuid,
network_params,
node_selectors,
):
config_file_path = shared_utils.path_join(
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
TRACOOR_CONFIG_FILENAME,
)

return ServiceConfig(
image=IMAGE_NAME,
ports=USED_PORTS,
files={
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
},
cmd=[
"single",
"--single-config={0}".format(config_file_path),
],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)


def new_config_template_data(
listen_port_num,
client_info,
):
return {
"ListenPortNum": listen_port_num,
"ParticipantClientInfo": client_info,
}


def new_cl_client_info(beacon_http_url, full_name):
return {
"Beacon_HTTP_URL": beacon_http_url,
"FullName": full_name,
}


def new_el_client_info(execution_http_url, full_name):
return {
"Execution_HTTP_URL": execution_http_url,
"FullName": full_name,
}
6 changes: 3 additions & 3 deletions static_files/dora-config/config.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ beaconapi:

executionapi:
endpoints:
{{ range $clClient := .ELClientInfo }}
- url: "{{ $clClient.Execution_HTTP_URL }}"
name: "{{ $clClient.FullName }}"
{{ range $elClient := .ELClientInfo }}
- url: "{{ $elClient.Execution_HTTP_URL }}"
name: "{{ $elClient.FullName }}"
archive: true
{{- end }}
depositLogBatchSize: 1000
Expand Down
39 changes: 39 additions & 0 deletions static_files/tracoor-config/config.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
server:
addr: ":8081"
metricsAddr: ":9091"
pprofAddr: ":6060"
gatewayAddr: ":{{ .ListenPortNum }}"
preStopSleepSeconds: 1
ntpServer: time.google.com

persistence:
dsn: "file:/tmp/tracoor.db"
driver_name: sqlite

services:
indexer:
retention:
beaconStates: 30m
executionBlockTraces: 30m
beaconBlocks: 30m

agents:
{{- range $client := .ParticipantClientInfo }}
- name: "{{ $client.Beacon.FullName }}"
ethereum:
overrideNetworkName: "{{ $client.Network }}"
beacon:
nodeAddress: "{{ $client.Beacon.Beacon_HTTP_URL }}"
execution:
nodeAddress: "{{ $client.Execution.Execution_HTTP_URL }}"
{{- end }}

shared:
metricsAddr: ":9091"
logging: "debug"
indexer:
address: 0.0.0.0:8081
store:
type: fs
config:
base_path: "/data/tracoor"

0 comments on commit b100cb6

Please sign in to comment.