Skip to content

Conversation

QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Jul 14, 2025

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive user and AI-optimized documentation for the WASM JS SDK, including interactive HTML docs and a detailed Markdown reference.
    • Added automated documentation checks and CI integration to ensure SDK documentation stays up to date.
    • Enhanced SDK with new test pages demonstrating identity key management, group queries, proof handling, serialization, cache inspection, post creation, and public key derivation.
    • Improved query support for identity keys with multiple request types and added support for path parameters in system queries, including proof-enabled variants.
    • Added a new SDK manager for iframe-based initialization.
    • Added a consistent header and navigation bar to the WASM SDK demo UI.
  • Bug Fixes

    • Resolved issues with nonce and balance retrieval consistency in identity queries.
  • Documentation

    • Added and updated guides for SDK usage, development workflow, and documentation maintenance.
    • Provided explicit instructions for contributing, testing, and regenerating documentation.
  • Chores

    • Updated ignore rules for build artifacts and documentation outputs.
    • Automated documentation validation and regeneration in CI workflows.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

This update introduces comprehensive documentation tooling, test harnesses, and enhancements for the Dash Platform WASM JS SDK. It adds automated documentation checks and generation, a detailed AI reference, user-facing docs, and multiple HTML-based test pages. The WASM SDK itself gains extended identity key and path query support, and new SDK management utilities.

Changes

File(s) Change Summary
.github/grpc-queries-cache.json Updated status for "getTokenContractInfo" query and timestamp.
.github/scripts/check-grpc-coverage.py Added WASM SDK documentation check and integrated it into coverage reporting.
.github/workflows/wasm-sdk-documentation-check.yml New GitHub Actions workflow for automated WASM SDK documentation validation and maintenance.
.gitignore Added ignore rules for WASM SDK build and doc artifacts.
CLAUDE.md Documented WASM SDK as a key component and added development workflow steps.
packages/wasm-sdk/.gitignore Stopped ignoring Cargo.lock in WASM SDK.
packages/wasm-sdk/AI_REFERENCE.md New, comprehensive AI-optimized reference for the WASM JS SDK.
packages/wasm-sdk/CLAUDE.md Added sections on documentation usage and maintenance for WASM SDK.
packages/wasm-sdk/README.md New README with usage, development, and architecture details for the WASM SDK.
packages/wasm-sdk/check_documentation.py New script to validate that all queries and transitions are documented.
packages/wasm-sdk/docs_manifest.json New manifest listing all documented queries and transitions.
packages/wasm-sdk/extract_definitions.py New script to extract SDK definitions from index.html for doc generation.
packages/wasm-sdk/fixed_definitions.json New fixed schema file for all queries and transitions in the WASM SDK.
packages/wasm-sdk/generate_docs.py New documentation generator producing HTML and Markdown docs from SDK definitions.
packages/wasm-sdk/index.html Added header/nav, extended query logic for identity keys and path elements.
packages/wasm-sdk/sdk-manager.js New SdkManager class for managing SDK in iframe and message-based command execution.
packages/wasm-sdk/src/queries/identity.rs Extended get_identity_keys functions to support "all", "specific", and "search" request types.
packages/wasm-sdk/src/queries/system.rs Modified path element queries to accept and process dynamic path parameters.
packages/wasm-sdk/tests/check_identity_keys.html New HTML test page for checking identity keys and authentication keys.
packages/wasm-sdk/tests/check_posts.html New HTML test page for querying and displaying posts by identity.
packages/wasm-sdk/tests/derive_public_key.html New HTML test page for deriving public key from private key WIF.
packages/wasm-sdk/tests/test-cache.html New HTML test page for inspecting service worker and cache status.
packages/wasm-sdk/tests/test_group_queries.html, test_groups.html New HTML test pages for group query validation using WASM SDK.
packages/wasm-sdk/tests/test_nonce.html New HTML test page for comparing identity balance and nonce values.
packages/wasm-sdk/tests/test_post_create.html New HTML test page for creating posts using the WASM SDK.
packages/wasm-sdk/tests/test_proof.html, test_proof.js, test_proof_result.html, ... New HTML and JS test pages/scripts for proof-related SDK queries and display.
packages/wasm-sdk/tests/test_serialization.html New HTML test page for serialization testing of various object types.
packages/wasm-sdk/tests/verify_proof_display.html New HTML page for verifying proof display UI and supported queries.

Sequence Diagram(s)

WASM SDK Documentation Check Flow

sequenceDiagram
    participant CI as GitHub Actions Workflow
    participant Repo as Repository
    participant DocCheck as check_documentation.py
    participant Dev as Developer

    CI->>Repo: Trigger on PR/Push/Manual Dispatch
    CI->>DocCheck: Run documentation check script
    DocCheck->>Repo: Read index.html, docs_manifest.json, AI_REFERENCE.md, docs.html
    DocCheck->>DocCheck: Extract definitions, compare with manifest
    DocCheck->>CI: Return success or error report
    alt On PR with errors
        CI->>Dev: Post/update PR comment with errors and fix instructions
        CI->>CI: Fail workflow
    else On Push to main with errors
        CI->>Repo: Auto-regenerate docs, commit, and push
    end
Loading

Extended Identity Key Query Flow

sequenceDiagram
    participant JS as JS UI (index.html)
    participant SDK as WASM SDK (identity.rs)
    JS->>SDK: get_identity_keys(identity_id, key_request_type, ...)
    alt key_request_type == "all"
        SDK->>SDK: Fetch all keys
    else key_request_type == "specific"
        SDK->>SDK: Fetch only specific key IDs
    else key_request_type == "search"
        SDK->>SDK: Parse search_purpose_map, fetch matching keys
    end
    SDK->>JS: Return keys or error
Loading

Possibly related PRs

Poem

🐇✨
In a warren of docs and code,
New scripts and tests now softly load.
Proofs and keys, with paths anew,
The SDK grows both strong and true.
With docs that build and checks that run,
This bunny’s work is never done!
🥕

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

Copy link

github-actions bot commented Jul 14, 2025

✅ gRPC Query Coverage Report

================================================================================
gRPC Query Coverage Report - NEW QUERIES ONLY
================================================================================

Total queries in proto: 47
Previously known queries: 47
New queries found: 0


================================================================================
Summary:
--------------------------------------------------------------------------------
No new queries found

Total known queries: 47
  - Implemented: 44
  - Not implemented: 2
  - Excluded: 1

Not implemented queries:
  - getConsensusParams
  - getTokenPreProgrammedDistributions


} catch (error) {
console.error('Error:', error);
resultDiv.innerHTML = 'Error: ' + (error.message || error);

Check warning

Code scanning / CodeQL

Exception text reinterpreted as HTML Medium test

Exception text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 3 months ago

To prevent the XSS vulnerability, error messages should be escaped before being inserted into the DOM. The best fix is to use a utility function or library to sanitize the error message by escaping special HTML characters (<, >, &, ", ', etc.). This ensures that even if the error contains malicious input, it will be treated as plain text rather than executable HTML or JavaScript.

In this specific case:

  1. Add a generic utility function escapeHTML to sanitize strings before assigning them to innerHTML.
  2. Apply escapeHTML to error.message || error on line 132.

Suggested changeset 1
packages/wasm-sdk/tests/check_identity_keys.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/wasm-sdk/tests/check_identity_keys.html b/packages/wasm-sdk/tests/check_identity_keys.html
--- a/packages/wasm-sdk/tests/check_identity_keys.html
+++ b/packages/wasm-sdk/tests/check_identity_keys.html
@@ -81,6 +81,12 @@
         
         let sdk = null;
         
+        function escapeHTML(string) {
+            const div = document.createElement('div');
+            div.appendChild(document.createTextNode(string));
+            return div.innerHTML;
+        }
+        
         async function initSDK() {
             await init();
             const builder = new WasmSdkBuilder();
@@ -129,7 +135,7 @@
                 
             } catch (error) {
                 console.error('Error:', error);
-                resultDiv.innerHTML = 'Error: ' + (error.message || error);
+                resultDiv.innerHTML = 'Error: ' + escapeHTML(error.message || String(error));
                 resultDiv.className = 'error';
             }
         };
EOF
@@ -81,6 +81,12 @@

let sdk = null;

function escapeHTML(string) {
const div = document.createElement('div');
div.appendChild(document.createTextNode(string));
return div.innerHTML;
}

async function initSDK() {
await init();
const builder = new WasmSdkBuilder();
@@ -129,7 +135,7 @@

} catch (error) {
console.error('Error:', error);
resultDiv.innerHTML = 'Error: ' + (error.message || error);
resultDiv.innerHTML = 'Error: ' + escapeHTML(error.message || String(error));
resultDiv.className = 'error';
}
};
Copilot is powered by AI and may make mistakes. Always verify output.

} catch (error) {
console.error('Error:', error);
resultDiv.innerHTML = 'Error: ' + (error.message || error);

Check warning

Code scanning / CodeQL

Exception text reinterpreted as HTML Medium test

Exception text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 3 months ago

To fix the issue, encode the exception text before inserting it into the DOM. This ensures that any meta-characters in the exception message are treated as plain text rather than HTML, mitigating the risk of XSS. A safe and standard approach involves using textContent instead of innerHTML for setting the text content of the resultDiv, as textContent automatically escapes meta-characters. Alternatively, a library like DOMPurify can be used for sanitization, but this is unnecessary here since textContent suffices.

Changes needed:

  1. Replace innerHTML on line 195 with textContent to safely insert the error message into resultDiv.
  2. Ensure no functionality is lost (e.g., preserving the format of the error message).

Suggested changeset 1
packages/wasm-sdk/tests/check_identity_keys.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/wasm-sdk/tests/check_identity_keys.html b/packages/wasm-sdk/tests/check_identity_keys.html
--- a/packages/wasm-sdk/tests/check_identity_keys.html
+++ b/packages/wasm-sdk/tests/check_identity_keys.html
@@ -192,7 +192,7 @@
                 
             } catch (error) {
                 console.error('Error:', error);
-                resultDiv.innerHTML = 'Error: ' + (error.message || error);
+                resultDiv.textContent = 'Error: ' + (error.message || error);
                 resultDiv.className = 'error';
             }
         };
EOF
@@ -192,7 +192,7 @@

} catch (error) {
console.error('Error:', error);
resultDiv.innerHTML = 'Error: ' + (error.message || error);
resultDiv.textContent = 'Error: ' + (error.message || error);
resultDiv.className = 'error';
}
};
Copilot is powered by AI and may make mistakes. Always verify output.

resultDiv.innerHTML = '<div class="key-section">';
resultDiv.innerHTML += '<h3>Private Key Info:</h3>';
resultDiv.innerHTML += 'WIF: ' + privateKeyWif + '<br>';

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium test

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 3 months ago

To fix the issue, user-controlled data (privateKeyWif) must be sanitized or properly escaped before being included in the DOM. The most appropriate solution here is to use textContent instead of innerHTML when injecting textual content into the DOM. textContent ensures that the provided data is treated as plain text and prevents it from being interpreted as HTML, thereby mitigating the XSS risk.

For lines where HTML structure is necessary (e.g., adding <br> tags), a safer approach is to construct the DOM elements programmatically using methods like document.createElement and appendChild.

Suggested changeset 1
packages/wasm-sdk/tests/derive_public_key.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/wasm-sdk/tests/derive_public_key.html b/packages/wasm-sdk/tests/derive_public_key.html
--- a/packages/wasm-sdk/tests/derive_public_key.html
+++ b/packages/wasm-sdk/tests/derive_public_key.html
@@ -83,27 +83,25 @@
                 const publicKeyBytes = publicKey.toBuffer();
                 const publicKeyHex = publicKeyBytes.toString('hex');
                 
-                resultDiv.innerHTML = '<div class="key-section">';
-                resultDiv.innerHTML += '<h3>Private Key Info:</h3>';
-                resultDiv.innerHTML += 'WIF: ' + privateKeyWif + '<br>';
-                resultDiv.innerHTML += 'Network: ' + privateKey.network.name + '<br><br>';
+                const keySection = document.createElement('div');
+                keySection.className = 'key-section';
                 
-                resultDiv.innerHTML += '<h3>Public Key Info:</h3>';
-                resultDiv.innerHTML += 'Compressed Public Key (hex): ' + publicKeyHex + '<br>';
-                resultDiv.innerHTML += 'Public Key Length: ' + publicKeyBytes.length + ' bytes<br>';
-                resultDiv.innerHTML += 'Is Compressed: ' + publicKey.compressed + '<br><br>';
+                const privateKeyHeader = document.createElement('h3');
+                privateKeyHeader.textContent = 'Private Key Info:';
+                keySection.appendChild(privateKeyHeader);
                 
-                // Convert to base64 for comparison with identity keys
-                const publicKeyBase64 = btoa(String.fromCharCode.apply(null, publicKeyBytes));
-                resultDiv.innerHTML += 'Public Key (base64): ' + publicKeyBase64 + '<br><br>';
+                const privateKeyInfo = document.createElement('p');
+                privateKeyInfo.textContent = 'WIF: ' + privateKeyWif;
+                keySection.appendChild(privateKeyInfo);
                 
-                resultDiv.innerHTML += '<h3>Instructions:</h3>';
-                resultDiv.innerHTML += '1. Copy the base64 public key above<br>';
-                resultDiv.innerHTML += '2. Go to the Check Identity Keys page<br>';
-                resultDiv.innerHTML += '3. Compare this public key with the "data" field of authentication keys<br>';
-                resultDiv.innerHTML += '4. They should match exactly for the key to work<br>';
-                resultDiv.innerHTML += '</div>';
+                const networkInfo = document.createElement('p');
+                networkInfo.textContent = 'Network: ' + privateKey.network.name;
+                keySection.appendChild(networkInfo);
                 
+                const publicKeyHeader = document.createElement('h3');
+                publicKeyHeader.textContent = 'Public Key Info:';
+                keySection.appendChild
+                
             } catch (error) {
                 resultDiv.innerHTML = '<div style="color: red;">Error: ' + error.message + '</div>';
                 console.error('Error:', error);
EOF
@@ -83,27 +83,25 @@
const publicKeyBytes = publicKey.toBuffer();
const publicKeyHex = publicKeyBytes.toString('hex');

resultDiv.innerHTML = '<div class="key-section">';
resultDiv.innerHTML += '<h3>Private Key Info:</h3>';
resultDiv.innerHTML += 'WIF: ' + privateKeyWif + '<br>';
resultDiv.innerHTML += 'Network: ' + privateKey.network.name + '<br><br>';
const keySection = document.createElement('div');
keySection.className = 'key-section';

resultDiv.innerHTML += '<h3>Public Key Info:</h3>';
resultDiv.innerHTML += 'Compressed Public Key (hex): ' + publicKeyHex + '<br>';
resultDiv.innerHTML += 'Public Key Length: ' + publicKeyBytes.length + ' bytes<br>';
resultDiv.innerHTML += 'Is Compressed: ' + publicKey.compressed + '<br><br>';
const privateKeyHeader = document.createElement('h3');
privateKeyHeader.textContent = 'Private Key Info:';
keySection.appendChild(privateKeyHeader);

// Convert to base64 for comparison with identity keys
const publicKeyBase64 = btoa(String.fromCharCode.apply(null, publicKeyBytes));
resultDiv.innerHTML += 'Public Key (base64): ' + publicKeyBase64 + '<br><br>';
const privateKeyInfo = document.createElement('p');
privateKeyInfo.textContent = 'WIF: ' + privateKeyWif;
keySection.appendChild(privateKeyInfo);

resultDiv.innerHTML += '<h3>Instructions:</h3>';
resultDiv.innerHTML += '1. Copy the base64 public key above<br>';
resultDiv.innerHTML += '2. Go to the Check Identity Keys page<br>';
resultDiv.innerHTML += '3. Compare this public key with the "data" field of authentication keys<br>';
resultDiv.innerHTML += '4. They should match exactly for the key to work<br>';
resultDiv.innerHTML += '</div>';
const networkInfo = document.createElement('p');
networkInfo.textContent = 'Network: ' + privateKey.network.name;
keySection.appendChild(networkInfo);

const publicKeyHeader = document.createElement('h3');
publicKeyHeader.textContent = 'Public Key Info:';
keySection.appendChild

} catch (error) {
resultDiv.innerHTML = '<div style="color: red;">Error: ' + error.message + '</div>';
console.error('Error:', error);
Copilot is powered by AI and may make mistakes. Always verify output.
resultDiv.innerHTML += '</div>';

} catch (error) {
resultDiv.innerHTML = '<div style="color: red;">Error: ' + error.message + '</div>';

Check warning

Code scanning / CodeQL

Exception text reinterpreted as HTML Medium test

Exception text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 3 months ago

To fix the issue, the error message needs to be sanitized or escaped before being inserted into the DOM. This ensures that any potentially dangerous characters (e.g., <, >, &, etc.) are appropriately encoded to avoid execution as HTML or JavaScript.

The best way to fix the problem is to use a utility function for escaping HTML characters, or leverage well-known libraries such as he for escaping. This ensures that the error message is displayed as plain text instead of being interpreted as HTML.

Steps:

  1. Replace error.message with an escaped version before inserting it into innerHTML.
  2. Add a helper function for escaping HTML if not already available.
  3. Modify the relevant lines in the deriveKey function to use this helper function.

Suggested changeset 1
packages/wasm-sdk/tests/derive_public_key.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/wasm-sdk/tests/derive_public_key.html b/packages/wasm-sdk/tests/derive_public_key.html
--- a/packages/wasm-sdk/tests/derive_public_key.html
+++ b/packages/wasm-sdk/tests/derive_public_key.html
@@ -105,7 +105,14 @@
                 resultDiv.innerHTML += '</div>';
                 
             } catch (error) {
-                resultDiv.innerHTML = '<div style="color: red;">Error: ' + error.message + '</div>';
+                const escapeHtml = (unsafe) => {
+                    return unsafe.replace(/&/g, "&amp;")
+                                 .replace(/</g, "&lt;")
+                                 .replace(/>/g, "&gt;")
+                                 .replace(/"/g, "&quot;")
+                                 .replace(/'/g, "&#039;");
+                };
+                resultDiv.innerHTML = '<div style="color: red;">Error: ' + escapeHtml(error.message) + '</div>';
                 console.error('Error:', error);
             }
         }
EOF
@@ -105,7 +105,14 @@
resultDiv.innerHTML += '</div>';

} catch (error) {
resultDiv.innerHTML = '<div style="color: red;">Error: ' + error.message + '</div>';
const escapeHtml = (unsafe) => {
return unsafe.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
};
resultDiv.innerHTML = '<div style="color: red;">Error: ' + escapeHtml(error.message) + '</div>';
console.error('Error:', error);
}
}
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
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: 35

🔭 Outside diff range comments (1)
packages/wasm-sdk/AI_REFERENCE.md (1)

1-1140: Systematic naming convention issue in generated documentation

This auto-generated documentation contains numerous examples using snake_case function names (e.g., get_identity_balance, get_documents, document_create, token_transfer) which don't match the actual camelCase SDK method names. Since this file is auto-generated, these issues should be fixed in the generate_docs.py script rather than manually editing this file.

Would you like me to review the generate_docs.py script to fix the systematic naming convention issues in the documentation generation?

🧹 Nitpick comments (28)
packages/wasm-sdk/tests/test_groups.html (1)

40-40: Consider varying dummy IDs for better test coverage.

All dummy contract and identity IDs use the same pattern ('11111111111111111111111111111111'). Consider using different patterns to test edge cases and ensure the API handles various ID formats correctly.

-                        '11111111111111111111111111111111', // dummy contract ID
+                        '11111111111111111111111111111111', // dummy contract ID
-                        '11111111111111111111111111111111', // dummy contract ID
+                        '22222222222222222222222222222222', // dummy contract ID
-                        '11111111111111111111111111111111', // dummy identity ID
+                        '33333333333333333333333333333333', // dummy identity ID

Also applies to: 53-53, 69-69

packages/wasm-sdk/CLAUDE.md (2)

5-13: Duplicated resource list – consider collapsing into a single canonical source
AI_REFERENCE.md, docs.html, and index.html are all flagged as entry points. Having three “first stops” dilutes the guidance – developers will inevitably pick the wrong one. Recommend nominating a single canonical reference (e.g. AI_REFERENCE.md) and moving the others to a “supplementary material” subsection.


54-60: CI failure hint is vague
“The CI will fail if documentation is out of sync” – great, but how does a contributor fix it? Link the exact workflow or point to generate_docs.py so devs can reproduce locally.

packages/wasm-sdk/sdk-manager.js (1)

59-59: Use optional chaining for safer property access.

The current condition could potentially throw if iframe.contentWindow is null. Use optional chaining for safer access.

-            if (iframe.contentWindow && iframe.contentWindow.sdkReady) {
+            if (iframe.contentWindow?.sdkReady) {
packages/wasm-sdk/README.md (1)

25-25: Wrap bare URL in angle brackets for better markdown compliance.

The bare URL should be wrapped in angle brackets for proper markdown formatting.

-3. Open http://localhost:8888 in your browser
+3. Open <http://localhost:8888> in your browser
packages/wasm-sdk/tests/derive_public_key.html (1)

53-53: Consider using a specific version or local copy of the library.

While the CDN approach works for testing, consider using a local copy or a more specific version for production reliability.

.github/scripts/check-grpc-coverage.py (1)

175-175: Consider using a more robust path construction.

While the current path construction works, consider using os.path.join() for better cross-platform compatibility.

-    wasm_sdk_path = Path(__file__).parent.parent.parent / 'packages' / 'wasm-sdk'
+    wasm_sdk_path = Path(__file__).parent.parent.parent / 'packages' / 'wasm-sdk'

Actually, the current approach using Path with / operator is already cross-platform compatible and more readable.

packages/wasm-sdk/tests/test-cache.html (4)

64-68: content-length header may be absent – add a reliable fallback

Many responses (especially compressed or chunked) omit the content-length header, yielding "unknown". You can obtain an accurate size by cloning the response and calling response.clone().arrayBuffer().byteLength when the header is missing.


104-108: 50 ms heuristic for cache hit is brittle

Network conditions vary widely; a cache hit on a slow device may exceed 50 ms and vice-versa. Prefer checking response.headers.get('x-cache'), response.headers.get('sw-from-cache'), or leveraging the Service-Worker fetch event’s response instanceof Response && response.headers.get('...') flag instead of elapsed time.


128-129: Unbounded setInterval poll can leak in long-running tabs

The status check runs every second forever. Clear it on visibilitychange / beforeunload, or replace with a one-off listener on navigator.serviceWorker.oncontrollerchange and registration events to avoid unnecessary wake-ups.

[performance]


76-86: Cache & SW destructive actions lack confirmation dialogs

clearCache() and unregisterSW() irreversibly wipe data without user confirmation. Add confirm() prompts (or disable in production builds) to prevent accidental data loss.

[ux]

Also applies to: 115-122

packages/wasm-sdk/index.html (4)

20-50: Use semantic <header> / <nav> and add basic ARIA for accessibility.

The new visual header works, but swapping the wrapper <div class="header"> for a semantic <header> (and the flex container for a <nav> with aria-label="Primary" or similar) costs nothing and gives screen-readers--and automated testing--useful structure.


101-101: Avoid hard-coding combined header / banner height.

height: calc(100vh - 110px) couples the layout to two elements whose height can drift with CSS tweaks or localization.
Prefer a flex column layout or CSS variables:

-.app-container {
-  display: flex;
-  height: calc(100vh - 110px); /* Account for header and status banner height */
-  overflow: hidden;
-}
+body {
+  display: flex;
+  flex-direction: column;
+  min-height: 100vh;
+}
+.app-container {
+  flex: 1 1 auto;
+  display: flex;
+  overflow: hidden;
+}

This removes magic numbers and keeps things robust to future style changes.


779-786: Minor link issues in the new header navigation.

  1. AI_REFERENCE.md will be served as raw Markdown – most browsers will just download the file. Either convert to HTML or point to the GitHub preview URL.
  2. Add rel="noopener noreferrer" on the external GitHub link to block window.opener leaks.
-      <a href="AI_REFERENCE.md">AI Reference</a>
-      <a href="https://github.com/dashpay/platform" target="_blank">GitHub</a>
+      <a href="AI_REFERENCE.html">AI Reference</a>
+      <a href="https://github.com/dashpay/platform" target="_blank" rel="noopener noreferrer">GitHub</a>

3561-3568: Optional: expose the new optional path parameter.

getPathElements now supports an explicit path argument, but the UI still only collects keys.
If advanced users need nested paths, add an optional array input similar to keys:

-              { name: "keys", type: "array", label: "Keys (hex strings)", required: true }
+              { name: "keys", type: "array", label: "Keys (hex strings)", required: true },
+              { name: "path", type: "array", label: "Path (hex strings)", required: false }

The fallback to [] is fine otherwise.

packages/wasm-sdk/src/queries/system.rs (2)

326-338: Consider refactoring the path conversion logic to reduce code duplication.

The path conversion logic is duplicated between get_path_elements and get_path_elements_with_proof_info. Consider extracting this into a helper function to improve maintainability.

+fn convert_path_to_bytes(path: &[String]) -> Vec<Vec<u8>> {
+    path.iter()
+        .map(|p| {
+            // Try to parse as a u8 number first (for root tree paths)
+            if let Ok(num) = p.parse::<u8>() {
+                vec![num]
+            } else {
+                // Otherwise treat as a string key
+                p.as_bytes().to_vec()
+            }
+        })
+        .collect()
+}

-    // Convert string path to byte vectors
-    // Path elements can be either numeric values (like "96" for Balances) or string keys
-    let path_bytes: Vec<Vec<u8>> = path.iter()
-        .map(|p| {
-            // Try to parse as a u8 number first (for root tree paths)
-            if let Ok(num) = p.parse::<u8>() {
-                vec![num]
-            } else {
-                // Otherwise treat as a string key
-                p.as_bytes().to_vec()
-            }
-        })
-        .collect();
+    let path_bytes = convert_path_to_bytes(&path);

461-473: Code duplication with get_path_elements function.

The path conversion logic is identical to the one in get_path_elements. This reinforces the need for the helper function suggested above.

packages/wasm-sdk/check_documentation.py (4)

73-73: Address unused loop variable.

The loop variable cat_key is not used within the loop body. Either use it or rename it to indicate it's intentionally unused.

-    for cat_key, category in current_defs.get('queries', {}).items():
+    for _cat_key, category in current_defs.get('queries', {}).items():

74-74: Optimize dictionary key access.

Using key in dict.keys() is less efficient than key in dict.

-        for query_key in category.get('queries', {}).keys():
+        for query_key in category.get('queries', {}):

79-79: Address unused loop variable.

Same issue as line 73 - the loop variable cat_key is not used.

-    for cat_key, category in current_defs.get('transitions', {}).items():
+    for _cat_key, category in current_defs.get('transitions', {}).items():

80-80: Optimize dictionary key access.

Same optimization opportunity as line 74.

-        for trans_key in category.get('transitions', {}).keys():
+        for trans_key in category.get('transitions', {}):
packages/wasm-sdk/tests/check_identity_keys.html (1)

66-66: Consider removing hardcoded test values from production.

The hardcoded identity ID should be removed or made configurable for production use to avoid confusion or unintended usage.

-        <input type="text" id="identityId" value="5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk">
+        <input type="text" id="identityId" placeholder="Enter Identity ID">
.github/workflows/wasm-sdk-documentation-check.yml (2)

73-99: Remove trailing spaces from YAML

Multiple lines in this section have trailing spaces that violate YAML formatting standards.

-          path: packages/wasm-sdk/documentation-check-report.txt
-          
+          path: packages/wasm-sdk/documentation-check-report.txt
+
 # ... and fix other lines with trailing spaces
-            const reportPath = 'packages/wasm-sdk/documentation-check-report.txt';
-            
+            const reportPath = 'packages/wasm-sdk/documentation-check-report.txt';
+
-              const status = '${{ steps.doc-check.outputs.status }}' === 'success' ? '✅' : '❌';
-              
+              const status = '${{ steps.doc-check.outputs.status }}' === 'success' ? '✅' : '❌';
+
-              });
-              
-              const botComment = comments.find(comment => 
-                comment.user.type === 'Bot' && 
+              });
+
+              const botComment = comments.find(comment =>
+                comment.user.type === 'Bot' &&
-              );
-              
+              );
+
-              const body = `### ${status} WASM SDK Documentation Check\n\n\`\`\`\n${report}\n\`\`\`\n\n**To fix documentation issues:**\n\`\`\`bash\ncd packages/wasm-sdk\npython3 generate_docs.py\n\`\`\``;
-              
+              const body = `### ${status} WASM SDK Documentation Check\n\n\`\`\`\n${report}\n\`\`\`\n\n**To fix documentation issues:**\n\`\`\`bash\ncd packages/wasm-sdk\npython3 generate_docs.py\n\`\`\``;
+

137-137: Add newline at end of file

YAML files should end with a newline character.

           echo "Documentation is out of date. Please run 'python3 generate_docs.py' in packages/wasm-sdk/"
-          exit 1
+          exit 1
+
packages/wasm-sdk/src/queries/identity.rs (1)

14-15: Remove potentially unused imports

The IndexMap import appears redundant as it's imported again where used (e.g., line 187). The KeyID import seems unused.

-use drive_proof_verifier::types::{IdentityPublicKeys, IndexMap};
-use dash_sdk::dpp::identity::KeyID;
+use drive_proof_verifier::types::IdentityPublicKeys;

Run this script to verify if KeyID is used:

#!/bin/bash
# Check if KeyID is used in this file
rg "KeyID" packages/wasm-sdk/src/queries/identity.rs
packages/wasm-sdk/generate_docs.py (3)

15-63: Consider documenting the limitations of JS-to-JSON conversion

The string replacement approach for converting JavaScript objects to JSON (lines 25-34) is fragile and may not handle all JavaScript syntax correctly. While the fallback to regex extraction is good, it would be helpful to document what JavaScript constructs are not supported.

Add a docstring note about limitations:

 def extract_definitions_from_html(html_content):
-    """Extract query and state transition definitions from index.html"""
+    """Extract query and state transition definitions from index.html
+    
+    Note: The JavaScript to JSON conversion supports basic object syntax but may not
+    handle complex JavaScript constructs like template literals, arrow functions, or
+    computed property names. Falls back to regex extraction if JSON parsing fails.
+    """

64-121: Add logging for failed regex extraction

The function silently returns an empty dictionary when the regex doesn't match. Consider adding logging to help debug extraction failures.

 def extract_definitions_regex(html_content, definition_name):
     """Robust regex extraction method for JavaScript object definitions"""
     definitions = {}
     
     # Find the complete definition block
     pattern = rf'const {definition_name} = (\{{(?:[^{{}}]|{{[^{{}}]*}})*\}});'
     match = re.search(pattern, html_content, re.DOTALL)
     if not match:
+        print(f"Warning: Could not find {definition_name} using regex extraction")
         return definitions

279-333: Consider adding error handling for malformed input

The function works well for well-formed input but could benefit from error handling for edge cases where the regex patterns don't match expected formats.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 399d146 and dd4234c.

📒 Files selected for processing (32)
  • .github/grpc-queries-cache.json (2 hunks)
  • .github/scripts/check-grpc-coverage.py (2 hunks)
  • .github/workflows/wasm-sdk-documentation-check.yml (1 hunks)
  • .gitignore (1 hunks)
  • CLAUDE.md (2 hunks)
  • packages/wasm-sdk/.gitignore (0 hunks)
  • packages/wasm-sdk/AI_REFERENCE.md (1 hunks)
  • packages/wasm-sdk/CLAUDE.md (2 hunks)
  • packages/wasm-sdk/README.md (1 hunks)
  • packages/wasm-sdk/check_documentation.py (1 hunks)
  • packages/wasm-sdk/docs_manifest.json (1 hunks)
  • packages/wasm-sdk/extract_definitions.py (1 hunks)
  • packages/wasm-sdk/fixed_definitions.json (1 hunks)
  • packages/wasm-sdk/generate_docs.py (1 hunks)
  • packages/wasm-sdk/index.html (5 hunks)
  • packages/wasm-sdk/sdk-manager.js (1 hunks)
  • packages/wasm-sdk/src/queries/identity.rs (4 hunks)
  • packages/wasm-sdk/src/queries/system.rs (2 hunks)
  • packages/wasm-sdk/tests/check_identity_keys.html (1 hunks)
  • packages/wasm-sdk/tests/check_posts.html (1 hunks)
  • packages/wasm-sdk/tests/derive_public_key.html (1 hunks)
  • packages/wasm-sdk/tests/test-cache.html (1 hunks)
  • packages/wasm-sdk/tests/test_group_queries.html (1 hunks)
  • packages/wasm-sdk/tests/test_groups.html (1 hunks)
  • packages/wasm-sdk/tests/test_nonce.html (1 hunks)
  • packages/wasm-sdk/tests/test_post_create.html (1 hunks)
  • packages/wasm-sdk/tests/test_proof.html (1 hunks)
  • packages/wasm-sdk/tests/test_proof.js (1 hunks)
  • packages/wasm-sdk/tests/test_proof_result.html (1 hunks)
  • packages/wasm-sdk/tests/test_proof_split.html (1 hunks)
  • packages/wasm-sdk/tests/test_serialization.html (1 hunks)
  • packages/wasm-sdk/tests/verify_proof_display.html (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/wasm-sdk/.gitignore
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
**/*.rs

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
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: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
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.
.gitignore (2)
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#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
.github/grpc-queries-cache.json (1)
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
packages/wasm-sdk/tests/test_proof.js (4)
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: 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.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
packages/wasm-sdk/CLAUDE.md (2)
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
packages/wasm-sdk/tests/test_nonce.html (4)
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: 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.
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.
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.
packages/wasm-sdk/tests/test_groups.html (3)
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.
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#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.
packages/wasm-sdk/README.md (5)
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
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#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
packages/wasm-sdk/tests/test_serialization.html (5)
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: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
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.
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.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use custom serialization with `rs-platform-serialization` for data structures
packages/wasm-sdk/tests/test_proof.html (5)
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: 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.
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
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.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
packages/wasm-sdk/tests/test_proof_split.html (2)
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#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/wasm-sdk/tests/verify_proof_display.html (2)
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: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
packages/wasm-sdk/tests/check_posts.html (2)
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: 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.
packages/wasm-sdk/tests/test-cache.html (1)
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.
packages/wasm-sdk/tests/test_proof_result.html (5)
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#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.
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.
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
packages/wasm-sdk/docs_manifest.json (4)
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
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: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/schema/v1/wallet-utils-contract-documents.json:49-55
Timestamp: 2024-11-25T07:49:05.419Z
Learning: In the schema definitions for the `wallet-utils-contract` (file `packages/wallet-utils-contract/schema/v1/wallet-utils-contract-documents.json`), the `$createdAt` field is a system field augmented by DPP and does not need to be defined explicitly in the schema's properties.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
packages/wasm-sdk/sdk-manager.js (1)
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
packages/wasm-sdk/tests/test_group_queries.html (3)
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: 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.
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.
packages/wasm-sdk/tests/check_identity_keys.html (7)
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#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.
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: 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.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
packages/wasm-sdk/src/queries/system.rs (6)
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#1924
File: packages/rs-sdk/src/sdk.rs:855-870
Timestamp: 2024-12-03T15:00:50.385Z
Learning: In `packages/rs-sdk/src/sdk.rs`, remember that `rustls_pemfile::certs` returns an iterator over `Result`, not a `Result` directly. Handle it accordingly in future code reviews.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.
Learnt from: shumkov
PR: dashpay/platform#2185
File: packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs:47-62
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In `rebroadcast_expired_withdrawal_documents_v1`, the variable `expired_withdrawal_indices` needs to be a `Vec<WithdrawalTransactionIndex>` rather than a `BTreeSet<WithdrawalTransactionIndex>`, because a vector is necessary for subsequent processing.
Learnt from: shumkov
PR: dashpay/platform#2185
File: packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs:47-62
Timestamp: 2024-09-30T11:55:43.856Z
Learning: In `rebroadcast_expired_withdrawal_documents_v1`, the variable `expired_withdrawal_indices` needs to be a `Vec<WithdrawalTransactionIndex>` rather than a `BTreeSet<WithdrawalTransactionIndex>`, because a vector is necessary for subsequent processing.
packages/wasm-sdk/src/queries/identity.rs (15)
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.
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.
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: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
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#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`.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
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.
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.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
CLAUDE.md (12)
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.586Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Manage the local development environment using Docker Compose and dashmate
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Check Rust code using `cargo check --workspace`
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Run Rust tests using `cargo test`
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#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Rust code should be linted using `cargo clippy --workspace`
packages/wasm-sdk/tests/derive_public_key.html (5)
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
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.
Learnt from: shumkov
PR: dashpay/platform#2449
File: packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs:107-150
Timestamp: 2025-03-13T07:24:37.295Z
Learning: In the RS SDK test data generation code, logging private keys is intentional and only enabled when a developer explicitly chooses to enable it, which is acceptable in test code contexts.
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.
packages/wasm-sdk/fixed_definitions.json (6)
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/schema/v1/wallet-utils-contract-documents.json:49-55
Timestamp: 2024-11-25T07:49:05.419Z
Learning: In the schema definitions for the `wallet-utils-contract` (file `packages/wallet-utils-contract/schema/v1/wallet-utils-contract-documents.json`), the `$createdAt` field is a system field augmented by DPP and does not need to be defined explicitly in the schema's properties.
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: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In `broadcastStateTransitionHandlerFactory.js`, error handling when querying transaction status is handled in the API script.
packages/wasm-sdk/AI_REFERENCE.md (5)
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
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: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In `broadcastStateTransitionHandlerFactory.js`, error handling when querying transaction status is handled in the API script.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:19-19
Timestamp: 2024-10-24T04:58:02.843Z
Learning: For operations involving Tenderdash where no client library exists yet, it's acceptable to use the Node.js built-in `crypto` module.
packages/wasm-sdk/index.html (4)

undefined

<retrieved_learning>
Learnt from: lklimek
PR: #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.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>

<retrieved_learning>
Learnt from: lklimek
PR: #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.
</retrieved_learning>

<retrieved_learning>
Learnt from: lklimek
PR: #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.
</retrieved_learning>

packages/wasm-sdk/tests/test_post_create.html (4)
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: 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.
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.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
🪛 markdownlint-cli2 (0.17.2)
packages/wasm-sdk/README.md

25-25: Bare URL used

(MD034, no-bare-urls)

🪛 ast-grep (0.38.6)
packages/wasm-sdk/tests/verify_proof_display.html

[warning] 53-53: "This link points to a plaintext HTTP URL. Prefer an encrypted HTTPS URL if possible."
Context: http://localhost:8888
Note: [CWE-319] Authentication Bypass by Primary Weakness [REFERENCES]
- https://cwe.mitre.org/data/definitions/319.html

(plaintext-http-link-html)

🪛 Biome (1.9.4)
packages/wasm-sdk/sdk-manager.js

[error] 59-59: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🪛 Ruff (0.12.2)
packages/wasm-sdk/check_documentation.py

73-73: Loop control variable cat_key not used within loop body

Rename unused cat_key to _cat_key

(B007)


74-74: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


79-79: Loop control variable cat_key not used within loop body

Rename unused cat_key to _cat_key

(B007)


80-80: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

packages/wasm-sdk/generate_docs.py

8-8: os imported but unused

Remove unused import: os

(F401)


1191-1191: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


1205-1205: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


1282-1282: f-string without any placeholders

Remove extraneous f prefix

(F541)


1392-1392: f-string without any placeholders

Remove extraneous f prefix

(F541)


1506-1506: f-string without any placeholders

Remove extraneous f prefix

(F541)


1594-1594: f-string without any placeholders

Remove extraneous f prefix

(F541)


1734-1734: Loop control variable cat_key not used within loop body

(B007)


1740-1740: Loop control variable cat_key not used within loop body

(B007)


1773-1773: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


1780-1780: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

🪛 YAMLlint (1.37.1)
.github/workflows/wasm-sdk-documentation-check.yml

[error] 59-59: trailing spaces

(trailing-spaces)


[error] 73-73: trailing spaces

(trailing-spaces)


[error] 81-81: trailing spaces

(trailing-spaces)


[error] 85-85: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)


[error] 93-93: trailing spaces

(trailing-spaces)


[error] 94-94: trailing spaces

(trailing-spaces)


[error] 97-97: trailing spaces

(trailing-spaces)


[error] 99-99: trailing spaces

(trailing-spaces)


[error] 123-123: trailing spaces

(trailing-spaces)


[error] 137-137: no new line character at the end of file

(new-line-at-end-of-file)

🪛 Gitleaks (8.27.2)
packages/wasm-sdk/generate_docs.py

132-132: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


137-137: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


155-155: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ 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). (2)
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: build-wasm-sdk
🔇 Additional comments (37)
.github/grpc-queries-cache.json (2)

118-120: LGTM! Status update reflects implementation progress.

The status change from "not_implemented" to "implemented" for getTokenContractInfo correctly tracks the completion of this query functionality as part of the WASM SDK enhancements.


146-146: Timestamp update is consistent with the status change.

The updated timestamp correctly reflects when the query status was modified.

.gitignore (1)

53-56: LGTM! Appropriate ignore patterns for WASM SDK artifacts.

The new ignore patterns correctly exclude build artifacts (wasm_sdk.js, wasm_sdk_bg.wasm) and generated documentation files (documentation-check-report.txt, extracted_definitions.json) from version control. This aligns with the documentation generation and checking scripts mentioned in the AI summary.

CLAUDE.md (2)

100-100: LGTM! Clear documentation of WASM SDK component.

The new entry accurately describes the WASM SDK's role as WebAssembly bindings for browser-based applications and appropriately references the comprehensive API documentation. This aligns with the retrieved learning about using WASM bindings for cross-language integration.


119-122: LGTM! Comprehensive WASM SDK development workflow guidance.

The new development workflow section provides clear, actionable instructions for WASM SDK development including build commands, testing procedures, and documentation maintenance. This complements the extensive new tooling and documentation introduced in this PR.

packages/wasm-sdk/tests/test_groups.html (2)

30-95: LGTM! Comprehensive group query testing with good error handling.

The test function properly exercises all four group-related queries with appropriate error handling for each individual query. The structure allows for easy debugging by displaying results in a readable format.


22-28: SDK initialization follows expected patterns.

The SDK initialization using WasmSdkBuilder with regtest configuration is appropriate for local testing and matches the patterns used in other test files.

packages/wasm-sdk/tests/test_nonce.html (1)

38-45: Property mismatch – verify the SDK return shapes
The code assumes balance has a balance field and nonce has a nonce field. Double-check: many SDK methods return a plain number (e.g. u64) rather than an object.

packages/wasm-sdk/tests/test_post_create.html (1)

64-65: Hard-coded private key committed to source
Even if it’s test-net, publishing a WIF in-tree is bad hygiene. Replace with a placeholder or fetch from environment/localStorage.

packages/wasm-sdk/docs_manifest.json (1)

1-291: Comprehensive documentation manifest looks excellent!

This auto-generated manifest provides a well-structured overview of the WASM SDK's API surface. The categorization into functional domains (identity, dataContract, document, etc.) is logical and the fact that all 66 entries are marked as documented indicates a mature documentation system.

packages/wasm-sdk/tests/test_proof_result.html (1)

1-59: Well-structured test file with comprehensive debugging output.

The test properly imports the WASM SDK, handles initialization, and provides detailed result inspection. The hardcoded identity ID is appropriate for testing purposes, and the comprehensive error handling ensures robust test execution.

packages/wasm-sdk/tests/test_proof_split.html (1)

1-144: Excellent visual test demonstrating proof split view layout.

The CSS flexbox implementation provides a clean split view with proper styling. The mock JSON data is realistic and the visual separation between data and proof sections is clear. The expected behavior documentation is particularly helpful for understanding the intended functionality.

packages/wasm-sdk/sdk-manager.js (1)

2-100: Well-designed SDK manager with proper async patterns.

The iframe-based approach for SDK isolation is sound, and the message passing system with unique IDs ensures proper command/response matching. The initialization logic correctly handles multiple concurrent initialization attempts.

packages/wasm-sdk/README.md (1)

1-145: Comprehensive and well-structured README documentation.

The README provides excellent coverage of all essential aspects including installation, usage, development workflow, architecture, and contribution guidelines. The documentation synchronization requirements are clearly explained, which is crucial for maintaining consistency.

packages/wasm-sdk/tests/derive_public_key.html (1)

97-97: The base64 conversion approach is correct.

The btoa(String.fromCharCode.apply(null, publicKeyBytes)) pattern is a standard way to convert byte arrays to base64 in browsers.

packages/wasm-sdk/tests/test_group_queries.html (1)

28-33: Test structure and error handling are well implemented.

The test cases are properly structured with individual error handling for each query function. The hardcoded test data is appropriate for testing purposes.

Also applies to: 37-42, 47-57, 62-69

packages/wasm-sdk/tests/check_posts.html (3)

46-56: SDK initialization pattern is consistent with builder approach.

The use of WasmSdkBuilder with set_testnet_mode() and build() follows a clear builder pattern, which is good for configurability.


68-80: Document query structure is well-formed.

The query structure with where, orderBy, and limit clauses follows the expected pattern for document queries.


92-92: createdAt format verified
The createdAt field is emitted as a numeric millisecond‐epoch value (see src/sdk.rs and the state transition’s JsValue::from_f64(created_at as f64)), so using new Date(post.createdAt) is correct. No changes needed.

.github/scripts/check-grpc-coverage.py (2)

173-194: Well-implemented documentation check function.

The function properly handles subprocess execution, error parsing, and provides appropriate fallback behavior when the check script doesn't exist.


338-361: Good integration with existing workflow.

The documentation check is properly integrated into the main flow with clear reporting and appropriate exit code handling. The success message accurately reflects both gRPC and documentation validation.

packages/wasm-sdk/tests/verify_proof_display.html (3)

54-54: HTTP localhost URL is acceptable for local development.

The static analysis tool flagged the HTTP localhost URL, but this is appropriate for local development and testing environments. HTTPS is not necessary for localhost.


42-86: Comprehensive and well-structured documentation.

The documentation provides clear implementation status, step-by-step testing instructions, expected results, and a comprehensive list of supported queries. This is excellent for developers and testers.


52-59: Clear and actionable testing instructions.

The step-by-step testing instructions are well-organized and provide specific examples (like the identity ID), making it easy for developers to verify the functionality.

packages/wasm-sdk/index.html (2)

10-12: Favicon and title additions look good.

The new title and dual-format favicon links are correct and improve branding.


3551-3555: Proof-aware wrapper for getPrefundedSpecializedBalance looks correct.

Branching on useProofs cleanly wires the new _with_proof_info binding.

packages/wasm-sdk/src/queries/system.rs (1)

319-319: LGTM! Enhanced path parameter supports dynamic query paths.

The addition of the path parameter enables dynamic specification of query paths instead of hardcoded empty vectors, improving the flexibility of the get_path_elements function.

packages/wasm-sdk/check_documentation.py (1)

12-131: LGTM! Comprehensive documentation validation logic.

The script provides thorough validation of documentation completeness, including:

  • File existence checks
  • Definition extraction and comparison
  • Timestamp validation
  • Clear error and warning reporting

The logic for detecting undocumented and removed items is sound and will help maintain documentation quality.

packages/wasm-sdk/fixed_definitions.json (1)

1-1658: LGTM! Comprehensive and well-structured API definitions.

The JSON schema provides a thorough definition of the WASM SDK API surface, including:

  • Clear categorization of queries and transitions
  • Detailed input parameter specifications
  • Proper type definitions and validation rules
  • Consistent structure across all definitions

This will serve as an excellent foundation for documentation generation and API validation.

packages/wasm-sdk/tests/check_identity_keys.html (2)

93-198: LGTM! Well-structured test functionality with proper error handling.

The JavaScript code provides comprehensive testing functionality:

  • Proper async/await usage
  • Good error handling and user feedback
  • Clear separation of concerns between identity fetching and key checking
  • Informative output formatting

The code effectively demonstrates the WASM SDK's identity key functionality.


71-71: Security concern: Hardcoded private key in test file.

The hardcoded private key in a test file could be a security risk if this file is deployed to production or if the key has any real value.

-        <input type="password" id="privateKey" value="XK6CFyvYUMvY9FVQLeYBZBFDbC4QuBLiqWMAFxBVZcMHJ5eARJtf">
+        <input type="password" id="privateKey" placeholder="Enter Private Key (WIF format)">
⛔ Skipped due to learnings
Learnt from: shumkov
PR: dashpay/platform#2449
File: packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs:107-150
Timestamp: 2025-03-13T07:24:37.295Z
Learning: In the RS SDK test data generation code, logging private keys is intentional and only enabled when a developer explicitly chooses to enable it, which is acceptable in test code contexts.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
packages/wasm-sdk/extract_definitions.py (4)

10-61: LGTM! Robust extraction logic with proper brace counting.

The manual extraction approach using brace counting is well-implemented and handles the complexity of extracting JavaScript objects from HTML content. The logic properly handles nested structures and edge cases.


63-129: Excellent parsing logic with proper nesting validation.

The definition block parsing correctly:

  • Validates category structure with proper nesting
  • Uses brace counting to handle complex nested objects
  • Includes safeguards against false matches within nested structures
  • Properly extracts category labels and items

The approach is robust and handles the complexity of parsing JavaScript definitions.


202-276: Comprehensive input parsing with good field extraction.

The input parsing logic effectively handles:

  • Various input field types and validation rules
  • Optional fields with proper defaults
  • Complex nested structures like options arrays
  • Proper regex patterns for field extraction

The code is well-structured and handles edge cases appropriately.


278-302: Good script organization with proper error handling.

The main function provides:

  • Proper file existence checking
  • Clear output formatting
  • Helpful statistics reporting
  • Appropriate return codes for CI integration

The script integrates well with the documentation toolchain.

packages/wasm-sdk/src/queries/identity.rs (1)

204-300: Well-implemented search key functionality

The search key request implementation properly handles JSON parsing, validates input, and builds the appropriate gRPC structures with comprehensive error handling.

packages/wasm-sdk/generate_docs.py (1)

122-278: LGTM!

The function generates appropriate example code for documentation. The hardcoded test data contains valid blockchain identifiers (not API keys as flagged by static analysis).

});

// Read and instantiate WASM module
const wasmBuffer = readFileSync('./pkg/wasm_sdk_bg.wasm');
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify WASM file path exists before reading.

The hardcoded path ./pkg/wasm_sdk_bg.wasm might not exist during testing, especially if the build hasn't been run.


🏁 Script executed:

#!/bin/bash
# Check if the WASM file path is correct and if build scripts exist
echo "Checking WASM SDK build output structure..."
fd -t f "wasm_sdk_bg.wasm" packages/wasm-sdk/
echo "Checking for build scripts..."
fd -t f "build.sh" packages/wasm-sdk/

Length of output: 276


🏁 Script executed:

#!/bin/bash
# Display the first 30 lines of the test file to inspect imports and context
head -n 30 packages/wasm-sdk/tests/test_proof.js

Length of output: 656


#!/bin/bash
# Show build.sh contents to confirm how `pkg/wasm_sdk_bg.wasm` is generated
sed -n '1,200p' packages/wasm-sdk/build.sh

🏁 Script executed:

#!/bin/bash
# Check if the built WASM file is output to the pkg directory
echo "Searching for wasm_sdk_bg.wasm under pkg/..."
fd -t f wasm_sdk_bg.wasm packages/wasm-sdk/pkg

# Inspect build.sh to confirm where the wasm is generated
echo "Showing build.sh contents to verify output paths..."
sed -n '1,200p' packages/wasm-sdk/build.sh

Length of output: 994


🏁 Script executed:

#!/bin/bash
# Inspect the npm scripts in wasm-sdk to see if build is run before tests
echo "Showing scripts from packages/wasm-sdk/package.json..."
sed -n '1,200p' packages/wasm-sdk/package.json

Length of output: 239


Add a pre-read existence check for the WASM file in the test

Before calling readFileSync, verify that the generated pkg/wasm_sdk_bg.wasm file actually exists and provide a clear error if it doesn’t (e.g. remind to run the build).

Please update packages/wasm-sdk/tests/test_proof.js accordingly. For example:

 import { WASI } from 'wasi';
-import { readFileSync } from 'fs';
+import fs, { readFileSync, existsSync } from 'fs';
 import { argv, env } from 'process';
+import path from 'path';
+import { fileURLToPath } from 'url';

+// Resolve __dirname in ESM
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = path.dirname(__filename);

 // Create WASI instance
 const wasi = new WASI({
   args: argv,
   env,
   preopens: {}
 });

-// Read and instantiate WASM module
-const wasmBuffer = readFileSync('./pkg/wasm_sdk_bg.wasm');
+// Verify and read the generated WASM module
+const wasmPath = path.resolve(__dirname, '../pkg/wasm_sdk_bg.wasm');
+if (!existsSync(wasmPath)) {
+  throw new Error(
+    `WASM file not found at ${wasmPath}. Please run “npm run build” (or ./build.sh) in packages/wasm-sdk before testing.`
+  );
+}
+const wasmBuffer = readFileSync(wasmPath);

 const wasmModule = new WebAssembly.Module(wasmBuffer);
 const instance = new WebAssembly.Instance(wasmModule, {
   wasi_snapshot_preview1: wasi.wasiImport
 });
  • Ensures tests fail fast with a clear message if you forget to build first.
  • Uses a path‐safe, file‐exists check rather than a hardcoded relative path alone.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const wasmBuffer = readFileSync('./pkg/wasm_sdk_bg.wasm');
import { WASI } from 'wasi';
import fs, { readFileSync, existsSync } from 'fs';
import { argv, env } from 'process';
import path from 'path';
import { fileURLToPath } from 'url';
// Resolve __dirname in ESM
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Create WASI instance
const wasi = new WASI({
args: argv,
env,
preopens: {}
});
// Verify and read the generated WASM module
const wasmPath = path.resolve(__dirname, '../pkg/wasm_sdk_bg.wasm');
if (!existsSync(wasmPath)) {
throw new Error(
`WASM file not found at ${wasmPath}. Please run "npm run build" (or ./build.sh) in packages/wasm-sdk before testing.`
);
}
const wasmBuffer = readFileSync(wasmPath);
const wasmModule = new WebAssembly.Module(wasmBuffer);
const instance = new WebAssembly.Instance(wasmModule, {
wasi_snapshot_preview1: wasi.wasiImport
});
🤖 Prompt for AI Agents
In packages/wasm-sdk/tests/test_proof.js at line 13, before calling readFileSync
to load the wasm_sdk_bg.wasm file, add a check to verify the file exists using a
path-safe method like fs.existsSync. If the file does not exist, throw an error
with a clear message instructing to run the build first. This will ensure the
test fails fast with a helpful message instead of failing silently or with a
confusing error.

and generates both user documentation (HTML) and AI reference (Markdown)
"""

import os
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove unused import

The os module is imported but never used in the code.

-import os
import re
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import os
import re
🧰 Tools
🪛 Ruff (0.12.2)

8-8: os imported but unused

Remove unused import: os

(F401)

🤖 Prompt for AI Agents
In packages/wasm-sdk/generate_docs.py at line 8, the 'os' module is imported but
not used anywhere in the file. Remove the import statement for 'os' to clean up
the code and avoid unnecessary imports.

Copy link
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: 2

♻️ Duplicate comments (8)
packages/wasm-sdk/tests/derive_public_key.html (1)

86-95: Avoid XSS by writing untrusted data via textContent instead of innerHTML
privateKeyWif and error.message are user-controlled strings. Inserting them with innerHTML can inject raw HTML/JS. Build the DOM with textContent, or escape first.

Example hardening for the error path:

-                resultDiv.innerHTML = '<div style="color: red;">Error: ' + error.message + '</div>';
+                resultDiv.textContent = `Error: ${error.message}`;

Do the same for all occurrences where WIF/public-key strings are rendered.

Also applies to: 108-109

packages/wasm-sdk/generate_docs.py (7)

8-11: Remove unused imports

Remove the unused os and html imports to clean up the code.

-import os
 import re
 import json
-import html
 from pathlib import Path

1502-1502: Remove unnecessary f-string prefix

Remove the extraneous f prefix since no variable interpolation is needed.

-            md_content += f"\nExample:\n```javascript\n"
+            md_content += "\nExample:\n```javascript\n"

1590-1590: Remove unnecessary f-string prefix

Remove the extraneous f prefix since no variable interpolation is needed.

-            md_content += f"\nExample:\n```javascript\n"
+            md_content += "\nExample:\n```javascript\n"

1730-1730: Remove unused loop variable

The loop variable cat_key is not used within the loop body.

-    for cat_key, category in list(query_defs.items()):
+    for _, category in list(query_defs.items()):

1736-1736: Remove unused loop variable

The loop variable cat_key is not used within the loop body.

-    for cat_key, category in list(transition_defs.items()):
+    for _, category in list(transition_defs.items()):

1769-1769: Remove unnecessary .keys() call

Iterate directly over the dictionary instead of calling .keys().

-        for query_key in category.get('queries', {}).keys():
+        for query_key in category.get('queries', {}):

1776-1776: Remove unnecessary .keys() call

Iterate directly over the dictionary instead of calling .keys().

-        for trans_key in category.get('transitions', {}).keys():
+        for trans_key in category.get('transitions', {}):
🧹 Nitpick comments (5)
packages/wasm-sdk/tests/derive_public_key.html (1)

96-98: Leverage Buffer’s built-in base-64 encoder instead of manual btoa
Buffer.toString('base64') is shorter, avoids the Unicode-code-unit conversion dance, and prevents potential “maximum call stack size exceeded” errors for longer keys.

-                const publicKeyBase64 = btoa(String.fromCharCode.apply(null, publicKeyBytes));
+                const publicKeyBase64 = publicKeyBytes.toString('base64');
.github/workflows/wasm-sdk-documentation-check.yml (4)

59-59: Fix trailing spaces.

Remove trailing spaces to comply with YAML formatting standards.

-          fi
-          
+          fi
+

74-74: Fix trailing spaces.

Remove trailing spaces to comply with YAML formatting standards.

-          path: packages/wasm-sdk/documentation-check-report.txt
-          
+          path: packages/wasm-sdk/documentation-check-report.txt
+

132-132: Fix trailing spaces.

Remove trailing spaces to comply with YAML formatting standards.

-          fi
-          
+          fi
+

152-152: Add missing newline at end of file.

YAML files should end with a newline character.

-          exit 1
+          exit 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 dd4234c and f97f190.

📒 Files selected for processing (12)
  • .github/workflows/wasm-sdk-documentation-check.yml (1 hunks)
  • packages/wasm-sdk/AI_REFERENCE.md (1 hunks)
  • packages/wasm-sdk/generate_docs.py (1 hunks)
  • packages/wasm-sdk/index.html (6 hunks)
  • packages/wasm-sdk/tests/derive_public_key.html (1 hunks)
  • packages/wasm-sdk/tests/test-cache.html (1 hunks)
  • packages/wasm-sdk/tests/test_group_queries.html (1 hunks)
  • packages/wasm-sdk/tests/test_nonce.html (1 hunks)
  • packages/wasm-sdk/tests/test_post_create.html (1 hunks)
  • packages/wasm-sdk/tests/test_proof.html (1 hunks)
  • packages/wasm-sdk/tests/test_proof.js (1 hunks)
  • packages/wasm-sdk/tests/test_serialization.html (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/wasm-sdk/tests/test_post_create.html
  • packages/wasm-sdk/tests/test_serialization.html
  • packages/wasm-sdk/tests/test-cache.html
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/wasm-sdk/tests/test_nonce.html
  • packages/wasm-sdk/tests/test_group_queries.html
  • packages/wasm-sdk/tests/test_proof.html
  • packages/wasm-sdk/index.html
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
🧠 Learnings (6)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
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: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
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.
packages/wasm-sdk/tests/test_proof.js (14)
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: 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.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in `packages/rs-sdk/scripts/`, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
Learnt from: shumkov
PR: dashpay/platform#2297
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:148-150
Timestamp: 2024-10-31T14:41:42.158Z
Learning: In the `obtainZeroSSLCertificateTaskFactory` function in `packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js`, the application already fails appropriately if `configFileRepository.write(configFile)` fails, so additional error handling around this operation is unnecessary.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-dapi-client/src/transport/wasm_channel.rs:100-114
Timestamp: 2025-01-23T08:59:30.805Z
Learning: In WebAssembly context, using panic for unrecoverable errors (like oneshot channel failures) is an acceptable pattern when properly documented, as recovery might not be meaningful in such cases.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-dapi-client/src/transport/wasm_channel.rs:100-114
Timestamp: 2025-01-23T08:59:30.805Z
Learning: In WebAssembly context, using panic for unrecoverable errors (like oneshot channel failures) is an acceptable pattern when properly documented, as recovery might not be meaningful in such cases.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-dapi-client/src/transport/wasm_channel.rs:100-114
Timestamp: 2025-01-23T08:59:30.805Z
Learning: In WebAssembly context, using panic for unrecoverable errors (like oneshot channel failures) is an acceptable pattern when properly documented, as recovery might not be meaningful in such cases.
Learnt from: shumkov
PR: dashpay/platform#2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In `obtainZeroSSLCertificateTaskFactory.js`, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on `e.details[ctx.externalIp]` may not be necessary.
Learnt from: shumkov
PR: dashpay/platform#2249
File: packages/dashmate/test/unit/status/scopes/platform.spec.js:77-78
Timestamp: 2024-10-18T15:37:36.387Z
Learning: In `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in tests to increase readability, rather than refactoring them into shared `beforeEach` blocks or helper functions.
Learnt from: shumkov
PR: dashpay/platform#2249
File: packages/dashmate/test/unit/status/scopes/platform.spec.js:466-467
Timestamp: 2024-10-18T15:37:21.329Z
Learning: In test files for the dashmate project, such as `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in tests rather than consolidating them, to increase readability.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
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.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
.github/workflows/wasm-sdk-documentation-check.yml (1)
Learnt from: lklimek
PR: dashpay/platform#2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in `packages/rs-sdk/scripts/`, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
packages/wasm-sdk/AI_REFERENCE.md (11)
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
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#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.
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: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: lklimek
PR: dashpay/platform#2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in `packages/rs-sdk/scripts/`, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In `broadcastStateTransitionHandlerFactory.js`, error handling when querying transaction status is handled in the API script.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:75-77
Timestamp: 2024-10-24T04:59:20.436Z
Learning: Tenderdash's `tx` RPC method accepts transaction hashes in base64 encoding, or in hex encoding if prefixed with `0x`. Therefore, in `packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js`, it's acceptable to use `stHash.toString('base64')` when calling `requestTenderRpc('tx', { hash: stHash.toString('base64') })`.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:19-19
Timestamp: 2024-10-24T04:58:02.843Z
Learning: For operations involving Tenderdash where no client library exists yet, it's acceptable to use the Node.js built-in `crypto` module.
packages/wasm-sdk/generate_docs.py (1)
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.
packages/wasm-sdk/tests/derive_public_key.html (13)
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
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.
Learnt from: shumkov
PR: dashpay/platform#2449
File: packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs:107-150
Timestamp: 2025-03-13T07:24:37.295Z
Learning: In the RS SDK test data generation code, logging private keys is intentional and only enabled when a developer explicitly chooses to enable it, which is acceptable in test code contexts.
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: QuantumExplorer
PR: dashpay/platform#2235
File: packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs:8-9
Timestamp: 2024-10-10T05:10:50.059Z
Learning: In the codebase, importing `Secp256k1` from `dashcore::key::Secp256k1` is acceptable.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:19-19
Timestamp: 2024-10-24T04:58:02.843Z
Learning: For operations involving Tenderdash where no client library exists yet, it's acceptable to use the Node.js built-in `crypto` module.
Learnt from: shumkov
PR: dashpay/platform#2249
File: packages/dashmate/test/unit/status/scopes/platform.spec.js:466-467
Timestamp: 2024-10-18T15:37:21.329Z
Learning: In test files for the dashmate project, such as `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in tests rather than consolidating them, to increase readability.
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: shumkov
PR: dashpay/platform#2249
File: packages/dashmate/test/unit/status/scopes/platform.spec.js:77-78
Timestamp: 2024-10-18T15:37:36.387Z
Learning: In `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in tests to increase readability, rather than refactoring them into shared `beforeEach` blocks or helper functions.
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: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-dpp/src/bls/native_bls.rs:45-49
Timestamp: 2024-11-20T09:55:15.990Z
Learning: The `PublicKey<Bls12381G2Impl>` library is external and cannot be modified. Suggestions to modify it are not applicable.
Learnt from: shumkov
PR: dashpay/platform#2107
File: packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js:116-124
Timestamp: 2024-11-22T10:28:33.588Z
Learning: In `configureCoreTaskFactory` in `packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js`, the `local_seed` configuration is already established earlier in the code, so adding error handling for its absence in the 'Generating funds to use as a collateral for masternodes' task is unnecessary.
🪛 actionlint (1.7.7)
.github/workflows/wasm-sdk-documentation-check.yml

135-135: the runner of "peter-evans/create-pull-request@v5" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.37.1)
.github/workflows/wasm-sdk-documentation-check.yml

[error] 59-59: trailing spaces

(trailing-spaces)


[error] 74-74: trailing spaces

(trailing-spaces)


[error] 82-82: trailing spaces

(trailing-spaces)


[error] 86-86: trailing spaces

(trailing-spaces)


[error] 93-93: trailing spaces

(trailing-spaces)


[error] 94-94: trailing spaces

(trailing-spaces)


[error] 95-95: trailing spaces

(trailing-spaces)


[error] 98-98: trailing spaces

(trailing-spaces)


[error] 100-100: trailing spaces

(trailing-spaces)


[error] 132-132: trailing spaces

(trailing-spaces)


[error] 142-142: trailing spaces

(trailing-spaces)


[error] 152-152: no new line character at the end of file

(new-line-at-end-of-file)

🪛 Gitleaks (8.27.2)
packages/wasm-sdk/generate_docs.py

132-132: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


137-137: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


155-155: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 Ruff (0.12.2)
packages/wasm-sdk/generate_docs.py

8-8: os imported but unused

Remove unused import: os

(F401)


11-11: html imported but unused

Remove unused import: html

(F401)


336-336: Redefinition of unused html from line 11

(F811)


347-347: Redefinition of unused html from line 11

(F811)


363-363: Redefinition of unused html from line 11

(F811)


420-420: Redefinition of unused html from line 11

(F811)


1502-1502: f-string without any placeholders

Remove extraneous f prefix

(F541)


1590-1590: f-string without any placeholders

Remove extraneous f prefix

(F541)


1730-1730: Loop control variable cat_key not used within loop body

(B007)


1736-1736: Loop control variable cat_key not used within loop body

(B007)


1769-1769: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


1776-1776: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

🪛 GitHub Check: CodeQL
packages/wasm-sdk/tests/derive_public_key.html

[warning] 88-88: DOM text reinterpreted as HTML
DOM text is reinterpreted as HTML without escaping meta-characters.


[warning] 108-108: Exception text reinterpreted as HTML
Exception text is reinterpreted as HTML without escaping meta-characters.

🔇 Additional comments (4)
packages/wasm-sdk/tests/test_proof.js (1)

1-57: LGTM! Excellent error handling and user experience improvements.

The test script now properly handles all the previously identified issues:

  • File existence checking before attempting to read
  • Comprehensive error handling with informative messages
  • Clear instructions for users on how to resolve issues (build the WASM module)
  • Proper WASI integration and module instantiation

The code follows best practices and provides a robust foundation for WASM module testing.

packages/wasm-sdk/AI_REFERENCE.md (1)

1-1140: Excellent comprehensive AI reference documentation.

This is a well-structured and comprehensive reference document that effectively addresses the previous feedback about function naming consistency. The document now consistently uses camelCase for all SDK method names (e.g., getIdentity, getIdentityKeys, getIdentityBalance) which aligns with JavaScript conventions.

Key strengths:

  • Clear organization with logical sections
  • Detailed parameter descriptions and examples
  • Consistent naming conventions throughout
  • Comprehensive coverage of all SDK functionality
  • Practical code examples for common use cases
  • Helpful troubleshooting section

The document will be extremely valuable for developers working with the WASM SDK and for AI systems that need to understand the API surface.

packages/wasm-sdk/generate_docs.py (2)

122-278: LGTM - Test data identifiers are appropriate

The function correctly generates example code with realistic test data. The static analysis warnings about "API keys" are false positives - these are legitimate public testnet identifiers used for documentation examples.


491-1428: Large function complexity noted but previously addressed

While this function is quite large and complex, the past review comments indicate that refactoring was addressed in previous commits. The function handles HTML generation, embedded CSS, JavaScript, and WASM SDK initialization logic appropriately.

Comment on lines +53 to +54
<script src="https://cdn.jsdelivr.net/npm/bitcore-lib-dash@8.25.45/bitcore-lib-dash.min.js"></script>
</head>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix global object name – window.bitcoreLibDash is undefined in browser builds
The CDN bundle attaches the library to window.bitcore, not window.bitcoreLibDash.
Attempting to access window.bitcoreLibDash will throw undefined is not an object and break the page.

-                const dashcore = window.bitcoreLibDash;
+                const dashcore = window.bitcore;

Also applies to: 74-78

🤖 Prompt for AI Agents
In packages/wasm-sdk/tests/derive_public_key.html around lines 53-54 and 74-78,
the code incorrectly references the global object as window.bitcoreLibDash, but
the CDN bundle attaches the library to window.bitcore. Update all references
from window.bitcoreLibDash to window.bitcore to fix the undefined error and
prevent the page from breaking.


- name: Create documentation update PR (protected branches)
if: github.event_name == 'push' && (contains(github.ref, 'master') || contains(github.ref, 'main')) && steps.doc-check.outputs.status == 'failure'
uses: peter-evans/create-pull-request@v5
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update action version to fix compatibility.

The peter-evans/create-pull-request@v5 action version is outdated and may not work with current GitHub Actions runners.

-        uses: peter-evans/create-pull-request@v5
+        uses: peter-evans/create-pull-request@v6
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6
🧰 Tools
🪛 actionlint (1.7.7)

135-135: the runner of "peter-evans/create-pull-request@v5" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In .github/workflows/wasm-sdk-documentation-check.yml at line 135, update the
version of the peter-evans/create-pull-request action from v5 to the latest
stable version to ensure compatibility with current GitHub Actions runners.
Replace the version tag with the newest release available on the action's
repository.

Copy link
Member Author

@QuantumExplorer QuantumExplorer left a comment

Choose a reason for hiding this comment

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

Self reviewed

@QuantumExplorer QuantumExplorer merged commit efd8cb1 into v2.1-dev Jul 14, 2025
24 checks passed
@QuantumExplorer QuantumExplorer deleted the feat/wasm-docs branch July 14, 2025 18:55
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.

1 participant