Skip to content

feat: run L1 anvil as a Docker compose service#15

Merged
douglance merged 1 commit into
mainfrom
testnode-migration-onto-main
Jun 16, 2026
Merged

feat: run L1 anvil as a Docker compose service#15
douglance merged 1 commit into
mainfrom
testnode-migration-onto-main

Conversation

@douglance

Copy link
Copy Markdown
Collaborator

Brings the L1-in-Docker migration onto main, branched fresh from main (not from the divergent testnode-workspace-migration).

Context

The earlier migration work (rollup creator #9, runtime cleanup) was already squash-merged into main via #6/#11. The only piece never merged to main was the L1-in-Docker change (it had only been merged into the long-lived testnode-workspace-migration branch, which had diverged from main). This branch cherry-picks just that remaining commit onto current main, so the diff is exactly the L1 change with no duplicated/conflicting history.

What

Moves the L1 anvil chain from a detached host process (plus a 100ms evm_mine heartbeat) into an l1 Docker compose service so docker compose down tears it down reliably.

  • docker/docker-compose.yaml — new l1 service (stock foundry image, no custom entrypoint). Publishes 8545 for both host tooling (127.0.0.1:8545) and Nitro containers (host.docker.internal:8545); state bind-mounted to config/anvil-state so snapshots keep working.
  • runtime.tsstartAnvilWithState()startL1Container() (composeUp); drops the now-dead pkill anvil/pkill heartbeat from resetRuntime.
  • stop/clean — drop pkill; compose down handles teardown.
  • status — L1 check uses the compose service instead of pgrep anvil.

Anvil's arg list (block-time/accounts/balance/mnemonic/chain-id/--state) is unchanged, so chain behavior is identical. Snapshot capture is unaffected: every capture path calls stopRuntime (compose down → anvil dumps state on SIGTERM) before copying config/anvil-state.

Verification

typecheck ✅ · build ✅ · lint ✅ · docker compose config ✅ · 142/142 tests pass

Move the L1 anvil chain from a detached host process (plus a 100ms
evm_mine heartbeat) into an `l1` Docker compose service so teardown via
`docker compose down` is reliable — no orphaned anvil/heartbeat
processes survive.

- add `l1` compose service (foundry image) publishing 8545 so both host
  tooling (127.0.0.1:8545) and Nitro containers (host.docker.internal)
  reach it; state bind-mounted to config/anvil-state so snapshots work
- replace startAnvilWithState() with startL1Container() (composeUp)
- drop the pkill anvil/heartbeat calls from stop/clean/resetRuntime and
  the host pgrep check in status; compose down handles teardown
@douglance douglance merged commit 1b06d68 into main Jun 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant