feat(move): add system state reset hooks#3970
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an admin-gated, system-reserved mechanism to reset (clear) object dynamic-field state by resetting an object’s field-tree root to the empty (genesis) root, and wires that capability into specific on-chain stores needed for Phase 1 slim mainnet rollout.
Changes:
- Add a new native + runtime API to clear an object’s dynamic fields (
object::clear_fields_by_system/native_clear_fields) by resetting field metadata (size + state root) and in-memory loaded fields. - Add admin-gated reset entrypoints for
RoochToBitcoinAddressMapping,BitcoinUTXOStore, andInscriptionStore, plus Move tests validating the reset behavior. - Regenerate/adjust Move docs and add an operational rollout plan document for the mainnet reset + rebase sequence.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| moveos/moveos-object-runtime/src/runtime_object_meta.rs | Adds metadata-level clear_fields to reset size/state-root to the empty root. |
| moveos/moveos-object-runtime/src/runtime_object.rs | Adds RuntimeObject::clear_fields to clear loaded field objects + delegate metadata reset. |
| frameworks/moveos-stdlib/src/natives/moveos_stdlib/object/object_fn.rs | Introduces native_clear_fields and its gas parameters. |
| frameworks/moveos-stdlib/src/natives/moveos_stdlib/object/mod.rs | Registers the new native and threads gas parameters through the module. |
| frameworks/moveos-stdlib/sources/object.move | Exposes clear_fields_by_system (system-reserved gated) and declares the new native. |
| frameworks/rooch-framework/src/natives/gas_parameter/object.rs | Adds gas schedule entry for native_clear_fields. |
| frameworks/rooch-framework/sources/address_mapping.move | Adds admin-gated reset entry for Rooch→Bitcoin mapping, plus a test helper. |
| frameworks/rooch-framework/sources/tests/state_reset_tests.move | Adds Move test for address mapping reset behavior. |
| frameworks/bitcoin-move/sources/utxo.move | Adds admin-gated reset entry for the UTXO store. |
| frameworks/bitcoin-move/sources/ord.move | Adds admin-gated reset entry for the inscription store + test helpers. |
| frameworks/bitcoin-move/sources/tests/state_reset_tests.move | Adds Move tests for UTXO + inscription store reset behavior. |
| frameworks/moveos-stdlib/doc/object.md | Regenerated docs to include clear_fields_by_system. |
| frameworks/rooch-framework/doc/address_mapping.md | Regenerated docs to include reset_rooch_to_bitcoin_mapping. |
| frameworks/bitcoin-move/doc/utxo.md | Regenerated docs to include reset_utxo_store. |
| frameworks/bitcoin-move/doc/ord.md | Regenerated docs to include reset_inscription_store. |
| frameworks/rooch-framework/doc/payment_channel.md | Doc reordering to place ErrorNotAdmin in the correct section. |
| docs/dev-guide/mainnet_state_reset_rollout_plan_20260317.md | Adds a concrete merge + mainnet execution sequence for Phase 1 slim rollout. |
You can also share your feedback on Copilot code review. Take the survey.
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
Testing