Skip to content

refactor(rebalancer-sim): Use testcontainers for anvil setup#8004

Merged
nambrot merged 1 commit into
feat/rebalancer-simulation-harnessfrom
nam/eng-3234-testcontainers-anvil
Feb 3, 2026
Merged

refactor(rebalancer-sim): Use testcontainers for anvil setup#8004
nambrot merged 1 commit into
feat/rebalancer-simulation-harnessfrom
nam/eng-3234-testcontainers-anvil

Conversation

@nambrot-agent
Copy link
Copy Markdown
Contributor

@nambrot-agent nambrot-agent commented Feb 3, 2026

Summary

Replaced spawn-based anvil process management with testcontainers, consistent with CLI e2e tests pattern.

  • No local anvil installation required (uses Docker image)
  • Automatic container cleanup even on test crashes
  • Retry logic for CI reliability
  • Consistent with how CLI e2e tests handle anvil

Addresses PR #7903 review comment from @xeno097.

Relates to ENG-3234.

Design Decision: Single Container

The rebalancer-sim intentionally uses a single anvil container with multiple virtual domains (domain IDs 1000, 2000, 3000) rather than multiple separate containers like CLI e2e tests. This is to:

  1. Keep provider/signer coordination simple - All domains share one RPC endpoint, avoiding multi-provider orchestration complexity
  2. Faster test execution - No multi-container startup/coordination overhead
  3. Simpler state management - Single blockchain state to reason about
  4. Sufficient for rebalancer testing - Tests verify rebalancer logic, not actual cross-chain message passing

The CLI e2e tests need multiple containers because they test real cross-chain scenarios. The rebalancer simulation tests the rebalancer's decision-making against synthetic scenarios on a shared state.

Changes

  • typescript/rebalancer-sim/package.json - Added testcontainers dependency
  • typescript/rebalancer-sim/test/utils/anvil.ts - Rewrote to use testcontainers (177 → 85 lines)

CI Workflow Note

The CI workflow change (.github/workflows/rebalancer-sim-test.yml) to remove the Foundry setup step couldn't be pushed due to token scope limitations. The change is:

-      - name: Setup Foundry
-        uses: ./.github/actions/setup-foundry
+      # Note: Foundry/anvil not needed - tests use testcontainers (Docker image)

This can be added manually or the tests will still work (Foundry setup is just unnecessary overhead now).

Testing

All tests pass locally:

  • harness-setup
  • inflight-guard
  • full-simulation (extreme-drain)

Replaced spawn-based anvil process management with testcontainers,
consistent with CLI e2e tests pattern.

- No local anvil installation required (uses Docker image)
- Automatic container cleanup even on test crashes
- Retry logic for CI reliability

Addresses PR #7903 review comment from @xeno097.

Note: CI workflow change (.github/workflows/rebalancer-sim-test.yml) to
remove Foundry setup step needs to be added separately due to token scope.
@hyper-gonk
Copy link
Copy Markdown
Contributor

hyper-gonk Bot commented Feb 3, 2026

⚙️ Node Service Docker Images Built Successfully

Service Tag
🔑 key-funder c1dbb6c-20260203-010957
🔍 offchain-lookup-server c1dbb6c-20260203-010957
♻️ rebalancer c1dbb6c-20260203-010957
🚀 ts-relayer c1dbb6c-20260203-010957
🕵️ warp-monitor c1dbb6c-20260203-010957
Full image paths
gcr.io/abacus-labs-dev/hyperlane-key-funder:c1dbb6c-20260203-010957
gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:c1dbb6c-20260203-010957
gcr.io/abacus-labs-dev/hyperlane-rebalancer:c1dbb6c-20260203-010957
gcr.io/abacus-labs-dev/hyperlane-ts-relayer:c1dbb6c-20260203-010957
gcr.io/abacus-labs-dev/hyperlane-warp-monitor:c1dbb6c-20260203-010957

@nambrot nambrot merged commit afbae12 into feat/rebalancer-simulation-harness Feb 3, 2026
20 checks passed
@nambrot nambrot deleted the nam/eng-3234-testcontainers-anvil branch February 3, 2026 16:04
@github-project-automation github-project-automation Bot moved this from In Review to Done in Hyperlane Tasks Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants