Skip to content

fix: treat address-only getsourcecode responses as unverified contracts#154

Merged
mattsse merged 1 commit intofoundry-rs:mainfrom
jsvisa:fix-address-only-response
Mar 3, 2026
Merged

fix: treat address-only getsourcecode responses as unverified contracts#154
mattsse merged 1 commit intofoundry-rs:mainfrom
jsvisa:fix-address-only-response

Conversation

@jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Mar 3, 2026

Some Blockscout-compatible explorers return an address-only payload for contract/getsourcecode on non-contract
addresses, e.g.:

request on https://zetascan.com/api?module=contract&action=getsourcecode&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413 returns:

{ "message": "OK", "result": [{ "Address": "0x..." }], "status": "1" }

foundry-block-explorers currently tries to deserialize this into ContractMetadata, which fails and emits noisy
Failed to deserialize response logs:

2026-03-03T03:40:27.827090Z ERROR etherscan: Failed to deserialize response: data did not match any variant of untagged enum ResponseData res="{\"message\":\"OK\",\"result\":[{\"Address\":\"0x7109709ecfa91a80626ff3989d68f67f5b1dd12d\"}],\"status\":\"1\"}"
2026-03-03T03:40:27.830366Z ERROR etherscan: Failed to deserialize response: data did not match any variant of untagged enum ResponseData res="{\"message\":\"OK\",\"result\":[{\"Address\":\"0xe98448ee92eb6cd06366febd70f7f11307fd9a2c\"}],\"status\":\"1\"}"
2026-03-03T03:40:27.831478Z ERROR etherscan: Failed to deserialize response: data did not match any variant of untagged enum ResponseData res="{\"message\":\"OK\",\"result\":[{\"Address\":\"0x000000000000000000636f6e736f6c652e6c6f67\"}],\"status\":\"1\"}"
2026-03-03T03:40:27.845193Z ERROR etherscan: Failed to deserialize response: data did not match any variant of untagged enum ResponseData res="{\"message\":\"OK\",\"result\":[{\"Address\":\"0x0000000000000000000000000000000000000000\"}],\"status\":\"1\"}"

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this makes sense, ty!

@mattsse mattsse merged commit a1f5ae1 into foundry-rs:main Mar 3, 2026
9 of 11 checks passed
@jsvisa jsvisa deleted the fix-address-only-response branch March 3, 2026 06:11
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.

2 participants