Skip to content

fix: lowercase checksummed addresses in transfer actions - #343

Open
saravanan619 wants to merge 2 commits into
hyperliquid-dex:masterfrom
saravanan619:fix/lowercase-transfer-addresses-339
Open

saravanan619 wants to merge 2 commits into
hyperliquid-dex:masterfrom
saravanan619:fix/lowercase-transfer-addresses-339

Conversation

@saravanan619

Copy link
Copy Markdown

Bug

The node lowercases embedded address strings before computing the L1 action hash, but vault_usd_transfer, sub_account_transfer and sub_account_spot_transfer signed the address exactly as passed. Since eth_account returns checksummed addresses by default, the natural call pattern — e.g. ex.vault_usd_transfer(checksummed_vault, ...) — produced a signature the node rejects, surfacing as a confusing "User or API Wallet <garbage> does not exist" error. No funds move; the call simply fails.

Fix

Lowercase the address argument in the signed action of all three methods (vaultAddress / subAccountUser), matching the existing convention in spot_deploy_user_genesis / spot_deploy_freeze_user, which already call .lower() on addresses.

Tests

Added 3 regression tests in tests/signing_test.py that call the Exchange methods with checksummed addresses (stubbed _post_action, no network) and assert:

  • the posted action carries the lowercased address (and token is untouched in the spot transfer), and
  • the signature verifies when the signer is recovered from the action the way the node hashes it (address fields lowercased), using the repo's own recover_agent_or_user_from_l1_action.

Verified red-then-green: the 3 new tests fail on unpatched code (recovered address is garbage) and pass after the fix. Full suite: tests/signing_test.py 16 passed. tests/info_test.py has 7 pre-existing failures on the clean tree too (stale cassettes / live API drift), unrelated to this change. Black + flake8 clean.

Fixes #339

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.

vault_usd_transfer / sub_account_transfer signatures rejected when addresses are checksummed

1 participant