Skip to content

fix: unpin the platform protocol version so clients auto-detect - #113

Draft
thepastaclaw wants to merge 4 commits into
dashpay:mainfrom
thepastaclaw:tracker-2594
Draft

fix: unpin the platform protocol version so clients auto-detect#113
thepastaclaw wants to merge 4 commits into
dashpay:mainfrom
thepastaclaw:tracker-2594

Conversation

@thepastaclaw

@thepastaclaw thepastaclaw commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #112.

The problem

PLATFORM_VERSION_OVERRIDE was pinned to 12 while testnet has been running protocol version 13 since late July. A pin is not a floor — in rs-sdk the version ratchet returns early when version_pinned is set, so a pinned client stays on the old version silently: no error, no warning, no matter what the network reports.

The constant's own TODO said to remove it once dashpay/platform#3809 landed in the consumed SDK. That condition is now met.

Why remove rather than bump to 13

Bumping re-arms the identical trap for protocol version 14 and leaves the failure mode intact — invisible, and (before this PR) unobservable in CI. Removing the pin is what the TODO prescribed, and auto-detection is verified working in the consumed release.

Measured against @dashevo/evo-sdk@4.1.0 and live testnet:

client config sdk.version() after connect() after first proof-bearing read
unpinned 12 13
{ version: 12 } 12 12
{ version: 13 } 13 13

Testnet reports protocol.drive.current = 13; the SDK's own ceiling (EvoSDK.getLatestVersionNumber()) is 13. So an unpinned client negotiates up to the network's active version, capped at what the SDK understands — exactly the #3809 behavior.

Changes

  • Remove the pin. createClient() no longer passes version to testnetTrusted / mainnetTrusted / localTrusted.
  • Delete platformVersion.mjs / .d.mts. The module existed only to hold this constant.
  • Example apps pass sdk.version() to document.toJSON(...) instead of the constant (dashnote, dashnote-starter, dashrate). That reflects the negotiated version and cannot go stale. DashSdk in each app gains version(): number.
  • Standalone lite pages are aligned with SDK 4.1.0. dashmint-lite.html carried the same defect independently — pinned to 11, with a comment pointing back at this constant — so it is unpinned. DashMint, Dashnote, DashRate, and DashProof lite pages now import the same Evo SDK version as their companion apps.

Regression coverage

The pin was invisible to CI: pull requests only run test:read-only, and that suite passed against a PV-13 testnet with the client stuck on 12 the whole time. Nothing asserted the negotiated version.

test/read-only.test.mjs now asserts that a createClient() client settles on the network's active protocol version after its first proof-bearing read. Verified both ways against live testnet: passes unpinned, fails with { version: 12 } restored.

The expected value is min(network active version, SDK ceiling) rather than the network version alone — when the network upgrades ahead of a released SDK the client legitimately stops at its own ceiling, and that shouldn't read as a regression. It lives in the read-only suite because that is the only root tutorial job CI runs on PRs (test:setup is not wired into any workflow), and it needs no credentials or funds (the fixture is the DPNS system contract). The same suite also checks that every standalone lite page imports exactly the Evo SDK version declared by its companion app.

Validation

All against Node 22.22.0, matching the .nvmrc 22.22 release line and package engine constraint.

gate result
npm run lint (tsc) pass
npm run test:read-only 13 passed, 1 skipped (no mnemonic)
npm run test:setup 47 passing
prettier --check (changed files) clean
dashnote build + test + lint build ok, 346 passed
dashrate build + test + lint build ok, 160 passed
dashnote-starter build + lint pass (no test suite by design)
dashmint-lab production build pass
dashproof-lab production build pass
standalone lite SDK-version regression 4/4 pass; built pages contain the 4.1.0 import
scripts/check-shared-auth-parity.sh byte-identical
dashnote load-anchor check no static evo-sdk import in entry chunk

node connect.mjs drives the real path end-to-end and reports drive: 4.1.0 on testnet.

Not verified

  • The write path. test:read-write is destructive and consumes testnet credits, and no funded PLATFORM_MNEMONIC was available here, so it was not run. This PR does not claim to have settled the open question in PLATFORM_VERSION_OVERRIDE is still pinned to 12, but testnet has been running protocol version 13 since late July #112 about whether a version-12-pinned client behaved differently for state transitions — it removes the pin so the question stops mattering. A workflow_dispatch run of the read-write suite would still be worth doing before this merges.
  • Standalone lite pages in a browser. No browser-level CDN fetch was performed. Their exact source and production-build import URLs are covered statically, while the live root regression verifies SDK 4.1.0 protocol negotiation against testnet.

Follow-ups, deliberately out of scope

Tracker: thepastaclaw/tracker#2594 (remains open pending review).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • SDK clients now automatically negotiate the compatible platform protocol version with the connected network.
    • Added access to the negotiated protocol version through the SDK interface.
  • Bug Fixes

    • Updated note and review creation flows to use the negotiated version, improving compatibility across network versions.
  • Tests

    • Added coverage verifying clients select the lower of the network’s active version and the SDK’s supported version.

thepastaclaw and others added 3 commits August 4, 2026 00:18
PLATFORM_VERSION_OVERRIDE was pinned to 12 while testnet has been running
protocol version 13 since late July. A pin is not a floor: rs-sdk's version
ratchet returns early when `version_pinned` is set, so a pinned client stays
on the old version silently — no error, no warning — no matter what the
network reports.

The pin's TODO said to remove it once dashpay/platform#3809 landed in the
consumed SDK. That condition is now met, and the behavior is verified against
the consumed @dashevo/evo-sdk 4.1.0 and live testnet:

  unpinned    after connect: 12  ->  after a proof-bearing read: 13
  version: 12 after connect: 12  ->  after a proof-bearing read: 12
  version: 13 after connect: 13  ->  after a proof-bearing read: 13

testnet reports protocol.drive.current = 13; the SDK's own ceiling
(getLatestVersionNumber) is 13. So an unpinned client negotiates its way to
the network's active version, capped at what the SDK understands.

Remove the pin rather than bumping it to 13. Bumping re-arms the same trap for
protocol version 14 and leaves the failure mode intact — silent, invisible in
CI, and only observable by manual dispatch of the read-write suite.

platformVersion.mjs existed only to hold this constant, so it goes with it.
Its other consumer was `document.toJSON(PLATFORM_VERSION_OVERRIDE)` in three
example apps; those now pass `sdk.version()`, which reflects the negotiated
version and cannot go stale.

dashmint-lite.html carried the same defect independently — pinned to 11 with a
comment pointing back at this constant — so it is unpinned too.

Co-Authored-By: Claude <noreply@anthropic.com>
The pin that dashpay#112 reported was invisible to CI: pull requests only run
test:read-only, and that suite passed against a PV-13 testnet with the client
stuck on 12 the whole time. Nothing asserted the negotiated version, so the
staleness could only be found by reading the constant.

Assert that a client from createClient() settles on the network's active
protocol version after its first proof-bearing read. Verified both ways
against live testnet: passes unpinned, fails with `{ version: 12 }` restored.

The expected value is min(network active version, SDK ceiling) rather than the
network version alone. When the network upgrades ahead of a released SDK the
client legitimately stops at its own ceiling, and that shouldn't read as a
regression.

Lives in the read-only suite because that is the only job CI runs on pull
requests; test:setup is not wired into any workflow. No credentials or funds
required — the fixture is the DPNS system contract.

Co-Authored-By: Claude <noreply@anthropic.com>
createNote and saveReview now read the negotiated protocol version off the
SDK instead of a shared constant, so the hand-rolled stubs in these suites
need to answer version(). Both stubs are cast (`as never` / `as unknown as
DashSdk`), so the compiler couldn't flag the gap — it showed up at runtime as
"sdk.version is not a function".

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The client no longer pins a platform protocol version. SDK instances expose their negotiated version, and example applications use it for document serialization. Read-only tests verify negotiation against testnet network status.

Changes

Protocol version negotiation

Layer / File(s) Summary
Remove client version pinning
setupDashClient-core.mjs, setupDashClient-core.d.mts, platformVersion.mjs, platformVersion.d.mts, example-apps/dashmint-lab/public/dashmint-lite.html
createClient and Dashmint now initialize SDK clients without a hardcoded protocol version. The PLATFORM_VERSION_OVERRIDE exports and related documentation are removed or updated.
Expose SDK version to applications
example-apps/dashnote*/src/dash/types.ts, example-apps/dashnote*/src/dash/createNote.ts, example-apps/dashrate/src/dash/*, example-apps/dashnote/test/dash.test.ts, example-apps/dashrate/test/review.test.ts
DashSdk exposes version(). Note and review serialization use the negotiated SDK version. Test mocks return version 13.
Validate negotiated version
test/read-only.test.mjs
A read-only regression test checks that the client version matches the lower of the network version and the SDK’s newest supported version.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant createClient
  participant EvoSDK
  participant DashNetwork
  Application->>createClient: create SDK client
  createClient->>EvoSDK: initialize without version override
  EvoSDK->>DashNetwork: negotiate protocol version
  DashNetwork-->>EvoSDK: return active protocol version
  EvoSDK-->>Application: expose version()
  Application->>EvoSDK: serialize document with negotiated version
Loading

Possibly related PRs

Suggested reviewers: thephez

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes remove the protocol-version pin, enable SDK negotiation, update dependent examples, and add regression coverage required by issue #112.
Out of Scope Changes check ✅ Passed All changes support issue #112 by removing the pin, updating dependent code, and testing negotiated protocol versions.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing the pinned platform protocol version to enable client auto-detection.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

PLATFORM_VERSION_OVERRIDE is still pinned to 12, but testnet has been running protocol version 13 since late July

1 participant