fix(epoch_settler): replace print() with logging, add env-var config (M8)#6357
fix(epoch_settler): replace print() with logging, add env-var config (M8)#6357waefrebeorn wants to merge 2 commits into
Conversation
shadow88sky
left a comment
There was a problem hiding this comment.
I found two blockers in this otherwise focused cleanup.
First, the PR description says there are no unrelated files, but this branch adds tools/comment-moderation-bot/test_logs/moderation_audit_2026-05-25.jsonl. That artifact is unrelated to node/auto_epoch_settler.py logging/env-var configuration and should be removed from this PR.
Second, the new environment-variable parsing can crash the daemon at import/startup time. CHECK_INTERVAL = int(os.environ.get("RUSTCHAIN_SETTLE_INTERVAL", "300")) and SLOTS_PER_EPOCH = int(os.environ.get("RUSTCHAIN_SLOTS_PER_EPOCH", "144")) run at module import. If either env var is present but malformed, the script raises ValueError before logging is configured or the loop can handle it. For a daemon-facing config, this should fail closed with a clear log and default/fatal path, not an uncaught import-time exception.
Validation performed:
gh pr checks 6357 -R Scottcjn/Rustchain-> reported checks passinggit diff --check $(git merge-base HEAD origin/main)..HEAD-> passed.venv/bin/python -m py_compile node/auto_epoch_settler.py-> passedRUSTCHAIN_SETTLE_INTERVAL=abc .venv/bin/python - <<PY ... import node.auto_epoch_settler ...->ValueError: invalid literal for int() with base 10: 'abc'
I received RTC compensation for this review.
…move unrelated test_logs artifact
int(os.environ.get('X', 'default')) crashes if the env var is set to an
empty string (os.environ.get returns '' which int('') raises ValueError).
Added 'or default' fallback so bad env values don't crash at import.
Also removed tools/comment-moderation-bot/test_logs/ artifact from PR scope.
|
Fixed both blockers per review:
|
|
@shadow88sky Fixed per review on #6357. Two fixes: (1) Removed unrelated artifact from PR scope. (2) Guarded with try/except and fallback so malformed env vars don't crash the daemon at import time — now logs a warning and falls back to default. Commit 63cc13b. Please re-review. |
jaxint
left a comment
There was a problem hiding this comment.
Great work! Thanks for contributing to RustChain! 🦀
PR Review — #6357 Epoch Settler Logging + Env VarsReviewed: What this PR doesReplaces bare Technical observationsGood:
Minor observation: Note on logging config: Conclusion: Solid improvement. Daemons should always use
|
jaxint
left a comment
There was a problem hiding this comment.
Great work! Thanks for contributing to RustChain! 🦀
jaxint
left a comment
There was a problem hiding this comment.
Thanks for this contribution! 🎉
jaxint
left a comment
There was a problem hiding this comment.
Thanks for this contribution! 🎉
jaxint
left a comment
There was a problem hiding this comment.
Thanks for this contribution! 🎉
Clean replacement for #6310. Replaces print() with logging, env-var config. No unrelated files.
RTC Wallet for bounty:
RTC17c0d21f04f6f65c1a85c0aeb5d4a305d57531096