Skip to content

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

Open
yhabib wants to merge 21 commits into
governance-dfx-icp-cli-migration-bb2c0efrom
feat/local-ckred-token
Open

yhabib wants to merge 21 commits into
governance-dfx-icp-cli-migration-bb2c0efrom
feat/local-ckred-token

Conversation

@yhabib

@yhabib yhabib commented Nov 2, 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

yhabib added 13 commits October 27, 2026 01:18
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.
… 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.
@zeropath-ai

zeropath-ai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 8ad4a49.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► .github/workflows/build.yml
    Update TVL test step to run test-tvl with arguments
Enhancement ► CHANGELOG-Nns-Dapp-unreleased.md
    Document ckRED token and mock exchange rate canister additions to local network tests
Enhancement ► HACKING.md
    Describe ckRED token and mock exchange rate canister presence on local network
Enhancement ► icp.yaml
    Add ckred_ledger, ckred_index, and xrc canisters; include their builds and environments
Enhancement ► mocks/ckred/README.md
    Add documentation for ckRED test token mock
Enhancement ► mocks/ckred/ckRED-logo.svg
    Add ckRED logo file
Enhancement ► scripts/icp-canister-create-with-id
    Add script for creating a canister with a specified ID via PocketIC REST API
Enhancement ► scripts/icp-network-start
    Integrate ckRED deployment steps and mock exchange rate canister; describe nns-dapp price read timing; adjust canister list for display
Enhancement ► scripts/nns-dapp/test-tvl
    Update to query governance total_locked_e8s via canister call and adjust TVL calculation; switch to icp canister calls and add environment local; adjust upgrade flow and TVL verification loop

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

Callers suppress Bash’s errexit, allowing a failed status pipeline to incorrectly indicate that a canister is installed, skip deployment, and report readiness without canister code.

1 open issue
What changed in this PR

Restores token-import and total-value-locked testing on the local icp-cli network introduced in #8123.

Changes:

  • Adds a ckRED ledger and index, plus a mock exchange rate canister using the mainnet ID.
  • Preserves installed mock state when restarting the network.
  • Re-enables the affected tests and adds polling for refreshed TVL values.
File Description
scripts/​nns-dapp/​test-tvl Migrates calls to icp-cli and polls for updated TVL.
scripts/​icp-network-start Deploys ckRED and the exchange rate mock.
scripts/​icp-canister-create-with-id Creates a fixed-ID canister through PocketIC.
mocks/​ckred/​README.md Documents the test token and initial funding.
mocks/​ckred/​ckRED-logo.svg Adds the ckRED token logo.
icp.yaml Registers pinned ledger, index, and exchange rate mock builds.
HACKING.md Documents the added local-network mocks.
frontend/​src/​tests/​e2e/​README.md Updates the remaining test-skip explanation.
frontend/​src/​tests/​e2e/​import-token.spec.ts Re-enables token-import 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 local functionality and tests.
.github/​workflows/​build.yml Restores the TVL test in CI.
.config/​spellcheck.dic Adds ckRED to the spelling dictionary.

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
The callers run is_installed in an || chain, which turns errexit off inside
the function. A failed status request then looked like an installed canister.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:48
Copilot AI previously approved these changes Nov 2, 2026

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.

🟢 Approved

No active review issues are reported for the changes restoring import-token and TVL test coverage.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 16:10
Copilot AI dismissed their stale review, a newer Copilot review was requested November 3, 2026 16:11

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

On fresh networks started without --nns_dapp_wasm, the backend can fetch exchange rates before XRC is deployed, leaving TVL at zero for six hours because no refresh is triggered afterward.

1 open issue

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
On a fresh network without --nns_dapp_wasm, the nns-dapp of the
launcher reads the ICP price before the mock exchange rate canister
exists. The total value locked then stays zero for six hours. The
script prints a note in that case, and HACKING.md explains it.
Copilot AI previously approved these changes Nov 3, 2026

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.

🟢 Approved

No active review issues are recorded for the local mock and test-restoration changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:19
Copilot AI dismissed their stale review, a newer Copilot review was requested November 3, 2026 20:19
Copilot AI previously approved these changes Nov 3, 2026

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.

🟢 Approved

No active review issues remain for the changes restoring local test-token and exchange-rate support.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:32
Copilot AI dismissed their stale review, a newer Copilot review was requested November 3, 2026 20:32
Copilot AI previously approved these changes Nov 3, 2026

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.

🟢 Approved

No active review issues block the local ckRED and exchange-rate mocks or the restored import-token and TVL tests.

No open issues 🎉

Review effort: Balanced

@yhabib
yhabib requested a balanced review from Copilot November 3, 2026 20:40
Copilot AI dismissed their stale review, a newer Copilot review was requested November 3, 2026 20:40
Copilot AI previously approved these changes Nov 3, 2026

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.

🟢 Approved

No active review issues remain for the changes restoring local import-token and TVL test coverage.

No open issues 🎉

Review effort: Balanced

…l-ckred-token

# Conflicts:
#	.config/spellcheck.dic
Copilot AI balanced review requested due to automatic review settings November 4, 2026 07:51
Copilot AI dismissed their stale review, a newer Copilot review was requested November 4, 2026 07:51
Copilot AI previously approved these changes Nov 4, 2026

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.

🟢 Approved

No active review issues were identified for the changes restoring local test-token and exchange-rate support.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:00
Copilot AI dismissed their stale review, a newer Copilot review was requested November 4, 2026 08:00
Copilot AI previously approved these changes Nov 4, 2026

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.

🟢 Approved

No active review issues are recorded for the local-network mocks and restored tests.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:06
Copilot AI dismissed their stale review, a newer Copilot review was requested November 4, 2026 08:06

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.

🟢 Approved

No active review issues are reported for the local mock setup and restored import-token and TVL tests.

No open issues 🎉

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.

3 participants