Skip to content

fix: deflake //rs/tests/cross_chain:ic_xc_cketh_test by compiling contracts offline - #10459

Merged
basvandijk merged 2 commits into
masterfrom
basvandijk/deflake-ic-xc-cketh-test-offline-solc
Jun 15, 2026
Merged

basvandijk merged 2 commits into
masterfrom
basvandijk/deflake-ic-xc-cketh-test-offline-solc

Conversation

@basvandijk

@basvandijk basvandijk commented Jun 14, 2026 •

Copy link
Copy Markdown
Collaborator

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 #9209.

This is also preventing 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, 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.

…tracts offline

The test was flaky in data centers with unreliable IPv4 connectivity (e.g.
dm1), panicking in `deploy_smart_contract` with:

    error sending request for url (https://binaries.soliditylang.org/linux-amd64/list.json)
    ... Network unreachable (os error 101)

Root cause: the foundry container ships no `solc`, so `forge create` downloads
the Solidity compiler from binaries.soliditylang.org at test runtime. That is
why the foundry UVM was created with `.enable_ipv4()`. The download fails
whenever the UVM's IPv4 connectivity is unavailable.

Fix: vendor the required `solc` compilers (0.8.18 and 0.8.20) 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.

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.

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.

Pull request overview

This PR deflakes the ckETH cross-chain system tests by vendoring specific solc binaries and making forge create compile contracts fully offline inside the foundry UVM, removing the runtime dependency on external IPv4 connectivity.

Changes:

  • Vendor solc 0.8.18 and 0.8.20 as pinned, hash-verified Bazel http_file dependencies.
  • Ship the vendored solc binaries in the ckETH UVM config image and copy them to an executable, writable location at UVM startup.
  • Update the test to mount the appropriate solc into the foundry container and pass it via forge create --use, while removing .enable_ipv4().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
rs/tests/cross_chain/ic_xc_cketh_test.rs Removes IPv4 requirement and forces offline contract compilation by bind-mounting pinned solc binaries into the foundry container.
rs/tests/cross_chain/BUILD.bazel Adds the two vendored solc binaries to the ckETH UVM config image.
MODULE.bazel Introduces pinned, hash-verified solc 0.8.18/0.8.20 http_file dependencies for offline compilation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gregorydemay

Copy link
Copy Markdown
Contributor

@basvandijk Thanks for that PR! I tried twice to run in the devenv container (also after a bazel clean)

bazel test //rs/tests/cross_chain:ic_xc_cketh_test --cache_test_results=no

but I'm getting some errors

========================================== Summary for //rs/tests/cross_chain:ic_xc_cketh_test ==========================================
Task assert_no_metrics_errors         PASSED  in   0.04s   -- Exited with code 0.
Task assert_no_unallowed_log_patterns PASSED  in   0.46s   -- Exited with code 0.
Task setup                            FAILED  in 511.64s   -- a scoped thread panicked
Task ic_xc_cketh_test                 FAILED  in   0.05s   -- Failed to find SetupResult attribute after setup. Cancelling test function.
=========================================================================================================================================

@basvandijk
basvandijk enabled auto-merge June 15, 2026 09:10
Address review feedback on #10459: name the vendored solc compilers by
role rather than version, so a future compiler bump only touches the
`http_file` URL and sha256 instead of every reference.

- MODULE.bazel: rename repos solc_linux_amd64_0_8_20 -> solc and
  solc_linux_amd64_0_8_18 -> solc_eth_deposit_helper (+ matching
  downloaded_file_path).
- BUILD.bazel: update the cketh_uvm_config_image srcmap accordingly.
- ic_xc_cketh_test.rs: rename SOLC_V0_8_20 -> SOLC and
  SOLC_V0_8_18 -> SOLC_ETH_DEPOSIT_HELPER.

EthDepositHelper.sol keeps its own compiler since it pins an older
Solidity version to match its immutable mainnet deployment.
@basvandijk
basvandijk added this pull request to the merge queue Jun 15, 2026
Merged via the queue into master with commit 8f4adb7 Jun 15, 2026
39 checks passed
@basvandijk
basvandijk deleted the basvandijk/deflake-ic-xc-cketh-test-offline-solc branch June 15, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants