@@ -63,9 +63,11 @@ class NodeImpl final {
6363 BlockNum last_pre_validated_block () const { return chain_sync_.last_pre_validated_block (); }
6464
6565 private:
66+ Task<void > run_execution_service ();
6667 Task<void > run_execution_server ();
6768 Task<void > run_backend_kv_grpc_server ();
6869 Task<void > embedded_sentry_run_if_needed ();
70+ Task<void > run_chain_sync ();
6971
7072 Settings& settings_;
7173 ChainConfig& chain_config_;
@@ -94,9 +96,9 @@ class NodeImpl final {
9496 std::unique_ptr<snapshots::bittorrent::BitTorrentClient> bittorrent_client_;
9597};
9698
97- static rpc::ServerSettings make_execution_server_settings () {
99+ static rpc::ServerSettings make_execution_server_settings (std::optional<std::string> exec_api_address ) {
98100 return rpc::ServerSettings{
99- .address_uri = " localhost:9092" ,
101+ .address_uri = exec_api_address. value_or ( " localhost:9092" ) ,
100102 .context_pool_settings = {.num_contexts = 1 }, // just one execution context
101103 };
102104}
@@ -161,7 +163,7 @@ NodeImpl::NodeImpl(
161163 db::RWAccess{chaindata_env_},
162164 },
163165 execution_service_{std::make_shared<execution::api::ActiveDirectService>(execution_engine_, execution_context_)},
164- execution_server_{make_execution_server_settings (), execution_service_},
166+ execution_server_{make_execution_server_settings (settings_. node_settings . exec_api_address ), execution_service_},
165167 execution_direct_client_{execution_service_},
166168 snapshot_sync_{settings.snapshot_settings , chain_config_.chain_id , chaindata_env_, settings_.node_settings .data_directory ->temp ().path (), execution_engine_.stage_scheduler ()},
167169 sentry_{
@@ -206,18 +208,22 @@ Task<void> NodeImpl::run_tasks() {
206208 co_await wait_for_setup ();
207209
208210 co_await (
211+ run_execution_service () &&
209212 run_execution_server () &&
210213 resource_usage_log_.run () &&
211- chain_sync_. async_run () &&
214+ run_chain_sync () &&
212215 run_backend_kv_grpc_server ());
213216}
214217
218+ Task<void > NodeImpl::run_execution_service () {
219+ // Thread running block execution requires custom stack size because of deep EVM call stacks
220+ return execution_service_->async_run (" exec-engine" , /* stack_size = */ kExecutionThreadStackSize );
221+ }
222+
215223Task<void > NodeImpl::run_execution_server () {
216224 // Thread running block execution requires custom stack size because of deep EVM call stacks
217- if (settings_.execution_server_enabled ) {
218- co_await execution_server_.async_run (/* stack_size=*/ kExecutionThreadStackSize );
219- } else {
220- co_await execution_service_->async_run (" exec-engine" , /* stack_size=*/ kExecutionThreadStackSize );
225+ if (settings_.node_settings .exec_api_address ) {
226+ co_await execution_server_.async_run (/* stack_size = */ kExecutionThreadStackSize );
221227 }
222228}
223229
@@ -239,6 +245,12 @@ Task<void> NodeImpl::embedded_sentry_run_if_needed() {
239245 }
240246}
241247
248+ Task<void > NodeImpl::run_chain_sync () {
249+ if (!settings_.node_settings .exec_api_address ) {
250+ co_await chain_sync_.async_run ();
251+ }
252+ }
253+
242254Node::Node (
243255 rpc::ClientContextPool& context_pool,
244256 Settings& settings,
0 commit comments