Intermittent, unusual increases in cycles balance when `canister_status` is called

No, the cycles are not sent along with the call. They are only used to pre-pay for processing the response you receive. The callee canister pays for its own execution. If you attach cycles to the call you make, then that’s a separate charge.

Assuming you don’t explicitly send cycles it would look roughly like this:

  • canister A gets called
  • before execution, A gets charged the max amount of cycles that call could consume (20B instructions times 0.4 cycles per instruction is 8B cycles)
  • call gets executed, using, say, 2.5B instructions (which costs 1B cycles)
  • canister receives 7B refund (8B max cost minus 1B that have been used)
  • as a result of the call, A tries to call the management canister. To make that call, cycles for processing the response need to be pre-paid. A gets charged 8B cycles
  • charge can be paid, so the call actually happens
  • what happens now does not matter
  • A receives the response
  • Processing the response is pre-paid, so no charge here
  • processing the response uses 5B instructions (so 2B cycles cost)
  • A receives 6B refund (8B max cost minus 2B actual cost)
  • response gets returned to whatever called A

My best guess is that the spikes happen when suddenly you are making less calls to other canisters. Is that a plausible explanation?

2 Likes