-
Notifications
You must be signed in to change notification settings - Fork 697
refactoring: Isolate clarity VM behind feature gate for lightweight serialization #6239
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
base: develop
Are you sure you want to change the base?
refactoring: Isolate clarity VM behind feature gate for lightweight serialization #6239
Conversation
Hello, There is an issue when compiling with this for CosmWasm context. The issue comes from
It is similar to this issue: The Can you take a look at the To reproduce locally, you can get the code from this branch: And run the CosmWasm Optimizer build using Docker:
|
…larity-vm-feature-gate
…larity-vm-feature-gate
…larity-vm-feature-gate
Hello, commit
|
@raress96 can you try building
|
It compiles fine with this, thanks. |
Description
This PR builds on top of #6238, and will be rebased once the other PR will be merged.
The primary goal is to separate the core Clarity data types and their serialization/deserialization logic from the heavyweight components of the full Clarity Virtual Machine.
Currently, any project using the clarity crate, even for simple value serialization, must include the entire VM with all its heavy dependencies. This results in unnecessarily large binaries and slower compile times for tools that only need to interact with Clarity data structures.
This PR introduces a vm feature flag that gates all VM-related code, including parsing, analysis, and execution. This allows developers to use the clarity crate in a lightweight, serialization-only mode by disabling default features.
Key Changes:
Introduced
vm
Feature Flag:Gated VM Modules and Functionality:
comparison between buidling with default flags and --no-default-flags
This change is fully backward compatible. The default features in Cargo.toml are configured to include vm, so existing projects will experience no breaking changes.
OPEN TO SUGGESTIONS TO IMPROVE IT!
Applicable issues
clarity
to enable lightweight serialization crate #6236Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml