Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
1b98a38
add 107 schema
maciejdfinity Dec 15, 2025
71e4b6a
add block encoding decoding tests
maciejdfinity Dec 15, 2025
c07af35
Merge branch 'master' into maciej-schema-feecol
maciejdfinity Dec 15, 2025
5dda884
typo
maciejdfinity Dec 15, 2025
561005a
typo
maciejdfinity Dec 15, 2025
8973bab
smaller range
maciejdfinity Dec 15, 2025
76e35cb
build fix
maciejdfinity Dec 15, 2025
816719f
Merge branch 'master' into maciej-schema-feecol
maciejdfinity Dec 15, 2025
48a948f
build fix
maciejdfinity Dec 16, 2025
5237a5d
changelog
maciejdfinity Dec 16, 2025
b4b2a1e
Merge branch 'master' into maciej-schema-feecol
maciejdfinity Jan 5, 2026
1a8f5cb
make tx required
maciejdfinity Jan 5, 2026
5ac5de8
handle endpoint initiated tx
maciejdfinity Jan 5, 2026
b59a42d
use constants
maciejdfinity Jan 5, 2026
df4cc15
make tx kind a separate constant
maciejdfinity Jan 5, 2026
cea1742
Merge branch 'master' into maciej-schema-feecol
maciejdfinity Jan 5, 2026
539ef8c
add set fee collector arg and error
maciejdfinity Jan 5, 2026
ee265bb
add comments
maciejdfinity Jan 5, 2026
cf62736
add endpoint
maciejdfinity Jan 5, 2026
9a2483b
fix did, not completely
maciejdfinity Jan 6, 2026
a67b6e0
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Jan 8, 2026
a24cfb7
check if endpoint called by the controller
maciejdfinity Jan 8, 2026
172d1a3
init args always set 107 fee col
maciejdfinity Jan 9, 2026
ad12027
credit fc107 when applying the transaction
maciejdfinity Jan 13, 2026
806f889
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Jan 14, 2026
13feab0
handle fc107 and test
maciejdfinity Jan 16, 2026
5cb8a43
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Jan 16, 2026
941d632
switch to mandaroty fee collector
maciejdfinity Jan 16, 2026
22653f7
build fix
maciejdfinity Jan 16, 2026
93c51bc
set fc in upgrade and init
maciejdfinity Jan 19, 2026
ad712ba
build fix
maciejdfinity Jan 19, 2026
584016b
set fc as first block before mint
maciejdfinity Jan 19, 2026
4d110f0
build fix
maciejdfinity Jan 19, 2026
dd51ea9
build fix
maciejdfinity Jan 19, 2026
a814866
use constant for mthd set by ledger
maciejdfinity Jan 19, 2026
f59cd00
only create block if fc set, remove legacy block tests
maciejdfinity Jan 19, 2026
78260f3
Automatically fixing code for linting and formatting issues
Jan 19, 2026
2205cbc
fee collector getter
maciejdfinity Jan 21, 2026
cba734f
improve fc test
maciejdfinity Jan 22, 2026
1fdb60d
improve tests
maciejdfinity Jan 22, 2026
ed3e054
test upgrade
maciejdfinity Jan 22, 2026
094be1e
test init
maciejdfinity Jan 22, 2026
1e657df
test upgrade legacy with no fc
maciejdfinity Jan 22, 2026
3527a8d
test upgrade legacy set
maciejdfinity Jan 22, 2026
f0a4054
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Jan 23, 2026
cef36b7
support fc 107 in the in mem ledger
maciejdfinity Jan 26, 2026
d6f6ce8
build fix
maciejdfinity Jan 26, 2026
844855f
clippy
maciejdfinity Jan 26, 2026
c23f316
fix fee col ranges index test
maciejdfinity Jan 26, 2026
be773e0
test index fc ranges set by endpoint
maciejdfinity Jan 26, 2026
6cc667a
fix upgrade downgrade test
maciejdfinity Jan 26, 2026
db9e2a0
add legacy ranges test
maciejdfinity Jan 28, 2026
0cf1aaf
fix legacy ranges test, merge tests into one
maciejdfinity Jan 28, 2026
3100ac0
remove incorrect comment
maciejdfinity Jan 28, 2026
8c0b230
add index new fc tests
maciejdfinity Jan 28, 2026
12d0312
remove unused minter
maciejdfinity Jan 28, 2026
85488e2
proptest
maciejdfinity Jan 29, 2026
7718d43
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Jan 29, 2026
28dead3
Automatically fixing code for linting and formatting issues
Jan 29, 2026
aa3ef36
remove unused method and refactor
maciejdfinity Jan 29, 2026
627333c
Merge branch 'maciej-ledger-feecol' of github.com:dfinity/ic into mac…
maciejdfinity Jan 29, 2026
5c896c2
refactor upgrade legacy tests
maciejdfinity Jan 29, 2026
30ae880
refactor
maciejdfinity Jan 29, 2026
53f04f8
refactor
maciejdfinity Jan 30, 2026
093924a
refactor
maciejdfinity Jan 30, 2026
6acc722
refactor
maciejdfinity Jan 30, 2026
304e2d5
refactor
maciejdfinity Jan 30, 2026
9868c66
add ledger state verification
maciejdfinity Jan 30, 2026
11d0cf6
add v5 ledger wasm
maciejdfinity Jan 30, 2026
52f9aa1
clippy
maciejdfinity Jan 30, 2026
8134ea1
Automatically fixing code for linting and formatting issues
Jan 30, 2026
04c1528
refactor
maciejdfinity Jan 30, 2026
92fe672
Merge branch 'maciej-ledger-feecol' of github.com:dfinity/ic into mac…
maciejdfinity Jan 30, 2026
fc5919c
clippy
maciejdfinity Jan 30, 2026
31695e3
fix test
maciejdfinity Jan 30, 2026
97a8feb
disable the tests that cannot run with old icrc3_disabled wasm
maciejdfinity Jan 30, 2026
21db7e5
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Jan 30, 2026
40b6e74
check for upgrade 107 block in golden upgrade
maciejdfinity Jan 31, 2026
398d290
fix golden tests
maciejdfinity Feb 2, 2026
70c92f4
improve legacy block testing
maciejdfinity Feb 2, 2026
8fd876a
other file
maciejdfinity Feb 2, 2026
a62d085
fix ckerc20 tests
maciejdfinity Feb 2, 2026
85ab3b8
fix xc suite orchestrator test
maciejdfinity Feb 2, 2026
fe7d54f
update canbench
maciejdfinity Feb 2, 2026
a50e892
remove fee collector from apply_transaction
maciejdfinity Feb 2, 2026
8516089
build fix
maciejdfinity Feb 2, 2026
c0e9cec
clippy
maciejdfinity Feb 3, 2026
6e1a69f
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Feb 3, 2026
f577ca9
move fc tests to fee_collector.rs
maciejdfinity Feb 3, 2026
d857983
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Feb 3, 2026
c565e44
add defaults in ledger state
maciejdfinity Feb 3, 2026
f0a2e19
remove default
maciejdfinity Feb 3, 2026
53ea05f
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Feb 3, 2026
0cf417f
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Feb 3, 2026
d45af12
Merge branch 'master' into maciej-ledger-feecol
maciejdfinity Feb 3, 2026
c5f7638
create block from_transaction
maciejdfinity Feb 4, 2026
4de9ca2
use apply_transaction
maciejdfinity Feb 4, 2026
81262b7
small refactor
maciejdfinity Feb 4, 2026
fa85ece
Revert "update canbench"
maciejdfinity Feb 4, 2026
4767419
update canbench
maciejdfinity Feb 4, 2026
ce46106
test icrc107_get_fee_collector
maciejdfinity Feb 5, 2026
fbc089e
Update rs/ledger_suite/icrc1/index-ng/tests/tests.rs
maciejdfinity Feb 5, 2026
7e3d456
use later ledger release for v5
maciejdfinity Feb 5, 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
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,13 @@ canisters(
"ck_btc_ledger": "ic-icrc1-ledger.wasm.gz",
"ck_btc_ledger_v1": "ic-icrc1-ledger.wasm.gz",
"ck_btc_ledger_v3": "ic-icrc1-ledger.wasm.gz",
"ck_btc_ledger_v5": "ic-icrc1-ledger.wasm.gz",
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to rename this to something more descriptive, and/or perhaps add a comment somewhere (I think comments don't work in mainnet-canister-revisions.json, but here would be ok?)? Especially since the v5 doesn't correspond to the LEDGER_VERSION, so it can be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Maybe we could change it to correspond to the ledger versions, i.e.:
v1 -> no_mem_mgr
v3 -> v1
v5 -> v3
WDYT?

"ck_btc_index": "ic-icrc1-index-ng.wasm.gz",
"ck_eth_archive": "ic-icrc1-archive-u256.wasm.gz",
"ck_eth_ledger": "ic-icrc1-ledger-u256.wasm.gz",
"ck_eth_ledger_v1": "ic-icrc1-ledger-u256.wasm.gz",
"ck_eth_ledger_v3": "ic-icrc1-ledger-u256.wasm.gz",
"ck_eth_ledger_v5": "ic-icrc1-ledger-u256.wasm.gz",
"ck_eth_index": "ic-icrc1-index-ng-u256.wasm.gz",
"sns_root": "sns-root-canister.wasm.gz",
"sns_governance": "sns-governance-canister.wasm.gz",
Expand Down
8 changes: 8 additions & 0 deletions mainnet-canister-revisions.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"rev": "2190613d3b5bcd9b74c382b22d151580b8ac271a",
"sha256": "25071c2c55ad4571293e00d8e277f442aec7aed88109743ac52df3125209ff45"
},
"ck_btc_ledger_v5": {
"rev": "e446c64d99a97e38166be23ff2bfade997d15ff7",
"sha256": "71c27c5dc10034a1175296892b37827df0265d0ae072f5c59e99b8a1f6c45c76"
},
Comment on lines 30 to 33
Copy link
Contributor

Choose a reason for hiding this comment

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

This points to ledger-suite-icrc-2025-04-14. Is there a particular reason for this specific version, or could we use ledger-suite-icrc-2025-10-27, which is the minimum version we point to from the currently most recent version ledger-suite-icrc-2026-02-02?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason, I just used the same version as current mainnet ledger :) Changed!

"ck_eth_archive": {
"rev": "512cf412f33d430b79f42330518166d14fc6884e",
"sha256": "3fafdd895c44886e38199882afcf06efb8e6e0b73af51eca327dcba4da7a0106"
Expand All @@ -47,6 +51,10 @@
"rev": "2190613d3b5bcd9b74c382b22d151580b8ac271a",
"sha256": "9637743e1215a4db376a62ee807a0986faf20833be2b332df09b3d5dbdd7339e"
},
"ck_eth_ledger_v5": {
"rev": "e446c64d99a97e38166be23ff2bfade997d15ff7",
"sha256": "15ec452faf00c40135b96a3ba0951ea13050e6e95e38cff249305462f81db62d"
},
"cycles-minting": {
"rev": "6f1ce3bb4c253f1bc4c5f432c7c47b06dccdba7e",
"sha256": "40a204bf4abc14bd61553b2b56413709a2fc7175227253d2809ffdb977c934de"
Expand Down
1 change: 1 addition & 0 deletions packages/icrc-ledger-types/src/icrc107/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod schema;
pub mod set_fee_collector;
25 changes: 25 additions & 0 deletions packages/icrc-ledger-types/src/icrc107/set_fee_collector.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use candid::{CandidType, Deserialize, Nat};
use serde::Serialize;

use super::super::icrc1::account::Account;

/// The arguments for the
/// [ICRC-107 `icrc107_set_fee_collector`](https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-107/ICRC-107.md#icrc107_set_fee_collector)
/// endpoint.
#[derive(CandidType, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct SetFeeCollectorArgs {
#[serde(default)]
pub fee_collector: Option<Account>,
pub created_at_time: u64,
}

/// The error return type for the
/// [ICRC-107 `icrc107_set_fee_collector`](https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-107/ICRC-107.md#icrc107_set_fee_collector)
/// endpoint.
#[derive(CandidType, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub enum SetFeeCollectorError {
AccessDenied(String),
InvalidAccount(String),
Duplicate { duplicate_of: Nat },
GenericError { error_code: Nat, message: String },
}
10 changes: 5 additions & 5 deletions rs/ethereum/cketh/minter/tests/ckerc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ mod withdraw_erc20 {
.assert_has_unique_events_in_order(&[EventPayload::ReimbursedErc20Withdrawal {
withdrawal_id: cketh_block_index.clone(),
burn_in_block: ckerc20_block_index.clone(),
reimbursed_in_block: Nat::from(3_u8),
reimbursed_in_block: Nat::from(4_u8),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the ICRC ledger is installed with a 107 fee collector, the first block is the fee collector setting block and therefore all block indexes that are tested need to be increased by 1.

ledger_id: deposit_params.token().ledger_canister_id,
reimbursed_amount: ckerc20_withdrawal_amount.into(),
transaction_hash: Some(
Expand All @@ -857,7 +857,7 @@ mod withdraw_erc20 {
}])
.call_ckerc20_ledger_get_transaction(
deposit_params.token().ledger_canister_id,
3_u8,
4_u8,
)
.expect_mint(Mint {
amount: ckerc20_withdrawal_amount.into(),
Expand Down Expand Up @@ -1346,7 +1346,7 @@ fn should_deposit_ckerc20() {
ckerc20
.deposit(params.clone())
.expect_mint()
.call_ckerc20_ledger_get_transaction(params.token().ledger_canister_id, 0_u8)
.call_ckerc20_ledger_get_transaction(params.token().ledger_canister_id, 1_u8)
.expect_mint(Mint {
amount: Nat::from(params.ckerc20_amount()),
to: params.recipient(),
Expand Down Expand Up @@ -1452,7 +1452,7 @@ fn should_deposit_cketh_and_ckerc20() {
created_at_time: None,
fee: None,
})
.call_ckerc20_ledger_get_transaction(params.token().ledger_canister_id, 0_u8)
.call_ckerc20_ledger_get_transaction(params.token().ledger_canister_id, 1_u8)
.expect_mint(Mint {
amount: Nat::from(params.ckerc20_amount()),
to: params.recipient(),
Expand Down Expand Up @@ -1548,7 +1548,7 @@ fn should_deposit_cketh_and_ckerc20_when_ledger_temporary_offline() {
},
ckerc20_token_symbol: ckusdc.ckerc20_token_symbol,
erc20_contract_address: ckusdc.erc20_contract_address,
mint_block_index: Nat::from(0_u8),
mint_block_index: Nat::from(1_u8),
},
]);

Expand Down
4 changes: 2 additions & 2 deletions rs/ethereum/cketh/test_utils/src/ckerc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl CkErc20Setup {
amount,
from_subaccount,
)
.expect_ok(1);
.expect_ok(2);
self
}

Expand Down Expand Up @@ -754,7 +754,7 @@ impl CkErc20DepositFlow {
},
ckerc20_token_symbol: self.params.token().ckerc20_token_symbol.clone(),
erc20_contract_address: self.params.token().erc20_contract_address.clone(),
mint_block_index: Nat::from(0_u8),
mint_block_index: Nat::from(1_u8),
},
]);
self.setup
Expand Down
14 changes: 3 additions & 11 deletions rs/ledger_suite/common/ledger_canister_core/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::time::Duration;

use crate::archive::{ArchivingGuardError, FailedToArchiveBlocks, LedgerArchivingGuard};
use ic_ledger_core::balances::{BalanceError, Balances, BalancesStore};
use ic_ledger_core::block::{BlockIndex, BlockType, EncodedBlock, FeeCollector};
use ic_ledger_core::block::{BlockIndex, BlockType, EncodedBlock};
use ic_ledger_core::timestamp::TimeStamp;
use ic_ledger_core::tokens::{TokensType, Zero};
use ic_ledger_hash_of::HashOf;
Expand Down Expand Up @@ -76,7 +76,8 @@ pub trait LedgerContext {
fn approvals(&self) -> &AllowanceTable<Self::AllowancesData>;
fn approvals_mut(&mut self) -> &mut AllowanceTable<Self::AllowancesData>;

fn fee_collector(&self) -> Option<&FeeCollector<Self::AccountId>>;
fn fee_collector(&self) -> Option<Self::AccountId>;
fn set_fee_collector(&mut self, fee_collector: Option<Self::AccountId>);
}

pub trait LedgerTransaction: Sized {
Expand Down Expand Up @@ -186,8 +187,6 @@ pub trait LedgerData: LedgerContext {
/// The callback that the ledger framework calls when it purges a transaction.
fn on_purged_transaction(&mut self, height: BlockIndex);

fn fee_collector_mut(&mut self) -> Option<&mut FeeCollector<Self::AccountId>>;

fn increment_archiving_failure_metric(&mut self);

fn get_archiving_failure_metric(&self) -> u64;
Expand Down Expand Up @@ -274,25 +273,18 @@ where
},
})?;

let fee_collector = ledger.fee_collector().cloned();
let block = L::Block::from_transaction(
ledger.blockchain().last_hash,
transaction,
now,
effective_fee,
fee_collector,
);
let block_timestamp = block.timestamp();

let height = ledger
.blockchain_mut()
.add_block(block)
.expect("failed to add block");
if let Some(fee_collector) = ledger.fee_collector_mut().as_mut()
&& fee_collector.block_index.is_none()
{
fee_collector.block_index = Some(height);
}

if let Some((_, tx_hash)) = maybe_time_and_hash {
// The caller requested deduplication, so we have to remember this
Expand Down
1 change: 0 additions & 1 deletion rs/ledger_suite/common/ledger_core/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ pub trait BlockType: Sized + Clone {
tx: Self::Transaction,
block_timestamp: TimeStamp,
effective_fee: Self::Tokens,
fee_collector: Option<FeeCollector<Self::AccountId>>,
) -> Self;

/// Encodes this block into a binary representation.
Expand Down
12 changes: 5 additions & 7 deletions rs/ledger_suite/icp/ledger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,13 @@ impl LedgerContext for Ledger {
&mut self.stable_approvals
}

fn fee_collector(&self) -> Option<&ic_ledger_core::block::FeeCollector<Self::AccountId>> {
fn fee_collector(&self) -> Option<Self::AccountId> {
None
}

fn set_fee_collector(&mut self, _fee_collector: Option<Self::AccountId>) {
trap("ICP ledger does not allow setting the fee collector");
}
}

impl LedgerData for Ledger {
Expand Down Expand Up @@ -319,12 +323,6 @@ impl LedgerData for Ledger {
self.blocks_notified.remove(height);
}

fn fee_collector_mut(
&mut self,
) -> Option<&mut ic_ledger_core::block::FeeCollector<Self::AccountId>> {
None
}

fn increment_archiving_failure_metric(&mut self) {
ARCHIVING_FAILURES.with(|cell| cell.set(cell.get() + 1));
}
Expand Down
6 changes: 2 additions & 4 deletions rs/ledger_suite/icp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ic_ledger_canister_core::ledger::{LedgerContext, LedgerTransaction, TxApplyE
use ic_ledger_core::{
approvals::{AllowanceTable, HeapAllowancesData},
balances::Balances,
block::{BlockType, EncodedBlock, FeeCollector},
block::{BlockType, EncodedBlock},
tokens::CheckedAdd,
};
use ic_ledger_hash_of::HASH_LENGTH;
Expand Down Expand Up @@ -381,7 +381,6 @@ impl Block {
transaction,
timestamp,
effective_fee,
None,
))
}

Expand All @@ -392,7 +391,7 @@ impl Block {
timestamp: TimeStamp,
effective_fee: Tokens,
) -> Self {
Self::from_transaction(parent_hash, transaction, timestamp, effective_fee, None)
Self::from_transaction(parent_hash, transaction, timestamp, effective_fee)
}

pub fn transaction(&self) -> Cow<'_, Transaction> {
Expand Down Expand Up @@ -436,7 +435,6 @@ impl BlockType for Block {
transaction: Self::Transaction,
timestamp: TimeStamp,
_effective_fee: Tokens,
_fee_collector: Option<FeeCollector<AccountIdentifier>>,
) -> Self {
Self {
parent_hash,
Expand Down
1 change: 0 additions & 1 deletion rs/ledger_suite/icp/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fn example_block() -> Block {
transaction,
TimeStamp::new(1, 1),
DEFAULT_TRANSFER_FEE,
None,
)
}

Expand Down
8 changes: 8 additions & 0 deletions rs/ledger_suite/icrc1/index-ng/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ rust_test(
conf["index_wasm"],
conf["ledger_wasm"],
"//rs/ledger_suite/icrc1/test_utils/icrc3_test_ledger:icrc3_test_ledger_canister.wasm.gz",
conf["ledger_wasm_v5"],
],
env = {
"RUST_TEST_THREADS": "4",
"CARGO_MANIFEST_DIR": "rs/ledger_suite/icrc1/index-ng",
"IC_ICRC1_INDEX_NG_WASM_PATH": "$(rootpath " + conf["index_wasm"] + ")",
"IC_ICRC1_LEDGER_WASM_PATH": "$(rootpath " + conf["ledger_wasm"] + ")",
"IC_ICRC3_TEST_LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/test_utils/icrc3_test_ledger:icrc3_test_ledger_canister.wasm.gz)",
"IC_ICRC1_LEDGER_V5_VERSION_WASM_PATH": "$(rootpath " + conf["ledger_wasm_v5"] + ")",
},
extra_srcs = ["tests/common/mod.rs"],
tags = ["cpu:4"],
Expand Down Expand Up @@ -151,19 +153,22 @@ rust_test(
"crate_features": [],
"index_wasm": ":index_ng_canister.wasm.gz",
"ledger_wasm": "//rs/ledger_suite/icrc1/ledger:ledger_canister.wasm.gz",
"ledger_wasm_v5": "@mainnet_canisters//:ck_btc_ledger_v5.wasm.gz",
"test_suffix": "",
},
{
"crate_features": ["u256-tokens"],
"index_wasm": ":index_ng_canister_u256.wasm.gz",
"ledger_wasm": "//rs/ledger_suite/icrc1/ledger:ledger_canister_u256.wasm.gz",
"ledger_wasm_v5": "@mainnet_canisters//:ck_eth_ledger_v5.wasm.gz",
"test_suffix": "_u256",
},
# - Ledger with ICRC-3 and without get-blocks
{
"crate_features": ["get_blocks_disabled"],
"index_wasm": ":index_ng_canister.wasm.gz",
"ledger_wasm": "//rs/ledger_suite/icrc1/ledger:ledger_canister_getblocksdisabled.wasm.gz",
"ledger_wasm_v5": "@mainnet_canisters//:ck_btc_ledger_v5.wasm.gz",
"test_suffix": "_wo_getblocks",
},
{
Expand All @@ -173,13 +178,15 @@ rust_test(
],
"index_wasm": ":index_ng_canister_u256.wasm.gz",
"ledger_wasm": "//rs/ledger_suite/icrc1/ledger:ledger_canister_u256_getblocksdisabled.wasm.gz",
"ledger_wasm_v5": "@mainnet_canisters//:ck_eth_ledger_v5.wasm.gz",
"test_suffix": "_u256_wo_getblocks",
},
# - Ledger without ICRC-3 and with get-blocks
{
"crate_features": ["icrc3_disabled"],
"index_wasm": ":index_ng_canister.wasm.gz",
"ledger_wasm": "@ic-icrc1-ledger-wo-icrc-3.wasm.gz//file",
"ledger_wasm_v5": "@mainnet_canisters//:ck_btc_ledger_v5.wasm.gz",
"test_suffix": "_wo_icrc3",
},
{
Expand All @@ -189,6 +196,7 @@ rust_test(
],
"index_wasm": ":index_ng_canister_u256.wasm.gz",
"ledger_wasm": "@ic-icrc1-ledger-wo-icrc-3-u256.wasm.gz//file",
"ledger_wasm_v5": "@mainnet_canisters//:ck_eth_ledger_v5.wasm.gz",
"test_suffix": "_wo_icrc3_u256",
},
]
Expand Down
25 changes: 24 additions & 1 deletion rs/ledger_suite/icrc1/index-ng/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ pub fn install_ledger(
archive_options: ArchiveOptions,
fee_collector_account: Option<Account>,
minter_principal: Principal,
) -> CanisterId {
install_ledger_with_wasm(
env,
initial_balances,
archive_options,
fee_collector_account,
minter_principal,
ledger_wasm(),
)
}

pub fn install_ledger_with_wasm(
env: &StateMachine,
initial_balances: Vec<(Account, u64)>,
archive_options: ArchiveOptions,
fee_collector_account: Option<Account>,
minter_principal: Principal,
ledger_wasm: Vec<u8>,
) -> CanisterId {
let mut builder = LedgerInitArgsBuilder::with_symbol_and_name(TOKEN_SYMBOL, TOKEN_NAME)
.with_minting_account(minter_principal)
Expand All @@ -93,7 +111,7 @@ pub fn install_ledger(
builder = builder.with_initial_balance(account, amount);
}
env.install_canister_with_cycles(
ledger_wasm(),
ledger_wasm,
Encode!(&LedgerArgument::Init(builder.build())).unwrap(),
None,
ic_types::Cycles::new(STARTING_CYCLES_PER_CANISTER),
Expand Down Expand Up @@ -148,6 +166,11 @@ pub fn ledger_wasm() -> Vec<u8> {
})
}

#[allow(dead_code)]
pub fn ledger_mainnet_v5_wasm() -> Vec<u8> {
std::fs::read(std::env::var("IC_ICRC1_LEDGER_V5_VERSION_WASM_PATH").unwrap()).unwrap()
}

#[cfg(feature = "icrc3_disabled")]
pub fn ledger_get_blocks(
env: &StateMachine,
Expand Down
Loading
Loading