Skip to content

docs(testnet): add runbooks for recovery check and nonce desync, and monitoring policies - #1126

Merged
phertyameen merged 1 commit into
bridgelet-org:mainfrom
Alhaandr:feature/issue-999-testnet-runbooks-and-monitoring
Nov 25, 2026
Merged

phertyameen merged 1 commit into
bridgelet-org:mainfrom
Alhaandr:feature/issue-999-testnet-runbooks-and-monitoring

Conversation

@Alhaandr

Copy link
Copy Markdown
Contributor

Summary

Closes #999
Closes #1000
Closes #1009
Closes #1010

This pull request implements four key runbook and monitoring deliverables for testnet operations:

  1. testnet/runbooks/expired-account-recovery-check.md (testnet/runbooks/expired-account-recovery-check.md: verify that funds actually landed at recovery_address after an expiry #1000): Documents the verification procedure for confirming that funds and base reserve actually landed at the configured recovery_address after account expiry, cross-checking AccountExpired event fields (recovery_address, amount_returned / total_amount, and reserve_amount) against actual on-chain SEP-41 token and reserve balances. Includes structured workflows for both manual QA testing and investigating reported discrepancies.
  2. testnet/runbooks/nonce-desync.md (testnet/runbooks/nonce-desync.md: recovering when an off-chain signer's nonce tracking falls out of sync with the on-chain SweepController nonce #999): Documents detection and recovery when an integrator's off-chain system (contextually using tools/sweep-signer) tracks nonces independently and falls out of sync with the live on-chain SweepController. Explains symptoms (repeated SignatureVerificationFailed despite a seemingly correct signature) and provides steps to directly query the contract via get_nonce() to resync the signing queue.
  3. testnet/monitoring/alert-thresholds.md (testnet/monitoring/alert-thresholds.md: propose alert thresholds for a sustained rise in AccountExpired events relative to SweepCompleted #1009): Proposes a concrete ratio-based alerting policy ($E \ge 2 \times S$ with minimum volume $E + S \ge 10$ over a 30-minute rolling window sustained for 15 minutes) for a sustained shift toward more accounts expiring unswept (AccountExpired) than being successfully swept (SweepCompleted), indicating partner relayer failure or contract regressions.
  4. testnet/monitoring/explorer-links.md (testnet/monitoring/explorer-links.md: curate Stellar Expert / Lumenscan links pre-filtered to this project's testnet contracts #1010): Curates pre-scoped, one-click Stellar Expert and Lumenscan URLs for all canonical deployed testnet contract IDs (SweepController, EphemeralAccount, ReserveContract, and AccountFactory), updating outdated IDs to match deployments/testnet.json and providing direct links to transaction and event histories.

What changed

  • testnet/runbooks/expired-account-recovery-check.md:
    • Added formal definition of AccountExpired and ReserveReclaimed event fields.
    • Added Workflow A for step-by-step manual QA verification (pre-flight snapshots, trigger invocation, state confirmation, event decoding, and balance reconciliation).
    • Added Workflow B for discrepancy investigation with a dedicated triage matrix and decision tree.
    • Documented current-source behavior vs. full token transfer behavior.
    • Provided a structured, copy-pasteable evidence record template.
  • testnet/runbooks/nonce-desync.md:
    • Added contextual reference to tools/sweep-signer and how independent off-chain nonce tracking drifts.
    • Added detailed symptom detection guide explaining why seemingly correct signatures fail with error code 1.
    • Added authoritative query instructions using SweepController::get_nonce().
    • Added step-by-step resynchronization procedure, comparison matrix ($L < C$, $L > C$, $L == C$), and architectural best practices (mutex locking, read-before-sign pattern).
  • testnet/monitoring/alert-thresholds.md:
    • Formulated a concrete threshold: ratio $E / S \ge 2.0$ with $E + S \ge 10$ sustained for 15 minutes over a 30-minute lookback window.
    • Defined the zero-sweep edge case alert (sweep_completion_silence) when $S = 0$ and $E \ge 10$.
    • Detailed root causes (partner relayer outages, gas starvation, nonce drift, contract regressions, network congestion).
    • Specified collector queries, deduplication keys, alert notification JSON schema, and on-call triage flow.
  • testnet/monitoring/explorer-links.md:
    • Updated all 4 contract IDs to match canonical deployments in deployments/testnet.json.
    • Added ready-made, one-click links to Stellar Expert (Overview, Transactions, Events) and Lumenscan for each deployed contract.
    • Documented key event topics to filter on for each contract.
    • Added dynamic link construction templates for child accounts, transaction hashes, and classic accounts.

Why

  • Integrators and QA engineers on testnet need reliable runbooks to verify fallback behavior and resolve signature failures caused by nonce drift.
  • Operations teams require concrete alert thresholds to detect relayer failures or contract regressions before they impact users.
  • Investigators need instant, pre-scoped block explorer access to inspect live contract state and events without constructing URLs by hand.

Testing performed

  • Ran scripts/check-testnet-links.py to verify all relative markdown links and anchors across the repository; confirmed zero broken links introduced by these changes.
  • Cross-referenced all contract IDs against deployments/testnet.json and deployment-artifacts/contract-ids.txt.
  • Verified Soroban event topics against Rust contract source code (contracts/ephemeral_account/src/events.rs and contracts/sweep_controller/src/lib.rs).
  • Verified tools/sweep-signer CLI argument syntax against tools/sweep-signer/src/main.rs.

Risks considered

  • Documentation drift: Addressed by aligning all contract IDs, event topics, and error codes directly with the repository's source code and deployment records.
  • False positives in alerting: Addressed by enforcing a minimum event sample ($E + S \ge 10$) and 15-minute sustain requirement to filter transient test activity.
  • Secret exposure: Emphasized in all runbooks that private keys, seed phrases, and reusable signatures must never be committed, logged, or shared in tickets.

Edge cases handled

  • Zero-sweep silence ($S = 0$) handled as a distinct dedicated alert rather than division-by-zero.
  • Multi-asset accounts handled in recovery verification by requiring per-asset balance reconciliation rather than comparing aggregate amounts to single token balances.
  • Nonce comparison edge cases ($L < C$, $L > C$, $L == C$, $C == 0$) covered with explicit operational actions.

Issue references

Closes #999
Closes #1000
Closes #1009
Closes #1010

…monitoring policies

- Add verification runbook for expired-account recovery checking AccountExpired event fields against on-chain balances (Closes bridgelet-org#1000)
- Add runbook for off-chain signer SweepController nonce desync detection and resync (Closes bridgelet-org#999)
- Propose ratio-based alert thresholds for sustained AccountExpired vs SweepCompleted rise (Closes bridgelet-org#1009)
- Curate ready-made block-explorer URLs pre-scoped to deployed testnet contract IDs (Closes bridgelet-org#1010)

Closes bridgelet-org#999
Closes bridgelet-org#1000
Closes bridgelet-org#1009
Closes bridgelet-org#1010
@drips-wave

drips-wave Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Alhaandr 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! 🚀

Learn more about application limits

@Alhaandr

Copy link
Copy Markdown
Contributor Author

work done, Sir. please merge it ASAP

@phertyameen
phertyameen merged commit ca47d8d into bridgelet-org:main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment