-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Overview
Running base/node depends heavily on environment variables (e.g., .env.mainnet, .env.sepolia). When variables are renamed, removed, or replaced across releases, users can end up with confusing startup failures like “unknown env var” or silent misconfiguration that only shows up later as sync/engine issues.
This feature proposes a built-in config validator that runs at startup (or as a separate command) to:
- detect unknown/typo env vars
- detect deprecated env vars that were renamed
- provide actionable fix suggestions before containers fully boot
Problem Description
Today, a user upgrading base/node can keep an older .env.* file and hit errors such as:
- unknown env variable names
- mismatched auth/jwt/env settings between services
- incorrect directory expectations (execution data dir vs host mount)
- invalid URLs or missing required L1/L2 endpoints
These errors can be time-consuming to diagnose because they appear in different containers/log streams and often don’t tell the user what to change.
Expected Behavior
- On startup (or via a dedicated command),
base/nodeshould:- Validate required env vars are present for the selected network/profile
- Identify unknown env vars and suggest likely intended names
- Identify deprecated env vars and suggest the new name(s)
- Validate basic formats (URL, numeric ports, file paths) with clear messages
- Validation should fail fast with a single consolidated report.
Steps to reproduce
- Run a previously working configuration (older
.env.mainnet) on a newer release ofbase/node. - Include one renamed/removed variable (or a small typo).
- Start with Docker Compose.
- Observe an “unknown env var” message in a specific container log (or a later runtime failure) without clear upgrade guidance.
Example code
# Example: user upgrades base/node but keeps an older env var name
cp .env.mainnet .env.mainnet.bak
# Introduce a renamed / deprecated env var (illustrative)
echo 'OP_NODE_L2_ENGINE_AUTH_RAW=/path/to/jwt.hex' >> .env.mainnet
# Start the stack
docker compose --env-file .env.mainnet up -d
# Today: error appears in logs and can be non-obvious to fix quickly
docker compose logs -f op-node
### Proposed Solution
1) Add a validator entry point
- Option A (preferred): a small node-config or base-node doctor command:
- ./scripts/doctor.sh or make doctor
- docker compose run --rm config-doctor
- Option B: validate as part of the compose startup (lightweight check container that runs first)
2) Maintain a deprecation map
- A versioned mapping of OLD_ENV_VAR -> NEW_ENV_VAR
- Include short notes (why it changed, which component consumes it)
3) Produce a single consolidated report
Group by severity:
- ERROR: missing required / invalid format
- WARN: deprecated / renamed
- INFO: optional improvements
-
Print suggested diffs (what to change in .env.*)