Skip to content

feat(sdk): wasm drive verify optimization#2683

Merged
QuantumExplorer merged 1 commit into
dashpay:v2.1-dev-sdkfrom
owl352:v2.1-dev-sdk
Jun 28, 2025
Merged

feat(sdk): wasm drive verify optimization#2683
QuantumExplorer merged 1 commit into
dashpay:v2.1-dev-sdkfrom
owl352:v2.1-dev-sdk

Conversation

@owl352
Copy link
Copy Markdown
Contributor

@owl352 owl352 commented Jun 25, 2025

Issue being fixed or feature implemented

This PR contains a fix for a build process that results in an unoptimized js package

Current size of build: 3 Mb

What was done?

  • Fixed Сargo.toml, because build profiles outside the parent Cargo.toml in workspace are not taken into account during build. Profile has also been slightly modified
  • Fixed build script. Added wasm-opt, wasm-snip and also updated to set individual profile parameters for build.
  • Fixed package.json. Before this PR package.json was generated when building from sh script, which is maximum not convenient and wrong. Now the root package.json for a module is the only and the main one for everything

How Has This Been Tested?

build by yarn build and then test in this project

Breaking Changes

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

@owl352 owl352 requested a review from QuantumExplorer as a code owner June 25, 2025 20:12
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 25, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@pshenmic pshenmic added this to the v2.1 milestone Jun 25, 2025
@lklimek lklimek requested review from Copilot June 26, 2025 08:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the WASM build pipeline for wasm-drive-verify by moving package metadata into its root package.json, applying Cargo and Binaryen optimizations in the build script, and removing redundant profile settings from Cargo.toml.

  • Consolidated and simplified package metadata in packages/wasm-drive-verify/package.json (added main/types, formatted collaborators).
  • Enhanced build.sh to use wasm-snip, refined wasm-bindgen invocation, and integrated extensive wasm-opt optimizations.
  • Removed local [profile.release] in Cargo.toml and registered the new package in the workspace’s root package.json.

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

File Description
packages/wasm-drive-verify/package.json Defined entry points (main, types) and formatted metadata
packages/wasm-drive-verify/build.sh Updated build steps: Cargo --config flags, wasm-snip/opt
packages/wasm-drive-verify/Cargo.toml Removed [profile.release] section in favor of CLI overrides
package.json Added packages/wasm-drive-verify to workspace packages
Files not reviewed (1)
  • .pnp.cjs: Language not supported
Comments suppressed due to low confidence (2)

packages/wasm-drive-verify/package.json:18

  • The exports field still points to ./dist/index.js, but the package entry points are now in pkg/. Update this to reference pkg/wasm_drive_verify.js (and corresponding require path) to match the new main.
      "import": "./dist/index.js",

packages/wasm-drive-verify/build.sh:38

  • The wasm-bindgen command is passing the input file as an argument to the --omit-default-module-path flag. Move the input path to the end of the command and keep --omit-default-module-path standalone, e.g.: wasm-bindgen ../../target/.../wasm_drive_verify.wasm --out-dir pkg --target web --omit-default-module-path.
  --omit-default-module-path ../../target/wasm32-unknown-unknown/release/wasm_drive_verify.wasm

Comment thread packages/wasm-drive-verify/build.sh
Comment thread packages/wasm-drive-verify/package.json
transitions = []
debug_logs = []

[profile.release]
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.

Can we move these settings to .cargo/config.toml and .cargo/config-release.toml instead of adding them to the build script?

Copilot suggests (but I didn't test):

[target.wasm32-unknown-unknown.profile.release]
opt-level = "z"
lto = true
codegen-units = 1
strip = true
panic = "abort"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

doesn't work.
3.6 mb instead of 3 mb.

And if you put it in .cargo/config.toml, it throws an error

error: expected a string, but found a table for `release` in /Users/bebra/Documents/Dash/verify/platform/packages/wasm-drive-verify/.cargo/config.toml

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

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

Thanks, this is great.

@QuantumExplorer QuantumExplorer changed the title feat: wasm drive verify optimization feat(sdk): wasm drive verify optimization Jun 28, 2025
@QuantumExplorer QuantumExplorer merged commit 7325012 into dashpay:v2.1-dev-sdk Jun 28, 2025
6 checks passed
QuantumExplorer pushed a commit that referenced this pull request Jun 28, 2025
Resolves merge conflicts by:
- Accepting upstream Cargo.toml changes that properly fix LTO configuration at workspace level (PR #2683)
- Accepting upstream .pnp.cjs and yarn.lock changes
- Removing temporary local workarounds for WASM build issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants