Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions rs/ledger_suite/icrc1/archive/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ fn icrc3_supported_block_types() -> Vec<SupportedBlockType> {
url: "https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md"
.to_string(),
},
SupportedBlockType {
block_type: "107feecol".to_string(),
url: "https://github.com/dfinity/ICRC/pull/117".to_string(),
},
]
}

Expand Down
11 changes: 10 additions & 1 deletion rs/ledger_suite/icrc1/archive/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use candid::{Decode, Encode, Nat, Principal};
use ic_base_types::CanisterId;
use ic_icrc1::blocks::encoded_block_to_generic_block;
use ic_ledger_core::block::{BlockType, EncodedBlock};
use ic_ledger_suite_state_machine_tests::test_http_request_decoding_quota;
use ic_ledger_suite_state_machine_tests::{
check_icrc3_supported_block_types, test_http_request_decoding_quota,
};
use ic_state_machine_tests::{StateMachine, WasmResult};
use icrc_ledger_types::icrc::generic_value::ICRC3Value;
use icrc_ledger_types::icrc1::account::Account;
Expand Down Expand Up @@ -352,3 +354,10 @@ fn test_archive_http_request_decoding_quota() {

test_http_request_decoding_quota(&setup.state_machine, setup.archive_id);
}

#[test]
fn test_icrc3_supported_block_types() {
let setup = Setup::default();

check_icrc3_supported_block_types(&setup.state_machine, setup.archive_id, true);
}
19 changes: 14 additions & 5 deletions rs/ledger_suite/tests/sm-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,16 +586,25 @@ pub fn test_icrc3_supported_block_types<T>(
T: CandidType,
{
let (env, canister_id) = setup(ledger_wasm, encode_init_args, vec![]);
check_icrc3_supported_block_types(&env, canister_id, false);
}

pub fn check_icrc3_supported_block_types(
env: &StateMachine,
canister_id: CanisterId,
supports_107: bool,
) {
let mut block_types = vec![];
for supported_block_type in supported_block_types(&env, canister_id) {
for supported_block_type in supported_block_types(env, canister_id) {
block_types.push(supported_block_type.block_type);
}
block_types.sort();
assert_eq!(
block_types,
vec!["1burn", "1mint", "1xfer", "2approve", "2xfer"]
);
let mut expected_block_types = vec!["1burn", "1mint", "1xfer", "2approve", "2xfer"];
if supports_107 {
expected_block_types.push("107feecol");
expected_block_types.sort();
}
assert_eq!(block_types, expected_block_types);
}

pub fn test_total_supply<T>(ledger_wasm: Vec<u8>, encode_init_args: fn(InitArgs) -> T)
Expand Down
Loading