Loading
fix(scripts): allow validator and genesis startup with pre-provisioned keyring
🔎 Visual review ofbf375e1a: explainer, review flags and prompts to ask an AI about the change
Summary
validator.sh and genesis.sh previously called resolve_signer_seed_phrase unconditionally on every startup, even when the file keyring already contained both the signer secp256k1 key and the ed25519 key (e.g. after keyring-init in node-launcher or on normal restarts).
This change checks whether both keys are already present in the file keyring before requiring SIGNER_SEED_PHRASE_FILE:
- Pre-provisioned keyring / restarts: skips
resolve_signer_seed_phraseso the runtime container does not needSIGNER_SEED_PHRASE_FILEmounted. - Missing or incomplete keyring (e.g. missing secp256k1 or ed25519 key): still calls
resolve_signer_seed_phraseand fails closed ifSIGNER_SEED_PHRASE_FILEis absent or invalid. - The startup check calls
thornode ed25519withSIGNER_NAME/SIGNER_PASSWDfrom the already-exported environment (same as the other bare calls);create_thor_useris unchanged.
Testing
- Added
build/scripts/tests/test_validator_startup.py(7 cases covering fresh boot, restart, missing keyring, missing ed25519 key, and recovery from seed file forvalidator.shandgenesis.sh). - Ran
./scripts/trunk check --cion all modified/added files (No issues). - Ran
python3 -m unittest -vontest_validator_startup.py,test_genesis_startup.py, andtest_core_unsafe.py(42/42 passed).
Edited by Huginn Ai