Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deserialization failure when fetching contract source_code from blockscout #22

Conversation

ckoopmann
Copy link
Contributor

@ckoopmann ckoopmann commented Dec 21, 2023

Blockscouts response upon requesting a contracts source code diverges from that of etherscan and is thereby incompatible with the current serde deserialization schema:

  1. Use "true" / "false" instead of "1"/"0" for various binary fields (e.g. "OptimizationUsed")
  2. Different naming of certain fields (e.g. "IsProxy" vs. "Proxy")
  3. Omitting fields entirely when data would be empty instead of returning an empty string (e.g. "ConstructorArguments").

For reference compare the blockscout and etherscan example response for the ETH deposit contract.

This PR fixes that by adjusting the serde deserialization options accordingly.

This partially addresses #21

@ckoopmann ckoopmann force-pushed the fix-blockscout-source-code-deserialization-failure branch from e7fa58d to 791c05b Compare December 21, 2023 04:32
Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

this is only for fetching contract sources, so it should be alright. Thanks!

@Evalir Evalir merged commit 472118d into foundry-rs:main Dec 21, 2023
8 checks passed
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