Skip to content

feat(regulated_token): store freeze, recovery and owner pinning - #599

Draft
JohnChangUK wants to merge 9 commits into
developfrom
fix/regulated-token-store-freeze
Draft

JohnChangUK wants to merge 9 commits into
developfrom
fix/regulated-token-store-freeze

Conversation

@JohnChangUK

@JohnChangUK JohnChangUK commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Hooks check object::root_owner(store) instead of the direct owner, so an account freeze reaches nested stores.
  • New entries freeze_stores, unfreeze_stores, burn_frozen_stores, recover_frozen_stores; the MCMS registrar dispatches all four.
  • Owner pinning: a store's root owner is recorded on first credit. A funded store must keep a matching pin, so a frozen holder cannot move funds by reparenting. Account primary stores are exempt because their owner cannot change. Empty stores rebind freely. Funded non-primary stores from before the upgrade stay locked until operator recovery.

Rollout

cbBTC (0xbb705952..., MCMS-owned) and USD1 (0x6febdb56..., external owner).

  1. Upgrade the package. cbBTC: via MCMS with the registrar package in the same upgrade. USD1: the external owner publishes directly.
  2. Post-upgrade, funded non-primary stores have no pin and abort E_STORE_NOT_PINNED. Account primary stores, empty stores and new stores are unaffected.
  3. Per affected store: freeze_stores([store]) then recover_frozen_stores([store], destination).

Ticket: https://smartcontract-it.atlassian.net/browse/NONEVM-6394

Port of the chainlink-ccip-aptos change
(smartcontractkit/chainlink-ccip-aptos#296):

- Hooks check the root owner of the store instead of the direct owner,
  so nested stores behind a controller object are covered.
- New store-level operations: freeze_stores, unfreeze_stores,
  burn_frozen_stores, recover_frozen_stores and the is_store_frozen view.
- One adaptation: fungible_asset::transfer_ref_metadata comparison keeps
  the 1.6 form (no references).
Second half of the chainlink-ccip-aptos port
(smartcontractkit/chainlink-ccip-aptos#296).
StoreOwnerPins records each store's root owner on first credit; credits
repin empty stores, debits and funded-store credits require a matching
pin, so a frozen holder cannot move funds by reparenting the store.
Funded stores predating the pin stay locked until operator recovery.
Empty stores skip the debit pin check: nothing can leave them, and
zero-amount debits must keep working.

Adaptations for the 1.6 toolchain (CLI 9.1.0 resolves receiver calls only
to self-named first parameters): object::root_owner,
object::object_address, fungible_asset::transfer_ref_metadata,
object::generate_signer_for_extending and signer::address_of are called
in classic form.
Register freeze_stores, unfreeze_stores, burn_frozen_stores and
recover_frozen_stores in the regulated_token MCMS registrar so
MCMS-owned deployments can reach the new store-level operations.
The hooks now check only the root owner, so freeze_account on the object
holding a store no longer stopped that store. Check the direct owner too,
as the code did before the root-owner change.
The frozen-store requirement aborted with the bare constant; wrap it in
error::invalid_state per the style guide, so clients see 0x30010 next to
the module's other categorized codes.
A store funded before StoreOwnerPins existed has no pin, so after an
in-place upgrade every deposit and withdrawal aborted E_STORE_NOT_PINNED.
An account's primary store cannot change owner, so skip the pin check for
it. StoreOwnershipPinned becomes a module event, and the tests cover the
upgrade cases.

This branch has not been deployed

No deployments
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.

1 participant