Skip to content
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5f853e6
test(cketh): build the live balance-scan harness on the shared fixture
gregorydemay Aug 13, 2026
5c6bda6
refactor(cketh): thread the install sender through the shared installers
gregorydemay Aug 13, 2026
c2053c6
fix(cketh): restore ECDSA_KEY_NAME as a single shared constant
gregorydemay Aug 13, 2026
f683e8c
fix(cketh): correct the documented cause of the live-mode crash
gregorydemay Aug 13, 2026
7e84561
refactor(cketh): rename EvmRpcBackend to EthereumBackend
gregorydemay Aug 13, 2026
04d586b
docs(cketh): explain why Mocked implies Finalized/LAST_SCRAPED_BLOCK_…
gregorydemay Aug 13, 2026
206bb5c
docs(cketh): scope CkEthCanisters' doc to how each fixture actually u…
gregorydemay Aug 13, 2026
d14bc70
docs(cketh): tighten the cycles-headroom comment on the live harness
gregorydemay Aug 13, 2026
33d34d1
refactor(cketh): build the live balance-scan harness on CkEthSetup it…
gregorydemay Aug 13, 2026
651d03a
refactor(cketh): collapse build_mocked/build_live into one build sequ…
gregorydemay Aug 13, 2026
ad8ce46
fix(cketh): restore the cycles-headroom rationale as a named constant
gregorydemay Aug 13, 2026
5d619c3
docs(cketh): lead the ledger conditional with the reason, not the obs…
gregorydemay Aug 13, 2026
a114ffd
refactor(cketh): reuse CkEthSetup::add_ckerc20_token in register_supp…
gregorydemay Aug 13, 2026
501c22f
refactor(cketh): apply the rate-limiting config to both new_env modes
gregorydemay Aug 13, 2026
d000a55
refactor(cketh): name new_env's modes with an EnvMode enum
gregorydemay Aug 13, 2026
78aa809
fix(cketh): assert with_env and with_live_mode are never combined
gregorydemay Aug 13, 2026
986fd38
docs(cketh): fix CkEthCanisters' doc referencing the removed build_mo…
gregorydemay Aug 13, 2026
336bc52
refactor(cketh): derive the fixture's live mode from EthereumBackend
gregorydemay Aug 13, 2026
7ebe033
refactor(cketh): hold the anvil node itself in EthereumBackend::Anvil
gregorydemay Aug 13, 2026
75f3d8e
refactor(cketh): inline pocket_ic_builder into its one caller, new_env
gregorydemay Aug 13, 2026
0a4ea72
refactor(cketh): let the fixture build the PocketIC instance it needs
gregorydemay Aug 13, 2026
8a44389
refactor(cketh): create and install the canisters the same way for ev…
gregorydemay Aug 13, 2026
a87674b
refactor(cketh): build the live balance-scan harness on CkErc20Setup
gregorydemay Aug 13, 2026
96d3b0b
Merge origin/ic_DEFI-2262_8_live-scan-setup
gregorydemay Aug 13, 2026
7a5682b
fix(cketh): build the live fixture on a non-live instance, go live last
gregorydemay Aug 14, 2026
8aff162
refactor(cketh): delete CkEthSetupBuilder, fold it into CkEthSetup::new
gregorydemay Aug 14, 2026
3cb7de4
Merge master into ic_DEFI-2262_8_live-scan-setup
gregorydemay Aug 14, 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
8 changes: 8 additions & 0 deletions rs/ethereum/cketh/minter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ rust_test(
"tests/deposit_from_cex_demo/MockUSDT.sol",
# End-to-end balance scan on a live PocketIC + local anvil node.
":cketh_minter_debug.wasm.gz",
"//rs/ethereum/ledger-suite-orchestrator:ledger_suite_orchestrator_canister.wasm.gz",
"//rs/ledger_suite/icrc1/archive:archive_canister_u256.wasm.gz",
"//rs/ledger_suite/icrc1/index-ng:index_ng_canister_u256.wasm.gz",
"//rs/ledger_suite/icrc1/ledger:ledger_canister_u256.wasm.gz",
"//rs/pocket_ic_server:pocket-ic-server",
"@evm_rpc.wasm.gz//file",
],
Expand All @@ -309,6 +313,10 @@ rust_test(
"CARGO_MANIFEST_DIR": "rs/ethereum/cketh/minter",
"CKETH_MINTER_WASM_PATH": "$(rootpath :cketh_minter_debug.wasm.gz)",
"EVM_RPC_CANISTER_WASM_PATH": "$(rootpath @evm_rpc.wasm.gz//file)",
"INDEX_CANISTER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/index-ng:index_ng_canister_u256.wasm.gz)",
"LEDGER_ARCHIVE_NODE_CANISTER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/archive:archive_canister_u256.wasm.gz)",
"LEDGER_CANISTER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister_u256.wasm.gz)",
"LEDGER_SUITE_ORCHESTRATOR_WASM_PATH": "$(rootpath //rs/ethereum/ledger-suite-orchestrator:ledger_suite_orchestrator_canister.wasm.gz)",
"POCKET_IC_BIN": "$(rootpath //rs/pocket_ic_server:pocket-ic-server)",
},
deps = [
Expand Down
9 changes: 3 additions & 6 deletions rs/ethereum/cketh/minter/tests/ckerc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,10 @@ mod deposit_erc20 {
use ic_cketh_minter::state::automatic_deposits::DEPOSIT_ADDRESS_SCAN_WINDOW;
use ic_cketh_test_utils::DEFAULT_USER_SUBACCOUNT;
use ic_cketh_test_utils::ckerc20::CkErc20Setup;
use ic_cketh_test_utils::new_pocket_ic;
use std::sync::Arc;

#[test]
fn should_trap_when_ckerc20_feature_not_active() {
let ckerc20 = CkErc20Setup::new_without_ckerc20_active(Arc::new(new_pocket_ic()));
let ckerc20 = CkErc20Setup::new_without_ckerc20_active();
let caller = ckerc20.caller();
ckerc20
.call_minter_deposit_erc20(caller, None)
Expand Down Expand Up @@ -407,21 +405,20 @@ mod withdraw_erc20 {
CKETH_TRANSFER_FEE, DEFAULT_BLOCK_HASH, DEFAULT_BLOCK_NUMBER,
DEFAULT_CKERC20_WITHDRAWAL_TRANSACTION, DEFAULT_CKERC20_WITHDRAWAL_TRANSACTION_FEE,
DEFAULT_CKERC20_WITHDRAWAL_TRANSACTION_HASH, DEFAULT_PRINCIPAL_ID, EXPECTED_BALANCE,
JsonRpcProvider, new_pocket_ic,
JsonRpcProvider,
};
use ic_ledger_suite_orchestrator_test_utils::CKERC20_TRANSFER_FEE;
use icrc_ledger_types::icrc3::transactions::Burn;
use num_bigint::BigUint;
use num_traits::ToPrimitive;
use serde_bytes::ByteBuf;
use std::convert::identity;
use std::sync::Arc;

const NOT_SUPPORTED_CKERC20_LEDGER_ID: Principal = Principal::management_canister();

#[test]
fn should_trap_when_ckerc20_feature_not_active() {
CkErc20Setup::new_without_ckerc20_active(Arc::new(new_pocket_ic()))
CkErc20Setup::new_without_ckerc20_active()
.call_minter_withdraw_erc20(
Principal::anonymous(),
0_u8,
Expand Down
4 changes: 2 additions & 2 deletions rs/ethereum/cketh/minter/tests/deposit_from_cex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use ic_cketh_minter::balance_scan::batcher::{
};
use ic_cketh_minter::numeric::Erc20Value;
use ic_cketh_test_utils::anvil::{Anvil, DEV_ACCOUNT, address_from_hex, deploy_mock_erc20};
use ic_cketh_test_utils::live_scan::{CkErc20LiveScanSetup, Holding, SupportedToken};
use ic_cketh_test_utils::live_scan::{Holding, LiveBalanceScanSetup, SupportedToken};
use ic_ethereum_types::Address;
use std::time::Duration;

Expand Down Expand Up @@ -194,7 +194,7 @@ fn should_flag_only_deposits_at_or_above_the_per_token_minimum() {
const USDC_ABOVE_MINIMUM: u128 = 15_000_000;
const USDT_BELOW_MINIMUM: u128 = 1_000_000;

let setup = CkErc20LiveScanSetup::new_live();
let setup = LiveBalanceScanSetup::new_live();
let deposits = [
(
setup.depositor(1),
Expand Down
24 changes: 18 additions & 6 deletions rs/ethereum/cketh/test_utils/src/ckerc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
DEPOSIT_WITH_SUBACCOUNT_HELPER_CONTRACT_ADDRESS, ERC20_HELPER_CONTRACT_ADDRESS,
ETH_HELPER_CONTRACT_ADDRESS, LAST_SCRAPED_BLOCK_NUMBER_AT_INSTALL, LedgerBalance, MAX_TICKS,
RECEIVED_ERC20_EVENT_TOPIC, RECEIVED_ETH_OR_ERC20_WITH_SUBACCOUNT_EVENT_TOPIC, assert_reply,
format_ethereum_address_to_eip_55, new_pocket_ic,
format_ethereum_address_to_eip_55,
};
use assert_matches::assert_matches;
use candid::{Decode, Encode, Nat, Principal};
Expand Down Expand Up @@ -62,7 +62,7 @@ pub struct CkErc20Setup {

impl Default for CkErc20Setup {
fn default() -> Self {
Self::new(Arc::new(new_pocket_ic()))
Self::new()
}
}

Expand All @@ -73,8 +73,14 @@ impl AsRef<CkEthSetup> for CkErc20Setup {
}

impl CkErc20Setup {
pub fn new(env: Arc<PocketIc>) -> Self {
let mut ckerc20 = Self::new_without_ckerc20_active(env);
pub fn new() -> Self {
Self::with_cketh(CkEthSetup::default())
}

/// Activates the ckERC20 feature on an existing ckETH fixture: the balance-scan harness in
/// [`crate::live_scan`] supplies one backed by a live anvil node rather than the mocked default.
pub(crate) fn with_cketh(cketh: CkEthSetup) -> Self {
let mut ckerc20 = Self::without_ckerc20_active(cketh);
ckerc20.cketh = ckerc20
.cketh
.upgrade_minter_to_add_orchestrator_id(
Expand All @@ -84,8 +90,14 @@ impl CkErc20Setup {
ckerc20
}

pub fn new_without_ckerc20_active(env: Arc<PocketIc>) -> Self {
let cketh = CkEthSetup::new(env.clone());
pub fn new_without_ckerc20_active() -> Self {
Self::without_ckerc20_active(CkEthSetup::default())
}

/// The ckETH fixture builds the PocketIC instance (its Ethereum backend decides how), and the
/// orchestrator is then created on that same instance so both share one replica.
fn without_ckerc20_active(cketh: CkEthSetup) -> Self {
let env = cketh.env.clone();
let orchestrator = LedgerSuiteOrchestrator::new(
env.clone(),
LedgerSuiteOrchestratorInitArg {
Expand Down
Loading
Loading