Skip to content

chore: build clarity for wasm32-unknown-unknown #6268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

hugocaillard
Copy link
Contributor

@hugocaillard hugocaillard commented Jul 8, 2025

Description

Fix: #5891

With the PR, the clarity-vm can be compiled to wasm32-unknown-unknown, as it is being using the clarinet JS SDK.

It mostly hide a few things behind compilation flags.

This PR also includes a few changes that are need for clarinet. Mostly by making public certain functions.

WIth this PR, this command passes:

cargo check -p clarity --no-default-features --target wasm32-unknown-unknown

Once this is merged, this check should be added to the CI.

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo
  • New integration test(s) added to bitcoin-tests.yml

@hugocaillard hugocaillard requested review from a team as code owners July 8, 2025 18:44
@hugocaillard
Copy link
Contributor Author

hugocaillard commented Jul 8, 2025

I just saw #6239, which is super promising for clarinet.

The two PRs enable similar things (compile to wasm), but also, this specific one (6268) add some changes needed specifically for clarinet.
I'm happy to move it in an other PR if needed

obycode
obycode previously approved these changes Jul 9, 2025
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

🎉

@hugocaillard hugocaillard force-pushed the chore/build-for-wasm32 branch from 7ece404 to 94c13c9 Compare July 9, 2025 08:33
@hugocaillard hugocaillard force-pushed the chore/build-for-wasm32 branch from 94c13c9 to 101a3bb Compare July 9, 2025 08:34
@hugocaillard
Copy link
Contributor Author

@obycode
I pushed an other commit, adding #[serde(default)] to symbolic expression developer-mode properties.
That useful when the vm with developer-mode enabled fetches data from the api (eg: clarinet mainnet execution simulation), and the api doesn't return the span.

obycode
obycode previously approved these changes Jul 9, 2025
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

👍

@aldur aldur requested a review from Jiloc July 10, 2025 14:48
@hugocaillard hugocaillard requested a review from Jiloc July 11, 2025 12:37
@hugocaillard
Copy link
Contributor Author

Thanks @Jiloc!

Copy link
Contributor

@Jiloc Jiloc left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link

codecov bot commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 11.11111% with 16 lines in your changes missing coverage. Please review.

Project coverage is 82.07%. Comparing base (c86013a) to head (c8bb20f).
Report is 28 commits behind head on develop.

Files with missing lines Patch % Lines
clarity/src/vm/costs/mod.rs 0.00% 13 Missing ⚠️
clarity/src/vm/representations.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #6268       +/-   ##
============================================
+ Coverage    62.18%   82.07%   +19.89%     
============================================
  Files          546      546               
  Lines       347228   347238       +10     
  Branches       323      323               
============================================
+ Hits        215912   284991    +69079     
+ Misses      131308    62239    -69069     
  Partials         8        8               
Files with missing lines Coverage Δ
clarity/src/vm/analysis/type_checker/v2_05/mod.rs 90.35% <100.00%> (+3.16%) ⬆️
clarity/src/vm/docs/mod.rs 90.09% <100.00%> (+47.46%) ⬆️
clarity/src/vm/mod.rs 90.41% <ø> (+3.88%) ⬆️
stacks-common/src/deps_common/bitcoin/util/mod.rs 0.00% <ø> (ø)
clarity/src/vm/representations.rs 81.53% <0.00%> (+2.75%) ⬆️
clarity/src/vm/costs/mod.rs 81.47% <0.00%> (+1.96%) ⬆️

... and 379 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c86013a...c8bb20f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants