feat: webhook enhancements and consistency checks#743
Merged
Conversation
Implement vault.cancelled webhook notification when a vault funding phase is cancelled. Subscribers monitoring the funding phase can now receive immediate notifications when a vault is cancelled, allowing them to notify depositors about refunds. Changes: - Add vault.cancelled event notification in processEvent after cancel_funding - Include contractId and cancelledAt timestamp in webhook payload - Add vault.cancelled to KNOWN_EVENTS whitelist for webhook subscriptions - Also add vault.matured and vault.funded to KNOWN_EVENTS (already implemented) The webhook is triggered within one tick of the cancel_funding event being indexed, meeting the acceptance criteria for immediate notification. Relates to StellarYield#660 StellarYield#668 StellarYield#670 StellarYield#671
|
@dannyy2000 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
This PR implements webhook enhancements and admin consistency checks to improve monitoring and data integrity across the platform.
Changes
#660 - Add vault.cancelled webhook event ✅
Context: Subscribers monitoring the funding phase need to know immediately when a vault is cancelled, so they can notify depositors about refunds.
Implementation:
vault.cancelledwebhook notification triggered after processingcancel_fundingeventscontractIdandcancelledAttimestampAcceptance Criteria Met:
vault.cancelledwebhook is called within one tick of the event being indexed#668 - Add per-vault contract ID filter to webhook subscriptions
Context: A subscriber may only care about events from a specific vault. Without filtering, they receive all vault events and must discard irrelevant ones.
Implementation:
contractIds: string[]field to webhooks tablecontractIds(max 20 addresses; each validated as Stellar C-address)Acceptance Criteria Met:
contractIds: ["CA...1"]does not receive events from "CA...2"#670 - Add GET /api/v1/admin/consistency DB-vs-chain check
Context: The DB can drift from chain state after indexer bugs or RPC outages. A consistency endpoint lets operators detect discrepancies.
Implementation:
contractIdquery paramconsistentboolean flagAcceptance Criteria Met:
consistent: falsewhen DB and chain values differ#671 - Add epoch sequence gap detection check
Context: If the indexer skips a ledger range, epoch numbers may have gaps (e.g. epoch 3 and 5 exist but not 4). Gaps indicate missed events.
Implementation:
{ gaps: number[][] }representing missing epoch rangesAcceptance Criteria Met:
{ gaps: [[4, 4]] }when epoch 4 is missing from sequence 1–5{ gaps: [] }for contiguous epoch sequencesAdditional Improvements
vault.maturedandvault.fundedto KNOWN_EVENTS whitelist (already implemented in indexer but missing from webhook validation)Testing
Closes #660
Closes #668
Closes #670
Closes #671