feat(ckdoge-minter): support ICRC-21 consent messages#10140
Open
Dfinity-Bjoern wants to merge 2 commits intomasterfrom
Open
feat(ckdoge-minter): support ICRC-21 consent messages#10140Dfinity-Bjoern wants to merge 2 commits intomasterfrom
Dfinity-Bjoern wants to merge 2 commits intomasterfrom
Conversation
Implements the ICRC-21 Canister Call Consent Message standard on the ckDOGE minter so that ICRC-21-aware wallets can display a human-readable description of `retrieve_doge_with_approval` calls before the user signs. Mirrors the ckBTC minter implementation from #10093, with the PR-review learnings applied up front: - Token symbols depend on the configured Dogecoin network (Mainnet => ckDOGE/DOGE, Regtest => ckTESTDOGE/TESTDOGE) and are threaded through both the GenericDisplay Markdown and FieldsDisplay fields. - `retrieve_doge_with_approval` is the only supported method; the legacy `retrieve_doge` flow intentionally returns UnsupportedCanisterCall. - Long values (Dogecoin address, subaccount hex) are emitted as a single `Value::Text` per the ICRC-21 spec — wallets are responsible for paginating, no canister-side chunking. - The destination address is parsed via `DogecoinAddress::parse` before any interpolation, blocking Markdown-injection payloads (newlines, backticks, `#`) and rejecting addresses from the wrong network. - Reuses `MAX_CONSENT_MESSAGE_ARG_SIZE_BYTES` from icrc-ledger-types. - ICRC-10 / ICRC-21 URLs point at the canonical dfinity/ICRC repo. - ICRC-21 unit tests live in `updates/tests.rs` (separate from prod code), and a smoke integration test exercises the endpoints end-to-end through Candid. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ICRC-21 “canister call consent messages” support to the ckDOGE minter so ICRC-21-aware wallets can preview a human-readable description of retrieve_doge_with_approval before signing, and advertises ICRC-10/ICRC-21 support via icrc10_supported_standards.
Changes:
- Implemented ICRC-21 consent message generation (GenericDisplay Markdown + FieldsDisplay fields) for
retrieve_doge_with_approval, including network-aware symbols (Mainnet vs Regtest) and address validation. - Exposed new canister endpoints:
icrc21_canister_call_consent_message(update) andicrc10_supported_standards(query), and updated the.didaccordingly. - Added unit + integration smoke tests and updated test utilities to exercise the new endpoints.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rs/dogecoin/ckdoge/test_utils/src/minter.rs | Adds helper wrappers to call/decode the new ICRC-10/ICRC-21 endpoints in PocketIC-based tests. |
| rs/dogecoin/ckdoge/minter/tests/tests.rs | Adds an integration smoke test covering supported-standards advertising, both display variants, and unsupported-method behavior. |
| rs/dogecoin/ckdoge/minter/src/updates/tests.rs | Adds unit tests for argument-size limits, decode failures, both display variants (with/without subaccount), network-aware symbols, and invalid-address rejection. |
| rs/dogecoin/ckdoge/minter/src/updates/mod.rs | Exposes the new icrc21 updates module. |
| rs/dogecoin/ckdoge/minter/src/updates/icrc21.rs | Implements ICRC-21 consent message construction + ICRC-10 supported-standards list for ckDOGE. |
| rs/dogecoin/ckdoge/minter/src/main.rs | Exposes the two new canister endpoints wired to the updates::icrc21 module. |
| rs/dogecoin/ckdoge/minter/ckdoge_minter.did | Adds ICRC-10/ICRC-21 types and endpoint declarations to the public Candid interface. |
| rs/dogecoin/ckdoge/minter/BUILD.bazel | Adds the needed icrc-ledger-types dependency for the canister build target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The qualified `candid::Encode!(...)` form doesn't resolve through the
re-export chain on the Linux toolchain — both Cargo Lint Linux and
Bazel Test All fail with:
error: cannot find macro `Encode` in this scope
= note: this error originates in the macro `candid::Encode`
Switch to the standard `use candid::Encode;` + bare `Encode!(...)` form
that the rest of the codebase uses. No behaviour change.
Co-Authored-By: Claude Opus 4.7 (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
Implements the ICRC-21 Canister Call Consent Message standard on the ckDOGE minter so that ICRC-21-aware wallets can display a human-readable description of
retrieve_doge_with_approvalcalls before the user signs.Both display variants from the standard are supported:
(label, Value)fields tailored for hardware wallets (e.g. Ledger Nano S+).Also adds an
icrc10_supported_standardsquery that advertises ICRC-10 and ICRC-21.This mirrors the ckBTC minter implementation from #10093, with the PR-review learnings applied up front rather than as follow-ups.
Implementation
rs/dogecoin/ckdoge/minter/src/updates/icrc21.rsholds the consent-message construction andicrc10_supported_standards.main.rsexposes the two new endpoints (icrc21_canister_call_consent_messageasupdate,icrc10_supported_standardsasquery).ckdoge_minter.diddeclares the ICRC-10 / ICRC-21 types and methods.MAX_CONSENT_MESSAGE_ARG_SIZE_BYTESfromicrc-ledger-types) and returnsIcrc21Error::UnsupportedCanisterCallfor unknown methods or undecodable args.retrieve_doge_with_approvalproduces a consent message; the legacyretrieve_dogeflow intentionally returnsUnsupportedCanisterCall.Mainnet ⇒ ckDOGE/DOGE,Regtest ⇒ ckTESTDOGE/TESTDOGE, threaded through the GenericDisplay Markdown, the FieldsDisplay intent, theTokenAmountsymbol, and the address label.Value::Textper the ICRC-21 spec; wallets handle pagination (cf. the Ledger ICP app).DogecoinAddress::parsebefore any interpolation. Bad addresses (including newlines/backticks/#payloads or addresses from the wrong network) are rejected with a generic error and never echoed back.dfinity/ICRCrepo.Test plan
updates::tests::icrc21covering: argument-size limit, unsupported method (incl. explicitretrieve_doge), decode failures, GenericDisplay output (with and without subaccount), FieldsDisplay output (with and without subaccount), regtest token symbols (both display variants), and Markdown-injection / wrong-network address rejection. Tests live inupdates/tests.rs(separate from prod code).test_icrc21_endpoints_smokeintegration test intests/tests.rsinstalls a mainnet minter viaSetup::new(Network::Mainnet)and exercises the full Candid path end-to-end:icrc10_supported_standardsadvertises both standards with the canonical URL;icrc21_canister_call_consent_messagereturns the expected GenericDisplay markdown and FieldsDisplay structured message; unsupported methods (includingretrieve_doge) are rejected.cargo clippy --all-features -p ic-ckdoge-minter -p ic-ckdoge-minter-test-utilsclean with the workspace lint set.bazel test //rs/dogecoin/ckdoge/minter:unit_tests //rs/dogecoin/ckdoge/minter:ckdoge_candid_api_tests //rs/dogecoin/ckdoge/minter:ckdoge_minter_replay_events_testsall pass (the candid API test verifies the.didmatches the canister).bazel test //rs/dogecoin/ckdoge/minter:integration_tests(Linux x86_64 only — runs in CI; contains the smoke test).🤖 Generated with Claude Code