Skip to content

Commit 2a4829b

Browse files
bogwarclaude
andcommitted
fix(ic-icrc1-test-utils): handle AuthorizedMint and AuthorizedBurn in match arms
Non-exhaustive pattern errors after adding the two new Operation variants. - effective_fee match: return None (no fee for authorized supply changes) - balance tracking: mirror Mint/Burn credit/debit behaviour - update_valid_allowance_from: check affected account validity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fe42624 commit 2a4829b

File tree

1 file changed

+13
-0
lines changed
  • rs/ledger_suite/icrc1/test_utils/src

1 file changed

+13
-0
lines changed

rs/ledger_suite/icrc1/test_utils/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ pub fn blocks_strategy<Tokens: TokensType>(
244244
Operation::Burn { ref fee, .. } => fee.clone().is_none().then_some(arb_fee),
245245
Operation::Mint { ref fee, .. } => fee.clone().is_none().then_some(arb_fee),
246246
Operation::FeeCollector { .. } => None,
247+
Operation::AuthorizedMint { .. } | Operation::AuthorizedBurn { .. } => None,
247248
};
248249
let btype = match transaction.operation {
249250
Operation::FeeCollector { .. } => Some(BTYPE_107.to_string()),
@@ -607,6 +608,12 @@ impl TransactionsAndBalances {
607608
Operation::FeeCollector { .. } => {
608609
panic!("FeeCollector107 not implemented")
609610
}
611+
Operation::AuthorizedMint { to, amount, .. } => {
612+
self.credit(to, amount.get_e8s());
613+
}
614+
Operation::AuthorizedBurn { from, amount, .. } => {
615+
self.debit(from, amount.get_e8s());
616+
}
610617
};
611618
self.transactions.push(tx);
612619

@@ -637,6 +644,12 @@ impl TransactionsAndBalances {
637644
Operation::FeeCollector { .. } => {
638645
panic!("FeeCollector107 not implemented")
639646
}
647+
Operation::AuthorizedMint { to, .. } => {
648+
self.check_and_update_account_validity(*to, default_fee);
649+
}
650+
Operation::AuthorizedBurn { from, .. } => {
651+
self.check_and_update_account_validity(*from, default_fee);
652+
}
640653
}
641654
}
642655

0 commit comments

Comments
 (0)