Skip to content
Draft
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
1 change: 1 addition & 0 deletions packages/pocket-ic/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`PocketIc::query_call_with_effective_principal_and_sender_info`, and `PocketIc::query_call_with_sender_info`
to make canister calls with sender info (additional information provided by the canister with which the sender principal is associated).
- The function `PocketIcBuilder::with_test_threshold_keys_subnet` to create a test threshold keys subnet.
- The function `PocketIc::create_canister_with_cycles` to create a canister with a specified initial cycles balance and default settings.



Expand Down
7 changes: 7 additions & 0 deletions packages/pocket-ic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,13 @@ impl PocketIc {
runtime.block_on(async { self.pocket_ic.create_canister().await })
}

/// Create a canister with a specified initial cycles balance and default settings.
#[instrument(ret(Display), skip(self), fields(instance_id=self.pocket_ic.instance_id))]
pub fn create_canister_with_cycles(&self, cycles: u128) -> CanisterId {
let runtime = self.runtime.clone();
runtime.block_on(async { self.pocket_ic.create_canister_with_cycles(cycles).await })
}

/// Create a canister with optional custom settings and a sender.
#[instrument(ret(Display), skip(self), fields(instance_id=self.pocket_ic.instance_id, settings = ?settings, sender = %sender.unwrap_or(Principal::anonymous()).to_string()))]
pub fn create_canister_with_settings(
Expand Down
8 changes: 7 additions & 1 deletion packages/pocket-ic/src/nonblocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,12 @@ impl PocketIc {
/// Create a canister with default settings as the anonymous principal.
#[instrument(ret(Display), skip(self), fields(instance_id=self.instance_id))]
pub async fn create_canister(&self) -> CanisterId {
self.create_canister_with_cycles(0).await
}

/// Create a canister with a specified initial cycles balance and default settings.
#[instrument(ret(Display), skip(self), fields(instance_id=self.instance_id))]
pub async fn create_canister_with_cycles(&self, cycles: u128) -> CanisterId {
let CanisterIdRecord { canister_id } = call_candid_as(
self,
Principal::management_canister(),
Expand All @@ -1058,7 +1064,7 @@ impl PocketIc {
"provisional_create_canister_with_cycles",
(ProvisionalCreateCanisterWithCyclesArgs {
settings: None,
amount: Some(0_u64.into()),
amount: Some(cycles.into()),
specified_id: None,
sender_canister_version: None,
},),
Expand Down
7 changes: 3 additions & 4 deletions rs/bitcoin/ckbtc/minter/tests/dump_stable_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ impl Setup {
// install bitcoin canister
let bitcoin_id = bitcoin_canister_id(btc_network);
env.create_canister_with_id(None, None, bitcoin_id).unwrap();
let ledger_id = env.create_canister();
let minter_id = env.create_canister();
let btc_checker_id = env.create_canister();
env.add_cycles(minter_id, 100_000_000_000_000);
let ledger_id = env.create_canister_with_cycles(100_000_000_000_000);
let minter_id = env.create_canister_with_cycles(100_000_000_000_000);
let btc_checker_id = env.create_canister_with_cycles(100_000_000_000_000);

let init_args = Encode!(&MinterArg::Init(CkbtcMinterInitArgs {
btc_network,
Expand Down
2 changes: 1 addition & 1 deletion rs/config/src/execution_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TIB: u64 = 1024 * GIB;
const REPLICATED_INTER_CANISTER_LOG_FETCH_FEATURE: FlagStatus = FlagStatus::Disabled;

// TODO(DSM-105): remove after the feature is enabled by default.
pub const LOG_MEMORY_STORE_FEATURE_ENABLED: bool = false;
pub const LOG_MEMORY_STORE_FEATURE_ENABLED: bool = true;
pub const LOG_MEMORY_STORE_FEATURE: FlagStatus = if LOG_MEMORY_STORE_FEATURE_ENABLED {
FlagStatus::Enabled
} else {
Expand Down
Loading