deps: trim alloy to used features to cut build time#85
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Alloy dependency now uses selected features instead of ChangesBuild configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…apis) The service uses only the HTTP provider and local/AWS signers, so alloy's broad 'full' meta-feature is over-provisioned. Replace it with the minimal set actually used; drops 21 crates (596->575) including the ws/ipc/pubsub transport stacks and the trace/txpool/debug rpc-types. Verified: all targets compile, 200 unit tests pass.
a80a5ab to
f6353cc
Compare
Un-ignore and commit Cargo.lock so image builds are reproducible and cargo-chef gets a stable dependency-cache key. Add [profile.dev] debug=line-tables-only (faster test-job compiles, smaller CI cache) and [profile.release] strip=true (195MB image, down from 209MB).
|
Expanded per review: added a build-config commit on top of the alloy trim.
Verified locally: full |
The service is I/O-bound (RPC/Redis/signing), so opt-level 3 buys no measurable runtime win. Dropping to 2 cuts the release/image compile ~27% (26.5s -> 19.4s crate recompile locally, more on the CI runner).
Why
alloyis pulled in with thefullmeta-feature, which enables far more than this service uses. Every unused feature is extra crates to compile on each cold build and on every CI test-job compile.Usage evidence in the codebase:
connect_httponly — zerows/ipc/pubsub.PrivateKeySigner(local) +AwsSigner(KMS) only — zero keystore/mnemonic/ledger/trezor.raw_request("anvil_setBalance", ...), not the typedAnvilApi, soprovider-anvil-apiisn't needed.What
Replace
fullwith the minimal set actually used:essentials=contract + provider-http + rpc-types + signer-local, which covers thesol!contracts, the HTTP provider/fillers, and the local signer. This drops thekzgfeature, thews/ipc/pubsubtransports, and thetrace/txpool/debug/anvilprovider RPC APIs.Cargo.lockis gitignored in this repo, so this is a Cargo.toml-only change; the lockfile that CI/Docker regenerate resolves to the trimmed set.Verified locally
cargo build --all-targets— clean (exit 0), so lib + both bins + the full test tree compile against the reduced feature set.cargo test unit_tests— 200 passed, 0 failed (12 Redis-dependent ignored).tokio-tungstenite,tungstenite,interprocess,alloy-pubsub,alloy-transport-ws,alloy-transport-ipc,alloy-rpc-types-{trace,txpool,debug}, plus thekzgwrapper.Honest scope
c-kzgstays — it comes in transitively viaalloy-consensus/eips(needed for transaction types), not thekzgfeature, so the heavy C build is not shed here.alloy-rpc-types-anvilstays becausenode-bindings(kept, for spawning Anvil in tests) depends on it.Independent of #84 (cargo-chef + shared rust-cache); both target
mainand touch different files.Summary by CodeRabbit