Skip to content

Conversation

@incrypto32
Copy link
Member

@incrypto32 incrypto32 commented Jan 1, 2026

This PR addresses a few issues.

  1. Workarounds for backward compatibility - ABI's which had non standard fields were accepted by rust-web3 but alloy is more strict with this so subgraphs that has ABI's with these compatibility issues failed.
  2. Fallback to use RPC or firehose to fetch blocks when it fails to deseriliaze from cache
  3. Few other bug fixes

@incrypto32 incrypto32 changed the title Fix compatibility issues between rust-web3 and ally Fix compatibility issues between rust-web3 and alloy Jan 2, 2026
@incrypto32 incrypto32 marked this pull request as ready for review January 5, 2026 15:09
@incrypto32 incrypto32 force-pushed the krishna/alloy branch 2 times, most recently from 59de59b to bf9fc99 Compare January 6, 2026 14:31
@incrypto32 incrypto32 force-pushed the krishna/alloy-abi-fixes branch from 60cad69 to 6113d2b Compare January 6, 2026 14:35
incrypto32 and others added 6 commits January 6, 2026 18:51
Some ABIs contain "undefined" as a stateMutability value, which is not
part of the official Solidity ABI specification. The spec only defines
four valid values: pure, view, nonpayable, and payable.

Alloy's StateMutability enum strictly follows the spec and rejects
"undefined" during deserialization, causing subgraph deployment failures
with: unknown variant `undefined`, expected one of `pure`, `view`,
`nonpayable`, `payable`

This adds a normalize_abi_json() function that preprocesses ABI JSON
before deserialization, replacing "undefined" with "nonpayable" (the
default state mutability). This handles non-compliant ABIs gracefully
while maintaining spec compliance.

Also adds a unit test to verify the normalization works correctly.

🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>
Extends normalize_abi_json() to also remove duplicate constructors from ABIs.

Some non-compliant ABIs contain multiple constructor entries (e.g., DolomiteMargin
ABI has two constructors, likely from incorrectly merged contract ABIs). Alloy's
JsonAbi only allows one constructor and fails with 'duplicate field self.constructor'
when encountering duplicates.

ethabi's Contract type silently handled this by only storing one constructor
(the last one encountered during deserialization).

The fix keeps only the first constructor and removes any subsequent ones, matching
the Solidity spec that a contract can only have one constructor.

Fixes subgraph QmacPbft3reGGGL4VBzrZCKHeLpRgU9X2wUJjvPBVweyRV deployment.
@incrypto32 incrypto32 force-pushed the krishna/alloy-abi-fixes branch from 6113d2b to 928b0eb Compare January 6, 2026 14:51
@incrypto32 incrypto32 changed the title Fix compatibility issues between rust-web3 and alloy Fix compatibility issues between rust-web3 and alloy, Fallback to firehose or RPC on deserialization errors Jan 6, 2026
@fordN fordN requested a review from dwerner January 6, 2026 16:43
Copy link
Contributor

@dwerner dwerner left a comment

Choose a reason for hiding this comment

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

lgtm! (couple comments, just around calling out the patching/normalization)

@incrypto32
Copy link
Member Author

@dwerner i just added two more normalizations and added comments.

@incrypto32 incrypto32 requested a review from dwerner January 7, 2026 15:29
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.

3 participants