ORIGYN-SA / CanDB

CanDB - CanDB is a flexible, performant, and horizontally scalable non-relational multi-canister data storage framework built for the Internet Computer.
Other
30 stars 9 forks source link

"this function call implicitly requires `system` capability and may perform undesired actions" #31

Open vporton opened 8 months ago

vporton commented 8 months ago

.mops/candb@1.0.7/src/CanisterActions.mo:60.9-60.28: warning [M0195], this function call implicitly requiressystemcapability and may perform undesired actions (please review the call and provide a type instantiationto suppress this warning)

when compiling with

$ moc --version
Motoko compiler 0.11.0+ (source yh3wb1vx-vj8j4j32-k8gq4m8y-4cxlqinf)
ByronBecker commented 8 months ago

This is from the transferCyclesStopAndDeleteCanisters API in CanDBAdmin.mo

https://github.com/ORIGYN-SA/CanDB/blob/d76760914f424bec8755bf15ece0fc491c1574ec/src/CanDBAdmin.mo#L33

It's used when you want to delete an array of canister ids in parallel. Essentially what it does is:

  /// 1. Calls the TransferCycles method of each canister actor (transferring cycles from your service partition canisters back to your CanDB Index canister actor)
  /// 2. Stops each canister
  /// 3. Deletes each canister

Step 1 is what's resulting in a system error, since the library is sending cycles.

You can also implement your own canister cycles cleanup if you want to avoid the warning, but I implemented it in the library so that you don't have to deal with it in the first place.