fix(scripts): allow validator and genesis startup with pre-provisioned keyring

🔎 Visual review of bf375e1a: 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_phrase so the runtime container does not need SIGNER_SEED_PHRASE_FILE mounted.
  • Missing or incomplete keyring (e.g. missing secp256k1 or ed25519 key): still calls resolve_signer_seed_phrase and fails closed if SIGNER_SEED_PHRASE_FILE is absent or invalid.
  • The startup check calls thornode ed25519 with SIGNER_NAME/SIGNER_PASSWD from the already-exported environment (same as the other bare calls); create_thor_user is 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 for validator.sh and genesis.sh).
  • Ran ./scripts/trunk check --ci on all modified/added files (No issues).
  • Ran python3 -m unittest -v on test_validator_startup.py, test_genesis_startup.py, and test_core_unsafe.py (42/42 passed).
Edited by Huginn Ai

Merge request reports

Loading
Loading