Skip to content

nightly

  • nightly
  • 6922c2e
  • Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
  • Choose a tag to compare

  • nightly
  • 6922c2e
  • Choose a tag to compare

  • Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
@gakonst gakonst tagged this 22 Jan 16:33
* fix(cast): improve error message for invalid hex calldata

Fixes #11584

When using `cast call --data 0x0`, the error message was confusing:
"If you wish to fetch function data from Etherscan, please provide an Etherscan API key."

This happened because:
1. `0x0` is invalid hex (odd length, should be `0x00`)
2. hex::decode failed
3. Code fell through to Etherscan lookup path

This PR makes two improvements:
1. When input looks like hex (starts with 0x) but fails to decode, provide a clear error message about invalid hex format
2. When no Etherscan key is provided and sig has no parentheses, assume fallback function instead of erroring

The second change also addresses the case where users want to call fallback without providing an Etherscan API key.

* fix: use actual hex decode error in message

* fix: remove overly broad fallback behavior

Only keep the hex error improvement - don't silently call fallback
when function name has no parentheses and no Etherscan key.

* refactor: clarify hex decode logic with if-let pattern

* bump

* test: add tests for invalid hex calldata error message

---------

Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Co-authored-by: zerosnacks <zerosnacks@protonmail.com>
Assets 2
Loading