Skip to content

fix: accept native RTC faucet wallets#4892

Open
saim256 wants to merge 1 commit into
Scottcjn:mainfrom
saim256:fix-faucet-rtc-wallets
Open

fix: accept native RTC faucet wallets#4892
saim256 wants to merge 1 commit into
Scottcjn:mainfrom
saim256:fix-faucet-rtc-wallets

Conversation

@saim256
Copy link
Copy Markdown
Contributor

@saim256 saim256 commented May 12, 2026

Summary

  • Fixes the live root faucet.py wallet validation bug from Bug: Faucet rejects valid RTC wallet addresses #4890.
  • Keeps legacy 0x... faucet addresses accepted.
  • Adds strict native RTC wallet support for RTC plus 40 hex characters, matching the issue example and canonical wallet format.
  • Updates the form placeholder and route docstring to show both accepted formats.
  • Adds regressions for accepting a valid native RTC wallet and rejecting malformed RTC-prefixed input.

Validation

  • python -m pytest tests\test_legacy_faucet_json_validation.py -q -> 5 passed
  • python -m pytest tests\test_legacy_faucet_json_validation.py tests\test_faucet.py -q -> 9 passed
  • python -m py_compile faucet.py tests\test_legacy_faucet_json_validation.py -> passed
  • git diff --check -> passed
  • python tools\bcos_spdx_check.py --base-ref origin/main -> OK

No live faucet, production wallet, or destructive testing was performed.

Wallet: RTC253255d034065a839cd421811ec589ae5b694ffc

Fixes #4890

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) tests Test suite changes labels May 12, 2026
@github-actions github-actions Bot added the size/S PR: 11-50 lines label May 12, 2026
Copy link
Copy Markdown

@TJCurnutte TJCurnutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the native RTC wallet validation fix. This is stronger than the minimal prefix-only variant because it adds a dedicated is_valid_wallet_address() helper, keeps the legacy 0x acceptance behavior unchanged, and validates native RTC addresses as RTC plus 40 hex characters.

Validation run:

  • python3 -m py_compile faucet.py tests/test_legacy_faucet_json_validation.py
  • python3 -m pytest tests/test_legacy_faucet_json_validation.py -q
  • git diff --check

All 5 focused faucet validation tests passed. LGTM.

@galpetame
Copy link
Copy Markdown

galpetame commented May 12, 2026

Review for #4892

I checked current head 6b19b0009da33da25a41e66f2f734155d6a0bfdf locally. The patch is narrow and targets the live root faucet.py, keeps legacy 0x... faucet addresses accepted, and adds strict native RTC validation as RTC plus 40 hex characters. That is stronger than a prefix-only check: malformed RTC-prefixed strings are rejected while a native wallet like RTCe4fbe4c9085b8b2ed3f1228504de66799025f6ce is accepted by the helper.

Validation performed in a local venv:

  • python -m pytest tests\test_legacy_faucet_json_validation.py tests\test_faucet.py -q -> 9 passed
  • python -m pytest tests\test_legacy_faucet_json_validation.py -q -> 5 passed
  • python -m py_compile faucet.py tests\test_legacy_faucet_json_validation.py tests\test_faucet.py -> passed
  • git diff --check HEAD^..HEAD -> passed
  • python tools\bcos_spdx_check.py --base-ref HEAD^ -> BCOS SPDX check: OK
  • Manual helper probe: legacy 0x1234567890 and native RTCe4fbe4c9085b8b2ed3f1228504de66799025f6ce returned valid; RTC123 and RTCzzzz... returned invalid.

I do not see a merge-blocking issue on this head. Optional follow-up only: keeping future examples aligned with the public wallet docs would make the accepted native address format even easier for users to recognize, but the current regression does exercise the rule correctly.

Bounty #73 payout wallet if this review is eligible: RTCe4fbe4c9085b8b2ed3f1228504de66799025f6ce

GitHub handle for tagging: @galpetame

Copy link
Copy Markdown

@shuibui shuibui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Security Fix

Good security fix. Atomic rate limiting / fail-closed patterns are correct.

Verdict: Approve.

Copy link
Copy Markdown
Contributor

@loganoe loganoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the native RTC faucet wallet fix. This keeps the legacy 0x... compatibility path and adds a canonical native wallet check (RTC plus 40 hex chars), so valid RTC wallet addresses are accepted while malformed RTC-prefixed strings are rejected.

Validation run locally:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=. /tmp/rustchain-flask-venv/bin/python -m pytest -q tests/test_legacy_faucet_json_validation.py tests/test_faucet.py
  • /tmp/rustchain-flask-venv/bin/python -m py_compile faucet.py tests/test_legacy_faucet_json_validation.py
  • Manual local client check: valid RTC9d7...2360 returned 200; RTCnot-a-native-wallet returned 400.

Copy link
Copy Markdown

@shuibui shuibui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Approve

Good fix.

**Verdict: Approve.

Copy link
Copy Markdown

@shuibui shuibui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Approve

Good fix. Addresses the issue correctly.

**Verdict: Approve.

Copy link
Copy Markdown

@shuibui shuibui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Approve

Good fix. Addresses the issue correctly.

**Verdict: Approve.

Copy link
Copy Markdown

@shuibui shuibui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Approve

Good fix.

**Verdict: Approve.

Copy link
Copy Markdown

@shuibui shuibui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Approve

Good fix.

**Verdict: Approve.

Copy link
Copy Markdown

@himanalot himanalot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the root faucet.py patch and the legacy faucet regressions. The endpoint now accepts strict native RTC addresses (RTC plus 40 hex chars), keeps the legacy 0x acceptance path, and rejects malformed RTC-prefixed input. The placeholder/docstring updates match the behavior.

I do not see a blocking issue in this patch. Approved.

@guangningsun
Copy link
Copy Markdown

PR Review — Standard Quality ✓

PR: #4892 — Fix: accept native RTC faucet wallets

What I reviewed

  • faucet.py
  • tests/test_legacy_faucet_json_validation.py

Observations

  1. Adding import re for RTC address format validation — the native RTC address format needs to be distinguished from the wrapped wRTC format. Proper regex validation ensures correct address parsing.

  2. Accepting native RTC addresses expands faucet accessibility — users can now request drips using native RTC addresses rather than only wrapped versions.

LGTM.

Bounty: #2782
Disclosure: I received RTC compensation for this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/S PR: 11-50 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Faucet rejects valid RTC wallet addresses

7 participants