Skip to content

Commit b100cb6

Browse files
barnabasbusasamcm
andauthored
feat: add tracoor (#651)
cc: @samcm min config: ```yaml additional_services: - tracoor ``` --------- Co-authored-by: Sam Calder-Mason <[email protected]>
1 parent e79c510 commit b100cb6

File tree

9 files changed

+202
-4
lines changed

9 files changed

+202
-4
lines changed

.github/tests/mix-with-tools-mev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ additional_services:
2525
- dugtrio
2626
- blutgang
2727
- apache
28+
- tracoor
2829
ethereum_metrics_exporter_enabled: true
2930
snooper_enabled: true
3031
mev_type: flashbots

.github/tests/mix-with-tools-minimal.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ additional_services:
2727
- dugtrio
2828
- blutgang
2929
- apache
30+
- tracoor
3031
ethereum_metrics_exporter_enabled: true
3132
snooper_enabled: true
3233
keymanager_enabled: true

.github/tests/mix-with-tools.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ additional_services:
2727
- dugtrio
2828
- blutgang
2929
- apache
30+
- tracoor
3031
ethereum_metrics_exporter_enabled: true
3132
snooper_enabled: true
3233
keymanager_enabled: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ additional_services:
592592
- blutgang
593593
- forky
594594
- apache
595+
- tracoor
595596

596597
# Configuration place for dora the explorer - https://github.com/ethpandaops/dora
597598
dora_params:

main.star

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dugtrio = import_module("./src/dugtrio/dugtrio_launcher.star")
2525
blutgang = import_module("./src/blutgang/blutgang_launcher.star")
2626
blobscan = import_module("./src/blobscan/blobscan_launcher.star")
2727
forky = import_module("./src/forky/forky_launcher.star")
28+
tracoor = import_module("./src/tracoor/tracoor_launcher.star")
2829
apache = import_module("./src/apache/apache_launcher.star")
2930
full_beaconchain_explorer = import_module(
3031
"./src/full_beaconchain/full_beaconchain_launcher.star"
@@ -507,6 +508,22 @@ def run(plan, args={}):
507508
final_genesis_timestamp,
508509
)
509510
plan.print("Successfully launched forky")
511+
elif additional_service == "tracoor":
512+
plan.print("Launching tracoor")
513+
tracoor_config_template = read_file(
514+
static_files.TRACOOR_CONFIG_TEMPLATE_FILEPATH
515+
)
516+
tracoor.launch_tracoor(
517+
plan,
518+
tracoor_config_template,
519+
all_participants,
520+
args_with_right_defaults.participants,
521+
el_cl_data_files_artifact_uuid,
522+
network_params,
523+
global_node_selectors,
524+
final_genesis_timestamp,
525+
)
526+
plan.print("Successfully launched tracoor")
510527
elif additional_service == "apache":
511528
plan.print("Launching apache")
512529
apache.launch_apache(

src/static_files/static_files.star

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ BLUTGANG_CONFIG_TEMPLATE_FILEPATH = (
2929
STATIC_FILES_DIRPATH + "/blutgang-config/config.toml.tmpl"
3030
)
3131
FORKY_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/forky-config/config.yaml.tmpl"
32-
32+
TRACOOR_CONFIG_TEMPLATE_FILEPATH = (
33+
STATIC_FILES_DIRPATH + "/tracoor-config/config.yaml.tmpl"
34+
)
3335
FULL_BEACONCHAIN_CONFIG_TEMPLATE_FILEPATH = (
3436
STATIC_FILES_DIRPATH + "/full-beaconchain-config/config.yaml.tmpl"
3537
)

src/tracoor/tracoor_launcher.star

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
shared_utils = import_module("../shared_utils/shared_utils.star")
2+
constants = import_module("../package_io/constants.star")
3+
4+
IMAGE_NAME = "ethpandaops/tracoor:0.0.18"
5+
SERVICE_NAME = "tracoor"
6+
7+
HTTP_PORT_ID = "http"
8+
HTTP_PORT_NUMBER = 7007
9+
10+
TRACOOR_CONFIG_FILENAME = "tracoor-config.yaml"
11+
12+
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"
13+
14+
# The min/max CPU/memory that tracoor can use
15+
MIN_CPU = 100
16+
MAX_CPU = 1000
17+
MIN_MEMORY = 128
18+
MAX_MEMORY = 2048
19+
20+
USED_PORTS = {
21+
HTTP_PORT_ID: shared_utils.new_port_spec(
22+
HTTP_PORT_NUMBER,
23+
shared_utils.TCP_PROTOCOL,
24+
shared_utils.HTTP_APPLICATION_PROTOCOL,
25+
)
26+
}
27+
28+
29+
def launch_tracoor(
30+
plan,
31+
config_template,
32+
participant_contexts,
33+
participant_configs,
34+
el_cl_data_files_artifact_uuid,
35+
network_params,
36+
global_node_selectors,
37+
final_genesis_timestamp,
38+
):
39+
all_client_info = []
40+
for index, participant in enumerate(participant_contexts):
41+
full_name, cl_client, el_client, _ = shared_utils.get_client_names(
42+
participant, index, participant_contexts, participant_configs
43+
)
44+
45+
beacon = new_cl_client_info(cl_client.beacon_http_url, full_name)
46+
execution = new_el_client_info(
47+
"http://{0}:{1}".format(
48+
el_client.ip_addr,
49+
el_client.rpc_port_num,
50+
),
51+
full_name,
52+
)
53+
54+
client_info = {
55+
"Beacon": beacon,
56+
"Execution": execution,
57+
"Network": network_params.network,
58+
}
59+
all_client_info.append(client_info)
60+
plan.print(network_params.network)
61+
template_data = new_config_template_data(
62+
HTTP_PORT_NUMBER,
63+
all_client_info,
64+
)
65+
66+
template_and_data = shared_utils.new_template_and_data(
67+
config_template, template_data
68+
)
69+
template_and_data_by_rel_dest_filepath = {}
70+
template_and_data_by_rel_dest_filepath[TRACOOR_CONFIG_FILENAME] = template_and_data
71+
72+
config_files_artifact_name = plan.render_templates(
73+
template_and_data_by_rel_dest_filepath, "tracoor-config"
74+
)
75+
el_cl_data_files_artifact_uuid = el_cl_data_files_artifact_uuid
76+
config = get_config(
77+
config_files_artifact_name,
78+
el_cl_data_files_artifact_uuid,
79+
network_params,
80+
global_node_selectors,
81+
)
82+
83+
plan.add_service(SERVICE_NAME, config)
84+
85+
86+
def get_config(
87+
config_files_artifact_name,
88+
el_cl_data_files_artifact_uuid,
89+
network_params,
90+
node_selectors,
91+
):
92+
config_file_path = shared_utils.path_join(
93+
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
94+
TRACOOR_CONFIG_FILENAME,
95+
)
96+
97+
return ServiceConfig(
98+
image=IMAGE_NAME,
99+
ports=USED_PORTS,
100+
files={
101+
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
102+
},
103+
cmd=[
104+
"single",
105+
"--single-config={0}".format(config_file_path),
106+
],
107+
min_cpu=MIN_CPU,
108+
max_cpu=MAX_CPU,
109+
min_memory=MIN_MEMORY,
110+
max_memory=MAX_MEMORY,
111+
node_selectors=node_selectors,
112+
)
113+
114+
115+
def new_config_template_data(
116+
listen_port_num,
117+
client_info,
118+
):
119+
return {
120+
"ListenPortNum": listen_port_num,
121+
"ParticipantClientInfo": client_info,
122+
}
123+
124+
125+
def new_cl_client_info(beacon_http_url, full_name):
126+
return {
127+
"Beacon_HTTP_URL": beacon_http_url,
128+
"FullName": full_name,
129+
}
130+
131+
132+
def new_el_client_info(execution_http_url, full_name):
133+
return {
134+
"Execution_HTTP_URL": execution_http_url,
135+
"FullName": full_name,
136+
}

static_files/dora-config/config.yaml.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ beaconapi:
4747

4848
executionapi:
4949
endpoints:
50-
{{ range $clClient := .ELClientInfo }}
51-
- url: "{{ $clClient.Execution_HTTP_URL }}"
52-
name: "{{ $clClient.FullName }}"
50+
{{ range $elClient := .ELClientInfo }}
51+
- url: "{{ $elClient.Execution_HTTP_URL }}"
52+
name: "{{ $elClient.FullName }}"
5353
archive: true
5454
{{- end }}
5555
depositLogBatchSize: 1000
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
server:
2+
addr: ":8081"
3+
metricsAddr: ":9091"
4+
pprofAddr: ":6060"
5+
gatewayAddr: ":{{ .ListenPortNum }}"
6+
preStopSleepSeconds: 1
7+
ntpServer: time.google.com
8+
9+
persistence:
10+
dsn: "file:/tmp/tracoor.db"
11+
driver_name: sqlite
12+
13+
services:
14+
indexer:
15+
retention:
16+
beaconStates: 30m
17+
executionBlockTraces: 30m
18+
beaconBlocks: 30m
19+
20+
agents:
21+
{{- range $client := .ParticipantClientInfo }}
22+
- name: "{{ $client.Beacon.FullName }}"
23+
ethereum:
24+
overrideNetworkName: "{{ $client.Network }}"
25+
beacon:
26+
nodeAddress: "{{ $client.Beacon.Beacon_HTTP_URL }}"
27+
execution:
28+
nodeAddress: "{{ $client.Execution.Execution_HTTP_URL }}"
29+
{{- end }}
30+
31+
shared:
32+
metricsAddr: ":9091"
33+
logging: "debug"
34+
indexer:
35+
address: 0.0.0.0:8081
36+
store:
37+
type: fs
38+
config:
39+
base_path: "/data/tracoor"

0 commit comments

Comments
 (0)