Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5b52dc3
feat(ckbtc-minter): support ICRC-21 consent messages
May 5, 2026
9a2df03
feat(ckbtc-minter): derive ICRC-21 token symbols from btc_network
May 5, 2026
cd68db5
Merge branch 'master' into bjoern/ckbtc-minter-icrc-21
Dfinity-Bjoern May 5, 2026
e2efdac
chore(ckbtc-minter): reuse shared MAX_CONSENT_MESSAGE_ARG_SIZE_BYTES
May 5, 2026
94fd5f6
Clippy fix
May 5, 2026
00f26c7
Update rs/bitcoin/ckbtc/minter/src/updates/icrc21.rs
Dfinity-Bjoern May 5, 2026
9cc5fb7
Update rs/bitcoin/ckbtc/minter/src/updates/icrc21.rs
Dfinity-Bjoern May 5, 2026
e96631c
refactor(ckbtc-minter): drop ICRC-21 FieldsDisplay value pre-chunking
May 5, 2026
6285499
feat(ckbtc-minter): validate destination address in ICRC-21 endpoint
May 5, 2026
36684ce
refactor(ckbtc-minter): tighten ICRC-21 GenericDisplay construction
May 5, 2026
ffeaff5
Merge branch 'master' into bjoern/ckbtc-minter-icrc-21
Dfinity-Bjoern May 5, 2026
f96bd35
chore(ckbtc-minter): allow canbench update target on Apple Silicon
May 5, 2026
b0195c3
chore(ckbtc-minter): point ICRC-21 standard URL at the dfinity/ICRC repo
May 5, 2026
1670bc4
Merge branch 'bjoern/ckbtc-minter-icrc-21' of github.com:dfinity/ic i…
May 5, 2026
75b279d
feat(ckbtc-minter): scope ICRC-21 to retrieve_btc_with_approval only
May 6, 2026
172b5c7
refactor(ckbtc-minter): move ICRC-21 tests into updates/tests.rs
May 6, 2026
3dc1a91
test(ckbtc-minter): smoke integration test for ICRC-10/ICRC-21 endpoints
May 6, 2026
bd563a2
test(ckbtc-minter): pin full GenericDisplay message in smoke test
May 6, 2026
da14c6d
Update canbench measurement
May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rs/bitcoin/ckbtc/minter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ genrule(
$(location :ckbtc_minter_dump_stable_memory) $(location @ckbtc_mainnet_events.gz//file) $@
""",
# For some unknown reason this target can take well over an hour to run on MacOS x86_64 so we exclude that platform:
# Note: `@platforms//cpu:arm` is 32-bit ARM. Apple Silicon is `aarch64`,
# so use that here — otherwise this target is incompatible on every Mac.
target_compatible_with = select({
"@platforms//os:osx": ["@platforms//cpu:arm"],
"@platforms//os:osx": ["@platforms//cpu:aarch64"],
"//conditions:default": [],
}),
visibility = ["//visibility:private"],
Expand Down
40 changes: 20 additions & 20 deletions rs/bitcoin/ckbtc/minter/canbench/results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ benches:
build_estimate_retrieve_btc_fee_1_50k_sats:
total:
calls: 1
instructions: 419639
instructions: 419644
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3441
instructions: 3446
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand All @@ -24,18 +24,18 @@ benches:
build_unsigned_transaction_1_50k_sats:
total:
calls: 1
instructions: 421753
instructions: 421760
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction:
calls: 1
instructions: 419172
instructions: 419177
heap_increase: 0
stable_memory_increase: 0
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3441
instructions: 3446
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand All @@ -51,18 +51,18 @@ benches:
build_unsigned_transaction_2_100k_sats:
total:
calls: 1
instructions: 421799
instructions: 421806
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction:
calls: 1
instructions: 419218
instructions: 419223
heap_increase: 0
stable_memory_increase: 0
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3441
instructions: 3446
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand All @@ -78,18 +78,18 @@ benches:
build_unsigned_transaction_3_1m_sats:
total:
calls: 1
instructions: 421702
instructions: 421709
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction:
calls: 1
instructions: 419121
instructions: 419126
heap_increase: 0
stable_memory_increase: 0
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3441
instructions: 3446
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand All @@ -105,18 +105,18 @@ benches:
build_unsigned_transaction_4_10m_sats:
total:
calls: 1
instructions: 422877
instructions: 422884
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction:
calls: 1
instructions: 420296
instructions: 420301
heap_increase: 0
stable_memory_increase: 0
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3441
instructions: 3446
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand All @@ -132,18 +132,18 @@ benches:
build_unsigned_transaction_5_1_btc:
total:
calls: 1
instructions: 422877
instructions: 422884
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction:
calls: 1
instructions: 420296
instructions: 420301
heap_increase: 0
stable_memory_increase: 0
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3441
instructions: 3446
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand All @@ -159,18 +159,18 @@ benches:
build_unsigned_transaction_6_10_btc:
total:
calls: 1
instructions: 429549
instructions: 429556
heap_increase: 0
stable_memory_increase: 0
scopes:
build_unsigned_transaction:
calls: 1
instructions: 426968
instructions: 426973
heap_increase: 0
stable_memory_increase: 0
build_unsigned_transaction_from_inputs:
calls: 1
instructions: 3908
instructions: 3913
heap_increase: 0
stable_memory_increase: 0
greedy:
Expand Down
77 changes: 76 additions & 1 deletion rs/bitcoin/ckbtc/minter/ckbtc_minter.did
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,70 @@ type DecodeLedgerMemoResult = variant {
// An error in case the minter was not able to decode the provided memo. This field is `opt`, so that other error
// types can be added in the future.
Err : opt DecodeLedgerMemoError;
}
};

// ICRC-10 supported standards record.
type Icrc10StandardRecord = record {
name : text;
url : text;
};

// ICRC-21 Canister Call Consent Message types.
type Icrc21ConsentMessageMetadata = record {
language : text;
utc_offset_minutes : opt int16;
};

type Icrc21DeviceSpec = variant {
GenericDisplay;
FieldsDisplay;
};

type Icrc21ConsentMessageSpec = record {
metadata : Icrc21ConsentMessageMetadata;
device_spec : opt Icrc21DeviceSpec;
};

type Icrc21ConsentMessageRequest = record {
method : text;
arg : blob;
user_preferences : Icrc21ConsentMessageSpec;
};

type Icrc21Value = variant {
TokenAmount : record {
decimals : nat8;
amount : nat64;
symbol : text;
};
TimestampSeconds : record { amount : nat64 };
DurationSeconds : record { amount : nat64 };
Text : record { content : text };
};

type Icrc21FieldsDisplay = record {
intent : text;
fields : vec record { text; Icrc21Value };
};

type Icrc21ConsentMessage = variant {
GenericDisplayMessage : text;
FieldsDisplayMessage : Icrc21FieldsDisplay;
};

type Icrc21ConsentInfo = record {
consent_message : Icrc21ConsentMessage;
metadata : Icrc21ConsentMessageMetadata;
};

type Icrc21ErrorInfo = record { description : text };

type Icrc21Error = variant {
UnsupportedCanisterCall : Icrc21ErrorInfo;
ConsentMessageUnavailable : Icrc21ErrorInfo;
InsufficientPayment : Icrc21ErrorInfo;
GenericError : record { error_code : nat; description : text };
};

service : (minter_arg : MinterArg) -> {
// Section "Convert BTC to ckBTC" {{{
Expand Down Expand Up @@ -728,4 +791,16 @@ service : (minter_arg : MinterArg) -> {
// Returns information related to minter transactions.
decode_ledger_memo : (DecodeLedgerMemoArgs) -> (DecodeLedgerMemoResult) query;
// }}}

// Section "ICRC-10 / ICRC-21" {{{

// Returns the list of supported ICRC standards.
icrc10_supported_standards : () -> (vec Icrc10StandardRecord) query;

// Returns a human-readable consent message describing the requested
// canister call. See the ICRC-21 standard for details:
// https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-21/ICRC-21.md
icrc21_canister_call_consent_message : (Icrc21ConsentMessageRequest) -> (variant { Ok : Icrc21ConsentInfo; Err : Icrc21Error });

// }}} Section "ICRC-10 / ICRC-21"
}
15 changes: 15 additions & 0 deletions rs/bitcoin/ckbtc/minter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ use ic_ckbtc_minter::{
};
use ic_http_types::{HttpRequest, HttpResponse};
use icrc_ledger_types::icrc1::account::Account;
use icrc_ledger_types::icrc21::errors::Icrc21Error;
use icrc_ledger_types::icrc21::requests::ConsentMessageRequest;
use icrc_ledger_types::icrc21::responses::ConsentInfo;

#[init]
fn init(args: MinterArg) {
Expand Down Expand Up @@ -265,6 +268,18 @@ fn decode_ledger_memo(arg: DecodeLedgerMemoArgs) -> DecodeLedgerMemoResult {
ic_ckbtc_minter::queries::decode_ledger_memo(arg)
}

#[update]
fn icrc21_canister_call_consent_message(
consent_msg_request: ConsentMessageRequest,
) -> Result<ConsentInfo, Icrc21Error> {
updates::icrc21::icrc21_canister_call_consent_message(consent_msg_request)
}

#[query]
fn icrc10_supported_standards() -> Vec<updates::icrc21::StandardRecord> {
updates::icrc21::icrc10_supported_standards()
}
Comment thread
Dfinity-Bjoern marked this conversation as resolved.

#[query(hidden = true)]
fn http_request(req: HttpRequest) -> HttpResponse {
if ic_cdk::api::in_replicated_execution() {
Expand Down
1 change: 1 addition & 0 deletions rs/bitcoin/ckbtc/minter/src/updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod tests;

pub mod get_btc_address;
pub mod get_withdrawal_account;
pub mod icrc21;
pub mod retrieve_btc;
pub mod update_balance;

Expand Down
Loading
Loading