Repository navigation
Conversation
… without a gateway Closes StellarGateLabs#879
…t*` metrics are ex Closes StellarGateLabs#880
…the docs tell rece Closes StellarGateLabs#881
…pt's timestamp and Closes StellarGateLabs#882
|
@solarix-x Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reject payment creation when trustline is confirmed missing
What was solved
#879 —
POST /v1/paymentsno longer rejects assets without a gateway trustline, althoughopenapi.yamldocumentstrustline_missingRestore the documented
trustline_missingrejection onPOST /v1/payments: add aTrustlineMetricsaccessor that reports a confirmed missing/unauthorized trustline (unknown state still allows creation), havepayments::createreturn the status/codeopenapi.yamlspecifies after resolvingaccepted_asset(native XLM exempt), and add a wiremock-driven test asserting rejection.Addressed:
TrustlineMetrics(insrc/horizon.rs) returning whether an asset is confirmed missing or unauthorized; unknown/never-checked/failed-check states must not report a confirmed absence.payments::create(src/api/payments.rs), after resolvingaccepted_asset, reject with the status code and error codetrustline_missingthatopenapi.yamlspecifies when the asset is confirmed unpayable.#880 —
stellargate_http_*andstellargate_payment*metrics are exported but never recorded, so they are always zeroWire the existing but unused HTTP and payment metrics recorders: add an HTTP metrics middleware in the API router that records method, matched route template (via MatchedPath), status, and elapsed time, placed outside the rate limiter and timeout layers so 429/408 responses are counted; call payment_metrics.record_created after db::create_payment succeeds in payments::create; call record_settlement(status, latency) in horizon::settle when update_payment_status returns Ok(true); and call record_expired for each row in expiry::sweep_once. Add tests asserting non-zero created/completed counters and latency observation after create+settle, route-template labeling for /v1/payments/{id}, and HTTP counter increment on 429.
Addressed:
#881 — Webhook events have no unique event ID, and the docs tell receivers to deduplicate by
payment_id, which drops real follow-up eventsAdd a stable, unique event id (and RFC 3339 created_at) to the signed webhook payload, expose it as a delivery header, ensure retries/redrive/manual redelivery reuse the stored id, and correct the docs to deduplicate on the event id rather than payment_id.
Addressed:
#882 — Inline webhook retries reuse the first attempt's timestamp and signature, so late retries fall outside the receiver's replay window
Move timestamp generation and HMAC signing inside the inline retry loop in
webhook::dispatchso each attempt is signed at send time, matching the redrive worker and manual redelivery paths. Add a test with a mock receiver enforcing a short replay tolerance that fails the first attempt and verifies the second attempt carries a fresh timestamp and valid signature.Addressed:
current_timestamp()andsign(...)inside thefor attempt in 1..=attemptsretry loop inwebhook::dispatchso each attempt is signed at send timeChanges
README.md(modify)WEBHOOK_REFERENCE.md(modify)Approach
POST /v1/paymentsno longer rejects assets without a gateway trustline, althoughopenapi.yamldocumentstrustline_missing#879 —POST /v1/paymentsno longer rejects assets without a gateway trustline, althoughopenapi.yamldocumentstrustline_missing(Changed: README.md)stellargate_http_*andstellargate_payment*metrics are exported but never recorded, so they are always zero #880 —stellargate_http_*andstellargate_payment*metrics are exported but never recorded, so they are always zero (Changed: README.md)payment_id, which drops real follow-up events #881 — Webhook events have no unique event ID, and the docs tell receivers to deduplicate bypayment_id, which drops real follow-up events (Changed: WEBHOOK_REFERENCE.md)Issues
Closes #879
Closes #880
Closes #881
Closes #882