Skip to content

chore(local): add a ckRED test token and a mock exchange rate canister to the local network - #8124

Merged
yhabib merged 13 commits into
governance-dfx-icp-cli-migration-bb2c0efrom
feat/local-ckred-token
Nov 2, 2026
Merged

yhabib merged 13 commits into
governance-dfx-icp-cli-migration-bb2c0efrom
feat/local-ckred-token

Conversation

@yhabib

@yhabib yhabib commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The icp-cli network of #8123 has no test token and no exchange rate canister. The two import token end-to-end tests and the TVL test are skipped because of that. The snsdemo snapshot had a ckRED ICRC token and a mock exchange rate canister for them.

Changes

  • Added the ckred_ledger and ckred_index canisters to icp.yaml, with the ICRC ledger and index wasms of the IC commit in config.json, and deployed them from scripts/icp-network-start on an application subnet with the test account of the "Get tokens" menu as the holder of the initial supply.
  • Added the xrc mock of the exchange rate canister to icp.yaml, created with the mainnet canister ID through the PocketIC REST API by the new scripts/icp-canister-create-with-id, and set its ICP price to 9 USD.
  • Installed the token and the mock only when the canister has no code, so a rerun of the start script keeps their state.
  • Enabled the import-token and import-token-anonymous-validation end-to-end tests and the TVL test of the test-rest job again, and made the TVL test poll for the refreshed rate.
  • Added the ckRED logo and a README under mocks/ckred.

Prev. #8123

The import token end-to-end tests need an ICRC token with an index.
The ledger and index wasms come from the IC commit in config.json. The
test account of the Get tokens menu holds the initial supply.
@yhabib
yhabib requested a review from a team as a code owner October 27, 2026 00:18
@zeropath-ai

zeropath-ai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 10af372.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► .github/workflows/build.yml
    - name: Test TVL
      run:
Enhancement ► frontend/src/tests/e2e/README.md
    - Some tests are skipped, because they need an SNS project or ckBTC, which the local network does not have. (updated wording)
Enhancement ► frontend/src/tests/e2e/import-token-anonymous-validation.spec.ts
    - test(...) replacing test.skip(...) for Import token deep link validates the URL canisters anonymously
Enhancement ► frontend/src/tests/e2e/import-token.spec.ts
    - test(...) replacing test.skip(...) for Test imported tokens
Enhancement ► scripts/icp-network-start
    - Deploys the ckRED test token
    - Deploys a mock exchange rate canister with the mainnet canister ID
    - Deploys and configures ckred_ledger, ckred_index, xrc canisters
Enhancement ► scripts/icp-canister-create-with-id
    - New script to create a canister with a given ID via PocketIC REST API (non-default method)
Enhancement ► scripts/nns-dapp/test-tvl
    - Use icp canister call for governance total_locked_e8s instead of dfx canister call
    - Upgrade path for nns-dapp with args file and environment local replaced, plus polling for TVL equality

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Repeated launcher runs supply initialization arguments during ckRED upgrades, aborting startup before requested application wasms are installed.

1 open issue
What changed in this PR

Adds a local ckRED test token to restore import-token end-to-end coverage after the migration from snsdemo to icp-cli.

Changes:

  • Defines and deploys ckRED ledger and index canisters, funding the test account used by “Get tokens.”
  • Re-enables both import-token end-to-end tests.
  • Adds token assets and updates local-network documentation.
File Description
scripts/​icp-network-start Deploys ckRED using a shared application-subnet helper.
mocks/​ckred/​README.md Documents token settings and initial funding.
mocks/​ckred/​ckRED-logo.svg Adds the ckRED logo.
icp.yaml Defines pinned ledger and index canisters for local deployment.
HACKING.md Documents local ckRED availability.
frontend/​src/​tests/​e2e/​README.md Updates the remaining skipped-test prerequisites.
frontend/​src/​tests/​e2e/​import-token.spec.ts Re-enables imported-token testing.
frontend/​src/​tests/​e2e/​import-token-anonymous-validation.spec.ts Re-enables anonymous deep-link validation testing.
CHANGELOG-Nns-Dapp-unreleased.md Records restored import-token test coverage.
.config/​spellcheck.dic Adds ckRED to the spelling dictionary.

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
… only once

The TVL of the nns-dapp needs the exchange rate canister with its
mainnet ID. A rerun of the start script no longer upgrades the ckRED
ledger with Init arguments.
@yhabib yhabib changed the title chore(local): add a ckRED test token to the local network chore(local): add a ckRED test token and a mock exchange rate canister to the local network Oct 27, 2026
@yhabib
yhabib requested a balanced review from Copilot October 27, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Fixed-ID provisioning and the restored integration tests still need validation on a running PocketIC network.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Startup can skip required deployments after failed status checks and overwrites an existing mock exchange rate on reruns.

2 open issues

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
Comment thread scripts/icp-network-start Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Fixed-ID provisioning and restart recovery need validation on a running PocketIC network, alongside the retained initialization fix.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Default startup can deploy the exchange-rate mock after the initial backend refresh, leaving TVL at zero until the six-hour refresh.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Trigger TVL refresh after XRC deployment on startup

scripts/​icp-network-start:194

On the documented startup path without --nns_dapp_wasm, nns-dapp is already running before XRC is deployed. If its one-second initial refresh runs before deployment, TVL can remain zero until the six-hour refresh (rs/backend/src/tvl.rs:33-36), since installing the mock does not restart that timer. Trigger a refresh after XRC deployment on this path too, or make XRC available before the backend's first refresh.

1 resolved since last review

Review effort: Balanced

@yhabib

yhabib commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Intentional. Without --nns_dapp_wasm the network keeps the bundled nns-dapp nightly, and its TVL refreshes again after six hours. The TVL test and the CI jobs install the wasm after the mocks, which refreshes the rate at once.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Default frontend-only startup can leave TVL zero or stale for hours because installing XRC does not trigger a backend refresh.

1 open issue

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
…S end-to-end tests again (#8125)

# Motivation

The local icp-cli network has no SNS project, so the SNS end-to-end
tests `sns-participation.spec.ts` and `sns-governance.spec.ts` are
skipped since #8123. The old snsdemo snapshot had the projects that the
tests expect. The `aggregator_test` job is also disabled, because its
helper scripts use dfx and the snsdemo scripts.

A fresh `scripts/icp-network-start` takes about five and a half minutes,
four minutes of it for the SNS projects. A start on a running network
takes one minute.

# Changes

- Added `scripts/icp-sns-create`, which creates an SNS project through a
`CreateServiceNervousSystem` proposal of the large NNS neuron of the
anonymous principal, buys the swap on request, and funds the test
account of the "Get tokens" menu.
- Added `scripts/icp-sns-aggregator-wait`, which speeds up the SNS
aggregator until it lists every SNS project, then restores its
configuration.
- Added a step to `scripts/icp-network-start` that creates Alfa Centauri
and Delta with a committed swap, and Bravo and Charlie with an open
swap, see `mocks/sns/README.md`.
- Enabled the two SNS end-to-end tests again.
- Enabled the `aggregator_test` job, ported its helper scripts from dfx
to icp, and let the job create nine more projects for the pagination
test.
- Updated HACKING.md, the end-to-end README and the unreleased
changelog.

---

Prev. #8124
Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:38
@yhabib
yhabib merged commit dbb222a into governance-dfx-icp-cli-migration-bb2c0e Nov 2, 2026
10 of 17 checks passed
@yhabib
yhabib deleted the feat/local-ckred-token branch November 2, 2026 14:38
yhabib added a commit that referenced this pull request Nov 2, 2026
… canister to the local network (#8124)"

This reverts commit dbb222a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The new NNS/SNS lifecycle and persisted-state paths require live validation against the pinned PocketIC launcher for clean startup, interrupted-run recovery, and upgrade/downgrade compatibility, which static review cannot establish.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

2 participants