From fd5845c713fd1a00287f9e49df9f23f071e7e500 Mon Sep 17 00:00:00 2001 From: Paul Bellamy Date: Thu, 16 Mar 2023 18:30:27 +0000 Subject: [PATCH] Add a horizon flag for --captive-core-enable-soroban-diagnostic-events --- services/horizon/internal/config.go | 23 ++++++++++++----------- services/horizon/internal/flags.go | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/services/horizon/internal/config.go b/services/horizon/internal/config.go index 2bca88b5ce..71be47bf91 100644 --- a/services/horizon/internal/config.go +++ b/services/horizon/internal/config.go @@ -19,17 +19,18 @@ type Config struct { Port uint AdminPort uint - EnableCaptiveCoreIngestion bool - EnableIngestionFiltering bool - UsingDefaultPubnetConfig bool - CaptiveCoreBinaryPath string - RemoteCaptiveCoreURL string - CaptiveCoreConfigPath string - CaptiveCoreTomlParams ledgerbackend.CaptiveCoreTomlParams - CaptiveCoreToml *ledgerbackend.CaptiveCoreToml - CaptiveCoreStoragePath string - CaptiveCoreReuseStoragePath bool - CaptiveCoreConfigUseDB bool + EnableCaptiveCoreIngestion bool + EnableIngestionFiltering bool + UsingDefaultPubnetConfig bool + CaptiveCoreBinaryPath string + RemoteCaptiveCoreURL string + CaptiveCoreConfigPath string + CaptiveCoreTomlParams ledgerbackend.CaptiveCoreTomlParams + CaptiveCoreToml *ledgerbackend.CaptiveCoreToml + CaptiveCoreStoragePath string + CaptiveCoreReuseStoragePath bool + CaptiveCoreConfigUseDB bool + CaptiveCoreConfigEnableSorobanDiagnosticEvents bool StellarCoreDatabaseURL string StellarCoreURL string diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index 8e787d3ef9..8275c4d4c4 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -40,6 +40,8 @@ const ( CaptiveCoreConfigPathName = "captive-core-config-path" // captive-core-use-db is the command line flag for enabling captive core runtime to use an external db url connection rather than RAM for ledger states CaptiveCoreConfigUseDB = "captive-core-use-db" + // captive-core-enable-soroban-diagnostic-events is the command line flag for enabling soroban diagnostic events in captive core + CaptiveCoreConfigEnableSorobanDiagnosticEvents = "captive-core-enable-soroban-diagnostic-events" captiveCoreMigrationHint = "If you are migrating from Horizon 1.x.y, start with the Migration Guide here: https://developers.stellar.org/docs/run-api-server/migrating/" ) @@ -193,6 +195,22 @@ func Flags() (*Config, support.ConfigOptions) { }, ConfigKey: &config.CaptiveCoreConfigUseDB, }, + &support.ConfigOption{ + Name: CaptiveCoreConfigEnableSorobanDiagnosticEvents, + OptType: types.Bool, + FlagDefault: false, + Required: false, + Usage: `when enabled, Horizon ingestion will instruct the captive + core invocation to emit Soroban diagnostic events.`, + CustomSetValue: func(opt *support.ConfigOption) error { + if val := viper.GetBool(opt.Name); val { + config.CaptiveCoreConfigEnableSorobanDiagnosticEvents = val + config.CaptiveCoreTomlParams.EnableSorobanDiagnosticEvents = val + } + return nil + }, + ConfigKey: &config.CaptiveCoreConfigEnableSorobanDiagnosticEvents, + }, &support.ConfigOption{ Name: "enable-captive-core-ingestion", OptType: types.Bool,