Watcher implementation & Stellar on Tilt#38
Open
svlachakis wants to merge 7 commits into
Open
Conversation
1. Timestamp from ledger — pollOnce now parses ledgerClosedAt from each event (ISO 8601 field from Stellar RPC). handleReobservationRequest calls getTransaction and uses its createdAt unix timestamp. All guardians will produce identical VAAs. 2. Reobservation routine unmanaged — Replaced bare go w.runReobservationHandler(...) with common.RunWithScissors(ctx, errC, "stellar_reobservation", ...). The Run loop selects on errC and returns if the handler dies. 3. TxID missing — mp.TxID is now set from hex-decoded txHash in both pollOnce and handleReobservationRequest. 4. Reobservation uses getTransaction — Rewrote handleReobservationRequest to first call getTransaction(txHash) (gets ledger + timestamp), then getEvents(startLedger=ledger) filtered by txHash. Handles NOT_FOUND/FAILED status explicitly. 5. Prometheus metrics — Added stellarConnectionErrors, stellarMessagesObserved, stellarMessagesConfirmed, currentStellarLedger counters/gauges. 6. Reobserver interface — Create() now returns w instead of nil. Added Reobserve(ctx, chainID, txID, customEndpoint) method that creates a fresh HTTP client for the custom endpoint. 7. Readiness — readiness.SetReady(w.readinessSync) called on every successful getEvents response in pollOnce. 8. P2P heartbeat — p2p.DefaultRegistry.SetNetworkStats called on startup (with contract address) and updated each poll with the latestLedger height from the getEvents response. 9. Zero emitter address — parseMessageFromXDR now returns nil with a Warn log if emitterAddress is empty. 10. Pagination — pollOnce now loops using the event id as cursor when exactly maxPerPoll events are returned, ensuring no events are missed. 11. Redundant RPC call — pollOnce no longer calls getLatestLedger separately; uses latestLedger from the getEvents response directly.
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.
Stellar Watcher
Core Functionality
The Stellar watcher monitors the Wormhole Core Bridge contract on Stellar for cross-chain message publications
Event Polling
getEventsendpoint at configurable intervals (default 700ms)message_publishedevents from the Wormhole contractEvent Parsing
nonce,sequence,emitter_address,payload,consistency_levelMessagePublicationformatMessage Publishing
Publishes parsed messages to the guardian's message processing pipeline with:
Ledger Tracking
Reobservation Support
Reobservation Request Handling
IsReobservation = trueflagFuture Work
Improvements
Tests
Metrics (Maybe?)
Guardian Set Management (Maybe?) - should be new future task
simulateTransactionorgetLedgerEntriesRPC calls or another approachTilt Infra - should be new future task
Example Result / Signed VAA