Skip to content

feat(icrc1): add ICRC-124 Rosetta data API support#9504

Draft
bogwar wants to merge 2 commits intoicrc-124-2-index-ngfrom
icrc-124-3-rosetta
Draft

feat(icrc1): add ICRC-124 Rosetta data API support#9504
bogwar wants to merge 2 commits intoicrc-124-2-index-ngfrom
icrc-124-3-rosetta

Conversation

@bogwar
Copy link
Contributor

@bogwar bogwar commented Mar 19, 2026

Summary

  • Add Pause, Unpause, Deactivate variants to Rosetta OperationType enum
  • Add ManagementActionMetadata struct (shared by all three ops) with caller, mthd, reason fields
  • Implement proper data-API conversion paths replacing panic! stubs with metadata-only Rosetta operations (no amounts, no accounts) following the FeeCollector pattern
  • Add round-trip parsing in rosetta_core_operations_to_icrc1_operation for the three new operation types
  • Construction API correctly remains unsupported (bail!) — these are privileged management operations

Test plan

  • cargo clippy --all-features -p ic-icrc-rosetta passes
  • bazel test //rs/rosetta-api/icrc1:ic-icrc-rosetta-unit-tests passes (includes proptest round-trip coverage for Pause/Unpause/Deactivate via arb_op())

🤖 Generated with Claude Code

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>
Copy link
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

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 OperationType with Pause, Unpause, and Deactivate.
  • 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 into IcrcOperation.

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")? {
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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")? {

Copilot uses AI. Check for mistakes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
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

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.

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