Repository navigation
chore: migrate motoko/evm_block_explorer to icp-cli - #1436
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- moc 1.9.0 → 1.11.0 (latest per mops-cli skill) - Remove `persistent` from actor declaration — redundant with `--default-persistent-actors` in mops.toml (motoko skill convention) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- backend/backend.did now generated by `mops generate candid backend`; type is named EvmBlockResult, Block fields alphabetically sorted by moc - README: use `mops generate candid backend` instead of raw moc command Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-generated by @icp-sdk/bindgen during build; mirrors the existing **/src/declarations/ entry for dfx-generated declarations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates the Motoko evm_block_explorer example from dfx to icp-cli, aligning the project layout and tooling (icp.yaml, mops, Vite + bindgen, CI) with the repository’s current ICP example conventions.
Changes:
- Replaced
dfx.json-based setup withicp.yaml(including local pre-builtevm_rpcand anicenvironment override) and updated the README/test flow toicpcommands. - Refactored the backend to a thin
get_evm_blockwrapper over a newbackend/EvmRpcApi.momodule and committedbackend/backend.didfor frontend bindgen. - Updated the frontend to use
@icp-sdk/bindgen+safeGetCanisterEnvactor wiring and removed the signing UI components.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| motoko/evm_block_explorer/icp.yaml | Defines backend/frontend recipes and local pre-built evm_rpc, plus ic environment injection for mainnet |
| motoko/evm_block_explorer/mops.toml | Updates toolchain/deps and sets canister main + candid path |
| motoko/evm_block_explorer/backend/app.mo | Simplifies backend API to get_evm_block returning a Result variant |
| motoko/evm_block_explorer/backend/EvmRpcApi.mo | New inline EVM RPC interface + getBlock helper (contains interface mismatches called out in review comments) |
| motoko/evm_block_explorer/backend/backend.did | Committed Candid interface for frontend binding generation |
| motoko/evm_block_explorer/frontend/vite.config.js | Switches to @icp-sdk/bindgen Vite plugin and icp-cli devserver cookie/proxy flow |
| motoko/evm_block_explorer/frontend/src/actor.js | New actor wiring via safeGetCanisterEnv + bindgen-generated actor |
| motoko/evm_block_explorer/frontend/src/Block.jsx | Updates UI to handle Result and validates block number input before enabling fetch |
| motoko/evm_block_explorer/frontend/src/main.jsx | Removes signing components from the UI |
| motoko/evm_block_explorer/frontend/package.json | Drops dfx generate step; adds @icp-sdk/bindgen |
| motoko/evm_block_explorer/test.sh | Adds an icp-cli test asserting deterministic Ethereum mainnet block 1 fields |
| motoko/evm_block_explorer/README.md | Updates instructions to icp-cli and documents candid regen + provider notes |
| motoko/evm_block_explorer/package.json | Removes workspace prebuild script |
| .github/workflows/evm_block_explorer.yml | Adds Motoko CI job + PR path trigger for the migrated example |
| .gitignore | Globally ignores bindgen output **/src/bindings/ |
| motoko/evm_block_explorer/dfx.json | Deleted (dfx artifact) |
| motoko/evm_block_explorer/BUILD.md | Deleted (dfx/ICP Ninja artifact) |
| motoko/evm_block_explorer/.devcontainer/devcontainer.json | Deleted (per-example devcontainer artifact) |
| motoko/evm_block_explorer/frontend/src/ECDSASigning.jsx | Deleted (signing UI removed) |
| motoko/evm_block_explorer/frontend/src/SchnorrSigning.jsx | Deleted (signing UI removed) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
int64 in Candid maps to Int64 in Motoko, not Int. No runtime impact since Candid allows int64 → int widening, but this matches the canonical interface precisely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the ?{} placeholder with the proper ?RpcConfig type matching
evm_rpc.did exactly. Adds inline comments explaining each field so
readers understand when and why they'd override the defaults.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
raymondk
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
icp.yaml:@dfinity/motoko@v5.0.0backend,@dfinity/asset-canister@v2.2.1frontend; pre-builtevm_rpccanister at v2.8.0 withnodesInSubnet = 28;environmentsblock withlocal(deploys all three canisters) andic(deploys onlybackend+frontend, injectsPUBLIC_CANISTER_ID:evm_rpc = 7hfb6-caaaa-aaaar-qadga-cai)dfx.json,BUILD.md,.devcontainer/(dfx artifacts)backend/EvmRpcApi.mo(new): inline actor type for the EVM RPC canister following thebasic_bitcoin/BitcoinApi.mopattern — no dfxcanister:import, no moc flags; principal resolved at runtime viaRuntime.envVar<system>("PUBLIC_CANISTER_ID:evm_rpc"); full type definitions foreth_getBlockByNumberwith a link to the complete EVM RPC Candid interfacebackend/app.mo: thin wrapper overEvmRpcApi.getBlock;get_evm_blockreturns{ #Ok : Block; #Err : Text }instead of trapping; nopersistentkeyword (redundant with--default-persistent-actors)backend/backend.did(new): generated viamops generate candid backend; committed because the frontend consumes it via@icp-sdk/bindgenget_ecdsa_public_key,get_schnorr_public_key,sign_message_with_ecdsa,sign_message_with_schnorr— isolated primitives with no EVM context; refer tobasic_ethereumfor the full signing + submission flowmops.toml:moc = "1.11.0",core = "2.5.0"(droppedsha2,base16);--default-persistent-actors+ warning flags;[canisters.backend]withmainandcandidpointing to the committed.didvite.config.jsand addedactor.jsto icp-cli only (no dfx fallback); removedECDSASigningandSchnorrSigningcomponents;Block.jsxhandles theResultvariant and requires a valid block number before enabling the fetch button; upgraded to@icp-sdk/bindgenfor TypeScript binding generationtest.sh: fetches Ethereum mainnet block 1 and asserts its deterministic hash and miner addressmotoko-evm_block_explorerjob usingghcr.io/dfinity/icp-dev-env-motoko:1.0.1; also addedmotoko/evm_block_explorer/**to the PR path trigger.gitignore: added**/src/bindings/to globally ignore bindgen output (mirrors the existing**/src/declarations/for dfx)Test plan
icp network start -d && icp deploy && bash test.shpasses locallynpm run dev --prefix frontendicp deploy -e icdeploys only backend + frontend on ICP mainnet🤖 Generated with Claude Code