feat(icrc1): add ICRC-124 pause/unpause/deactivate operations#9501
feat(icrc1): add ICRC-124 pause/unpause/deactivate operations#9501bogwar wants to merge 3 commits intoicrc-124-1-typesfrom
Conversation
Add Pause, Unpause, and Deactivate operation variants across the ledger suite for ICRC-124 support. These management operations share a common ManagementAction payload (caller, reason, ts, mthd) and do not affect account balances. Changes: - Add ManagementAction struct and Transaction fields in icrc-ledger-types - Add Operation variants and FlattenedTransaction support in ic-icrc1 - Add endpoint conversions in ic-icrc1 endpoints - Handle new variants in index-ng (no-op for balances, empty accounts) - Update .did files (ledger, archive, index-ng) - Add Rosetta stubs (IcrcOperation variants, exhaustive match arms) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds ICRC-124 management transaction kinds (pause/unpause/deactivate) across the ICRC-1 ledger stack, propagating them through transaction encoding/decoding, .did interfaces, index-ng handling, and Rosetta parsing/match exhaustiveness.
Changes:
- Extend core ICRC-1
Operation/transaction flattening and endpointTransactionconversion to includePause,Unpause, andDeactivatewith a sharedManagementActionpayload. - Update index-ng and test utilities to treat ICRC-124 operations as balance-neutral and account-list-empty.
- Update Rosetta storage/types parsing plus add explicit “not supported” stubs for ICRC-124 operations.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rs/rosetta-api/icrc1/src/data_api/services.rs | Adjust tests/account selection logic to ignore new management ops. |
| rs/rosetta-api/icrc1/src/construction_api/utils.rs | Explicitly rejects ICRC-124 ops in construction helpers. |
| rs/rosetta-api/icrc1/src/construction_api/services.rs | Adds exhaustive match handling in tests for new ledger ops. |
| rs/rosetta-api/icrc1/src/common/utils/utils.rs | Adds Rosetta conversion stub behavior for ICRC-124 ops. |
| rs/rosetta-api/icrc1/src/common/storage/types.rs | Adds Rosetta storage IcrcOperation variants + btype parsing/serialization and proptests. |
| rs/rosetta-api/icrc1/src/common/storage/storage_operations/mod.rs | Treats ICRC-124 ops as no-ops for balances; stores them with operation_type strings. |
| rs/ledger_suite/test_utils/in_memory_ledger/src/lib.rs | Treats ICRC-124 ops as balance-neutral in in-memory ledger. |
| rs/ledger_suite/icrc1/test_utils/src/lib.rs | Updates strategies/balance tracking to account for new ops as balance-neutral. |
| rs/ledger_suite/icrc1/src/lib.rs | Adds core Operation variants + flattening fields for reason; wires btype-based decoding. |
| rs/ledger_suite/icrc1/src/endpoints.rs | Adds new Transaction fields and maps ledger ops to ManagementAction payloads. |
| rs/ledger_suite/icrc1/ledger/ledger.did | Extends Candid Transaction with pause/unpause/deactivate + ManagementAction type. |
| rs/ledger_suite/icrc1/index-ng/src/main.rs | Ignores ICRC-124 ops for balances and returns empty account lists. |
| rs/ledger_suite/icrc1/index-ng/index-ng.did | Extends index-ng Candid Transaction and adds ManagementAction. |
| rs/ledger_suite/icrc1/archive/archive.did | Extends archive Candid Transaction and adds ManagementAction. |
| packages/icrc-ledger-types/src/icrc3/transactions.rs | Adds transaction kind constants, ManagementAction, and Transaction fields/constructors for ICRC-124 ops. |
Comments suppressed due to low confidence (1)
rs/rosetta-api/icrc1/src/common/storage/types.rs:512
- The fallback error message for unknown operation types is now misleading: the match accepts
BTYPE_107and the newBTYPE_124_*values, but the error still says only'burn', 'mint', 'xfer' or 'approve'are expected. Updating the message (or making it generic like "unsupported operation type") would make debugging malformed blocks much easier.
found => {
bail!(
"Expected field 'op' to be 'burn', 'mint', 'xfer' or 'approve' but found {found}"
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make Operation::apply() a no-op for ICRC-124 variants instead of panicking, so ledger replay/upgrade handles management blocks safely - Fix non-exhaustive match in rosetta system_tests.rs - Add missing pause/unpause/deactivate fields in Transaction struct literals in sns token_valuation and nervous_system initial_supply tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix non-exhaustive match in multitoken_system_tests.rs - Add missing pause/unpause/deactivate fields in index-ng test - Use BTYPE_124_* constants instead of hardcoded strings in rosetta storage_operations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Pause,Unpause,Deactivateoperation variants to the core ledger library (ic-icrc1), with a sharedManagementActionCandid payload structTransactionresponse includes the new operation kinds.didfiles (ledger, archive, index-ng) withManagementActiontype and newTransactionfieldsIcrcOperationvariants, btype parsing, exhaustive match arms)PR 2 in a 4-PR stacked series for ICRC-124/154. Stacked on #9500.
Test plan
cargo clippyonicrc-ledger-types,ic-icrc1,ic-icrc1-index-ng,ic-icrc-rosetta,ic-icrc1-test-utils//packages/icrc-ledger-types:test//rs/ledger_suite/icrc1:icrc1_unit_test//rs/ledger_suite/icrc1:icrc1_test//rs/ledger_suite/icrc1/index-ng:index_ng_unit_test.didcompatibility tests (ledger, archive, index-ng — both u64 and u256)//rs/rosetta-api/icrc1:ic-icrc-rosetta-unit-tests🤖 Generated with Claude Code