You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ant-devnet: handle SIGTERM and use a per-run data dir by default #261
ant-devnet still leaves state behind when it is stopped with SIGTERM, which is how process managers and ant dev stop stop it. This is the remainder of WithAutonomi/ant-sdk#73.
Already fixed on main: the Anvil Testnet is now kept alive until main exits (local_testnet: Option<evmlib::testnet::Testnet>) instead of std::mem::forget, so its Drop runs on a normal exit.
Still open in src/bin/ant-devnet/main.rs:
Only SIGINT is handled. The binary waits on tokio::signal::ctrl_c(). On SIGTERM the process dies without calling devnet.shutdown(), so cleanup_data_dir is never honoured and the Anvil child is not dropped.
The default data dir is shared across runs.DevnetConfig::default() uses default_root_dir() (~/.local/share/ant/ on Linux). An interrupted run leaves partial node identities there for the next run to trip over.
Proposed fix
Wait on SIGINT or SIGTERM (tokio::signal::unix::signal(SignalKind::terminate()) on Unix, ctrl_c elsewhere) before calling devnet.shutdown().await.
When --data-dir is not given, use a fresh per-run directory (tempfile::TempDir or temp_dir().join("ant_devnet_{rand}")). The manifest already records the paths, so consumers can still find them. This matches tests/e2e/testnet.rs and ant-core's MiniTestnet.
Once this lands, ant-sdk's ant dev stop band-aid (force-kill plus wiping ~/.local/share/ant/{nodes,spill}, from ant-sdk#81) can be reduced.
Activity