-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Summary
When building forc-node in the Nix sandbox, the build fails because fuel-core-relayer uses the ethers-contract::abigen! macro, which cannot locate the ethers crate.
Related Issue
This is related to but separate from #196. Issue #196 documents the fuel-core-wasm-executor network access problem. This issue documents a different blocker.
Root Cause
The abigen! macro from ethers-contract uses the proc-macro-crate library to detect crate names at compile time. It generates code with paths like ::ethers::core::types::*. However, fuel-core-relayer only depends on individual ethers sub-crates (ethers-contract, ethers-core, ethers-providers), not the umbrella ethers crate.
In a normal cargo build, proc-macro-crate can read Cargo.toml and detect the sub-crates. But in Nix's sandboxed/vendored build environment, this detection fails, causing compilation errors like:
error[E0433]: failed to resolve: could not find `ethers` in the list of imported crates
This is a known issue with the ethers ecosystem in sandboxed builds:
Attempted Fix
We attempted to fix this by:
- Adding
ethers = { version = "2.0", default-features = false }to the forc workspace - Patching
Cargo.lockto include ethers and its dependencies - Patching the vendored
fuel-core-relayerCargo.toml inpreBuild
However, this led to cargo resolution errors looking for ethers-etherscan even with default-features = false, likely due to how cargo resolves features in offline/sandboxed mode.
Potential Solutions
- Patch fuel-core-relayer upstream to add the umbrella
etherscrate as a dependency - Vendor a pre-patched version of fuel-core-relayer
- Use Nix overlays to modify the ethers crate's feature resolution
- Patch the vendored crates more aggressively during the Nix build
Affects
forc-node>= 0.70.x (both sway and forc repo versions)