Skip to content

Reland OPENAUDIO_ prefixed env vars (reverts #197) - #271

Merged
raymondjacobson merged 2 commits into
mainfrom
claude/busy-kepler-620f15
May 19, 2026
Merged

Reland OPENAUDIO_ prefixed env vars (reverts #197)#271
raymondjacobson merged 2 commits into
mainfrom
claude/busy-kepler-620f15

Conversation

@raymondjacobson

Copy link
Copy Markdown
Contributor

Summary

Re-lands #195 ("Add OPENAUDIO_ prefixed env vars for all configuration"), which was reverted in #197.

Why the original crash wasn't actually #195's fault

#197 was opened after legacy creator-node deployments panicked during CometBFT handshake:

```
panic: state.AppHash does not match AppHash after replay. Got E3B0..., expected .
```

That was a state-sync bug: CometBFT's state.db could end up at height 0 while the app DB already had block records (the very scenario the comment at `pkg/core/server/abci.go`'s state-sync restore block now warns about). It has since been fixed by #253 (state-sync snapshot reliability) and related work, so this can be safely re-applied on top of current main.

Changes vs the original #195 patch

  • Keep state-sync defaults from #255 (`Keep=2`, `BlockInterval=100000`) instead of Add OPENAUDIO_ prefixed env vars for all configuration #195's older values.
  • Carry forward #224's separate `OPENAUDIO_ARCHIVE_STORAGE_DRIVER_URL` (with `AUDIUS_ARCHIVE_STORAGE_DRIVER_URL` fallback).
  • Update `pkg/uptime/uptime.go` — post-Add OPENAUDIO_ prefixed env vars for all configuration #195 main added a `mustGetenv("nodeEndpoint")` call. Now reads `OPENAUDIO_NODE_ENDPOINT` first with `nodeEndpoint` fallback while preserving the original "sleep 1h then fatal" behavior; drops the now-unused `mustGetenv` / `getenvWithDefault` helpers.
  • Reconcile `CLAUDE.md` with the validator-node terminology landed in #264 and document the `pkg/env` helper API.

Backward compatibility

Every legacy env var (`nodeEndpoint`, `delegatePrivateKey`, `delegateOwnerWallet`, `spOwnerWallet`, `dbUrl`, `audius_core_root_dir`, `ethProviderUrl`, `ethRegistryAddress`, `stateSync*`, `AUDIUS_STORAGE_DRIVER_URL`, etc.) continues to work via fallback. Legacy creator / discovery node registrations behave identically.

Test plan

  • `go build ./...` passes (native + `CGO_ENABLED=0 GOOS=linux GOARCH=amd64`)
  • `go test ./pkg/core/... ./pkg/core/config/... ./pkg/common/...` passes
  • CI green
  • Verify devnet boots with `make up`
  • Verify a legacy node (one with only `nodeEndpoint`/`delegatePrivateKey` set externally) still starts and resumes consensus

🤖 Generated with Claude Code

raymondjacobson and others added 2 commits May 18, 2026 14:54
This re-applies #195 (reverted in #197). The handshake panic that
prompted the original revert (`state.AppHash does not match AppHash
after replay. Got E3B0..., expected .`) was caused by an
unrelated state-sync bug: CometBFT's state.db could end up at height 0
while the app database had block records, producing the mismatch.
That class of failure has since been fixed by #253 and related
state-sync reliability work, so the env-var change is safe to bring
back on top of current main.

Changes since #195:
- Keep state-sync defaults from #255 (Keep=2, BlockInterval=100000)
- Carry forward #224's separate archive bucket DSN (now goes through
  env.String with AUDIUS_ARCHIVE_STORAGE_DRIVER_URL fallback)
- Update pkg/uptime/uptime.go which post-revert added a
  `mustGetenv("nodeEndpoint")` call — read OPENAUDIO_NODE_ENDPOINT first
  with legacy fallback, drop the now-unused mustGetenv/getenvWithDefault
- CLAUDE.md: keep the validator-node terminology from #264 and add the
  pkg/env helper list

Legacy env vars (nodeEndpoint, delegatePrivateKey, dbUrl,
audius_core_root_dir, spOwnerWallet, etc.) continue to work via
fallback, so legacy creator / discovery node registrations are
unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
On a legacy creator/discovery node, the bundled /env/${NETWORK}.env
declares OPENAUDIO_ defaults (e.g. OPENAUDIO_CORE_ROOT_DIR=/data/core).
If the operator only set the legacy name with a *different* value
(e.g. audius_core_root_dir=/data/bolt), the Go env helper would pick
the OPENAUDIO_ default and look at a path that has no chain data —
producing the CometBFT `state.AppHash does not match AppHash after
replay` panic that originally got #195 reverted.

Promote externally-set legacy keys to their OPENAUDIO_ counterparts
before source_env_file runs. source_env_file is a no-op for already-set
keys, so the legacy value wins; if the operator instead set the
OPENAUDIO_ name directly, that already-set value is left alone.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@raymondjacobson
raymondjacobson merged commit 42b8325 into main May 19, 2026
4 checks passed
@raymondjacobson
raymondjacobson deleted the claude/busy-kepler-620f15 branch May 19, 2026 00:56
@raymondjacobson raymondjacobson mentioned this pull request May 19, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant