Skip to content

fix: normalize address in sim_fundAccount - #1789

Closed
feafel wants to merge 3 commits into
genlayerlabs:v0.123-devfrom
feafel:fix/fund-account-normalize-address
Closed

feafel wants to merge 3 commits into
genlayerlabs:v0.123-devfrom
feafel:fix/fund-account-normalize-address

Conversation

@feafel

@feafel feafel commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

Fixes #1788: sim_fundAccount returned a success-looking result hash but silently credited nothing when passed a lowercase address (e.g. from MetaMask). Ethereum JSON-RPC addresses are case-insensitive, so normalize to checksum format before the lookup.

Changes

  • backend/protocol_rpc/endpoints.py: added to_checksum_address normalization after address validation
  • tests/unit/test_simulator_sessions.py: added test for lowercase address normalization

Impact

Wallets such as MetaMask return lowercase addresses from eth_accounts, so a faucet button that passes the connected address silently did nothing. Now the address is properly normalized before crediting.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Account funding now stores valid addresses in a consistent checksum format, including when lowercase addresses are provided. Invalid addresses continue to be rejected.

sim_fundAccount returned a success-looking result hash but silently
credited nothing when passed a lowercase address (e.g. from MetaMask).
Ethereum JSON-RPC addresses are case-insensitive, so normalize to
checksum format before the lookup.

Closes genlayerlabs#1788
@github-actions
github-actions Bot changed the base branch from main to v0.123-dev October 12, 2026 11:52
@github-actions

Copy link
Copy Markdown
Contributor

This PR targeted main, which is only the default/static branch.

I retargeted it to v0.123-dev, the active development branch. Pushes to v0.123-dev automatically fast-forward main.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d333b38-0985-4fb4-869f-fe05244a9daa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

# Conflicts:
#	backend/protocol_rpc/endpoints.py
…lization test

The expected address was not a valid EIP-55 checksum, so the test never
passed. fund_account now commits the session (genlayerlabs#1760), which object() cannot do.
@danieljrc888

Copy link
Copy Markdown
Contributor

Thanks! I merged current v0.123-dev into the branch (b974e515, keeping the #1758 amount parsing and using the module-level eth_utils import) and fixed the test in 5d724aa0:

  • the expected value "0x" + "AB" * 20 is not the EIP-55 checksum of that address (0xABaBaBaBABabABabAbAbABAbABabababaBaBABaB), so the test failed even on the original head;
  • fund_account now calls session.commit() (fix(rpc): commit funding credit before fund_account returns #1760), so the test uses MagicMock() instead of object() and asserts the commit.

tests/unit/: 1673 passed, 7 skipped. This pairs with #1773, which normalizes the shared credit_tx_value_once helper.

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed for the v0.123 release candidate; unit suite and CI green.

@danieljrc888

Copy link
Copy Markdown
Contributor

/run-e2e all

Frozen landing cut: #1789 alone, head 5d724aa0979c5fc9bf028f0d507ad20146d055b1 over v0.123-dev@e59ddfbaa15f19a2d856f184e3e27a30c3007cb2; no cross-repository Depends-On. Full component and stack coverage (no stack selector). Native CI is green. Merge is authorized once this E2E is green.

danieljrc888 added a commit that referenced this pull request Oct 21, 2026
Lands four reviewed fork PRs together after a full E2E run on this exact head:

- #1765: redact validator private keys from call receipts and explorer payloads
- #1715: bind postgres, redis and ollama host ports to loopback
- #1773: normalize addresses in raw-SQL balance operations
- #1789: normalize the address in sim_fundAccount

Co-authored-by: Kanan <93033289+kriss39@users.noreply.github.com>
Co-authored-by: Starling <82058629+Starling-spell@users.noreply.github.com>
Co-authored-by: Alicepoltora <Alicepoltora@users.noreply.github.com>
@danieljrc888

Copy link
Copy Markdown
Contributor

Landed in v0.123-dev via #1797 (squash 9e907cd), which combined #1765, #1715, #1773 and #1789 at their reviewed heads and passed full E2E. Your commits are credited with Co-authored-by. Thanks for the fix!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sim_fundAccount returns success but credits nothing when the address is not EIP-55 checksummed

3 participants