fix(rewards): import hmac for admin endpoints#6669
Conversation
|
CI note after the first run:
The failing broad job is reporting unrelated baseline failures such as |
7e58837 to
4220071
Compare
MolhamHamwi
left a comment
There was a problem hiding this comment.
Reviewed and in this PR.
Two technical observations:
- Moving to module scope is the right fix for the admin balance routes because those closures can call without depending on the unrelated route importing it first. That keeps privileged endpoint authentication deterministic across route order and request history.
- The new tests cover both a successful admin-key path and a wrong-key 401 path for , plus , which is a good regression shape for the prior NameError/500 class: it proves the module-level import is available on both guarded balance endpoints and that auth failures remain controlled responses.
One non-blocking note: the test module relies on , so it remains tied to the existing dynamic-load test harness. That is fine if the suite already injects this module name, but worth keeping consistent if these tests are ever run standalone.
I received RTC compensation for this review.
MolhamHamwi
left a comment
There was a problem hiding this comment.
Reviewed node/rewards_implementation_rip200.py and tests/test_rewards_admin_hmac_import.py in this PR.
Two technical observations:
- Moving
hmacto module scope is the right fix for the admin balance routes because those closures can callhmac.compare_digestwithout depending on the unrelated/rewards/settleroute importing it first. That keeps privileged endpoint authentication deterministic across route order and request history. - The new tests cover both a successful admin-key path and a wrong-key 401 path for
/wallet/balance, plus/wallet/balances/all, which is a good regression shape for the prior NameError/500 class: it proves the module-level import is available on both guarded balance endpoints and that auth failures remain controlled responses.
One non-blocking note: the test module relies on sys.modules["rewards_mod"], so it remains tied to the existing dynamic-load test harness. That is fine if the suite already injects this module name, but worth keeping consistent if these tests are ever run standalone.
I received RTC compensation for this review.
|
Follow-up after the non-blocking review note: I updated Validation after the update: No payout is asserted; this just removes the remaining test-harness concern and keeps the focused validation green. |
|
CI follow-up after commit
Focused validation for this PR remains: |
Summary
hmacto module scope innode/rewards_implementation_rip200.pyFixes #6668.
Why
/rewards/settleimportedhmacinside its route function, but sibling routes registered byregister_rewards_rip200()also callhmac.compare_digest(). Those routes hitNameErrorat runtime whenRC_ADMIN_KEYis configured:GET /wallet/balanceGET /wallet/balances/allGET /lottery/eligibilityGET /consensus/round_robin_statusValidation
Payout/miner id:
keon0711Disclosure: submitted as a RustChain bug bounty candidate; no payout is asserted unless maintainers accept it.