Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target/
.soroban/
.cargo/
2 changes: 1 addition & 1 deletion cmd/stellar-rpc/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24-bullseye as build
FROM golang:1.24-bullseye AS build
ARG RUST_TOOLCHAIN_VERSION=stable
ARG REPOSITORY_VERSION

Expand Down
94 changes: 53 additions & 41 deletions cmd/stellar-rpc/internal/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,37 @@ type Config struct {
CaptiveCoreHTTPQueryThreadPoolSize uint16
CaptiveCoreHTTPQuerySnapshotLedgers uint16

Endpoint string
AdminEndpoint string
CheckpointFrequency uint32
CoreRequestTimeout time.Duration
DefaultEventsLimit uint
DefaultTransactionsLimit uint
DefaultLedgersLimit uint
FriendbotURL string
HistoryArchiveURLs []string
HistoryArchiveUserAgent string
IngestionTimeout time.Duration
LogFormat LogFormat
LogLevel logrus.Level
MaxEventsLimit uint
MaxTransactionsLimit uint
MaxLedgersLimit uint
MaxHealthyLedgerLatency time.Duration
NetworkPassphrase string
PreflightWorkerCount uint
PreflightWorkerQueueSize uint
PreflightEnableDebug bool
SQLiteDBPath string
HistoryRetentionWindow uint32
SorobanFeeStatsLedgerRetentionWindow uint32
ClassicFeeStatsLedgerRetentionWindow uint32
Endpoint string
NetworkPassphrase string
SQLiteDBPath string
HistoryArchiveURLs []string
AdminEndpoint string
HistoryArchiveUserAgent string
FriendbotURL string
CheckpointFrequency uint32

CoreRequestTimeout time.Duration
IngestionTimeout time.Duration

LogFormat LogFormat
LogLevel logrus.Level

PreflightWorkerCount uint
PreflightWorkerQueueSize uint
PreflightEnableDebug bool

HistoryRetentionWindow uint32
SorobanFeeStatsLedgerRetentionWindow uint32
ClassicFeeStatsLedgerRetentionWindow uint32

DefaultEventsLimit uint
DefaultTransactionsLimit uint
DefaultLedgersLimit uint
MaxEventsLimit uint
MaxTransactionsLimit uint
MaxLedgersLimit uint
MaxHealthyLedgerLatency time.Duration

RequestBacklogGlobalQueueLimit uint
RequestBacklogGetHealthQueueLimit uint
RequestBacklogGetEventsQueueLimit uint
Expand All @@ -64,22 +70,28 @@ type Config struct {
RequestBacklogSimulateTransactionQueueLimit uint
RequestBacklogGetFeeStatsTransactionQueueLimit uint
RequestExecutionWarningThreshold time.Duration
MaxRequestExecutionDuration time.Duration
MaxGetHealthExecutionDuration time.Duration
MaxGetEventsExecutionDuration time.Duration
MaxGetNetworkExecutionDuration time.Duration
MaxGetVersionInfoExecutionDuration time.Duration
MaxGetLatestLedgerExecutionDuration time.Duration
MaxGetLedgerEntriesExecutionDuration time.Duration
MaxGetTransactionExecutionDuration time.Duration
MaxGetTransactionsExecutionDuration time.Duration
MaxGetLedgersExecutionDuration time.Duration
MaxSendTransactionExecutionDuration time.Duration
MaxSimulateTransactionExecutionDuration time.Duration
MaxGetFeeStatsExecutionDuration time.Duration
ServeLedgersFromDatastore bool
BufferedStorageBackendConfig ledgerbackend.BufferedStorageBackendConfig
DataStoreConfig datastore.DataStoreConfig

MaxRequestExecutionDuration time.Duration
MaxGetHealthExecutionDuration time.Duration
MaxGetEventsExecutionDuration time.Duration
MaxGetNetworkExecutionDuration time.Duration
MaxGetVersionInfoExecutionDuration time.Duration
MaxGetLatestLedgerExecutionDuration time.Duration
MaxGetLedgerEntriesExecutionDuration time.Duration
MaxGetTransactionExecutionDuration time.Duration
MaxGetTransactionsExecutionDuration time.Duration
MaxGetLedgersExecutionDuration time.Duration
MaxSendTransactionExecutionDuration time.Duration
MaxSimulateTransactionExecutionDuration time.Duration
MaxGetFeeStatsExecutionDuration time.Duration

ServeLedgersFromDatastore bool
BufferedStorageBackendConfig ledgerbackend.BufferedStorageBackendConfig
DataStoreConfig datastore.DataStoreConfig

LoadTestFile string
LoadTestMergingEnabled bool
LoadTestFrequency time.Duration

// We memoize these, so they bind to pflags correctly
optionsCache *Options
Expand Down
18 changes: 18 additions & 0 deletions cmd/stellar-rpc/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,24 @@ func (cfg *Config) options() Options {
return toml.LoadBytes(tomlBytes)
},
},
{
TomlKey: strutils.KebabToConstantCase("load-test-file"),
ConfigKey: &cfg.LoadTestFile,
Usage: "Perform ingestion load testing with the given .xdr.zstd bundle of ledgers. WARNING: This will be destructive to your database.",
DefaultValue: "",
},
{
TomlKey: strutils.KebabToConstantCase("load-test-merging"),
ConfigKey: &cfg.LoadTestMergingEnabled,
Usage: "Merge load testing ledgers (LOAD_TEST_FILE) with live ingestion.",
DefaultValue: false,
},
{
TomlKey: strutils.KebabToConstantCase("load-test-frequency"),
ConfigKey: &cfg.LoadTestFrequency,
Usage: "Ingest a ledger every duration (seconds)",
DefaultValue: time.Second * 2,
},
}
return *cfg.optionsCache
}
Expand Down
25 changes: 24 additions & 1 deletion cmd/stellar-rpc/internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/stellar/go/clients/stellarcore"
"github.com/stellar/go/historyarchive"
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/ingest/loadtest"
"github.com/stellar/go/support/datastore"
supporthttp "github.com/stellar/go/support/http"
supportlog "github.com/stellar/go/support/log"
Expand Down Expand Up @@ -292,6 +293,28 @@ func createIngestService(cfg *config.Config, logger *supportlog.Entry, daemon *D
logger.WithError(err).Error("could not run ingestion. Retrying")
}

var backend ledgerbackend.LedgerBackend = daemon.core
if cfg.LoadTestFile != "" {
daemon.Logger().
WithField("path", cfg.LoadTestFile).
Warnf("Ingestion will run with load testing")

config := loadtest.LedgerBackendConfig{
NetworkPassphrase: cfg.NetworkPassphrase,
LedgersFilePath: cfg.LoadTestFile,
LedgerCloseDuration: cfg.LoadTestFrequency,
}

if cfg.LoadTestMergingEnabled {
daemon.Logger().
WithField("path", cfg.LoadTestFile).
Warnf("Load testing will merge with live ingestion")
config.LedgerBackend = daemon.core
}

backend = loadtest.NewLedgerBackend(config)
}

return ingest.NewService(ingest.Config{
Logger: logger,
DB: db.NewReadWriter(
Expand All @@ -304,7 +327,7 @@ func createIngestService(cfg *config.Config, logger *supportlog.Entry, daemon *D
),
NetworkPassPhrase: cfg.NetworkPassphrase,
Archive: *historyArchive,
LedgerBackend: daemon.core,
LedgerBackend: backend,
Timeout: cfg.IngestionTimeout,
OnIngestionRetry: onIngestionRetry,
Daemon: daemon,
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stellar/go v0.0.0-20250818235326-815d6a25c539
github.com/stellar/go v0.0.0-20251003192800-0e7db2ccfd7d
github.com/stretchr/testify v1.9.0
)

Expand Down Expand Up @@ -48,6 +48,7 @@ require (
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/pkg/xattr v0.4.9 // indirect
github.com/xdrpp/goxdr v0.1.1 // indirect
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,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 v0.0.0-20250818235326-815d6a25c539 h1:B4UgruJPJ9mdvKPKoYltToLjz4cYZrTj6VYlaTiCX5o=
github.com/stellar/go v0.0.0-20250818235326-815d6a25c539/go.mod h1:ac8hwpljbFXC3Sf9nGfqBXXEvAEdnNRqQHGqP7QN8oY=
github.com/stellar/go v0.0.0-20251003192800-0e7db2ccfd7d h1:qkPPmOc/dTmEX/wcbbuqMVWRJ9ESq6OoybjgjHd8/+M=
github.com/stellar/go v0.0.0-20251003192800-0e7db2ccfd7d/go.mod h1:ac8hwpljbFXC3Sf9nGfqBXXEvAEdnNRqQHGqP7QN8oY=
github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE=
github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
Loading