Complete Telegram bot commands for RustChain status#4863
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
508704820
left a comment
There was a problem hiding this comment.
Code Review: Complete Telegram Bot Commands for RustChain Status
Summary
Adds /miners and /price commands to the RustChain Telegram bot, plus rate limiting window and RTC reference rate configuration.
What Works Well
- New /miners command: Lists active miners with status fields
- New /price command: Shows RTC reference rate in USD
- Rate limiting improvement: Added RATE_LIMIT_WINDOW_SECONDS for per-user cooldown
- Configurable reference rate: RTC_REFERENCE_RATE_USD in .env
- README updated: New commands documented in table
Issues Found
1. Low — Hardcoded reference rate source
The price command uses a configured RTC_REFERENCE_RATE_USD from .env (default $0.10). This is not a live market price. Consider fetching from an API or clearly labeling it as a "reference rate" not "market price" to avoid confusion.
2. Nit — Rate limit window naming
RATE_LIMIT_PER_MINUTE and RATE_LIMIT_WINDOW_SECONDS could conflict. If a user sends 10 requests in 1 minute (within per-minute limit) but within 5-second windows, which takes precedence? Clarify the interaction.
Verdict: Approve
Good feature additions. The reference rate disclaimer is the main concern.
saim256
left a comment
There was a problem hiding this comment.
Approving current head b773e47.
The PR completes the missing /miners and /price commands for the existing Telegram bot, keeps the older per-minute limit while adding the requested 5-second per-user throttle, and updates the README/.env deployment guidance. The /price copy correctly calls this a reference rate rather than a market quote.
Validation performed:
python -m pytest telegram_bot\tests -qinitially failed becausepython-telegram-botwas not installed in this local environment- installed missing local test dependencies:
python -m pip install --user python-telegram-bot pytest-asyncio python -m pytest telegram_bot\tests -q-> 31 passedpython -m py_compile telegram_bot\rustchain_query_bot.py telegram_bot\tests\test_bot_commands.py telegram_bot\tests\test_rustchain_client.py-> passedpython tools\bcos_spdx_check.py --base-ref origin/main-> BCOS SPDX check: OKgit diff --check origin/main...HEAD -- telegram_bot/.env.example telegram_bot/README.md telegram_bot/rustchain_query_bot.py telegram_bot/tests/test_bot_commands.py telegram_bot/tests/test_rustchain_client.py-> passed
godd-ctrl
left a comment
There was a problem hiding this comment.
Approved current head b773e4747b008645c00d371f03399d17e174ee4a.
The new Telegram commands are registered, documented, and covered by focused tests. /miners normalizes supported API response shapes and limits output to a manageable list; /price is read-only and environment-configurable. The expanded rate limiter is covered by the client tests.
Validation performed:
- git diff --name-status origin/main...HEAD -> telegram_bot files only
- git diff --check origin/main...HEAD -> passed
- python tools\bcos_spdx_check.py --base-ref origin/main -> passed
- python -m py_compile telegram_bot\rustchain_query_bot.py telegram_bot\tests\test_bot_commands.py telegram_bot\tests\test_rustchain_client.py -> passed
- Initial pytest failed because python-telegram-bot was not installed in this environment
- Installed declared test/runtime dependencies into temporary C:\tmp\review-pydeps-telegram
- PYTHONPATH=C:\tmp\review-pydeps-telegram;telegram_bot python -m pytest telegram_bot\tests -q -> 31 passed
No blocking issues found in the reviewed diff.
|
Follow-up for the review feedback:
Validation: python -m pytest telegram_bot\tests -q -> 31 passed. |
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Thanks for contributing. Approved.
saim256
left a comment
There was a problem hiding this comment.
Approved current head 0e5cc95.
The follow-up resolves the ambiguity from the earlier review: /price now clearly presents an RTC bounty reference rate rather than a live market quote, adds a regression assertion for that wording, and renames the cooldown configuration to RATE_LIMIT_COOLDOWN_SECONDS while preserving RATE_LIMIT_WINDOW_SECONDS as a backwards-compatible fallback. The README and .env.example now use the clearer public names.
Validation performed locally:
- python -m pytest telegram_bot\tests -q -> 31 passed
- python -m py_compile telegram_bot\rustchain_query_bot.py telegram_bot\tests\test_bot_commands.py telegram_bot\tests\test_rustchain_client.py -> passed
- git diff --check origin/main...HEAD -- telegram_bot/.env.example telegram_bot/README.md telegram_bot/rustchain_query_bot.py telegram_bot/tests/test_bot_commands.py telegram_bot/tests/test_rustchain_client.py -> passed
- python tools\bcos_spdx_check.py --base-ref origin/main -> BCOS SPDX check: OK
- rg confirmed the new env names are documented and the legacy env names remain only as code fallbacks
No blocking issues found.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
loganoe
left a comment
There was a problem hiding this comment.
Review for Scottcjn/rustchain-bounties#73 on current head 0e5cc950be306c154b62b0826a4e98552fdb8d06.
The Telegram bot update now closes the earlier ambiguity around /price: it labels the value as the RTC bounty reference rate rather than a live market quote, keeps the legacy rate-limit env name only as a fallback, and documents the clearer RATE_LIMIT_COOLDOWN_SECONDS surface. The /miners and /price command coverage is included with the existing bot command tests.
Validation performed:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --no-project --with pytest --with pytest-asyncio --with python-telegram-bot --with requests --with python-dotenv python -m pytest -p pytest_asyncio.plugin telegram_bot/tests -q-> 31 passedpython3 -m py_compile telegram_bot/rustchain_query_bot.py telegram_bot/tests/test_bot_commands.py telegram_bot/tests/test_rustchain_client.py-> passedgit diff --check origin/main...HEAD -- telegram_bot/.env.example telegram_bot/README.md telegram_bot/rustchain_query_bot.py telegram_bot/tests/test_bot_commands.py telegram_bot/tests/test_rustchain_client.py-> passedpython3 tools/bcos_spdx_check.py --base-ref origin/main-> OK
No blocking issues found in the updated PR.
Summary
RTC wallet: dazer1234
Validation
Implemented with OpenAI Codex assistance.