Skip to content

chore: migrate rust/inter-canister-calls to icp-cli#1420

Open
marc0olo wants to merge 7 commits into
masterfrom
chore/migrate-rust-inter-canister-calls-to-icp-cli
Open

chore: migrate rust/inter-canister-calls to icp-cli#1420
marc0olo wants to merge 7 commits into
masterfrom
chore/migrate-rust-inter-canister-calls-to-icp-cli

Conversation

@marc0olo

@marc0olo marc0olo commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace dfx.json with icp.yaml using @dfinity/rust@v3.3.0 for both counter and caller canisters
  • Restructure source: src/caller/caller/, src/counter/counter/; update workspace Cargo.toml
  • Upgrade ic-cdk to 0.20; add ic-cdk-management-canister = "0.1.1" to caller (replaces removed ic_cdk::management_canister module); add ic_cdk::export_candid!() to both canisters; update edition to "2024"
  • Add rust-toolchain.toml with wasm32-unknown-unknown target
  • Replace Makefile with test.sh: 9 tests covering all endpoints (call_get_and_set, set_then_get, call_increment, call_get, stubborn_set, send_cycles) with setup (counter reset + caller top-up) before each run
  • Add CI workflow inter-canister-calls.yml (icp-dev-env-rust:1.0.1); remove legacy rust-inter-canister-calls.yaml
  • README: add Node.js v18+, Rust with wasm32-unknown-unknown prerequisites
  • Delete dfx.json, BUILD.md, .devcontainer/, old src/ tree, old .did files, Makefile

Test plan

  • icp network start -d && icp deploy && bash test.sh passes — all 9 tests green including send_cycles after top-up
  • CI workflow inter-canister-calls passes on push

🤖 Generated with Claude Code

@marc0olo marc0olo force-pushed the chore/migrate-rust-inter-canister-calls-to-icp-cli branch from 8d577d1 to bbef37c Compare June 17, 2026 17:02
marc0olo and others added 2 commits June 19, 2026 08:32
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e to 1.0.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo force-pushed the chore/migrate-rust-inter-canister-calls-to-icp-cli branch from bbef37c to 146a833 Compare June 19, 2026 06:33
marc0olo and others added 5 commits July 3, 2026 19:32
…from icp.yaml

environment_variables is not a valid canister-level field. PUBLIC_CANISTER_ID:counter
is automatically injected by the @dfinity/rust recipe for all sibling canisters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e README

- caller: replace removed ic_cdk::management_canister with ic-cdk-management-canister = "0.1.1"
  (DepositCyclesArgs); send_cycles target stays as Principal parameter since the
  canister ID is provided by the caller, not hardcoded
- caller + counter: add export_candid!() required by @dfinity/rust recipe's candid-extractor step
- Both crates: edition 2021 → 2024; add cdylib comment
- README: add Node.js v18+, Rust with wasm32-unknown-unknown prerequisites

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… icp canister id

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uce send amount

On repeated runs the caller exhausts its cycles; top up with 1t before the test
and reduce the amount sent from 1t to 100b so the test is idempotent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ptions

- Fetch COUNTER_ID once at the top instead of 7 times
- Move setup (reset + top-up) to the top before all tests
- Fix Test 8 description: "retries until success" was misleading since a
  healthy local canister never fails; now says "no retries needed"
- Use 99 for stubborn_set to distinguish it from earlier set values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the rust/inter-canister-calls example from dfx to icp-cli, aligning it with the repository’s modern example structure and CI approach while keeping the two-canister (“counter” + “caller”) setup.

Changes:

  • Replaced dfx.json/Makefile-based workflow with icp.yaml + test.sh and a new GitHub Actions workflow using the icp-dev-env-rust:1.0.1 container.
  • Restructured the Rust workspace and canister sources (src/* → top-level caller/ and counter/ crates), updated dependencies (including ic-cdk 0.20) and added export_candid!().
  • Updated README to document icp-cli-based local deploy/test steps and current security best-practices link.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rust/inter-canister-calls/test.sh Adds an icp-cli-based integration test script covering the example’s endpoints.
rust/inter-canister-calls/rust-toolchain.toml Ensures the wasm target is available for builds.
rust/inter-canister-calls/README.md Updates instructions from dfx/ICP Ninja to icp-cli deploy + test flow.
rust/inter-canister-calls/icp.yaml Introduces icp-cli project definition for counter and caller canisters.
rust/inter-canister-calls/Cargo.toml Updates workspace members to the new crate layout.
rust/inter-canister-calls/Cargo.lock Refreshes lockfile for updated dependencies/tooling.
rust/inter-canister-calls/counter/src/lib.rs Reintroduces the counter canister code in the new crate location and exports Candid.
rust/inter-canister-calls/counter/Cargo.toml Defines the new counter canister crate manifest.
rust/inter-canister-calls/caller/src/lib.rs Updates inter-canister calling logic to ic-cdk 0.20 and management-canister crate usage; exports Candid.
rust/inter-canister-calls/caller/Cargo.toml Defines the new caller canister crate manifest and adds ic-cdk-management-canister.
rust/inter-canister-calls/dfx.json Removes legacy dfx project configuration.
rust/inter-canister-calls/Makefile Removes dfx-driven Makefile test runner.
rust/inter-canister-calls/BUILD.md Removes ICP Ninja/dfx-oriented build instructions.
rust/inter-canister-calls/.devcontainer/devcontainer.json Removes per-example devcontainer configuration.
rust/inter-canister-calls/src/counter/src/lib.rs Deletes old counter source location after restructure.
rust/inter-canister-calls/src/counter/counter.did Removes committed .did from the prior dfx layout.
rust/inter-canister-calls/src/counter/Cargo.toml Deletes old counter crate manifest from the prior layout.
rust/inter-canister-calls/src/caller/Cargo.toml Deletes old caller crate manifest from the prior layout.
rust/inter-canister-calls/src/caller/caller.did Removes committed .did from the prior dfx layout.
.github/workflows/rust-inter-canister-calls.yaml Removes the legacy dfx-based CI workflow.
.github/workflows/inter-canister-calls.yml Adds new container-based CI workflow using icp-cli.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rust/inter-canister-calls/counter/Cargo.toml
Comment thread rust/inter-canister-calls/caller/Cargo.toml
Comment thread rust/inter-canister-calls/test.sh
@marc0olo marc0olo marked this pull request as ready for review July 3, 2026 18:04
@marc0olo marc0olo requested review from a team as code owners July 3, 2026 18:04
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.

3 participants