feat(icrc1): add ICRC-154 pause/unpause/deactivate ledger endpoints#9510
Draft
bogwar wants to merge 3 commits intoicrc-124-3-rosettafrom
Draft
feat(icrc1): add ICRC-154 pause/unpause/deactivate ledger endpoints#9510bogwar wants to merge 3 commits intoicrc-124-3-rosettafrom
bogwar wants to merge 3 commits intoicrc-124-3-rosettafrom
Conversation
Add the actual ICRC-154 endpoints so the ledger can create pause, unpause, and deactivate blocks in response to controller calls. Includes query methods for state inspection and a pause guard that blocks transfers and approvals when the ledger is paused or deactivated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ICRC-154 pause/unpause/deactivate management endpoints to the ICRC-1 ledger canister, including persisted paused/deactivated state and corresponding type/interface updates, and updates state-machine assertions for supported standards and block types.
Changes:
- Introduces
icrc154_pause,icrc154_unpause,icrc154_deactivateupdate calls (controller-only) plusicrc154_is_paused/icrc154_is_deactivatedquery calls, and records these actions as ICRC-124 block types. - Persists
pausedanddeactivatedflags inLedgerstate and gatesicrc1_transfer,icrc2_approve, andicrc2_transfer_fromwhen paused/deactivated. - Extends
icrc-ledger-typeswith ICRC-154 Candid args/errors and updates the.didinterface + SM tests for new supported standard and block types.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rs/ledger_suite/tests/sm-tests/src/lib.rs | Updates expected supported standards and ICRC-3 supported block types to include ICRC-154 / 124pause/124unpause/124deactivate. |
| rs/ledger_suite/icrc1/ledger/src/main.rs | Adds pause/deactivate guard to transfers/approvals, registers ICRC-154 + block types, and implements new ICRC-154 endpoints. |
| rs/ledger_suite/icrc1/ledger/src/lib.rs | Adds persisted paused/deactivated flags with accessors/mutators and initializes defaults for upgrade compatibility. |
| rs/ledger_suite/icrc1/ledger/ledger.did | Adds ICRC-154 types and service methods to the public Candid interface. |
| packages/icrc-ledger-types/src/lib.rs | Exposes a new icrc154 module. |
| packages/icrc-ledger-types/src/icrc154/mod.rs | Defines ICRC-154 args and error enums for Candid/serde. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The archive canister doesn't advertise 124 block types, only the ledger does. Split the check so archive tests can opt out of expecting them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…fields The new fields on the Ledger struct slightly increase serialization cost during upgrades. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
PauseArgs,UnpauseArgs,DeactivateArgsand corresponding error enums) inicrc-ledger-typespaused/deactivatedpersistent state to theLedgerstruct with accessor/setter methodsicrc154_pause,icrc154_unpause,icrc154_deactivate) that create ICRC-124 blocks and update ledger state, authorized viais_controller()icrc154_is_paused,icrc154_is_deactivated) for state inspectionicrc1_transfer,icrc2_approve, andicrc2_transfer_fromthat returnsGenericErrorwhen the ledger is paused or deactivated.didfile with new types and service methodsStacked on #9488 (PR 3: Rosetta support)
Test plan
cargo clippypasses foricrc-ledger-typesandic-icrc1-ledgercheck_candid_interface)ledger_unit_testpassesledger_canister_testpassesledger_testandledger_test_u256pass (including updated supported standards/block types assertions)upgrade_downgradeandupgrade_downgrade_u256pass (serde defaults ensure backward compatibility)icrc1_unit_testpassesicrc-ledger-typestests pass🤖 Generated with Claude Code