Skip to content

feat(icrc1): add ICRC-123 freeze Operation variants, index-ng, and .did updates#9533

Draft
bogwar wants to merge 1 commit intoicrc-123-1-typesfrom
icrc-123-2-index-ng
Draft

feat(icrc1): add ICRC-123 freeze Operation variants, index-ng, and .did updates#9533
bogwar wants to merge 1 commit intoicrc-123-1-typesfrom
icrc-123-2-index-ng

Conversation

@bogwar
Copy link
Copy Markdown
Contributor

@bogwar bogwar commented Mar 21, 2026

Summary

  • Add FreezeAccount, UnfreezeAccount, FreezePrincipal, UnfreezePrincipal variants to Operation enum with CBOR encoding/decoding in Transaction
  • Add endpoint conversion support (OperationGetTransactionsResponse) with proper btype mapping for all 4 freeze/unfreeze block types
  • Update index-ng to treat freeze/unfreeze operations as non-balance-affecting (no index changes needed)
  • Add Rosetta stubs for freeze operations (full Rosetta support in follow-up PR)

Stacked on #9530.

Test plan

  • Existing index-ng tests continue to pass — freeze/unfreeze operations correctly handled as no-ops for balance tracking
  • Rosetta system tests pass — new operation variants are matched in all exhaustive match arms

🤖 Generated with Claude Code

…id updates

- Add 4 Operation variants: FreezeAccount, UnfreezeAccount, FreezePrincipal, UnfreezePrincipal
- Add account/principal fields to FlattenedTransaction for CBOR serialization
- Update TryFrom/From conversions for new block types
- Freeze ops are no-ops in Transaction::apply() (no balance impact)
- Update index-ng to handle freeze ops (no balance tracking)
- Update archive.did, index-ng.did, ledger.did with freeze types
- Update exhaustive Operation matches in test_utils, in_memory_ledger
- Add minimal rosetta match arms for new Operation variants

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for ICRC-123 freeze/unfreeze operations to the ledger suite. The PR extends the Operation enum with four new variants (FreezeAccount, UnfreezeAccount, FreezePrincipal, UnfreezePrincipal), adds serialization/deserialization support through the FlattenedTransaction struct, implements endpoint conversion in BlockTransaction conversions, and adds appropriate stubs for Rosetta support. The freeze operations are correctly treated as non-balance-affecting operations throughout the codebase.

Changes:

  • Added four freeze/unfreeze operation variants to the Operation enum in rs/ledger_suite/icrc1/src/lib.rs
  • Extended FlattenedTransaction with account and principal fields to support serialization
  • Implemented conversions between Operation/Transaction and FlattenedTransaction for all freeze variants
  • Added endpoint conversion support in rs/ledger_suite/icrc1/src/endpoints.rs mapping freeze operations to FreezeAccountAction and FreezePrincipalAction
  • Updated all exhaustive pattern matches across the codebase to include the four new operation variants
  • Updated error message in Rosetta tests from "ICRC-124 operations" to "Management operations" to reflect inclusion of ICRC-123 operations
  • Added unimplemented!() stubs for freeze operations in Rosetta with notes on follow-up PR

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rs/ledger_suite/icrc1/src/lib.rs Added four new Operation variants with full serialization/deserialization support and proper handling in apply_transaction as no-ops
rs/ledger_suite/icrc1/src/endpoints.rs Added Block→Transaction conversion for all four freeze operations
rs/ledger_suite/icrc1/index-ng/src/main.rs Updated pattern matches to handle freeze operations as non-balance-affecting
rs/ledger_suite/icrc1/test_utils/src/lib.rs Updated test utilities to properly handle freeze operations as no-ops in balance tracking
rs/ledger_suite/test_utils/in_memory_ledger/src/lib.rs Updated in-memory ledger to handle freeze operations as no-ops
rs/rosetta-api/icrc1/src/common/storage/types.rs Added unimplemented! stub with follow-up PR note
rs/rosetta-api/icrc1/src/construction_api/services.rs Updated test to include new operation variants with corrected error message
rs/rosetta-api/icrc1/tests/system_tests.rs Updated exhaustive match arm to include four new operation variants
rs/rosetta-api/icrc1/tests/multitoken_system_tests.rs Updated exhaustive match arm to include four new operation variants

All changes are consistent with the implementation pattern established by ICRC-124 management operations (Pause, Unpause, Deactivate). The implementation correctly:

  • Imports constants from icrc_ledger_types
  • Uses existing action types (FreezeAccountAction, FreezePrincipalAction)
  • Treats freeze operations as non-balance-affecting throughout the codebase
  • Provides clear unimplemented stubs with notes about follow-up work

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants