Repository navigation
fix: deflake //rs/tests/cross_chain:ic_xc_cketh_test_head_nns - #9209
Merged
basvandijk merged 1 commit intoMar 6, 2026
Merged
Conversation
Fix two sources of flakiness: 1. After minter reinstall, get_minter_info() returns minter_address: None because the ECDSA public key hasn't been lazily fetched yet. Fix by calling minter_address() first (which triggers the lazy ECDSA key fetch) before calling get_minter_info() in test_cketh_deposit, test_ckerc20_deposit, and test_deposit_with_subaccount. 2. In send_smart_contract, cast send --json via docker may include extra output after the JSON object, causing serde_json::from_str to fail with trailing characters. Fix by parsing only the first line of the output.
basvandijk
marked this pull request as ready for review
March 5, 2026 15:11
basvandijk
enabled auto-merge
March 5, 2026 15:23
gregorydemay
approved these changes
Mar 6, 2026
gregorydemay
left a comment
Contributor
There was a problem hiding this comment.
All very good insights, thanks!
pull Bot
pushed a commit
to mikeyhodl/ic
that referenced
this pull request
Jun 15, 2026
…tracts offline (dfinity#10459) ## Problem `//rs/tests/cross_chain:ic_xc_cketh_test` and `…:ic_xc_cketh_test_head_nns` are flaky in data centers with unreliable IPv4 connectivity (e.g. `dm1`), panicking in `deploy_smart_contract`: ``` thread 'main' panicked at rs/tests/cross_chain/ic_xc_cketh_test.rs: called `Result::unwrap()` on an `Err` value: block_on_bash_script: exit_status = 1. Output: Err: Error: error sending request for url (https://binaries.soliditylang.org/linux-amd64/list.json) - Error #1: tcp connect error: Network unreachable (os error 101) ``` ## Root cause The `foundry` container ships `forge`/`cast`/`anvil` but **no `solc`**. When `forge create` compiles a helper contract, it downloads the Solidity compiler from `binaries.soliditylang.org` at test runtime (first the release index `list.json`, then the `solc` binary). That is why the foundry UVM was created with `.enable_ipv4()`. Whenever the UVM's IPv4 connectivity is unavailable, the download fails and the test flakes. This is a third, distinct source of flakiness from the two fixed in dfinity#9209. This is also [preventing](https://github.com/dfinity/ic/pull/10253/changes#r3387217110.) these tests to run on the local system-test backend which doesn't have external network access. ## Fix Vendor the required `solc` compilers as pinned, hash-verified Bazel `http_file` dependencies, ship them in the ckETH UVM config image, bind-mount them into the foundry container, and pass them to `forge create --use <path>`. Compilation now happens fully offline and the `.enable_ipv4()` dependency is removed. - **MODULE.bazel**: add the `solc` and `solc_eth_deposit_helper` `http_file` deps (sha256 taken from `list.json`). The compilers are named by role rather than version, so a future compiler bump only touches the `http_file` URL and sha256. - **rs/tests/cross_chain/BUILD.bazel**: add both binaries to the `cketh_uvm_config_image` srcmap (→ `/config/solc` and `/config/solc_eth_deposit_helper`). - **rs/tests/cross_chain/ic_xc_cketh_test.rs**: drop `.enable_ipv4()`; copy the compilers to a writable path + `chmod +x` (vfat drops the exec bit); pass the compiler matching each contract's `pragma` to `forge create --use`. This also removes a source of non-determinism: contracts declaring `pragma solidity ^0.8.20` previously let `svm` pick the latest 0.8.x available at runtime; they are now pinned to exactly 0.8.20. `EthDepositHelper.sol` stays on 0.8.18 to remain faithful to the [deployed mainnet helper contract](https://etherscan.io/address/0x7574eB42cA208A4f6960ECCAfDF186D627dCC175), so it gets its own `solc_eth_deposit_helper` compiler. ## Verification Ran on `dm1` (the flaky environment) with caching disabled: ``` bazel test //rs/tests/cross_chain:ic_xc_cketh_test --cache_test_results=no ``` ``` ============== Summary for //rs/tests/cross_chain:ic_xc_cketh_test ============== Task setup PASSED in 118.22s Task ic_xc_cketh_test PASSED in 225.80s Task assert_no_metrics_errors PASSED in 3.96s Task assert_no_unallowed_log_patterns PASSED in 0.85s //rs/tests/cross_chain:ic_xc_cketh_test PASSED in 353.9s ``` The foundry UVM came up without IPv4, `forge create --use` compiled and deployed all four contracts from the vendored compilers, and every ETH/ERC-20/subaccount deposit flow passed — no network fetch to `binaries.soliditylang.org`.
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.
Root Cause Analysis
This PR fixes two sources of flakiness in
//rs/tests/cross_chain:ic_xc_cketh_test_head_nnsobserved since 2026-03-03 (3 flaky runs: 2 on master, 1 on a PR branch).Issue 1:
Option::unwrap()onNone(2 of 3 failures)After the ckETH minter is reinstalled in
support_eth_deposit, the ECDSA public key in the minter state is reset toNone. Whentest_cketh_deposit(and similar functions) immediately callget_minter_info(), theminter_addressfield isNonebecauseget_minter_info()reads state synchronously without triggering the lazy ECDSA key derivation.Fix: Call
minter.minter_address().awaitbeforeget_minter_info(). Theminter_address()endpoint lazily fetches the ECDSA key from the management canister and stores it in state. By the timeget_minter_info()is called, the key is available. Applied totest_cketh_deposit,test_ckerc20_deposit, andtest_deposit_with_subaccount.Issue 2: JSON parse failure with trailing characters (1 of 3 failures)
In
send_smart_contract, thecast send --jsoncommand run viadocker runoccasionally produces extra output after the JSON object (e.g., container cleanup messages), causingserde_json::from_strto fail withError("trailing characters", line: 2, column: 1).Fix: Parse only the first line of the trimmed output, which contains the JSON object from
cast send.Verified with
bazel test --test_output=errors --runs_per_test=3 --jobs=3— all 3 runs passed.This PR was created following the steps in
.claude/skills/fix-flaky-tests/SKILL.md.