refactor: move AssetMap from clarity into the clarity-types crate - #7513
Open
cylewitruk-stacks wants to merge 1 commit into
Open
Conversation
5 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Moves asset-effect tracking from the Clarity VM into clarity-types while preserving compatibility re-exports and VM error behavior.
Changes:
- Introduces
effects::AssetMap,AssetMapEntry, andAssetMapError. - Preserves VM compatibility and maps new errors to existing VM errors.
- Adds feature-gated JSON support and expanded asset-map tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
stackslib/src/chainstate/stacks/db/transactions.rs |
Converts burn-total errors into VM errors. |
contrib/clarity-cli/Cargo.toml |
Enables asset-map JSON support. |
clarity/src/vm/errors.rs |
Re-exports and converts AssetMapError. |
clarity/src/vm/contexts.rs |
Re-exports the relocated asset-map types. |
clarity/Cargo.toml |
Forwards the JSON feature. |
clarity-types/src/tests/mod.rs |
Registers asset-map tests. |
clarity-types/src/tests/asset_map.rs |
Tests merging, overflow, epoch, and JSON behavior. |
clarity-types/src/lib.rs |
Exposes the effects module. |
clarity-types/src/effects/mod.rs |
Defines the effects module interface. |
clarity-types/src/effects/asset_map.rs |
Implements relocated asset tracking. |
clarity-types/README.md |
Documents effects and JSON support. |
clarity-types/Cargo.toml |
Adds the optional JSON feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Coverage Report for CI Build 31747827433Coverage decreased (-0.06%) to 86.584%Details
Uncovered Changes
Coverage Regressions194 previously-covered lines in 37 files lost coverage.
Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move
AssetMapandAssetMapEntryfromclarityinto the newclarity_types::effectsmodule and give them their ownAssetMapErrorerror type.The existing
clarity::vm::contexts::{AssetMap, AssetMapEntry}paths remain available as re-exports for downstream compatibility (following the already established convention of re-exportingclarity-typestypes fromclarity).Chose
effectsas the map/entry types felt more like "side-effect/accumulator" types than core Clarity types.See #7478 (comment) for more context.
Changes
AssetMapandAssetMapEntrytoclarity_types::effects.AssetMapErrortype for accumulation and merge failures.AssetMapErrorinto the existing Clarity VM error variants.AssetMapErrorthroughclarity::vm::errors.AssetMapandAssetMapEntrycompatibility paths.AssetMap::to_jsonbehind the optionalasset-map-jsonfeature.AssetMaptests, including coverage for:This is intended to be a dependency-boundary refactor with no consensus or runtime behavior changes.