diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md index 3d2dcfa..2340696 100644 --- a/docs/ENVIRONMENT.md +++ b/docs/ENVIRONMENT.md @@ -42,10 +42,10 @@ FORK_URL=https://mainnet.base.org docker compose up -d `red-team.sh` boots the docker-compose stack and then calls protocol operations using **Base mainnet** addresses for the Uniswap V3 periphery (V3_FACTORY, SwapRouter02, NonfungiblePositionManager). These addresses are only valid on a mainnet fork. -`red-team.sh` calls `sudo docker compose up -d` internally, and `sudo` strips environment variables by default. Pass `FORK_URL` inline with `-E` to preserve it: +`red-team.sh` calls `sudo docker compose up -d` internally. The script uses `sudo -E` so that `FORK_URL` is preserved across the sudo boundary: ```bash -FORK_URL=https://mainnet.base.org sudo -E bash scripts/harb-evaluator/red-team.sh +FORK_URL=https://mainnet.base.org bash scripts/harb-evaluator/red-team.sh ``` ### FitnessEvaluator (`onchain/test/FitnessEvaluator.t.sol`) diff --git a/scripts/harb-evaluator/red-team.sh b/scripts/harb-evaluator/red-team.sh index 8b51d81..9d8e784 100755 --- a/scripts/harb-evaluator/red-team.sh +++ b/scripts/harb-evaluator/red-team.sh @@ -63,11 +63,13 @@ cd "$REPO_ROOT" sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' 2>/dev/null || true # Tear down completely (volumes too — clean anvil state) -sudo docker compose down -v >/dev/null 2>&1 || true +sudo -E docker compose down -v >/dev/null 2>&1 || true sleep 3 # Bring up -sudo docker compose up -d >/dev/null 2>&1 \ +# -E preserves FORK_URL (and other env vars) across the sudo boundary so that +# anvil-entrypoint.sh honours the caller's FORK_URL override. +sudo -E docker compose up -d >/dev/null 2>&1 \ || die "docker compose up -d failed" # Wait for bootstrap to complete (max 120s)