Skip to content

fix(dpp): surface identifier-typed document properties as base58 in JS - #4577

Merged
QuantumExplorer merged 2 commits into
v4.2-devfrom
claude/great-wilson-800d24
Sep 1, 2026
Merged

fix(dpp): surface identifier-typed document properties as base58 in JS#4577
QuantumExplorer merged 2 commits into
v4.2-devfrom
claude/great-wilson-800d24

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Sep 1, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Since #4567/#4568 merged, the platform-test-suite "Test Suite" and "Test Suite in browser (1)" CI jobs fail on every PR against v4.2-dev:

IndexOnlyDocument.spec.js:331 — should fetch liked posts through a chained query with verified proofs
AssertionError: expected Uint8Array[...] to equal '<base58>'

The Document properties getter in wasm-dpp2 serialized property values through the non-human-readable serde path, so identifier-typed properties reached JS as Uint8Array. The chained-query surface documents them as base58 strings — that's the form inner where-clauses accept back, so a proven join value works as a pagination cursor directly (the README's documented pattern; a Uint8Array wouldn't even deserialize into the query's JSON where-clauses) — and the functional spec asserts it.

No schema threading is needed for the fix: every typed decode path already marks these values as Value::Identifier — binary document deserialization (DocumentPropertyType read) for full documents and decode_value_for_tree_keys for indexOnly index-key synthesis — so the variant alone identifies them at the JS boundary.

What was done?

  • Added platform_value_to_object_with_base58_identifiers to wasm-dpp2's serialization conversions: recursively converts Value::Identifier values to base58 Value::Text before the usual object serialization. Map keys already surfaced identifier keys as base58 via stringify_map_keys_for_object; now values match.
  • The Document properties getter uses it. Other binary properties (Value::Bytes*) still surface as Uint8Array, and toObject() / toJSON() are unchanged.

This fixes the surface uniformly for every read path that returns Document wrappers (getDocuments, getChainedDocuments inner and outer halves, DPNS, document history), in both Node and browser bundles — the failure was never browser-specific; the Node "Test Suite" job fails on the same assertion (e.g. run 33496971715).

How Has This Been Tested?

  • New wasm-dpp2 unit test: a document round-tripped through toBytes/fromBytes with a contract carrying an identifier-typed property (contentMediaType: application/x.dash.dpp.identifier) surfaces that property as the base58 string, while other properties keep their shapes. This exercises the same Value::Identifier-producing decode path the chained query verifier uses.
  • Full wasm-dpp2 unit suite: 1158 passing.
  • cargo check/clippy for wasm-dpp2 on wasm32 clean.
  • The failing functional spec IndexOnlyDocument.spec.js asserts this exact surface against a local network in the Test Suite CI jobs on this PR.

Also added packages/wasm-dpp2/** and packages/js-evo-sdk/** to the e2e-tests-changed CI filter: the suite drives the network through @dashevo/evo-sdk (wasm-dpp2 under it) since #4567, but changes to those packages didn't trigger the Test Suite jobs — including this PR's fix, which would otherwise merge unproven.

Breaking Changes

None (no consensus impact). The JS Document.properties getter now returns base58 strings instead of Uint8Array for identifier-typed properties; the only in-repo consumer asserting on this surface is the chained-query functional spec, which expects base58.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Document identifier properties are now consistently represented as Base58 strings when serialized and deserialized.
    • Other binary properties continue to be handled as binary data.
  • Tests

    • Added coverage to verify identifier and regular string property handling.
    • Expanded end-to-end test detection for relevant package changes.

The Document properties getter serialized Value::Identifier through the
non-human-readable serde path, so identifier-typed properties (typed by
binary document deserialization and index-key synthesis alike) reached
JS as Uint8Array. The chained-query surface documents them as base58 —
the form where-clauses accept back as a pagination cursor — and the
platform-test-suite asserts it, failing the Test Suite and browser CI
jobs on every PR since #4567.

Convert Value::Identifier values to base58 strings in the properties
getter (map keys already got this via stringify_map_keys_for_object);
other binary properties stay Uint8Array, and toObject/toJSON are
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 1, 2026
@thepastaclaw

thepastaclaw commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review — 40 ahead in queue (commit a768ceb)
Queue position: 41/41

The suite drives the network through @dashevo/evo-sdk (wasm-dpp2 under
it) since the chained-query coverage landed, but neither package was in
the e2e-tests-changed filter, so changes to them shipped without the
suite running.

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

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: a8f88a8c-d9e6-4d47-b2a2-d8475711bb03

📥 Commits

Reviewing files that changed from the base of the PR and between fba1a25 and a768ceb.

📒 Files selected for processing (4)
  • .github/workflows/tests.yml
  • packages/wasm-dpp2/src/data_contract/document/model.rs
  • packages/wasm-dpp2/src/serialization/conversions.rs
  • packages/wasm-dpp2/tests/unit/Document.spec.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Document property serialization now exposes identifier values as Base58 strings while preserving binary values as Uint8Array. Tests cover document roundtripping, and the E2E path filter now tracks both affected packages.

Changes

Identifier property serialization

Layer / File(s) Summary
Identifier-aware value conversion
packages/wasm-dpp2/src/serialization/conversions.rs
Adds recursive conversion of identifier values to Base58 text before JavaScript object serialization. Binary values remain Uint8Array, and map keys remain unchanged.
Document property integration and validation
packages/wasm-dpp2/src/data_contract/document/model.rs, packages/wasm-dpp2/tests/unit/Document.spec.ts
DocumentWasm::properties uses identifier-aware serialization. The document roundtrip test verifies Base58 identifier output and unchanged string properties.
E2E change detection
.github/workflows/tests.yml
The E2E path filter now includes changes under packages/wasm-dpp2/** and packages/js-evo-sdk/**.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a768c

Document properties now expose identifier-typed values as base58 strings while preserving existing representations for other values; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant DocumentWasm
  participant IdentifierConversion
  participant JavaScriptObject
  DocumentWasm->>IdentifierConversion: serialize document properties
  IdentifierConversion->>IdentifierConversion: convert identifiers to Base58 text
  IdentifierConversion->>JavaScriptObject: return identifiers as strings and bytes as Uint8Array
Loading

Suggested reviewers: shumkov

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: exposing identifier-typed document properties as Base58 strings in JavaScript.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/great-wilson-800d24

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.

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@QuantumExplorer
QuantumExplorer merged commit 0c2f337 into v4.2-dev Sep 1, 2026
16 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/great-wilson-800d24 branch September 1, 2026 11:37
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.88%. Comparing base (3630a61) to head (a768ceb).
⚠️ Report is 2 commits behind head on v4.2-dev.

Additional details and impacted files
@@             Coverage Diff              @@
##           v4.2-dev    #4577      +/-   ##
============================================
- Coverage     87.10%   84.88%   -2.22%     
============================================
  Files          2756     2786      +30     
  Lines        359634   370054   +10420     
============================================
+ Hits         313247   314118     +871     
- Misses        46387    55936    +9549     
Components Coverage Δ
dpp 83.80% <ø> (-4.58%) ⬇️
drive 83.81% <ø> (-1.96%) ⬇️
drive-abci 89.53% <ø> (-0.21%) ⬇️
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.92% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 41.10% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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