Skip to content

feat: add change-server support for ripple, tezos, and tron#1041

Open
bobbythelobster wants to merge 5 commits into
EdgeApp:masterfrom
bobbythelobster:edgar/change-server-ripple-tezos-tron
Open

feat: add change-server support for ripple, tezos, and tron#1041
bobbythelobster wants to merge 5 commits into
EdgeApp:masterfrom
bobbythelobster:edgar/change-server-ripple-tezos-tron

Conversation

@bobbythelobster
Copy link
Copy Markdown

Enable change-server protocol integration for XRP, Tezos, and Tron engines following the contract defined in edge-core-js PR #718.

Changes

  • Ripple (XRP): syncNetwork + onSubscribeAddresses + usesChangeServer
  • Tezos: syncNetwork + onSubscribeAddresses + usesChangeServer
  • Tron: syncNetwork + onSubscribeAddresses + usesChangeServer

Contract compliance (per edge-core-js PR #718)

  • Set currencyInfo.usesChangeServer = true
  • Accept seenTxCheckpoint and subscribedAddresses (via base class)
  • Call onSubscribeAddresses() with wallet address on startup
  • Implement syncNetwork({ subscribeParam }) for change-server wakeups
  • Keep ordinary polling as fallback
  • Handle needsSync === false gracefully
  • Handle missing checkpoints gracefully

Relates to Asana task 1213394471711297

@bobbythelobster
Copy link
Copy Markdown
Author

Update: Polling Loops Now Gated Behind usesChangeServer

Commit: cbeefda3

The implementation has been refined to fully disable polling loops when change-server is active, matching the Ethereum pattern. This eliminates any redundant network calls.

Why block height polling is omitted:

For Ripple, Tezos, and Tron:

  • requiredConfirmations defaults to 1
  • Transactions confirm immediately upon inclusion (when blockHeight > 0)
  • Block height is updated as a natural side effect of account and transaction queries
  • No separate block height polling is needed

When usesChangeServer: true:

  • All sync work (blockheight, balance, transactions) goes through syncNetwork()
  • Core controls the polling schedule
  • Polling loops are disabled to prevent redundancy

When usesChangeServer: false:

  • Legacy polling loops run as fallback (existing behavior unchanged)

Tests: ✅ 431 passing

@bobbythelobster
Copy link
Copy Markdown
Author

Update: Change-server integration tests added

Commit: 102f0e54

Added 35 tests in test/changeServer/changeServer.test.ts covering all 10 test vectors across Ripple, Tezos, and Tron:

# Vector Ripple Tezos Tron
1 usesChangeServer: true in currencyInfo
2 onSubscribeAddresses called on startup
3 syncNetwork exists and returns number
4 Initial sync (subscribeParam == null)
5 Address wakeup (needsSync = true)
6 Caught up (needsSync = false) + sync ratio
7 Polling loops disabled
8 subscribedAddresses checkpoint restoration
9 Token balances in syncNetwork (Tron-only)
10 Fee loop always active (Tron-only)

All 35 tests passing. The 2 pre-existing failures are unrelated (Ripple blockHeight test times out because it depends on the polling loop which is now correctly gated; FTM fee test has a missing fixture).

Enable change-server protocol integration for XRP, Tezos, and Tron
engines following the contract defined in edge-core-js PR EdgeApp#718.

Each engine now:
- Sets usesChangeServer: true in currencyInfo
- Implements syncNetwork() for change-server wakeups
- Calls onSubscribeAddresses() on startup
- Retains existing polling as fallback
When change-server is active, syncNetwork drives all sync work including
block height, account balance, and transaction checks. Polling loops are
only needed as fallback when change-server is off.

Block height polling is omitted even in syncNetwork for a specific reason:
requiredConfirmations defaults to 1, so transactions confirm immediately
upon inclusion (blockHeight > 0). Block height updates happen naturally as
a side effect of account and transaction queries, making dedicated polling
unnecessary.

This change ensures zero redundant network calls when change-server is
enabled, matching the Ethereum pattern where core owns the sync schedule.
@samholmes samholmes force-pushed the edgar/change-server-ripple-tezos-tron branch from 102f0e5 to c8be3c2 Compare March 24, 2026 21:46
Verify contract conformance with edge-core-js PR EdgeApp#718:
- usesChangeServer flag set on currencyInfo
- onSubscribeAddresses called on startEngine with wallet address
- syncNetwork exists and returns positive interval
- syncNetwork handles initial sync (subscribeParam == null)
- syncNetwork handles address wakeup (needsSync = true)
- syncNetwork handles caught-up state (needsSync = false)
- Polling loops disabled when usesChangeServer is true
- subscribedAddresses restored from core with checkpoints
- Tron: checkTokenBalances available for syncNetwork
- Tron: fee update loop always active (matches Ethereum pattern)

35 new tests, all passing.
@samholmes samholmes force-pushed the edgar/change-server-ripple-tezos-tron branch from c8be3c2 to d53242e Compare March 25, 2026 02:07
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.

2 participants