Skip to content

Fix runtime errors and Motoko issues across 8 skills#13

Merged
JoshDFN merged 1 commit into
mainfrom
fix-runtime-errors
Feb 26, 2026
Merged

Fix runtime errors and Motoko issues across 8 skills#13
JoshDFN merged 1 commit into
mainfrom
fix-runtime-errors

Conversation

@JoshDFN

@JoshDFN JoshDFN commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Deep verification of all 12 skills (both Rust and Motoko) found runtime-breaking issues that passed compile checks but would fail when an AI agent actually deploys and runs the code.

Rust — .candid().candid_tuple() (18 locations across 6 skills)

IC inter-canister responses are encoded as Candid argument sequences. Response::candid() uses decode_one (wrong for tuples), Response::candid_tuple() uses decode_args (correct). Every skill using let (result,): (T,) = response.candid() would panic at runtime.

  • ckbtc: 6 call sites
  • evm-rpc: 5 call sites
  • icrc-ledger: 4 call sites
  • multi-canister: 2 call sites
  • vetkd: 2 call sites (already fixed by prior agent, confirming)

Motoko — thisSelf (2 skills)

this is unbound in anonymous persistent actor { }. Must use persistent actor Self { } and Principal.fromActor(Self).

  • wallet: 1 actor declaration + 1 fromActor call
  • ckbtc: 1 actor declaration + 3 fromActor calls

vetKD — cycles too low (both languages)

DFINITY's own ic-vetkeys library uses 26_153_846_153 cycles (~26B) for vetKD management canister calls. Our skills had 100_000_000 (100M) — would trap on mainnet.

Frontend — fetchRootKeyshouldFetchRootKey (2 skills)

In @icp-sdk/core 5.0, fetchRootKey is a method on the agent instance, not a constructor option. The HttpAgent.create() option is shouldFetchRootKey.

  • asset-canister: 1 location
  • internet-identity: 1 location

Test plan

  • Verify site builds
  • Spot-check updated code blocks

Rust (8 skills):
- .candid() → .candid_tuple() in all inter-canister call decode sites (18 locations)
  decode_one fails on argument sequences; decode_args is correct for IC responses

Motoko (2 skills):
- wallet + ckbtc: persistent actor { → persistent actor Self {
  'this' is unbound in anonymous actors; Self is the named reference

vetkd (both languages):
- Cycles for vetkd calls: 100M → 26B (DFINITY's own library uses 26_153_846_153)

Frontend (2 skills):
- asset-canister + internet-identity: fetchRootKey → shouldFetchRootKey
  fetchRootKey is a method, shouldFetchRootKey is the HttpAgent.create() option
@JoshDFN JoshDFN merged commit 4d13c69 into main Feb 26, 2026
4 checks passed
@marc0olo marc0olo deleted the fix-runtime-errors branch February 27, 2026 14:47
marc0olo added a commit that referenced this pull request Apr 2, 2026
…vals

Addresses #135 (Obs 2, 5, 6, 7), #136 (F2), #139, #141.

SKILL.md:
- Add pitfall #8: networks/environments must be YAML arrays, not maps
- Add pitfall #13: { agent } → { agentOptions } silent anonymous identity
- Add pitfall #15: mops.toml placement for inline vs path-based canisters
- Renumber pitfalls 8→16

binding-generation.md:
- Add createActor warning above code example ({ agentOptions } not { agent })
- Add opt T → T | null section (bindgen wrapper unwraps arrays)

dfx-migration.md:
- Add safeGetCanisterEnv before/after migration example
- Add createActor breaking API change with before/after code
- Add custom Motoko builds section (mops toolchain bin moc)
- Add frontend migration checklist items 11-14

evaluations/icp-cli.json:
- Add createActor adversarial eval (3/3 with skill, 0/3 without)
- Add opt T representation eval
marc0olo added a commit that referenced this pull request Apr 2, 2026
…vals (#144)

Addresses #135 (Obs 2, 5, 6, 7), #136 (F2), #139, #141.

SKILL.md:
- Add pitfall #8: networks/environments must be YAML arrays, not maps
- Add pitfall #13: { agent } → { agentOptions } silent anonymous identity
- Add pitfall #15: mops.toml placement for inline vs path-based canisters
- Renumber pitfalls 8→16

binding-generation.md:
- Add createActor warning above code example ({ agentOptions } not { agent })
- Add opt T → T | null section (bindgen wrapper unwraps arrays)

dfx-migration.md:
- Add safeGetCanisterEnv before/after migration example
- Add createActor breaking API change with before/after code
- Add custom Motoko builds section (mops toolchain bin moc)
- Add frontend migration checklist items 11-14

evaluations/icp-cli.json:
- Add createActor adversarial eval (3/3 with skill, 0/3 without)
- Add opt T representation eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant