Skip to content

cycles-management: add pitfall for icp cycles transfer vs icp canister top-up#238

Closed
joozzed wants to merge 1 commit into
dfinity:mainfrom
joozzed:add-cycles-transfer-vs-topup-pitfall
Closed

cycles-management: add pitfall for icp cycles transfer vs icp canister top-up#238
joozzed wants to merge 1 commit into
dfinity:mainfrom
joozzed:add-cycles-transfer-vs-topup-pitfall

Conversation

@joozzed

@joozzed joozzed commented Jul 3, 2026

Copy link
Copy Markdown

Summary

  • Adds pitfall Fix multi-canister Rust factory: API corrections for ic-cdk 0.18 #7 to cycles-management: icp cycles transfer credits the recipient's cycles-ledger balance, not a canister's execution/compute cycle balance — pointing it at a canister principal silently fails to fund the canister, with no error and no visible change in icp canister status.
  • Adds a correct/wrong command comparison to the "Top Up a Canister" section.
  • Adds evaluations/cycles-management.json (did not previously exist) with 2 output evals and trigger evals covering this distinction.

Found via a real incident: made this exact mistake twice in a row against a live mainnet canister before realizing icp canister top-up was the correct command.

Test plan

  • npm run validate — 26 skills validated, all passed, no new warnings
  • Eval 1 "Top up a mainnet canister" — WITH skill 3/3, WITHOUT skill 1/3
  • Eval 2 "Cycles transfer does not fund a canister" — WITH skill 4/4, WITHOUT skill 3/4
  • Trigger evals — should-trigger 4/4, should-not-trigger 3/3
Eval 1: Top up a mainnet canister
WITH skill: 3/3 passed
  ✅ Uses 'icp canister top-up <canister> --amount <N> -e ic' (or -n ic with a principal)
  ✅ Does NOT suggest 'icp cycles transfer' to fund the canister
  ✅ Mentions that --amount supports k/m/b/t suffixes, or shows a concrete amount like 600b or 1000000000000

WITHOUT skill: 1/3 passed
  ❌ Uses 'icp canister top-up <canister> --amount <N> -e ic' (or -n ic with a principal)
     → Uses the old dfx tool ('dfx ledger top-up' / 'dfx cycles top-up') rather than 'icp canister top-up -e ic'.
  ✅ Does NOT suggest 'icp cycles transfer' to fund the canister
  ❌ Mentions that --amount supports k/m/b/t suffixes, or shows a concrete amount like 600b or 1000000000000
     → Uses a generic placeholder '<ICP>' and never mentions suffixes or a concrete cycle amount.
Eval 2: Cycles transfer does not fund a canister
WITH skill: 4/4 passed
  ✅ Explains that 'icp cycles transfer' moves cycles to the recipient's cycles-ledger balance, not the canister's execution/compute cycle balance
  ✅ States that the canister cannot use cycles sent this way
  ✅ Recommends 'icp canister top-up <canister> --amount <N> -e ic' as the correct fix
  ✅ Does NOT suggest that running 'icp cycles transfer' again will move the parked cycles into the canister's execution balance

WITHOUT skill: 3/4 passed
  ✅ Explains that 'icp cycles transfer' moves cycles to the recipient's cycles-ledger balance, not the canister's execution/compute cycle balance
  ✅ States that the canister cannot use cycles sent this way
  ❌ Recommends 'icp canister top-up <canister> --amount <N> -e ic' as the correct fix
     → Suggests 'icp cycles top-up <canister-id> 600000000000 -n ic' — wrong subcommand/flags.
  ✅ Does NOT suggest that running 'icp cycles transfer' again will move the parked cycles into the canister's execution balance
Trigger evals
Should trigger: 4/4 correct
  ✅ "How do I top up my canister with more cycles?"
  ✅ "My canister ran out of cycles and froze, what do I do?"
  ✅ "I sent cycles to my canister's principal with icp cycles transfer but it's still low on cycles"
  ✅ "How do I fund a canister on mainnet before deploying?"

Should NOT trigger: 3/3 correct
  ✅ "Add a wallet connect button for ICRC token transfers in my dapp"
  ✅ "How do I integrate Internet Identity login into my frontend?"
  ✅ "Implement ICRC-1 transfer logic inside my canister"

icp cycles transfer moves cycles between cycles-ledger balances (like a
token transfer). Pointing it at a canister's principal credits that
principal's ledger balance, not the canister's execution/compute cycle
balance -- canister status shows no change and the canister keeps
burning toward freezing. icp canister top-up is the correct command.

Adds evaluations/cycles-management.json (new) with 2 output evals and
trigger evals covering this distinction.
@joozzed joozzed requested review from a team and JoshDFN as code owners July 3, 2026 17:29
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Thank you for contributing! Unfortunately this repository does not accept external contributions yet.

We are working on enabling this by aligning our internal processes and our CI setup to handle external contributions. However this will take some time to set up so in the meantime we unfortunately have to close this Pull Request.

We hope you understand and will come back once we accept external PRs.

— The DFINITY Foundation

@marc0olo

marc0olo commented Jul 3, 2026

Copy link
Copy Markdown
Member

Hey @joozzed, thanks for the contribution! I will check this on Monday and see if we can open the repo for external contributions.

@marc0olo marc0olo reopened this Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Thank you for contributing! Unfortunately this repository does not accept external contributions yet.

We are working on enabling this by aligning our internal processes and our CI setup to handle external contributions. However this will take some time to set up so in the meantime we unfortunately have to close this Pull Request.

We hope you understand and will come back once we accept external PRs.

— The DFINITY Foundation

@github-actions github-actions Bot closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants