diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d4008209..8e08f050 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -23,7 +23,7 @@ jobs: # the soroban CLI & RPC source code to compile and run from system test # refers to checked out source of current git hub ref context SYSTEM_TEST_SOROBAN_CLI_REF: https://github.com/stellar/soroban-cli.git\#main - SYSTEM_TEST_SOROBAN_RPC_REF: ${{ github.workspace }}/stellar-rpc + SYSTEM_TEST_STELLAR_RPC_REF: ${{ github.workspace }}/stellar-rpc # core git ref should be latest commit for stable soroban functionality # the core bin can either be compiled in-line here as part of ci, @@ -54,8 +54,7 @@ jobs: # system test will build quickstart image internally to use for running the service stack # configured in standalone network mode(core, rpc) - SYSTEM_TEST_QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#ae7fdb07283a0af836d4cd51ff09b02db93fb12c - + SYSTEM_TEST_QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#1a831b2350dd3928b60eb745d0862ee19dd2aaaa # triggers system test to log out details from quickstart's logs and test steps SYSTEM_TEST_VERBOSE_OUTPUT: "true" @@ -104,7 +103,7 @@ jobs: CORE_COMPILE_CONFIGURE_FLAGS="$SYSTEM_TEST_CORE_COMPILE_CONFIGURE_FLAGS" \ CORE_IMAGE=$SYSTEM_TEST_CORE_IMAGE \ CORE_IMAGE_BIN_PATH=$SYSTEM_TEST_CORE_IMAGE_BIN_PATH \ - SOROBAN_RPC_GIT_REF=$SYSTEM_TEST_SOROBAN_RPC_REF \ + STELLAR_RPC_GIT_REF=$SYSTEM_TEST_STELLAR_RPC_REF \ SOROBAN_CLI_GIT_REF=$SYSTEM_TEST_SOROBAN_CLI_REF \ RUST_TOOLCHAIN_VERSION=$SYSTEM_TEST_RUST_TOOLCHAIN_VERSION \ RS_XDR_GIT_REF=$SYSTEM_TEST_RS_XDR_GIT_REF \ diff --git a/.github/workflows/stellar-rpc.yml b/.github/workflows/stellar-rpc.yml index 2906ac30..6b515d2d 100644 --- a/.github/workflows/stellar-rpc.yml +++ b/.github/workflows/stellar-rpc.yml @@ -101,9 +101,9 @@ jobs: protocol-version: [ 21, 22 ] runs-on: ${{ matrix.os }} env: - SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true - SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }} - SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core + STELLAR_RPC_INTEGRATION_TESTS_ENABLED: true + STELLAR_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }} + STELLAR_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 22.0.0-2138.721fd0a65.focal PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:22.0.0-2138.721fd0a65.focal PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.0.0-2138.721fd0a65.focal @@ -124,7 +124,7 @@ jobs: shell: bash run: | docker pull "$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" - echo SOROBAN_RPC_INTEGRATION_TESTS_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" >> $GITHUB_ENV + echo STELLAR_RPC_INTEGRATION_TESTS_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" >> $GITHUB_ENV - name: Install Captive Core shell: bash diff --git a/Makefile b/Makefile index 39502cd1..2f5a96db 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ endif # (libpreflight.a is put at target/release-with-panic-unwind/ when not cross compiling) CARGO_BUILD_TARGET ?= $(shell rustc -vV | sed -n 's|host: ||p') -SOROBAN_RPC_BINARY := stellar-rpc +STELLAR_RPC_BINARY := stellar-rpc STELLAR_RPC_BINARY := stellar-rpc @@ -86,7 +86,7 @@ clean: # https://github.com/stellar/pipelines/blob/master/stellar-rpc/Jenkinsfile-stellar-rpc-package-builder # as part of the package building. build-stellar-rpc: build-libs - go build -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} -o ${SOROBAN_RPC_BINARY} -trimpath -v ./cmd/stellar-rpc + go build -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} -o ${STELLAR_RPC_BINARY} -trimpath -v ./cmd/stellar-rpc # the build-stellar-rpc build target is an optimized build target used by # https://github.com/stellar/pipelines/blob/master/stellar-rpc/Jenkinsfile-stellar-rpc-package-builder diff --git a/cmd/stellar-rpc/docker/Dockerfile.release b/cmd/stellar-rpc/docker/Dockerfile.release index e627ae5a..5b03b7a9 100644 --- a/cmd/stellar-rpc/docker/Dockerfile.release +++ b/cmd/stellar-rpc/docker/Dockerfile.release @@ -1,8 +1,8 @@ FROM ubuntu:22.04 ARG STELLAR_CORE_VERSION ENV STELLAR_CORE_VERSION=${STELLAR_CORE_VERSION:-*} -ARG SOROBAN_RPC_VERSION -ENV SOROBAN_RPC_VERSION=${SOROBAN_RPC_VERSION:-*} +ARG STELLAR_RPC_VERSION +ENV STELLAR_RPC_VERSION=${STELLAR_RPC_VERSION:-*} ENV STELLAR_CORE_BINARY_PATH /usr/bin/stellar-core ENV DEBIAN_FRONTEND=noninteractive @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates echo "deb https://apt.stellar.org focal testing" >/etc/apt/sources.list.d/SDF-testing.list && \ echo "deb https://apt.stellar.org focal unstable" >/etc/apt/sources.list.d/SDF-unstable.list && \ apt-get update && \ - apt-get install -y stellar-core=${STELLAR_CORE_VERSION} stellar-stellar-rpc=${SOROBAN_RPC_VERSION} && \ + apt-get install -y stellar-core=${STELLAR_CORE_VERSION} stellar-stellar-rpc=${STELLAR_RPC_VERSION} && \ apt-get clean ENTRYPOINT ["/usr/bin/stellar-stellar-rpc"] diff --git a/cmd/stellar-rpc/docker/Makefile b/cmd/stellar-rpc/docker/Makefile index c461792c..2f28c0f0 100644 --- a/cmd/stellar-rpc/docker/Makefile +++ b/cmd/stellar-rpc/docker/Makefile @@ -4,18 +4,18 @@ SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") BUILD_DATE := $(shell date -u +%FT%TZ) # Extract latest release semver from GitHub -SOROBAN_RPC_LATEST_RELEASE := $(shell curl -sS https://api.github.com/repos/stellar/stellar-rpc/releases/latest|jq -r ".tag_name"| tr -d "v" ) +STELLAR_RPC_LATEST_RELEASE := $(shell curl -sS https://api.github.com/repos/stellar/stellar-rpc/releases/latest|jq -r ".tag_name"| tr -d "v" ) -# If deb version was provided via the SOROBAN_RPC_VERSION variable use it. +# If deb version was provided via the STELLAR_RPC_VERSION variable use it. # If not get latest deb build matching release from GitHub -ifndef SOROBAN_RPC_VERSION - SOROBAN_RPC_VERSION_PACKAGE_VERSION := $(shell curl -sS https://apt.stellar.org/dists/focal/unstable/binary-amd64/Packages|grep -A 18 stellar-stellar-rpc|grep Version|grep $(SOROBAN_RPC_LATEST_RELEASE)|head -1|cut -d' ' -f2 ) +ifndef STELLAR_RPC_VERSION + STELLAR_RPC_VERSION_PACKAGE_VERSION := $(shell curl -sS https://apt.stellar.org/dists/focal/unstable/binary-amd64/Packages|grep -A 18 stellar-stellar-rpc|grep Version|grep $(STELLAR_RPC_LATEST_RELEASE)|head -1|cut -d' ' -f2 ) else - SOROBAN_RPC_VERSION_PACKAGE_VERSION := $(SOROBAN_RPC_VERSION) + STELLAR_RPC_VERSION_PACKAGE_VERSION := $(STELLAR_RPC_VERSION) endif -ifndef SOROBAN_RPC_VERSION_PACKAGE_VERSION - $(error Couldn't establish deb build from version $(SOROBAN_RPC_LATEST_RELEASE). Has the package been built?) +ifndef STELLAR_RPC_VERSION_PACKAGE_VERSION + $(error Couldn't establish deb build from version $(STELLAR_RPC_LATEST_RELEASE). Has the package been built?) endif ifndef STELLAR_CORE_VERSION @@ -28,9 +28,9 @@ BINARY_NAME ?= stellar-rpc ifndef TAG # Set the TAG based on the value of BINARY_NAME ifeq ($(BINARY_NAME),stellar-rpc) - TAG := stellar/stellar-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) + TAG := stellar/stellar-rpc:$(STELLAR_RPC_VERSION_PACKAGE_VERSION) else - TAG := stellar/stellar-stellar-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) + TAG := stellar/stellar-stellar-rpc:$(STELLAR_RPC_VERSION_PACKAGE_VERSION) endif endif # TAG @@ -38,7 +38,7 @@ endif # TAG docker-build: $(SUDO) docker build --pull --platform linux/amd64 $(DOCKER_OPTS) \ --label org.opencontainers.image.created="$(BUILD_DATE)" \ - --build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) --build-arg SOROBAN_RPC_VERSION=$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) \ + --build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) --build-arg STELLAR_RPC_VERSION=$(STELLAR_RPC_VERSION_PACKAGE_VERSION) \ --build-arg BINARY_NAME=$(BINARY_NAME) \ -t $(TAG) -f Dockerfile.release . diff --git a/cmd/stellar-rpc/internal/config/options.go b/cmd/stellar-rpc/internal/config/options.go index 1a906c80..07acd6ca 100644 --- a/cmd/stellar-rpc/internal/config/options.go +++ b/cmd/stellar-rpc/internal/config/options.go @@ -33,14 +33,16 @@ func (cfg *Config) options() Options { defaultStellarCoreBinaryPath, _ := exec.LookPath("stellar-core") cfg.optionsCache = &Options{ { - Name: "config-path", + Name: "config-path", + // TODO: deprecate and rename to STELLAR_RPC_ EnvVar: "SOROBAN_RPC_CONFIG_PATH", TomlKey: "-", Usage: "File path to the toml configuration file", ConfigKey: &cfg.ConfigPath, }, { - Name: "config-strict", + Name: "config-strict", + // TODO: deprecate and rename to STELLAR_RPC_ EnvVar: "SOROBAN_RPC_CONFIG_STRICT", TomlKey: "STRICT", Usage: "Enable strict toml configuration file parsing. This will prevent unknown fields in the config toml from being parsed.", @@ -197,9 +199,10 @@ func (cfg *Config) options() Options { Validate: required, }, { - Name: "db-path", - Usage: "SQLite DB path", - ConfigKey: &cfg.SQLiteDBPath, + Name: "db-path", + Usage: "SQLite DB path", + ConfigKey: &cfg.SQLiteDBPath, + // TODO: deprecate and rename to stellar_rpc.sqlite DefaultValue: "soroban_rpc.sqlite", }, { diff --git a/cmd/stellar-rpc/internal/daemon/daemon.go b/cmd/stellar-rpc/internal/daemon/daemon.go index e087c47c..e9de64d9 100644 --- a/cmd/stellar-rpc/internal/daemon/daemon.go +++ b/cmd/stellar-rpc/internal/daemon/daemon.go @@ -27,6 +27,7 @@ import ( "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/config" + "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/daemon/interfaces" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/db" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/feewindow" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/ingest" @@ -35,7 +36,6 @@ import ( ) const ( - prometheusNamespace = "soroban_rpc" maxLedgerEntryWriteBatchSize = 150 defaultReadTimeout = 5 * time.Second defaultShutdownGracePeriod = 10 * time.Second @@ -220,7 +220,8 @@ func mustCreateHistoryArchive(cfg *config.Config, logger *supportlog.Entry) *his } func mustOpenDatabase(cfg *config.Config, logger *supportlog.Entry, metricsRegistry *prometheus.Registry) *db.DB { - dbConn, err := db.OpenSQLiteDBWithPrometheusMetrics(cfg.SQLiteDBPath, prometheusNamespace, "db", metricsRegistry) + dbConn, err := db.OpenSQLiteDBWithPrometheusMetrics( + cfg.SQLiteDBPath, interfaces.PrometheusNamespace, "db", metricsRegistry) if err != nil { logger.WithError(err).Fatal("could not open database") } diff --git a/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go b/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go index 255cc4b2..ca66802a 100644 --- a/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go +++ b/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go @@ -9,6 +9,9 @@ import ( proto "github.com/stellar/go/protocols/stellarcore" ) +// TODO: deprecate and rename to stellar_rpc +const PrometheusNamespace = "soroban_rpc" + // NoOpDaemon The noOpDeamon is a dummy daemon implementation, supporting the Daemon interface. // Used only in testing. type NoOpDaemon struct { @@ -21,7 +24,7 @@ type NoOpDaemon struct { func MakeNoOpDeamon() *NoOpDaemon { return &NoOpDaemon{ metricsRegistry: prometheus.NewRegistry(), - metricsNamespace: "soroban_rpc", + metricsNamespace: PrometheusNamespace, coreClient: noOpCoreClient{}, } } diff --git a/cmd/stellar-rpc/internal/daemon/metrics.go b/cmd/stellar-rpc/internal/daemon/metrics.go index c7d9dd6d..db799a59 100644 --- a/cmd/stellar-rpc/internal/daemon/metrics.go +++ b/cmd/stellar-rpc/internal/daemon/metrics.go @@ -21,14 +21,14 @@ import ( func (d *Daemon) registerMetrics() { // LogMetricsHook is a metric which counts log lines emitted by stellar rpc - logMetricsHook := logmetrics.New(prometheusNamespace) + logMetricsHook := logmetrics.New(interfaces.PrometheusNamespace) d.logger.AddHook(logMetricsHook) for _, counter := range logMetricsHook { d.metricsRegistry.MustRegister(counter) } buildInfoGauge := prometheus.NewGaugeVec( - prometheus.GaugeOpts{Namespace: prometheusNamespace, Subsystem: "build", Name: "info"}, + prometheus.GaugeOpts{Namespace: interfaces.PrometheusNamespace, Subsystem: "build", Name: "info"}, []string{"version", "goversion", "commit", "branch", "build_timestamp"}, ) buildInfoGauge.With(prometheus.Labels{ @@ -49,7 +49,7 @@ func (d *Daemon) MetricsRegistry() *prometheus.Registry { } func (d *Daemon) MetricsNamespace() string { - return prometheusNamespace + return interfaces.PrometheusNamespace } type CoreClientWithMetrics struct { @@ -60,12 +60,12 @@ type CoreClientWithMetrics struct { func newCoreClientWithMetrics(client stellarcore.Client, registry *prometheus.Registry) *CoreClientWithMetrics { submitMetric := prometheus.NewSummaryVec(prometheus.SummaryOpts{ - Namespace: prometheusNamespace, Subsystem: "txsub", Name: "submission_duration_seconds", + Namespace: interfaces.PrometheusNamespace, Subsystem: "txsub", Name: "submission_duration_seconds", Help: "submission durations to Stellar-Core, sliding window = 10m", Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, //nolint:mnd }, []string{"status"}) opCountMetric := prometheus.NewSummaryVec(prometheus.SummaryOpts{ - Namespace: prometheusNamespace, Subsystem: "txsub", Name: "operation_count", + Namespace: interfaces.PrometheusNamespace, Subsystem: "txsub", Name: "operation_count", Help: "number of operations included in a transaction, sliding window = 10m", Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, //nolint:mnd }, []string{"status"}) diff --git a/cmd/stellar-rpc/internal/integrationtest/infrastructure/test.go b/cmd/stellar-rpc/internal/integrationtest/infrastructure/test.go index 9d93dced..b132b239 100644 --- a/cmd/stellar-rpc/internal/integrationtest/infrastructure/test.go +++ b/cmd/stellar-rpc/internal/integrationtest/infrastructure/test.go @@ -112,8 +112,8 @@ type Test struct { } func NewTest(t *testing.T, cfg *TestConfig) *Test { - if os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_ENABLED") == "" { - t.Skip("skipping integration test: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED not set") + if os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_ENABLED") == "" { + t.Skip("skipping integration test: STELLAR_RPC_INTEGRATION_TESTS_ENABLED not set") } i := &Test{t: t} @@ -137,7 +137,7 @@ func NewTest(t *testing.T, cfg *TestConfig) *Test { } if i.sqlitePath == "" { - i.sqlitePath = path.Join(i.t.TempDir(), "soroban_rpc.sqlite") + i.sqlitePath = path.Join(i.t.TempDir(), "stellar_rpc.sqlite") } if parallel { @@ -276,9 +276,9 @@ func (i *Test) getRPConfigForContainer() rpcConfig { } func (i *Test) getRPConfigForDaemon() rpcConfig { - coreBinaryPath := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN") + coreBinaryPath := os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN") if coreBinaryPath == "" { - i.t.Fatal("missing SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN") + i.t.Fatal("missing STELLAR_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN") } return rpcConfig{ // Allocate port dynamically and then figure out what the port is @@ -479,7 +479,7 @@ func (i *Test) getComposeCommand(args ...string) *exec.Cmd { cmd = exec.Command("docker", cmdline...) } - if img := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_DOCKER_IMG"); img != "" { + if img := os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_DOCKER_IMG"); img != "" { cmd.Env = append( cmd.Env, "CORE_IMAGE="+img, @@ -722,7 +722,7 @@ func (i *Test) fillContainerPorts() { } func GetCoreMaxSupportedProtocol() uint32 { - str := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL") + str := os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL") if str == "" { return MaxSupportedProtocolVersion } diff --git a/cmd/stellar-rpc/internal/preflight/preflight_test.go b/cmd/stellar-rpc/internal/preflight/preflight_test.go index 75cfb1b7..aaef58df 100644 --- a/cmd/stellar-rpc/internal/preflight/preflight_test.go +++ b/cmd/stellar-rpc/internal/preflight/preflight_test.go @@ -313,7 +313,7 @@ func createLedger(ledgerSequence uint32) xdr.LedgerCloseMeta { } func getDB(t testing.TB, restartDB bool) *db.DB { - dbPath := path.Join(t.TempDir(), "soroban_rpc.sqlite") + dbPath := path.Join(t.TempDir(), "stellar_rpc.sqlite") dbInstance, err := db.OpenSQLiteDB(dbPath) require.NoError(t, err)