Skip to content

Conversation

@incrypto32
Copy link
Member

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.

incrypto32 and others added 4 commits January 1, 2026 22:30
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 changed the title Fix compatibility issues between rust-web3 and ally Fix compatibility issues between rust-web3 and alloy Jan 2, 2026
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