From 824ca2411c48ed1475eef0041d95f6cf90760f3a Mon Sep 17 00:00:00 2001 From: marcello33 Date: Fri, 24 Apr 2026 09:42:10 +0200 Subject: [PATCH] implement grpc comms --- .gitignore | 2 ++ src/cl/heimdall_v2/launcher.star | 3 +++ src/cl/launcher.star | 2 ++ src/config/input_parser.star | 1 + src/config/sanity_check.star | 1 + src/el/bor/launcher.star | 5 +++++ src/el/shared.star | 3 +++ static_files/cl/heimdall_v2/app.toml | 4 ++-- static_files/el/bor/config.toml | 4 ++++ 9 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0ab871c3..32bba8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ tmp/ +.idea/ test params.yml +*.DS_Store diff --git a/src/cl/heimdall_v2/launcher.star b/src/cl/heimdall_v2/launcher.star index dbbe9554..926ee88e 100644 --- a/src/cl/heimdall_v2/launcher.star +++ b/src/cl/heimdall_v2/launcher.star @@ -16,6 +16,7 @@ def launch( cl_node_ids, l1_rpc_url, el_rpc_url, + el_grpc_url, amqp_url, container_proc_manager_artifact, ): @@ -38,7 +39,9 @@ def launch( # URLs. "amqp_url": amqp_url, "el_rpc_url": el_rpc_url, + "el_grpc_url": el_grpc_url, "l1_rpc_url": l1_rpc_url, + "cl_bor_grpc_flag": participant.get("cl_bor_grpc_flag"), # Port numbers. "rest_api_port_number": shared.REST_API_PORT_NUMBER, "grpc_port_number": shared.GRPC_PORT_NUMBER, diff --git a/src/cl/launcher.star b/src/cl/launcher.star index 1c92864d..08d80d3e 100644 --- a/src/cl/launcher.star +++ b/src/cl/launcher.star @@ -40,6 +40,7 @@ def launch( el_node_name = el_launcher.generate_name(participant, id) el_rpc_url = "http://{}:{}".format(el_node_name, el_shared.RPC_PORT_NUMBER) + el_grpc_url = "http://{}:{}".format(el_node_name, el_shared.GRPC_PORT_NUMBER) service = launch_method( plan, @@ -51,6 +52,7 @@ def launch( node_ids, l1_rpc_url, el_rpc_url, + el_grpc_url, rabbitmq_url, container_proc_manager_artifact, ) diff --git a/src/config/input_parser.star b/src/config/input_parser.star index 56d295a8..d72b8a5f 100644 --- a/src/config/input_parser.star +++ b/src/config/input_parser.star @@ -84,6 +84,7 @@ POLYGON_POS_PARTICIPANT = { "cl_indexer_pruning_enabled": constants.CL_INDEXER_PRUNING_ENABLED, "el_type": constants.EL_TYPE.bor, "el_image": constants.IMAGES.get("l2_el_bor_image"), + "cl_bor_grpc_flag": False, "count": 1, } diff --git a/src/config/sanity_check.star b/src/config/sanity_check.star index 045bf9c4..87b0a936 100644 --- a/src/config/sanity_check.star +++ b/src/config/sanity_check.star @@ -25,6 +25,7 @@ POLYGON_POS_PARAMS = { "el_bor_produce_witness", # Allow bor to start producing witnesses. "el_bor_sync_with_witness", # Enable bor to sync new blocks using witnesses. "el_bor_stateless_parallel_import", # Enable bor to use parallel import in stateless mode. + "cl_bor_grpc_flag", # Enable heimdall → bor gRPC transport (default HTTP). "count", ], "setup_images": [ diff --git a/src/el/bor/launcher.star b/src/el/bor/launcher.star index 0b2e9c76..12a5d7ea 100644 --- a/src/el/bor/launcher.star +++ b/src/el/bor/launcher.star @@ -67,6 +67,7 @@ def launch( "discovery_port_number": shared.DISCOVERY_PORT_NUMBER, "metrics_port_number": shared.METRICS_PORT_NUMBER, "pprof_port_number": shared.PPROF_PORT_NUMBER, + "grpc_port_number": shared.GRPC_PORT_NUMBER, "ethstats_server_port_number": constants.ETHSTATS_SERVER_PORT_NUMBER, }, ), @@ -115,6 +116,10 @@ def launch( number=shared.PPROF_PORT_NUMBER, application_protocol="http", ), + shared.GRPC_PORT_ID: PortSpec( + number=shared.GRPC_PORT_NUMBER, + application_protocol="grpc", + ), }, files={ # app data diff --git a/src/el/shared.star b/src/el/shared.star index f43cbc39..14aceaf0 100644 --- a/src/el/shared.star +++ b/src/el/shared.star @@ -14,6 +14,9 @@ METRICS_PORT_NUMBER = 7071 PPROF_PORT_ID = "pprof" PPROF_PORT_NUMBER = 6060 +GRPC_PORT_ID = "grpc" +GRPC_PORT_NUMBER = 3131 + # CPU and memory limits. MAX_CPU = 4000 # in milicores (4 cores) MAX_MEM = 16384 # in megabytes (16 GB) diff --git a/static_files/cl/heimdall_v2/app.toml b/static_files/cl/heimdall_v2/app.toml index 3413d9fc..20a2094d 100644 --- a/static_files/cl/heimdall_v2/app.toml +++ b/static_files/cl/heimdall_v2/app.toml @@ -247,10 +247,10 @@ eth_rpc_url = "{{.l1_rpc_url}}" bor_rpc_url = "{{.el_rpc_url}}" # GRPC flag for bor chain -bor_grpc_flag = "false" +bor_grpc_flag = "{{ if .cl_bor_grpc_flag }}true{{ else }}false{{ end }}" # GRPC endpoint for bor chain -bor_grpc_url = "localhost:3131" +bor_grpc_url = "{{.el_grpc_url}}" # RPC endpoint for cometBFT comet_bft_rpc_url = "http://0.0.0.0:{{.rpc_port_number}}" diff --git a/static_files/el/bor/config.toml b/static_files/el/bor/config.toml index d5c7ba27..0ce6973d 100644 --- a/static_files/el/bor/config.toml +++ b/static_files/el/bor/config.toml @@ -129,6 +129,10 @@ ethstats = "{{.node_name}}:{{.ethstats_server_secret}}@ethstats-server:{{.ethsta # Enable expensive metrics collection and reporting (default: false) expensive = false +[grpc] + # gRPC server for heimdall-bor communication. + addr = "0.0.0.0:{{.grpc_port_number}}" + [pprof] # Enable the pprof HTTP server (default: false) pprof = true