Skip to content

fix(web): seed the SDK at the deployment's protocol version before it connects - #744

Merged
PastaPastaPasta merged 2 commits into
masterfrom
fix/682-seed-protocol-version
Nov 25, 2026
Merged

PastaPastaPasta merged 2 commits into
masterfrom
fix/682-seed-protocol-version

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Fixes #682.

Problem

On a slow link, a first visit to /explore/ on testnet shows under Trending this week:

That read did not land
time range (IN_TIME_RANGE) queries require protocol version 14+ … this network runs protocol version 13

A new wasm-sdk (rc.8) starts at its built-in floor, 13, unless its own localStorage store (dash-sdk.protocol-version.<network>, protocol_version_store.rs) holds a learned version. The warm-up's learnVersion read gets 5 s to teach it 14; on a link slower than that, the first page query is built at 13 and the SDK refuses the timeRange query before sending it. Mainnet's snapshots are at 14 too, so a slow first visit there can hit the same thing.

Fix

The bundled contract snapshots prove the network runs their platformVersion (deploy-v2 registers only on a network at it). Before the SDK is built, seedSdkVersion raises wasm-sdk's store to that version. wasm-sdk then seeds the new SDK with with_initial_version, and auto-detect stays on. A stored version at or above it is kept. learnVersion stays as the fallback when storage is blocked.

Evidence

Live testnet, build 203aa36, fresh browser profile, every cross-origin request delayed 6 s (Playwright):

  • Before: after 15 s, Trending shows the "protocol version 13" error above.
  • With the store holding 14 before the page's scripts run (what this change writes): Trending loads and shows its normal empty state, "No repo has 5 new stars in the last week."

Tests

lib/sdk/service-addresses.test.ts: on testnet and mainnet, the SDK is constructed with 14 already in its store. A missing, lower or garbage value is raised, a higher one is never lowered, devnet is untouched, and blocked storage doesn't throw. vitest service tests pass (77) and tsc is clean.

Migration / compat check

  • Touches: one localStorage key that wasm-sdk itself owns and writes, in the same format (a decimal string), after its first proved response on every visit. Normally this only writes earlier the value the SDK would store anyway.
  • Never lowers: a stored higher version (e.g. a future 15) is kept.
  • Unknown values: wasm-sdk ignores any value it doesn't know or that sits at or below its floor, so a browser running an older build reads the key the same way.
  • Untouched: keys, vault, IndexedDB, settings, storage profiles, document formats, contracts and URLs.
  • Result: compatible, no migration needed.

🤖 Generated with Claude Code

… connects

A new wasm-sdk starts at its built-in floor (13 on rc.8) unless its
localStorage store holds a learned version. On a link slower than the
warm-up's 5 s wait, nothing taught it 14 before the first query, so
Trending's timeRange query was refused client-side with "this network
runs protocol version 13".

The bundled contract snapshots prove the network runs their version, so
raise wasm-sdk's own store (dash-sdk.protocol-version.<network>) to it
before the SDK is built. Auto-detect stays on; a higher stored version is
kept and nothing is ever lowered.

Fixes #682

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c793936-17d7-47e6-9af8-f147efe56760
Commits

Reviewing files that changed from the base of the PR and between 203aa36 and ab9e712.

Files selected for processing: 2

  • forge-web/lib/sdk/service-addresses.test.ts
  • forge-web/lib/sdk/service.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PastaPastaPasta
PastaPastaPasta merged commit c1562c9 into master Nov 25, 2026
21 checks passed
PastaPastaPasta added a commit that referenced this pull request Nov 26, 2026
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.

web: on a slow link the SDK guesses protocol version 13, so Trending fails on testnet

1 participant