Skip to content

feat(sdk): enable proof support for most queries#2718

Merged
QuantumExplorer merged 5 commits into
v2.1-devfrom
fix-wasm-sdk-proof-support
Aug 6, 2025
Merged

feat(sdk): enable proof support for most queries#2718
QuantumExplorer merged 5 commits into
v2.1-devfrom
fix-wasm-sdk-proof-support

Conversation

@thephez
Copy link
Copy Markdown
Collaborator

@thephez thephez commented Aug 5, 2025

Issue being fixed or feature implemented

The WASM SDK lacked proof toggle functionality for numerous queries that had available WASM proof variants, preventing users from accessing cryptographic verification metadata.

What was done?

  • Added missing WASM function imports for most proof variants
  • Implemented JavaScript proof toggle logic for data contract, voting, and identity queries
  • Un-skipped previously disabled proof tests
  • Maintained backward compatibility

How Has This Been Tested?

  • Built WASM SDK with ./build.sh
  • All 19 automated proof tests passed
  • Verified proof responses contain expected metadata
  • Confirmed UI toggle functionality works correctly

Breaking Changes

None

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 made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Added support for querying proof information across various identity, data contract, document, token, voting, and group queries in the WASM SDK UI. Users can now enable a toggle to retrieve proof info with their queries.
  • Tests

    • Enabled tests for data contract queries with proof info and expanded proof info testing for multiple identity-related queries.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 5, 2025

Walkthrough

Support for querying with proof information has been introduced across multiple query types in the WASM SDK UI. New functions suffixed with _with_proof_info are imported and conditionally invoked based on a "With Proof Info" toggle. Corresponding automated tests are updated to enable and validate proof info support for these queries.

Changes

Cohort / File(s) Change Summary
WASM SDK UI Query Proof Support
packages/wasm-sdk/index.html
Imports new _with_proof_info query functions and updates query execution logic to invoke them when proofs enabled.
UI Automation Test Proof Activation
packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
Unskips proof info tests for data contract queries and enables proof support in identity-related query tests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant WASM_SDK

    User->>UI: Toggle "With Proof Info" and submit query
    UI->>UI: Check useProofs flag
    alt useProofs enabled
        UI->>WASM_SDK: Call *_with_proof_info function
    else useProofs disabled
        UI->>WASM_SDK: Call regular query function
    end
    WASM_SDK-->>UI: Return query result (with or without proof info)
    UI-->>User: Display result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

enhancement, js-sdk

Suggested reviewers

  • QuantumExplorer
  • shumkov

Poem

In the warren of code, a toggle appears,
Now queries bring proofs, dispelling old fears.
With with_proof_info we leap and we bound,
Ensuring our data is safe and sound.
Tests now awakened, no longer they sleep—
A rabbit’s delight in a code review deep! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-wasm-sdk-proof-support

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thephez thephez marked this pull request as ready for review August 5, 2025 13:19
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76ef999 and a2f792d.

📒 Files selected for processing (2)
  • packages/wasm-sdk/index.html (8 hunks)
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
packages/wasm-sdk/index.html

📄 CodeRabbit Inference Engine (CLAUDE.md)

Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Files:

  • packages/wasm-sdk/index.html
packages/wasm-sdk/**/index.html

📄 CodeRabbit Inference Engine (packages/wasm-sdk/CLAUDE.md)

packages/wasm-sdk/**/index.html: When adding new queries or state transitions, update the definitions in index.html.
The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Files:

  • packages/wasm-sdk/index.html
🧠 Learnings (21)
📓 Common learnings
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2318
File: .github/workflows/tests-build-image.yml:45-45
Timestamp: 2024-11-13T10:31:30.891Z
Learning: In the dashpay/platform repository, changes to `.github/workflows/tests-build-image.yml` that switch the Docker image platform from `linux/arm64` to `linux/amd64` for testing purposes are acceptable when required to run on GitHub-hosted runners. ARM64 testing is covered on the testnet.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'
📚 Learning: quantumexplorer determined that a coderabbit suggestion about fixing signable_bytes calculation in i...
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: applies to packages/wasm-sdk/**/index.html : when adding new queries or state transitions, update th...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/**/index.html : the wasm sdk now fully supports where and orderby claus...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: in packages/wasm-sdk/ai_reference.md, the documentation correctly shows the actual sdk method signat...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : the wasm sdk now fully supports where and orderby clauses...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: in `packages/wallet-contract/test/bootstrap.js`, for mocha tests in node.js, async functions like `l...
Learnt from: shumkov
PR: dashpay/platform#2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In `packages/wallet-contract/test/bootstrap.js`, for Mocha tests in Node.js, async functions like `loadWasmDpp` can be assigned directly to `beforeAll` without wrapping them in another async function.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification...
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/index.html : test the wasm sdk using the web interface at 'index.html' ...
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/**/generate_docs.py : when adding new queries or state transitions, run...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: in rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defi...
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in packages/wasm-sdk/test/ui-automation/run-ui-tests.sh, the script doesn't require cleanup handling...
Learnt from: thephez
PR: dashpay/platform#2715
File: packages/wasm-sdk/test/ui-automation/run-ui-tests.sh:6-286
Timestamp: 2025-07-31T18:15:51.813Z
Learning: In packages/wasm-sdk/test/ui-automation/run-ui-tests.sh, the script doesn't require cleanup handling because it relies on Playwright's built-in webServer configuration to manage the HTTP server lifecycle automatically. The script only runs foreground processes through npm/Playwright commands.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in the rust sdk's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`...
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : when implementing wasm sdk functionality, always refer to...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : token functions are methods on wasmsdk, not standalone fu...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : for wasm builds, fix 'time not implemented on this platfo...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in packages/wasm-sdk/docs.html, quantumexplorer confirmed that placeholder private keys in documenta...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in packages/wasm-sdk, the wallet helper `derive_key_from_seed_with_path` (rust function in src/walle...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/index.html:4360-4416
Timestamp: 2025-07-28T20:04:48.458Z
Learning: In packages/wasm-sdk, the wallet helper `derive_key_from_seed_with_path` (Rust function in src/wallet/key_derivation.rs) is synchronous; its JS wrapper returns a value immediately, so `await` is unnecessary.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request obj...
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in the implementation of `fromproof` in `package...
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, ...
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.

Applied to files:

  • packages/wasm-sdk/index.html
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: build-wasm-sdk
  • GitHub Check: build-and-test-wasm-sdk
🔇 Additional comments (3)
packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js (3)

310-334: LGTM! Test activation aligns with proof support enhancement.

The getDataContracts query with proof info test has been properly activated. The implementation follows the established pattern using executeQueryWithProof helper and appropriate validation functions.


336-361: LGTM! Consistent test activation for contract history queries.

The getDataContractHistory query with proof info test has been appropriately enabled. The implementation is consistent with other proof tests and includes proper validation for contract history data structures.


574-586: LGTM! Comprehensive proof support activation for identity queries.

The systematic enabling of proof support for multiple identity queries is well-executed. The changes correctly update only the hasProofSupport flags while maintaining existing validation functions, ensuring that proof tests will now run for these previously unsupported queries.

Comment thread packages/wasm-sdk/index.html
  1. Identified the root cause: The Rust proof function doesn't support "search" key request type and lacks the
  search_purpose_map parameter
  2. Implemented graceful fallback: When keyRequestType === 'search' and proofs are enabled, the code now falls back to the
  non-proof version with a console warning
@thephez thephez added this to the v2.1 milestone Aug 5, 2025
@thephez thephez changed the title feat(sdk): enable proof support for more queries feat(sdk): enable proof support for most queries Aug 5, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/wasm-sdk/index.html (1)

4200-4233: Duplicate else-if branches produce dead code

getFinalizedEpochInfos and the two getEvonodesProposedEpochBlocks* cases are implemented twice in the giant else-if chain: first at Lines 4200-4233 (with proof support) and again at Lines 4490-4505 (non-proof only).
Because the chain short-circuits on the first match, the later branches are unreachable and will never execute.

Besides confusing future readers, this duplication risks accidental divergence when only one copy is edited.

Delete the second copies and keep the fully-featured versions.

Also applies to: 4490-4506

🧹 Nitpick comments (1)
packages/wasm-sdk/index.html (1)

1076-1208: Redundant double-import inflates bundle and obscures tree-shaking

All individual SDK symbols are imported explicitly (Lines 1068-1203).
Immediately after, the same module is imported again with a namespace wildcard (Lines 1205-1206):

import * as queryFunctions from './pkg/wasm_sdk.js';

This second import is unnecessary—the module is already instantiated once per ES-module rules—and it prevents bundlers from shaking out the large symbol list you just enumerated. Unless you really need reflective access via queryFunctions[fnName], drop the wildcard import and keep the explicit list (or vice-versa).

-import * as queryFunctions from './pkg/wasm_sdk.js';

Keeping only one style simplifies maintenance and avoids redundant specifiers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92af0ce and 56724be.

📒 Files selected for processing (1)
  • packages/wasm-sdk/index.html (17 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
packages/wasm-sdk/index.html

📄 CodeRabbit Inference Engine (CLAUDE.md)

Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Files:

  • packages/wasm-sdk/index.html
packages/wasm-sdk/**/index.html

📄 CodeRabbit Inference Engine (packages/wasm-sdk/CLAUDE.md)

packages/wasm-sdk/**/index.html: When adding new queries or state transitions, update the definitions in index.html.
The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Files:

  • packages/wasm-sdk/index.html
🧠 Learnings (20)
📓 Common learnings
Learnt from: thephez
PR: dashpay/platform#2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.103Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: lklimek
PR: dashpay/platform#2318
File: .github/workflows/tests-build-image.yml:45-45
Timestamp: 2024-11-13T10:31:30.891Z
Learning: In the dashpay/platform repository, changes to `.github/workflows/tests-build-image.yml` that switch the Docker image platform from `linux/arm64` to `linux/amd64` for testing purposes are acceptable when required to run on GitHub-hosted runners. ARM64 testing is covered on the testnet.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Use 'rs-drive-proof-verifier' for cryptographic proof verification
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.
📚 Learning: the get_identity_keys_with_proof_info function in the rust wasm bindings does not support the "searc...
Learnt from: thephez
PR: dashpay/platform#2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.103Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : the wasm sdk now fully supports where and orderby clauses...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/**/index.html : the wasm sdk now fully supports where and orderby claus...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/**/index.html : when adding new queries or state transitions, update th...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : when implementing wasm sdk functionality, always refer to...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in packages/wasm-sdk/ai_reference.md, the documentation correctly shows the actual sdk method signat...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : token functions are methods on wasmsdk, not standalone fu...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification...
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: applies to packages/wasm-sdk/index.html : test the wasm sdk using the web interface at 'index.html' ...
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: quantumexplorer determined that a coderabbit suggestion about fixing signable_bytes calculation in i...
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in packages/wasm-sdk/docs.html, quantumexplorer confirmed that placeholder private keys in documenta...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in packages/wasm-sdk, the wallet helper `derive_key_from_seed_with_path` (rust function in src/walle...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/index.html:4360-4416
Timestamp: 2025-07-28T20:04:48.458Z
Learning: In packages/wasm-sdk, the wallet helper `derive_key_from_seed_with_path` (Rust function in src/wallet/key_derivation.rs) is synchronous; its JS wrapper returns a value immediately, so `await` is unnecessary.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in the `packages/rs-drive-proof-verifier`, avoid suggesting size limits for `proof_bytes` in errors ...
Learnt from: QuantumExplorer
PR: dashpay/platform#2332
File: packages/rs-drive-proof-verifier/src/error.rs:21-23
Timestamp: 2024-11-15T14:39:23.704Z
Learning: In the `packages/rs-drive-proof-verifier`, avoid suggesting size limits for `proof_bytes` in errors unless there's a specific need, as it may not be necessary.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in the rust sdk's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`...
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request obj...
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in the implementation of `fromproof` in `package...
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: the `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its we...
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, ...
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.

Applied to files:

  • packages/wasm-sdk/index.html
📚 Learning: in the `transition_to_version_8` function, errors from `grove_get_path_query` when retrieving active...
Learnt from: shumkov
PR: dashpay/platform#2422
File: packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:152-163
Timestamp: 2025-01-15T08:09:59.365Z
Learning: In the `transition_to_version_8` function, errors from `grove_get_path_query` when retrieving active contested resource votes are intentionally logged and ignored (returning `Ok(())`) to allow the protocol upgrade to proceed despite query failures.

Applied to files:

  • packages/wasm-sdk/index.html
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: build-wasm-sdk
  • GitHub Check: build-and-test-wasm-sdk
🔇 Additional comments (1)
packages/wasm-sdk/index.html (1)

3796-3830: Nice adherence to known SDK limitation

Fallback to the non-proof version when keyRequestType === 'search' (Lines 3797-3808) matches the documented gap in get_identity_keys_with_proof_info support (see learning from 2025-08-05). Good defensive handling.

@QuantumExplorer QuantumExplorer merged commit be080b5 into v2.1-dev Aug 6, 2025
25 checks passed
@QuantumExplorer QuantumExplorer deleted the fix-wasm-sdk-proof-support branch August 6, 2025 08:19
@coderabbitai coderabbitai Bot mentioned this pull request Sep 23, 2025
6 tasks
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