Skip to content

Fix/config and horizon issues#62

Merged
Manuel1234477 merged 5 commits into
StellarGateLabs:mainfrom
whiteghost0001:fix/config-and-horizon-issues
Jun 26, 2026
Merged

Fix/config and horizon issues#62
Manuel1234477 merged 5 commits into
StellarGateLabs:mainfrom
whiteghost0001:fix/config-and-horizon-issues

Conversation

@whiteghost0001

Copy link
Copy Markdown
Contributor

I fixed 2 compilation issues in the StellarGate Rust project:

Config struct mismatch: Replaced usdc_issuer field with accepted_assets field in src/config.rs and updated src/horizon.rs to use the new field. Also added listener_mode and rate_limit_requests_per_sec fields.

Timestamp normalization: Fixed src/db.rs to normalize created_at in row_to_webhook_delivery() for RFC 3339 UTC consistency.

closes #24
closes #25

Hand-written openapi.yaml covers all implemented endpoints:
POST/GET /payments, GET /payments/:id, GET /payments/:id/webhooks,
POST /payments/:id/webhooks/:delivery_id/redeliver, and GET /health.

Spec is served as JSON at /openapi.json (YAML parsed at startup via
serde_yaml so the file stays the single source of truth). Swagger UI
is served at /docs via a CDN-loaded HTML page pointing at /openapi.json.
This commit addresses 2 issues that were causing compilation errors:

Issue 1: Config struct field mismatch
- The Config struct in src/config.rs was missing the accepted_assets field
  and had an outdated usdc_issuer field. The verify() function in
  src/horizon.rs was updated to use the new accepted_assets field which
  supports multiple configurable assets (XLM, USDC, and any custom assets).
- Added AcceptedAsset struct with code and issuer fields
- Added AcceptedAsset::parse_list() to parse comma-separated asset config
- Added AcceptedAsset::default_list() returning XLM and USDC defaults
- Updated Config::from_env() to read ACCEPTED_ASSETS env var
- Updated Config::Debug impl to include accepted_assets and rate_limit_requests_per_sec
- Updated test config in src/config.rs to use accepted_assets
- Added listener_mode field to Config struct (was missing)

Issue 2: Timestamp normalization inconsistency
- The row_to_webhook_delivery() function in src/db.rs was not normalizing
  the created_at timestamp, while row_to_payment() was. This caused
  webhook delivery timestamps to potentially be in the old format
  (space separator, no Z suffix) instead of strict RFC 3339 UTC.
- Applied normalize_ts() to created_at in row_to_webhook_delivery()
  for consistency with row_to_payment()

Additional fixes:
- Added db import to src/api/mod.rs (needed for ready endpoint)
- Added State import to src/api/mod.rs (needed for ready endpoint)
- Added ConnectInfoLayer to the payments router for rate limiting middleware
- Added ready function to src/api/mod.rs (was missing)
- Updated tests/api_tests.rs to use correct Config fields

Closes StellarGateLabs#47 StellarGateLabs#48 StellarGateLabs#43 StellarGateLabs#42 StellarGateLabs#41 StellarGateLabs#40 StellarGateLabs#39 StellarGateLabs#38 StellarGateLabs#45 StellarGateLabs#44 StellarGateLabs#46
@GBOYEE

GBOYEE commented Jun 24, 2026

Copy link
Copy Markdown

I'd like to work on this.

Approach:

  • I'll analyze the codebase and implement a clean solution
  • Verify with existing tests + add new ones if needed

Estimated effort: ~1-2 hours. PR incoming shortly.

@Manuel1234477 Manuel1234477 merged commit 6a5db19 into StellarGateLabs:main Jun 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add machine-readable error codes and request IDs to API responses Gracefully stop the Horizon poller (and drain webhooks) on shutdown

3 participants