Skip to content

fix(tilt): use namespace-agnostic stellar RPC URL#79

Open
cupicmarko wants to merge 57 commits into
stellarfrom
fix/stellar-tilt-fails
Open

fix(tilt): use namespace-agnostic stellar RPC URL#79
cupicmarko wants to merge 57 commits into
stellarfrom
fix/stellar-tilt-fails

Conversation

@cupicmarko

Copy link
Copy Markdown

No description provided.

Oghma and others added 30 commits June 4, 2026 14:06
… to wormhole-soroban-client, and simplified contracts/wormhole-contract/src/vaa
Oghma and others added 27 commits June 4, 2026 14:06
* Added testnet script with corresponding testnet vaas

* feat: add deployment script

* refactor: use new deployment script for the core contract

---------

Co-authored-by: Goutham <dkgoutham1806@gmail.com>
* docs: Added comments/docs to every file

* docs: Updated README.md file

* chore: better explanation of "action"

* docs: move architecture sections to ARCHITECTURE.md

* chore: rewrite README.md

* chore: update cspell-custom-words

---------

Co-authored-by: Matteo Lisotto <matteo.lisotto@gmail.com>
feat: Removed existing initialisation function and added __constructor implementation
feat: let contractclient creates `WormholeClient` struct
…ss (#72)

* Update core contract to use only contract addresses for emitter address

* Bump stellar dependencies to latest

* Use Address:to_payload to get the 32-byte address

* deps: remove unused deps and `stellar-strkey`

---------

Co-authored-by: Matteo Lisotto <matteo.lisotto@gmail.com>
* Add unit tests for stellar core contract

* Add unit tests for stellar core contract

* Add integration tests for Wormhole contract functionality on Stellar

* Refactor test `nonce` to use runtime-generated values in Wormhole contract

* chore: simplify integration test scripts

* chore: use `stellar keys fund` command instead of calling friendbot through curl

* chore: apply clippy

* chore: apply cargo fmt

* chore: delete redundant scritps.

These operations are handled in the `integration-tests` crate

* chore: add a cleanup trap

---------

Co-authored-by: Matteo Lisotto <matteo.lisotto@gmail.com>
* fix: Reject governance payloads with trailing bytes after parsing

* fix: Extend TTL for CurrentGuardianSetIndex on write

* fix: Remove unused StorageKey::Admin and its storage write

* fix: Replace governance_emitter storage with const in getter

* fix: Extend MessageFee TTL on read in post_message_with_fee

* fix: Eliminate double VAA parsing in governance flow

* fix: Add parse_and_verify_vaa and eliminate double parsing

* fix: Fix is_governance_vaa_consumed to return Result<bool>

* fix: Remove MINIMUM_CONTRACT_BALANCE check from transfer_fees

* doc: edit docs on MINIMUM_CONTRACT_BALANCE check

* fix: Reject VAAs with version != 1 during parsing

* fix: Remove TTL extension from consume_vaa

* test: Fix tests for removed StorageKey::Admin, GovernanceEmitter storage, and MINIMUM_CONTRACT_BALANCE
* fix: Remove posted message hash storage and getter

* fix: Remove last fee transfer timestamp storage and getter

* fix: Remove get_contract_balance on-chain getter
* Implement Soroban executor contract

* chore: use `soroban_client` crate interface

* chore: fix executor dev-dependencies for tests

* refactor: use `BytesReader` instead of manuel byte parsing

* refactor: replace `init` with `__constructor`

* refactor: use new `contractevent` macro

* refactor: `request_execution` returns `Result`

* chore: drop unused `NotInitialized` executor error

* chore: apply cargo fmt

* chore: apply cargo clippy

* refactor: `Executor` to reflect EVM implementation

* refactor: move test into `tests.rs`

* refactor: move types, error and interface in `wormhole-soroban-client`

* chore: add missing documentation

---------

Co-authored-by: Matteo Lisotto <matteo.lisotto@gmail.com>
* feat: add lookup table

* chore: apply cargo fmt
  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.
go test auto-resolved missing checksums and promoted
github.com/gagliardetto/binary from indirect to direct.
## Stellar Watcher

### Core Functionality

The Stellar watcher monitors the Wormhole Core Bridge contract on
Stellar for cross-chain message publications

#### Event Polling
- Continuously polls the Soroban RPC `getEvents` endpoint at
configurable intervals (default **700ms**)
- Detects new `message_published` events from the Wormhole contract

#### Event Parsing
- Decodes base64-encoded XDR event data from Soroban contract events  
- Extracts message fields: `nonce`, `sequence`, `emitter_address`,
`payload`, `consistency_level`
- Converts Stellar-specific formats to Wormhole's standard
`MessagePublication` format

#### Message Publishing
Publishes parsed messages to the guardian's message processing pipeline
with:
- **Timestamp:** current time  
- **Emitter chain:** Stellar  
- **Fields:** all extracted message fields  

##### Ledger Tracking
- Maintains state of the last processed ledger  
- Avoids duplicate processing  
- Handles restarts gracefully  

---

### Reobservation Support

#### Reobservation Request Handling
- Listens for reobservation requests from the guardian network  
- Queries events by specific transaction hash  
- Re-parses and republishes messages with `IsReobservation = true` flag
- Enables message recovery and debugging workflows  

---

### Future Work

#### Improvements
- [x] Timestamp changed from time.Now() → ledgerClosedAt / createdAt
- [x] IsReobservation flow upgraded from linear event search to
getTransaction
- [x] Reobserver interface now implemented (returns w from Create)
- [x] Readiness (readiness.SetReady) wired up
- [x] P2P heartbeat (SetNetworkStats) wired up 

#### Tests
- [x] Integration tests for reobservation requests  
- [ ] End-to-end tests with local Stellar network - should be new future
task

#### Metrics (Maybe?)
- [x] Message observation counters (observed / confirmed / orphaned)  
- [ ] Reobservation request metrics (success / failure / latency) -
should be new future task
- [x] Connection error tracking  
- [x] Current ledger height gauges  
- [ ] RPC call latency histograms  - should be new future task


#### Guardian Set Management (Maybe?) - should be new future task
- [ ] Read guardian sets from Soroban contract storage  
- [ ] Requires implementing `simulateTransaction` or `getLedgerEntries`
RPC calls or another approach
- [ ] Periodic polling to detect guardian set updates  
- [ ] Publish guardian set changes to the guardian network  

#### Tilt Infra - should be new future task
- [ ] Someone needs to look on Tilt infra an make it even better, that's
just a POC.


### Example Result / Signed VAA

```
2025-11-07T15:10:43.230Z	INFO	guardian-0.root.61_watch	stellar message published	{"component": "stellar_watcher", "rpc": "[http://stellar.default.svc.cluster.local:8000/soroban/rpc",](http://stellar.default.svc.cluster.local:8000/soroban/rpc%22,) "contract": "CBWQUIB4R65Z2DGC263FQ7BBI7TGIGOLFTYMLE6QPWBD5QDOUVJY3AKR", "chain": "stellar", "ledger": 2438, "tx": "2e5c06ece7fc8191d2028ed6dd06d53506956f1ca7fabfb0e952ec258b33c456", "seq": 1, "consistency": 1}
2025-11-07T15:10:43.251Z	INFO	guardian-0.root	signed VAA with quorum	{"message_id": "61/fda6fcf519faef33c6cce224fe5eb856da4212588c6202eaa32a6db8facdceac/1", "digest": "1e08121ec71dc2e3ce18945b7ffdd71a0fe9773216308230d5e337c61df2222e"}
```
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.

4 participants