fix(seid): decouple seid --home from the container HOME env#449
Conversation
seid containers set HOME=/.sei (the data dir). Cosmos-SDK derives DefaultNodeHome = filepath.Join(os.UserHomeDir(), ".sei") = $HOME/.sei, so HOME=/.sei makes any bare `seid` (e.g. a human `kubectl exec` running `seid keys list`) resolve its home to /.sei/.sei — creating a nested /.sei/.sei/config, dropping .bash_history onto the data PVC, and making bare keyring commands look in the wrong place. The controller's own start/init already pass --home, but they took the value FROM $HOME. Fix (atomic — a partial change would boot `seid start --home <wronghome>`, i.e. a validator wipe / state-sync redo): - Every seid invocation now passes an explicit --home <dataDir> (/.sei), independent of $HOME: sidecarWaitCommand (the live start), the base buildNodeMainContainer args, and the seid-init script (incl. the genesis.json skip-guard and the tmp mkdir). - HOME moves to /home/nonroot, backed by a per-pod emptyDir (guaranteed writable, off the data PVC), so shell/home writes never touch /.sei and a bare `seid` no longer nests at $HOME/.sei. Not changed: signing-key/node-key mounts, the sidecar-only operator keyring (assertNoOperatorKeyringOnSeidContainers), TMPDIR (=dataDir/tmp, literal). SEI_HOME is intentionally NOT added to the seid container — the seid CLI does not honor it (viper prefix is SEID, and client `keys` reads the raw --home pflag); only an explicit --home works. Remediation for existing pods: /.sei/.sei and /.sei/.bash_history are inert junk (seid reads /.sei/config via explicit --home); no migration needed. The init guard now checks /.sei/config/genesis.json, so an OnDelete restart does not re-init. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PR SummaryHigh Risk Overview SeiNode pod generation now sets Tests and Reviewed by Cursor Bugbot for commit a8fe210. Bugbot is set up for automated code reviews on this repo. Configure here. |
Problem
seid containers set
HOME=/.sei(the data dir). Cosmos-SDK computesDefaultNodeHome = filepath.Join(os.UserHomeDir(), ".sei")=$HOME/.sei, soHOME=/.seimakes any bareseid(e.g. a humankubectl execrunningseid keys list) resolve its home to/.sei/.sei. Result: a nested/.sei/.sei/config,.bash_historywritten onto the data PVC, and bare keyring commands looking in the wrong place. (Reported by Masih.)The controller's own
start/initalready pass--home, but they took the value from$HOME— so we can't just moveHOMEwithout repointing them.Fix (atomic)
Every seid invocation now passes an explicit
--home /.sei, independent of$HOME:sidecarWaitCommand(the liveseid start), the basebuildNodeMainContainerargs, and theseid-initscript — including thegenesis.jsonskip-guard and thetmpmkdir.HOME→/home/nonroot, backed by a per-pod emptyDir (guaranteed writable, off the data PVC). Shell/home writes no longer touch/.sei; a bareseidno longer nests at$HOME/.sei.Deliberately not changed
assertNoOperatorKeyringOnSeidContainers);TMPDIR(=/.sei/tmp, literal).SEI_HOMEis intentionally NOT added to the seid container — the seid CLI doesn't honor it (viper prefix isSEID, and clientkeysreads the raw--homepflag). Only explicit--homeworks. (This was a false start in the original proposal, caught in review.)Remediation for existing pods
/.sei/.seiand/.sei/.bash_historyare inert junk (seid reads/.sei/configvia explicit--home); no migration needed, optional one-timerm -rfto reclaim disk. The init guard now checks/.sei/config/genesis.json, so an OnDelete rolling restart does not re-init.Follow-ups (separate)
internal/task/bootstrap_resources.gomirrors the sameHOME/$HOMEpattern on the ephemeral bootstrap pod — deferred (TTL-bounded, rarely exec'd).client.toml keyring-backend = osvs the sidecar'sfilekeyring) — separate item.Verification
go build ./...,go vet ./..., andgo test ./internal/...all green. Root-caused + fix designed/endorsed by systems-engineer + kubernetes-specialist review.🤖 Generated with Claude Code