Repository navigation
chore: migrate rust/evm_block_explorer to icp-cli - #1435
Merged
marc0olo merged 10 commits intoJul 9, 2026
Merged
Conversation
- Delete dfx.json, BUILD.md, .devcontainer/ (dfx artifacts) - Rewrite icp.yaml: rust@v3.3.0, asset-canister@v2.2.1, evm_rpc pre-built at v2.8.0; add environments block so production sets PUBLIC_CANISTER_ID:evm_rpc to the shared mainnet canister - Update backend/Cargo.toml: edition 2024, ic-cdk 0.20, replace evm-rpc-canister-types + ic0 with evm_rpc_client 0.4.0, evm_rpc_types 3.1.1, ic-canister-runtime 0.2.0, and ic-cdk-management-canister 0.1.1 for ECDSA/Schnorr APIs - Move backend/lib.rs → backend/src/lib.rs; update to new API: EvmRpcClient builder pattern for get_evm_block, ic_cdk::api::env_var_value for runtime canister ID resolution, ic-cdk-management-canister types for ECDSA/Schnorr (EcdsaPublicKeyArgs, SignWithEcdsaArgs, etc.) - Rewrite frontend/vite.config.js: icp-cli only (no dfx fallback), uses icp network status for proxy target and root key - Rewrite frontend/src/actor.js: icp-cli only via safeGetCanisterEnv() - Add test.sh covering ECDSA/Schnorr public key and signing endpoints - Add .github/workflows/evm_block_explorer.yml CI workflow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…m ic deploy Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…om get_evm_block Using only Llama caused 521 failures when that provider is down. Now uses Llama + Cloudflare + PublicNode for redundancy. Changed return type to Result<Block, String> so provider errors surface as a Candid Err variant instead of an IC trap. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…0 default Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sistent When some providers are down and others succeed, MultiRpcResult::Inconsistent previously caused an error. Now falls back to the first successful response so transient provider outages don't block the request entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ance - Use only PublicNode (no API key, reliable) instead of multiple providers with unreliable Llama/Cloudflare; comment explains how to switch to RpcServices::EthMainnet(None) for production consensus - icp.yaml: add nodesInSubnet=28 to validate cycle costs locally, restore local environment entry, add explanatory comments matching basic_ethereum - README: fix deploy command (ic environment, not production), add RPC providers section documenting the PublicNode default and production upgrade path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t, clean workflow - Restore '// Use "key_1" for production' comment on KEY_NAME (present in the original, carries important production guidance) - Add test 5: fetch Ethereum mainnet block 1 and assert its deterministic hash and miner address (both are immutable historical facts) - Remove redundant npm install step from workflow — icp deploy already runs the build steps defined in icp.yaml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ning panels ECDSASigning and SchnorrSigning both declared function Block() internally and had an error state that was set but never rendered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ck data The ECDSA/Schnorr signing functions were isolated primitives with no connection to EVM concepts — no address derivation, no transaction construction. Developers wanting signing + EVM interaction should use basic_ethereum instead. Removes: get_ecdsa_public_key, get_schnorr_public_key, sign_message_with_ecdsa, sign_message_with_schnorr from backend and DID; ECDSASigning and SchnorrSigning components; hex, sha2, ic-cdk-management-canister dependencies; signing tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates the rust/evm_block_explorer example from dfx artifacts to the canonical icp-cli workflow, modernizing the Rust backend to use evm_rpc_client and updating the frontend/dev tooling accordingly.
Changes:
- Replaced legacy
dfx/ic0-syscall based backend logic withevm_rpc_client+ runtime canister ID resolution viaic_cdk::api::env_var_value, and changed the API to returnResult<Block, String>. - Updated project configuration for
icp-cli(icp.yaml+ new CI workflow) including local-only deployment of a pre-builtevm_rpccanister and anicenvironment mapping to the shared mainnet EVM RPC canister. - Simplified the frontend to focus on block fetching (removed signing UI) and aligned dev server configuration with the established
ic_envcookie pattern used in other examples.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rust/evm_block_explorer/test.sh | Adds a deterministic end-to-end CLI test asserting block-1 hash/miner via get_evm_block. |
| rust/evm_block_explorer/README.md | Updates docs for icp-cli, mainnet deployment mode, and RPC provider guidance; refreshes security link. |
| rust/evm_block_explorer/icp.yaml | Switches to updated recipes, adds local pre-built evm_rpc, and introduces local/ic environments with env var injection. |
| rust/evm_block_explorer/frontend/vite.config.js | Removes dfx fallback and uses the standard ic_env cookie + icp network status proxy setup for dev. |
| rust/evm_block_explorer/frontend/src/main.jsx | Removes signing components from the rendered UI. |
| rust/evm_block_explorer/frontend/src/Block.jsx | Handles Result return type and disables fetch until the block number is valid. |
| rust/evm_block_explorer/frontend/src/actor.js | Removes dfx env-var fallback; relies on ic_env cookie (consistent with rust/hello_world). |
| rust/evm_block_explorer/backend/src/lib.rs | New backend implementation using evm_rpc_client and returning Result instead of panicking. |
| rust/evm_block_explorer/backend/Cargo.toml | Updates edition/dependencies and aligns crate layout with src/lib.rs. |
| rust/evm_block_explorer/backend/backend.did | Updates the public interface to only expose get_evm_block returning a Result. |
| rust/evm_block_explorer/frontend/src/ECDSASigning.jsx | Removes signing UI component (dropped backend signing APIs). |
| rust/evm_block_explorer/frontend/src/SchnorrSigning.jsx | Removes signing UI component (dropped backend signing APIs). |
| rust/evm_block_explorer/dfx.json | Deletes legacy dfx project config. |
| rust/evm_block_explorer/BUILD.md | Deletes ICP Ninja follow-up instructions tied to removed dfx artifacts. |
| rust/evm_block_explorer/.devcontainer/devcontainer.json | Deletes per-example devcontainer (repo uses the root devcontainer). |
| .github/workflows/evm_block_explorer.yml | Adds CI workflow using the pinned Rust dev-env container and icp network start/deploy/test.sh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marc0olo
marked this pull request as ready for review
July 9, 2026 15:10
lwshang
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
dfx.json,BUILD.md,.devcontainer/(dfx artifacts)icp.yaml:@dfinity/rust@v3.3.0,@dfinity/asset-canister@v2.2.1; 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)evm-rpc-canister-types+ rawic0syscalls withevm_rpc_client 0.4.0+evm_rpc_types 3.1.1(builder pattern);ic_cdk::api::env_var_valuefor runtime canister ID resolution;get_evm_blocknow returnsResult<Block, String>instead of panicking; usesEthMainnetService::PublicNodeby default (no API key required)get_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 flowbackend/lib.rs→backend/src/lib.rs; updatedCargo.tomltoedition = "2024",ic-cdk = "0.20"; removedhex,sha2,ic-cdk-management-canister(no longer needed)vite.config.jsandactor.jsto icp-cli only (no dfx fallback); removedECDSASigningandSchnorrSigningcomponents;Block.jsxhandles theResultvariant and requires a valid block number before enabling the fetch buttontest.sh: fetches Ethereum mainnet block 1 and asserts its deterministic hash and miner addressrust-evm_block_explorerjob usingghcr.io/dfinity/icp-dev-env-rust:1.0.1Test 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