Description
Extend env.ts/contract.ts so a misconfigured environment fails fast: refuse to boot when BLOCKCHAIN_ENABLED but RPC/key/contract missing; assert CHAIN_ENV/VERCEL_ENV consistency; guarantee staging can never carry a mainnet chainId/contract and vice versa. Run assertConfiguredChain() before the first anchor. Add unit tests for the matrix.
Affected areas
backend/src/config/env.ts, backend/src/config/contract.ts, backend/src/**/*.test.ts.
Dependencies / order
No blockers; can run in parallel with #3.
Acceptance criteria
Definition of done
Description
Extend
env.ts/contract.tsso a misconfigured environment fails fast: refuse to boot whenBLOCKCHAIN_ENABLEDbut RPC/key/contract missing; assertCHAIN_ENV/VERCEL_ENVconsistency; guarantee staging can never carry a mainnet chainId/contract and vice versa. RunassertConfiguredChain()before the first anchor. Add unit tests for the matrix.Affected areas
backend/src/config/env.ts,backend/src/config/contract.ts,backend/src/**/*.test.ts.Dependencies / order
No blockers; can run in parallel with #3.
Acceptance criteria
chainId 8453(or a mainnet contract) refuses to start; production carrying84532refuses to start.assertConfiguredChain()runs before anchoring; an RPC whose real chainId differs fromenv.chainIdis rejected.Architecture.mdsection 10).Definition of done
staging(nevermain).stagingpreview stack.