From 65d8b5efce0cd08c759ef5b942fdcb8dc12c94de Mon Sep 17 00:00:00 2001 From: Paul Bellamy Date: Thu, 16 Mar 2023 18:29:58 +0000 Subject: [PATCH] Add captive core config for enable soroban diagnostic events --- ingest/ledgerbackend/captive_core_backend.go | 23 ++++++++++++-------- ingest/ledgerbackend/toml.go | 3 +++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ingest/ledgerbackend/captive_core_backend.go b/ingest/ledgerbackend/captive_core_backend.go index f7f2b36fa6..74ae192457 100644 --- a/ingest/ledgerbackend/captive_core_backend.go +++ b/ingest/ledgerbackend/captive_core_backend.go @@ -70,10 +70,11 @@ func (c *CaptiveStellarCore) roundDownToFirstReplayAfterCheckpointStart(ledger u // // Requires Stellar-Core v13.2.0+. type CaptiveStellarCore struct { - archive historyarchive.ArchiveInterface - checkpointManager historyarchive.CheckpointManager - ledgerHashStore TrustedLedgerHashStore - useDB bool + archive historyarchive.ArchiveInterface + checkpointManager historyarchive.CheckpointManager + ledgerHashStore TrustedLedgerHashStore + useDB bool + enableSorobanDiagnosticEvents bool // cancel is the CancelFunc for context which controls the lifetime of a CaptiveStellarCore instance. // Once it is invoked CaptiveStellarCore will not be able to stream ledgers from Stellar Core or @@ -136,6 +137,9 @@ type CaptiveCoreConfig struct { // of DATABASE parameter in the captive-core-config-path or if absent, the db will default to sqlite // and the db file will be stored at location derived from StoragePath parameter. UseDB bool + + // Enable Soroban diagnostic events in core + EnableSorobanDiagnosticEvents bool } // NewCaptive returns a new CaptiveStellarCore instance. @@ -173,11 +177,12 @@ func NewCaptive(config CaptiveCoreConfig) (*CaptiveStellarCore, error) { } c := &CaptiveStellarCore{ - archive: &archivePool, - ledgerHashStore: config.LedgerHashStore, - useDB: config.UseDB, - cancel: cancel, - checkpointManager: historyarchive.NewCheckpointManager(config.CheckpointFrequency), + archive: &archivePool, + ledgerHashStore: config.LedgerHashStore, + useDB: config.UseDB, + enableSorobanDiagnosticEvents: config.EnableSorobanDiagnosticEvents, + cancel: cancel, + checkpointManager: historyarchive.NewCheckpointManager(config.CheckpointFrequency), } c.stellarCoreRunnerFactory = func() stellarCoreRunnerInterface { diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index 892363c98b..4de551f93c 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -88,6 +88,7 @@ type captiveCoreTomlValues struct { UseBucketListDB bool `toml:"EXPERIMENTAL_BUCKETLIST_DB,omitempty"` BucketListDBPageSizeExp *uint `toml:"EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT,omitempty"` BucketListDBCutoff *uint `toml:"EXPERIMENTAL_BUCKETLIST_DB_INDEX_CUTOFF,omitempty"` + EnableSorobanDiagnosticEvents bool `toml:"ENABLE_SOROBAN_DIAGNOSTIC_EVENTS,omitempty"` } // QuorumSetIsConfigured returns true if there is a quorum set defined in the configuration. @@ -324,6 +325,8 @@ type CaptiveCoreTomlParams struct { UseDB bool // the path to the core binary, used to introspect core at runtie, determine some toml capabilities CoreBinaryPath string + // Make core emit Soroban diagnostic events + EnableSorobanDiagnosticEvents bool } // NewCaptiveCoreTomlFromFile constructs a new CaptiveCoreToml instance by merging configuration