From 2e528f1c98d41bc0f6f94461d0a0a9bdae209ce5 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Thu, 27 Jul 2023 19:54:29 +0200 Subject: [PATCH] Add captive-core support for TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME --- ...appendix-with-minimum-persistent-entry.cfg | 11 ++++++++ ...with-appendix-minimum-persistent-entry.cfg | 19 ++++++++++++++ ingest/ledgerbackend/toml.go | 25 ++++++++++--------- ingest/ledgerbackend/toml_test.go | 7 ++++++ 4 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 ingest/ledgerbackend/testdata/appendix-with-minimum-persistent-entry.cfg create mode 100644 ingest/ledgerbackend/testdata/expected-online-with-appendix-minimum-persistent-entry.cfg diff --git a/ingest/ledgerbackend/testdata/appendix-with-minimum-persistent-entry.cfg b/ingest/ledgerbackend/testdata/appendix-with-minimum-persistent-entry.cfg new file mode 100644 index 0000000000..3a8eade51d --- /dev/null +++ b/ingest/ledgerbackend/testdata/appendix-with-minimum-persistent-entry.cfg @@ -0,0 +1,11 @@ +TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME=16 + +[[HOME_DOMAINS]] +HOME_DOMAIN="testnet.stellar.org" +QUALITY="MEDIUM" + +[[VALIDATORS]] +NAME="sdf_testnet_1" +HOME_DOMAIN="testnet.stellar.org" +PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" +ADDRESS="localhost:123" diff --git a/ingest/ledgerbackend/testdata/expected-online-with-appendix-minimum-persistent-entry.cfg b/ingest/ledgerbackend/testdata/expected-online-with-appendix-minimum-persistent-entry.cfg new file mode 100644 index 0000000000..278c681595 --- /dev/null +++ b/ingest/ledgerbackend/testdata/expected-online-with-appendix-minimum-persistent-entry.cfg @@ -0,0 +1,19 @@ +# Generated file, do not edit +FAILURE_SAFETY = -1 +HTTP_PORT = 11626 +LOG_FILE_PATH = "" +NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" +TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME = 16 + +[[HOME_DOMAINS]] + HOME_DOMAIN = "testnet.stellar.org" + QUALITY = "MEDIUM" + +[[VALIDATORS]] + ADDRESS = "localhost:123" + HOME_DOMAIN = "testnet.stellar.org" + NAME = "sdf_testnet_1" + PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" + +[HISTORY.h0] + get = "curl -sf http://localhost:1170/{0} -o {1}" diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index 68145b517e..df87c6bc85 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -78,18 +78,19 @@ type captiveCoreTomlValues struct { LimitTxQueueSourceAccount bool `toml:"LIMIT_TX_QUEUE_SOURCE_ACCOUNT,omitempty"` // we cannot omitempty because 0 is a valid configuration for FAILURE_SAFETY // and the default is -1 - FailureSafety int `toml:"FAILURE_SAFETY"` - UnsafeQuorum bool `toml:"UNSAFE_QUORUM,omitempty"` - RunStandalone bool `toml:"RUN_STANDALONE,omitempty"` - ArtificiallyAccelerateTimeForTesting bool `toml:"ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING,omitempty"` - HomeDomains []HomeDomain `toml:"HOME_DOMAINS,omitempty"` - Validators []Validator `toml:"VALIDATORS,omitempty"` - HistoryEntries map[string]History `toml:"-"` - QuorumSetEntries map[string]QuorumSet `toml:"-"` - 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"` + FailureSafety int `toml:"FAILURE_SAFETY"` + UnsafeQuorum bool `toml:"UNSAFE_QUORUM,omitempty"` + RunStandalone bool `toml:"RUN_STANDALONE,omitempty"` + ArtificiallyAccelerateTimeForTesting bool `toml:"ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING,omitempty"` + HomeDomains []HomeDomain `toml:"HOME_DOMAINS,omitempty"` + Validators []Validator `toml:"VALIDATORS,omitempty"` + HistoryEntries map[string]History `toml:"-"` + QuorumSetEntries map[string]QuorumSet `toml:"-"` + 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"` + TestingMinimumPersistentEntryLifetime *uint `toml:"TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME,omitempty"` } // QuorumSetIsConfigured returns true if there is a quorum set defined in the configuration. diff --git a/ingest/ledgerbackend/toml_test.go b/ingest/ledgerbackend/toml_test.go index 92f5c10cb5..b21ca8c72a 100644 --- a/ingest/ledgerbackend/toml_test.go +++ b/ingest/ledgerbackend/toml_test.go @@ -301,6 +301,13 @@ func TestGenerateConfig(t *testing.T) { peerPort: newUint(12345), logPath: nil, }, + { + name: "offline config with minimum persistent entry in appendix", + mode: stellarCoreRunnerModeOnline, + appendPath: filepath.Join("testdata", "appendix-with-minimum-persistent-entry.cfg"), + expectedPath: filepath.Join("testdata", "expected-online-with-appendix-minimum-persistent-entry.cfg"), + logPath: nil, + }, } { t.Run(testCase.name, func(t *testing.T) { var err error