Skip to content

feat: implement WebAssembly Merkle Tree Module for client-side proof …#76

Merged
elizabetheonoja-art merged 4 commits into
Utility-Protocol:mainfrom
dev-king-001:main
Jun 24, 2026
Merged

feat: implement WebAssembly Merkle Tree Module for client-side proof …#76
elizabetheonoja-art merged 4 commits into
Utility-Protocol:mainfrom
dev-king-001:main

Conversation

@dev-king-001

Copy link
Copy Markdown
Contributor

Description

Implement a WebAssembly (WASM) based Merkle Tree module to significantly improve client-side performance for tree construction and proof generation. This introduces a Rust-compiled WASM implementation along with a Web Worker wrapper to offload heavy cryptographic operations from the main thread.

Closes #62

Changes Made

  • Rust WASM Module: Added a high-performance Rust implementation of a Merkle Tree in rust/merkle/ compiled to WebAssembly.
  • WASM Loader: Created src/utils/wasmLoader.ts to reliably fetch and instantiate the compiled .wasm binary.
  • TypeScript Wrapper: Created src/utils/merkleWasm.ts to handle memory allocation and provide a clean TypeScript interface to the WASM exports (buildTree, generateProof, verifyProof).
  • JS Fallback Integration: Added src/utils/merkleTree.ts to route calls through the WASM module if available, or fall back to a JavaScript stub if initialization fails.
  • Web Worker Support: Introduced src/workers/merkleWorker.worker.ts to execute Merkle tree tasks entirely off the main UI thread, using transferable ArrayBuffers for zero-copy performance.
  • Benchmarks: Added performance benchmark tests (src/tests/merkleWasm.bench.ts) to track and enforce minimum hash rates and proof generation times.
  • Config Updates: Updated vitest.config.ts to include .bench.ts files in the test suite.

Verification

  • Ensure benchmark tests pass and performance metrics are met.
  • Verify that WASM module loads successfully in the browser.
  • Confirm Web Worker offloads tasks without blocking the main UI thread.

fahatadam and others added 4 commits June 24, 2026 17:48
Resolved a strict mode violation in the 'container-queries.spec.ts' Playwright test where `getByText("Live Telemetry")` matched both the section heading and the loading text span. Updated the locator to use an exact string match to ensure reliable test execution on CI.

@elizabetheonoja-art elizabetheonoja-art left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@elizabetheonoja-art elizabetheonoja-art merged commit c112e12 into Utility-Protocol:main Jun 24, 2026
4 checks passed
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.

WebAssembly Module for Client-Side Merkle Tree Proof Generation with Rust SHA-256 at 15K Hashes/Second

3 participants