From eff86d6049d0d55d30b3c81c5b99f47c8f92ea51 Mon Sep 17 00:00:00 2001 From: Christian Jonas Date: Mon, 4 May 2026 13:42:11 -0400 Subject: [PATCH 1/6] use apply-load tooling from go-stellar-sdk/ingest/loadtest package --- go.mod | 8 +- go.sum | 8 +- internal/integration/generate_ledgers_test.go | 343 +----------------- 3 files changed, 18 insertions(+), 341 deletions(-) diff --git a/go.mod b/go.mod index 64a9c430..929675e6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.25 require ( cloud.google.com/go/storage v1.42.0 // indirect github.com/2opremio/pretty v0.2.2-0.20230601220618-e1d5758b2a95 - github.com/BurntSushi/toml v1.3.2 + github.com/BurntSushi/toml v1.3.2 // indirect github.com/Masterminds/squirrel v1.5.4 github.com/Microsoft/go-winio v0.6.1 // indirect github.com/adjust/goautoneg v0.0.0-20150426214442-d788f35a0315 @@ -36,7 +36,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.17.0 - github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf // indirect + github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3 // indirect github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible github.com/stretchr/testify v1.11.1 github.com/xdrpp/goxdr v0.1.1 // indirect @@ -48,7 +48,7 @@ require ( require ( github.com/creachadair/jrpc2 v1.2.0 github.com/fsouza/fake-gcs-server v1.49.2 - github.com/stellar/go-stellar-sdk v0.3.1-0.20260325174035-031e5bfdc4bd + github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9 ) require ( @@ -136,7 +136,7 @@ require ( github.com/imkira/go-interpol v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/klauspost/compress v1.17.6 + github.com/klauspost/compress v1.17.6 // indirect github.com/kr/text v0.2.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect diff --git a/go.sum b/go.sum index 7ce8763d..5bcd061b 100644 --- a/go.sum +++ b/go.sum @@ -429,10 +429,10 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go-stellar-sdk v0.3.1-0.20260325174035-031e5bfdc4bd h1:riEMBHcXZ+QHBa271TEc8Z99Wdg7PFw2p425iM1thXI= -github.com/stellar/go-stellar-sdk v0.3.1-0.20260325174035-031e5bfdc4bd/go.mod h1:tLKAQPxa2I5UvGMabBbUXcY3fmgYnfDudrMeK7CDX4w= -github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf h1:GY1RVbX3Hg7poPXEf6yojjP0hyypvgUgZmCqQU9D0xg= -github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9 h1:6QpPonRwTAIDFR1QxeYnXaV0VEoIk+Wch48Yh86WmAo= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9/go.mod h1:wri78xryBVXoegTsZY5jcq4z1tPIgJt8Vv4Hgy1npJo= +github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3 h1:/NnsQpfVYPFr5Xm/V7EOblI8P05zewwkJLOlLItsW7U= +github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible h1:jMXXAcz6xTarGDQ4VtVbtERogcmDQw4RaE85Cr9CgoQ= github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible/go.mod h1:7CJ23pXirXBJq45DqvO6clzTEGM/l1SfKrgrzLry8b4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/internal/integration/generate_ledgers_test.go b/internal/integration/generate_ledgers_test.go index 942599e6..3b9df7ca 100644 --- a/internal/integration/generate_ledgers_test.go +++ b/internal/integration/generate_ledgers_test.go @@ -1,23 +1,13 @@ package integration import ( - "io" "os" - "os/exec" - "path/filepath" - "regexp" - "strconv" "testing" - "github.com/BurntSushi/toml" - "github.com/klauspost/compress/zstd" "github.com/stretchr/testify/require" - "github.com/stellar/go-stellar-sdk/historyarchive" - "github.com/stellar/go-stellar-sdk/ingest" - "github.com/stellar/go-stellar-sdk/ingest/ledgerbackend" - "github.com/stellar/go-stellar-sdk/keypair" - "github.com/stellar/go-stellar-sdk/xdr" + "github.com/stellar/go-stellar-sdk/ingest/loadtest" + "github.com/stellar/go-stellar-sdk/support/log" "github.com/stellar/stellar-horizon/internal/test/integration" ) @@ -46,14 +36,8 @@ func TestGenerateLedgers(t *testing.T) { t.Skip("This test run does not support less than Protocol 25") } + // If "", falls back to looking for "stellar-core" in PATH coreBinaryPath := os.Getenv("HORIZON_INTEGRATION_TESTS_CAPTIVE_CORE_BIN") - if coreBinaryPath == "" { - var err error - coreBinaryPath, err = exec.LookPath("stellar-core") - require.NoError(t, err) - } - coreVersion, err := ledgerbackend.CoreBuildVersion(coreBinaryPath) - require.NoError(t, err) // Use custom config if provided, otherwise use default configPath := os.Getenv("LOADTEST_CORE_CONFIG_PATH") @@ -63,322 +47,15 @@ func TestGenerateLedgers(t *testing.T) { outputPath := os.Getenv("LOADTEST_OUTPUT_PATH") fixturesPath := os.Getenv("LOADTEST_FIXTURES_PATH") - // both output paths need to be set or empty, it doesn't make sense - // to only have 1 or the other - require.Equal(t, len(outputPath) == 0, len(fixturesPath) == 0) - - t.Logf("Using stellar-core: %s %s", coreBinaryPath, coreVersion) - t.Logf("Using config: %s", configPath) - - cfg := parseConfig(t, configPath) - - // Run apply-load - workDir, preBenchmarkCheckpoint := runApplyLoad(t, coreBinaryPath, configPath, cfg) - - t.Log("Verifying fixtures completeness...") - metadataPath := filepath.Join(workDir, cfg.MetadataOutputStream) - verifyFixturesCompleteness(t, workDir, metadataPath, cfg.NetworkPassphrase, preBenchmarkCheckpoint) - - // Stream ledgers to output file, or just count them for verification - // Only include benchmark ledgers (after the pre-benchmark checkpoint), - // not setup ledgers which would conflict with the fixtures. - if outputPath != "" { - t.Logf("Streaming ledgers to %s", outputPath) - count := streamLedgersToFile(t, metadataPath, outputPath, preBenchmarkCheckpoint) - t.Logf("Wrote %d ledgers", count) - require.NotZero(t, count, "apply-load should generate at least one ledger") - } - - // Stream fixtures to output file, or just count them for verification - if fixturesPath != "" { - t.Logf("Streaming fixtures to %s", fixturesPath) - count := streamFixturesToFile(t, workDir, cfg.NetworkPassphrase, preBenchmarkCheckpoint, fixturesPath) - t.Logf("Wrote %d ledger entry fixtures", count) - } -} - -func runApplyLoad(t *testing.T, coreBinaryPath, configPath string, cfg applyLoadConfig) (string, uint32) { workDir := t.TempDir() - // Copy config to work dir (apply-load writes files relative to config location) - destConfigPath := filepath.Join(workDir, "apply-load.cfg") - copyFile(t, configPath, destConfigPath) - - // Step 1: Initialize database - newDBCmd := exec.Command(coreBinaryPath, "new-db", "--conf", destConfigPath) - newDBCmd.Dir = workDir - output, err := newDBCmd.CombinedOutput() - if err != nil { - t.Logf("new-db failed:\n%s", string(output)) - } - require.NoError(t, err) - - // Step 2: Initialize history archive - newHistCmd := exec.Command(coreBinaryPath, "new-hist", cfg.HistoryArchiveName, "--conf", destConfigPath) - newHistCmd.Dir = workDir - output, err = newHistCmd.CombinedOutput() - if err != nil { - t.Logf("new-hist failed:\n%s", string(output)) - } - require.NoError(t, err) - t.Logf("Initialized history archive: %s", cfg.HistoryArchiveName) - - // Step 3: Execute stellar-core apply-load - applyLoadCmd := exec.Command(coreBinaryPath, "apply-load", "--conf", destConfigPath) - applyLoadCmd.Dir = workDir - output, err = applyLoadCmd.CombinedOutput() - if err != nil { - t.Logf("apply-load failed:\n%s", string(output)) - } else { - t.Logf("apply-load succeeded:\n%s", string(output)) - } - require.NoError(t, err) - - // Parse pre-benchmark checkpoint from stellar-core output. - // The config sets LOG_FILE_PATH="" so logs go to stdout. - checkpoint := parsePreBenchmarkCheckpoint(t, string(output)) - t.Logf("Pre-benchmark checkpoint: ledger %d", checkpoint) - - return workDir, checkpoint -} - -func parsePreBenchmarkCheckpoint(t *testing.T, output string) uint32 { - // This parses a purpose-built log message from stellar-core's apply-load command. - // It is the intended interface for communicating the pre-benchmark checkpoint boundary. - re := regexp.MustCompile(`Published final checkpoint before benchmark: ledger (\d+)`) - matches := re.FindStringSubmatch(output) - require.NotNil(t, matches, "could not find 'Published final checkpoint before benchmark' in stellar-core output") - - ledger, err := strconv.ParseUint(matches[1], 10, 32) - require.NoError(t, err) - - return uint32(ledger) -} - -type applyLoadConfig struct { - NetworkPassphrase string - MetadataOutputStream string - HistoryArchiveName string -} - -func parseConfig(t *testing.T, configPath string) applyLoadConfig { - data, err := os.ReadFile(configPath) - require.NoError(t, err) - - var raw map[string]any - err = toml.Unmarshal(data, &raw) - require.NoError(t, err) - - passphrase, ok := raw["NETWORK_PASSPHRASE"].(string) - require.True(t, ok, "NETWORK_PASSPHRASE not found in config") - - metadataStream, ok := raw["METADATA_OUTPUT_STREAM"].(string) - require.True(t, ok, "METADATA_OUTPUT_STREAM not found in config") - - history, ok := raw["HISTORY"].(map[string]any) - require.True(t, ok, "HISTORY section not found in config") - require.Len(t, history, 1, "expected exactly one history archive in config") - - var archiveName string - for name := range history { - archiveName = name - } - - return applyLoadConfig{ - NetworkPassphrase: passphrase, - MetadataOutputStream: metadataStream, - HistoryArchiveName: archiveName, - } -} - -func streamLedgersToFile(t *testing.T, metadataPath, outputPath string, preBenchmarkCheckpoint uint32) int { - inFile, err := os.Open(metadataPath) - require.NoError(t, err) - - // Note: xdr.Stream closes the underlying reader when ReadOne hits EOF or error - stream := xdr.NewStream(inFile) - - outFile, err := os.Create(outputPath) - require.NoError(t, err) - defer outFile.Close() - - writer, err := zstd.NewWriter(outFile) - require.NoError(t, err) - defer writer.Close() - - count := 0 - skipped := 0 - - for { - var ledger xdr.LedgerCloseMeta - if err := stream.ReadOne(&ledger); err == io.EOF { - break - } else { - require.NoError(t, err) - } - - // Skip setup ledgers (ledgers up to and including the pre-benchmark checkpoint). - // Only include benchmark ledgers which operate on the fixture state. - if ledger.LedgerSequence() <= preBenchmarkCheckpoint { - skipped++ - continue - } - - require.NoError(t, xdr.MarshalFramed(writer, ledger)) - count++ - } - - t.Logf("Wrote %d benchmark ledgers, skipped %d setup ledgers", count, skipped) - return count -} - -func openCheckpointReader(t *testing.T, workDir, networkPassphrase string, checkpointLedger uint32) ingest.ChangeReader { - archivePath := filepath.Join(workDir, "history") - archive, err := historyarchive.Connect( - "file://"+archivePath, - historyarchive.ArchiveOptions{ - NetworkPassphrase: networkPassphrase, - }, - ) - require.NoError(t, err) - - checkpointReader, err := ingest.NewCheckpointChangeReader(t.Context(), archive, checkpointLedger) - require.NoError(t, err) - - return checkpointReader -} - -func streamFixturesToFile(t *testing.T, workDir, networkPassphrase string, checkpointLedger uint32, outputPath string) int { - checkpointReader := openCheckpointReader(t, workDir, networkPassphrase, checkpointLedger) - defer checkpointReader.Close() - - // Compute root account to filter it out (exists in any network with this passphrase) - rootAccountID := keypair.Root(networkPassphrase).Address() - - outFile, err := os.Create(outputPath) - require.NoError(t, err) - defer outFile.Close() - - writer, err := zstd.NewWriter(outFile) - require.NoError(t, err) - defer writer.Close() - - count := 0 - skipped := 0 - for { - change, err := checkpointReader.Read() - if err == io.EOF { - break - } - require.NoError(t, err) - - if change.Post != nil { - entry := change.Post - - // Skip protocol-level entries that would conflict with existing DB state: - // 1. Config settings - exist in any network - // 2. Root account - derived from network passphrase, created at genesis - if entry.Data.Type == xdr.LedgerEntryTypeConfigSetting { - skipped++ - continue - } - if entry.Data.Type == xdr.LedgerEntryTypeAccount { - if entry.Data.Account.AccountId.Address() == rootAccountID { - skipped++ - continue - } - } - - require.NoError(t, xdr.MarshalFramed(writer, entry)) - count++ - } - } - - t.Logf("Wrote %d entries, skipped %d protocol entries", count, skipped) - return count -} - -func copyFile(t *testing.T, src, dst string) { - data, err := os.ReadFile(src) - require.NoError(t, err) - require.NoError(t, os.WriteFile(dst, data, 0644)) -} - -func verifyFixturesCompleteness(t *testing.T, workDir, metadataPath, networkPassphrase string, checkpointLedger uint32) { - // Step 1: Load all ledger entry keys from fixtures into a set - knownKeys := make(map[string]bool) - checkpointReader := openCheckpointReader(t, workDir, networkPassphrase, checkpointLedger) + logger := log.New() + logger.SetOutput(&testWriter{test: t}) + logger.SetLevel(log.InfoLevel) - fixtureCount := 0 - for { - change, err := checkpointReader.Read() - if err == io.EOF { - break - } - require.NoError(t, err) - if change.Post != nil { - key, err := change.Post.LedgerKey() - require.NoError(t, err) - keyB64, err := key.MarshalBinaryBase64() - require.NoError(t, err) - knownKeys[keyB64] = true - fixtureCount++ - } - } - require.NoError(t, checkpointReader.Close()) - t.Logf("Loaded %d fixture keys into verification set", fixtureCount) - - // Step 2: Stream through generated ledgers and verify each change - file, err := os.Open(metadataPath) + // Create and run the apply-load generator + a, err := loadtest.NewApplyLoad(logger, coreBinaryPath, configPath, outputPath, fixturesPath, workDir) require.NoError(t, err) - stream := xdr.NewStream(file) - - for { - var ledger xdr.LedgerCloseMeta - if err := stream.ReadOne(&ledger); err == io.EOF { - break - } else { - require.NoError(t, err) - } - require.True(t, ledger.ProtocolVersion() == integration.GetCoreMaxSupportedProtocol()) - - // Extract changes from this ledger - changeReader, err := ingest.NewLedgerChangeReaderFromLedgerCloseMeta(networkPassphrase, ledger) - require.NoError(t, err) - - for { - change, err := changeReader.Read() - if err == io.EOF { - break - } - require.NoError(t, err) - - // If the change has a Pre state, the entry must already exist in our known set - if change.Pre != nil { - key, err := change.Pre.LedgerKey() - require.NoError(t, err) - keyB64, err := key.MarshalBinaryBase64() - require.NoError(t, err) - require.True(t, knownKeys[keyB64]) - } - - // Update our known set based on the Post state - if change.Post != nil { - // Entry exists after this change - add/keep in set - key, err := change.Post.LedgerKey() - require.NoError(t, err) - keyB64, err := key.MarshalBinaryBase64() - require.NoError(t, err) - knownKeys[keyB64] = true - } else if change.Pre != nil { - // Entry was deleted - remove from set - key, err := change.Pre.LedgerKey() - require.NoError(t, err) - keyB64, err := key.MarshalBinaryBase64() - require.NoError(t, err) - delete(knownKeys, keyB64) - } - } - require.NoError(t, changeReader.Close()) - } + t.Log("Successfully initialized apply-load generator") + require.NoError(t, a.RunApplyLoadAndWrite(t.Context())) } From 3ca683589268ef37219b781d1096407df5914383 Mon Sep 17 00:00:00 2001 From: Christian Jonas Date: Wed, 6 May 2026 12:23:02 -0400 Subject: [PATCH 2/6] update test for new ApplyLoad shape in sdk --- go.mod | 2 +- go.sum | 4 ++++ internal/integration/generate_ledgers_test.go | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 929675e6..f75bdcb2 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( require ( github.com/creachadair/jrpc2 v1.2.0 github.com/fsouza/fake-gcs-server v1.49.2 - github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9 + github.com/stellar/go-stellar-sdk v0.5.1-0.20260506155819-2cb812f76484 ) require ( diff --git a/go.sum b/go.sum index 5bcd061b..5238df99 100644 --- a/go.sum +++ b/go.sum @@ -431,6 +431,10 @@ github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9 h1:6QpPonRwTAIDFR1QxeYnXaV0VEoIk+Wch48Yh86WmAo= github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9/go.mod h1:wri78xryBVXoegTsZY5jcq4z1tPIgJt8Vv4Hgy1npJo= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260504183245-04c473a4e892 h1:1ZtWFrIh0qXa3k8sxnJCEwGPNh00iNsyS1EUwPngIxU= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260504183245-04c473a4e892/go.mod h1:wri78xryBVXoegTsZY5jcq4z1tPIgJt8Vv4Hgy1npJo= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260506155819-2cb812f76484 h1:AtE+cA4k91qzl5pg91OVZjgWiXDB1FEQtStaZ9ZeCnw= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260506155819-2cb812f76484/go.mod h1:wH+L/1lnWZYUJQei6HF0QhIvs7chSHOapizIJDp66SE= github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3 h1:/NnsQpfVYPFr5Xm/V7EOblI8P05zewwkJLOlLItsW7U= github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible h1:jMXXAcz6xTarGDQ4VtVbtERogcmDQw4RaE85Cr9CgoQ= diff --git a/internal/integration/generate_ledgers_test.go b/internal/integration/generate_ledgers_test.go index 3b9df7ca..7a23b086 100644 --- a/internal/integration/generate_ledgers_test.go +++ b/internal/integration/generate_ledgers_test.go @@ -12,6 +12,8 @@ import ( "github.com/stellar/stellar-horizon/internal/test/integration" ) +const LOADTEST_EXPECTED_NUM_LEDGERS = 30 + // TestGenerateLedgers generates ledgers using stellar-core's apply-load command. // The generated ledgers can be written to a compressed XDR file for use in load testing. // It also extracts ledger entry fixtures from the pre-benchmark checkpoint. @@ -54,8 +56,17 @@ func TestGenerateLedgers(t *testing.T) { logger.SetLevel(log.InfoLevel) // Create and run the apply-load generator - a, err := loadtest.NewApplyLoad(logger, coreBinaryPath, configPath, outputPath, fixturesPath, workDir) + res, err := loadtest.ApplyLoad(t.Context(), loadtest.Options{ + CoreBinaryPath: coreBinaryPath, + ConfigPath: configPath, + OutputPath: outputPath, + FixturesPath: fixturesPath, + WorkDirPath: workDir, + Logger: logger, + }) require.NoError(t, err) + require.Equal(t, LOADTEST_EXPECTED_NUM_LEDGERS, res.CountLedgers, "Expected %d ledgers, got %d", + LOADTEST_EXPECTED_NUM_LEDGERS, res.CountLedgers) + require.Greater(t, res.CountFixtures, 0, "Expected at least 1 fixture, got %d", res.CountFixtures) t.Log("Successfully initialized apply-load generator") - require.NoError(t, a.RunApplyLoadAndWrite(t.Context())) } From 8dbd535046bde04926d851dd279cdef13fb3a33a Mon Sep 17 00:00:00 2001 From: Christian Jonas Date: Wed, 6 May 2026 12:24:26 -0400 Subject: [PATCH 3/6] remove stale log line --- internal/integration/generate_ledgers_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/integration/generate_ledgers_test.go b/internal/integration/generate_ledgers_test.go index 7a23b086..7640b22b 100644 --- a/internal/integration/generate_ledgers_test.go +++ b/internal/integration/generate_ledgers_test.go @@ -68,5 +68,4 @@ func TestGenerateLedgers(t *testing.T) { require.Equal(t, LOADTEST_EXPECTED_NUM_LEDGERS, res.CountLedgers, "Expected %d ledgers, got %d", LOADTEST_EXPECTED_NUM_LEDGERS, res.CountLedgers) require.Greater(t, res.CountFixtures, 0, "Expected at least 1 fixture, got %d", res.CountFixtures) - t.Log("Successfully initialized apply-load generator") } From 5b95ec69fd4fb44ef758b9ff48d0e58c7dfff153 Mon Sep 17 00:00:00 2001 From: Christian Jonas Date: Mon, 11 May 2026 11:44:21 -0400 Subject: [PATCH 4/6] go mod tidy --- go.mod | 2 +- go.sum | 8 ++------ internal/integration/generate_ledgers_test.go | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index f75bdcb2..d87a2e32 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( require ( github.com/creachadair/jrpc2 v1.2.0 github.com/fsouza/fake-gcs-server v1.49.2 - github.com/stellar/go-stellar-sdk v0.5.1-0.20260506155819-2cb812f76484 + github.com/stellar/go-stellar-sdk v0.5.1-0.20260506215501-d170348eff6c ) require ( diff --git a/go.sum b/go.sum index 5238df99..4aef2f0e 100644 --- a/go.sum +++ b/go.sum @@ -429,12 +429,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9 h1:6QpPonRwTAIDFR1QxeYnXaV0VEoIk+Wch48Yh86WmAo= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260504173038-3f90dff249a9/go.mod h1:wri78xryBVXoegTsZY5jcq4z1tPIgJt8Vv4Hgy1npJo= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260504183245-04c473a4e892 h1:1ZtWFrIh0qXa3k8sxnJCEwGPNh00iNsyS1EUwPngIxU= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260504183245-04c473a4e892/go.mod h1:wri78xryBVXoegTsZY5jcq4z1tPIgJt8Vv4Hgy1npJo= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260506155819-2cb812f76484 h1:AtE+cA4k91qzl5pg91OVZjgWiXDB1FEQtStaZ9ZeCnw= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260506155819-2cb812f76484/go.mod h1:wH+L/1lnWZYUJQei6HF0QhIvs7chSHOapizIJDp66SE= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260506215501-d170348eff6c h1:CQQ7lh6vgAx/MVJPZdEnEeAW2nBVgRkE8Fwt5FwWVi4= +github.com/stellar/go-stellar-sdk v0.5.1-0.20260506215501-d170348eff6c/go.mod h1:wH+L/1lnWZYUJQei6HF0QhIvs7chSHOapizIJDp66SE= github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3 h1:/NnsQpfVYPFr5Xm/V7EOblI8P05zewwkJLOlLItsW7U= github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible h1:jMXXAcz6xTarGDQ4VtVbtERogcmDQw4RaE85Cr9CgoQ= diff --git a/internal/integration/generate_ledgers_test.go b/internal/integration/generate_ledgers_test.go index 7640b22b..76220519 100644 --- a/internal/integration/generate_ledgers_test.go +++ b/internal/integration/generate_ledgers_test.go @@ -55,7 +55,7 @@ func TestGenerateLedgers(t *testing.T) { logger.SetOutput(&testWriter{test: t}) logger.SetLevel(log.InfoLevel) - // Create and run the apply-load generator + // Run apply-load res, err := loadtest.ApplyLoad(t.Context(), loadtest.Options{ CoreBinaryPath: coreBinaryPath, ConfigPath: configPath, From ceadea391b2bcd89011063946bab77f8ae1eea43 Mon Sep 17 00:00:00 2001 From: Christian Jonas Date: Mon, 11 May 2026 13:20:49 -0400 Subject: [PATCH 5/6] set ephemeral output paths if not provided --- internal/integration/generate_ledgers_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/integration/generate_ledgers_test.go b/internal/integration/generate_ledgers_test.go index 76220519..2430d3ca 100644 --- a/internal/integration/generate_ledgers_test.go +++ b/internal/integration/generate_ledgers_test.go @@ -2,6 +2,7 @@ package integration import ( "os" + "path/filepath" "testing" "github.com/stretchr/testify/require" @@ -47,9 +48,15 @@ func TestGenerateLedgers(t *testing.T) { configPath = "testdata/apply-load.cfg" } + workDir := t.TempDir() outputPath := os.Getenv("LOADTEST_OUTPUT_PATH") + if outputPath == "" { + outputPath = filepath.Join(workDir, "ledgers.xdr.zst") + } fixturesPath := os.Getenv("LOADTEST_FIXTURES_PATH") - workDir := t.TempDir() + if fixturesPath == "" { + fixturesPath = filepath.Join(workDir, "fixtures.xdr.zst") + } logger := log.New() logger.SetOutput(&testWriter{test: t}) From 5617ff2eab4ca5a185acc996f2ab2cf469d94432 Mon Sep 17 00:00:00 2001 From: Christian Jonas Date: Wed, 24 Jun 2026 17:25:51 -0400 Subject: [PATCH 6/6] migrate LedgerBackendConfig references to new API --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/ingest/main.go | 2 +- internal/integration/ingestion_load_test.go | 16 ++++++++++------ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index d87a2e32..6a8878a3 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.17.0 - github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3 // indirect + github.com/stellar/go-xdr v0.0.0-20260529210834-0bf8f4956364 // indirect github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible github.com/stretchr/testify v1.11.1 github.com/xdrpp/goxdr v0.1.1 // indirect @@ -48,7 +48,7 @@ require ( require ( github.com/creachadair/jrpc2 v1.2.0 github.com/fsouza/fake-gcs-server v1.49.2 - github.com/stellar/go-stellar-sdk v0.5.1-0.20260506215501-d170348eff6c + github.com/stellar/go-stellar-sdk v0.6.1-0.20260623184313-0844c2c845ff ) require ( diff --git a/go.sum b/go.sum index 4aef2f0e..10be7a52 100644 --- a/go.sum +++ b/go.sum @@ -429,10 +429,10 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260506215501-d170348eff6c h1:CQQ7lh6vgAx/MVJPZdEnEeAW2nBVgRkE8Fwt5FwWVi4= -github.com/stellar/go-stellar-sdk v0.5.1-0.20260506215501-d170348eff6c/go.mod h1:wH+L/1lnWZYUJQei6HF0QhIvs7chSHOapizIJDp66SE= -github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3 h1:/NnsQpfVYPFr5Xm/V7EOblI8P05zewwkJLOlLItsW7U= -github.com/stellar/go-xdr v0.0.0-20260423131911-a87d4d0789c3/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= +github.com/stellar/go-stellar-sdk v0.6.1-0.20260623184313-0844c2c845ff h1:ewOxt1L5MWP178SJJtQ7RK6OnUZEYENXgMCcNT5wi8o= +github.com/stellar/go-stellar-sdk v0.6.1-0.20260623184313-0844c2c845ff/go.mod h1:IkcqcrE9UQi7n/1y+MxKB+7qzdjG1T2kGOD7Ss8dqjw= +github.com/stellar/go-xdr v0.0.0-20260529210834-0bf8f4956364 h1:gOKrfuWdZ92LFlv0TAwgZ7OsWKeBsOMDlGLyFgduI1w= +github.com/stellar/go-xdr v0.0.0-20260529210834-0bf8f4956364/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible h1:jMXXAcz6xTarGDQ4VtVbtERogcmDQw4RaE85Cr9CgoQ= github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible/go.mod h1:7CJ23pXirXBJq45DqvO6clzTEGM/l1SfKrgrzLry8b4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/internal/ingest/main.go b/internal/ingest/main.go index df6849e0..2fbf0eee 100644 --- a/internal/ingest/main.go +++ b/internal/ingest/main.go @@ -706,7 +706,7 @@ func (s *system) LoadTest(ledgersFilePath, fixturesFilePath string, merge bool, // 4. Set up loadtest backend and run FSM config := loadtest.LedgerBackendConfig{ NetworkPassphrase: s.config.NetworkPassphrase, - LedgersFilePath: ledgersFilePath, + LedgersFilePaths: []string{ledgersFilePath}, LedgerCloseDuration: closeDuration, } if merge { diff --git a/internal/integration/ingestion_load_test.go b/internal/integration/ingestion_load_test.go index 9d9d6c6b..d6e066e4 100644 --- a/internal/integration/ingestion_load_test.go +++ b/internal/integration/ingestion_load_test.go @@ -53,14 +53,16 @@ func TestLoadTestLedgerBackend(t *testing.T) { require.True(t, tx.Successful) replayConfig := loadtest.LedgerBackendConfig{ - NetworkPassphrase: "invalid passphrase", - LedgersFilePath: filepath.Join("testdata", fmt.Sprintf("load-test-ledgers-v%d.xdr.zstd", itest.Config().ProtocolVersion)), + NetworkPassphrase: "invalid passphrase", + LedgersFilePaths: []string{ + filepath.Join("testdata", fmt.Sprintf("load-test-ledgers-v%d.xdr.zstd", itest.Config().ProtocolVersion)), + }, LedgerCloseDuration: 3 * time.Second / 2, LedgerBackend: newCaptiveCore(itest), } var generatedLedgers []xdr.LedgerCloseMeta - readFile(t, replayConfig.LedgersFilePath, + readFile(t, replayConfig.LedgersFilePaths[0], func() *xdr.LedgerCloseMeta { return &xdr.LedgerCloseMeta{} }, func(ledger *xdr.LedgerCloseMeta) { generatedLedgers = append(generatedLedgers, *ledger) @@ -187,13 +189,15 @@ func TestLoadTestLedgerBackend(t *testing.T) { func TestLoadTestLedgerBackendWithoutMerge(t *testing.T) { replayConfig := loadtest.LedgerBackendConfig{ - NetworkPassphrase: "invalid passphrase", - LedgersFilePath: filepath.Join("testdata", fmt.Sprintf("load-test-ledgers-v%d.xdr.zstd", horizoningest.MaxSupportedProtocolVersion)), + NetworkPassphrase: "invalid passphrase", + LedgersFilePaths: []string{ + filepath.Join("testdata", fmt.Sprintf("load-test-ledgers-v%d.xdr.zstd", horizoningest.MaxSupportedProtocolVersion)), + }, LedgerCloseDuration: 3 * time.Second / 2, } var generatedLedgers []xdr.LedgerCloseMeta - readFile(t, replayConfig.LedgersFilePath, + readFile(t, replayConfig.LedgersFilePaths[0], func() *xdr.LedgerCloseMeta { return &xdr.LedgerCloseMeta{} }, func(ledger *xdr.LedgerCloseMeta) { generatedLedgers = append(generatedLedgers, *ledger)