feat(icrc1): add ICRC-124 Rosetta data API support#9504
feat(icrc1): add ICRC-124 Rosetta data API support#9504bogwar wants to merge 2 commits intoicrc-124-2-index-ngfrom
Conversation
Add proper Rosetta data-API support for Pause, Unpause, and Deactivate operations following the FeeCollector pattern: metadata-only operations with no amounts or account changes. Construction API correctly remains unsupported (management operations). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Rosetta Data API support for ICRC-124 management operations (Pause/Unpause/Deactivate) by introducing shared metadata and implementing bidirectional conversions between ledger operations and Rosetta operations, while explicitly keeping Construction API unsupported for these privileged actions.
Changes:
- Extend Rosetta
OperationTypewithPause,Unpause, andDeactivate. - Add
ManagementActionMetadata(caller/mthd/reason) and use it for ICRC-124 Rosetta operation metadata. - Replace prior
panic!stubs with proper metadata-only Rosetta operation conversions and add round-trip parsing back intoIcrcOperation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
rs/rosetta-api/icrc1/src/common/utils/utils.rs |
Implements parsing/building of Pause/Unpause/Deactivate between Rosetta operations and stored ICRC operations; replaces panic path with metadata-only operations. |
rs/rosetta-api/icrc1/src/common/types.rs |
Adds new operation types and introduces ManagementActionMetadata with ObjectMap conversion helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| pub fn build(self) -> anyhow::Result<crate::common::storage::types::IcrcOperation> { | ||
| Ok(match self.icrc_operation.context("Icrc Operation type needs to be of type Mint, Burn, Transfer or Approve")? { |
There was a problem hiding this comment.
The context/error message in build() is now misleading: it still says the operation type must be Mint/Burn/Transfer/Approve, but this builder also supports FeeCollector and the new Pause/Unpause/Deactivate variants. Please update the message so debugging invalid/missing operation types is accurate.
| Ok(match self.icrc_operation.context("Icrc Operation type needs to be of type Mint, Burn, Transfer or Approve")? { | |
| Ok(match self.icrc_operation.context("Icrc Operation type must be one of Mint, Burn, Transfer, Approve, FeeCollector, Pause, Unpause, or Deactivate")? { |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 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,Deactivatevariants to RosettaOperationTypeenumManagementActionMetadatastruct (shared by all three ops) withcaller,mthd,reasonfieldspanic!stubs with metadata-only Rosetta operations (no amounts, no accounts) following the FeeCollector patternrosetta_core_operations_to_icrc1_operationfor the three new operation typesbail!) — these are privileged management operationsTest plan
cargo clippy --all-features -p ic-icrc-rosettapassesbazel test //rs/rosetta-api/icrc1:ic-icrc-rosetta-unit-testspasses (includes proptest round-trip coverage for Pause/Unpause/Deactivate viaarb_op())🤖 Generated with Claude Code