Skip to content

Commit e2a4704

Browse files
incrypto32claude
andauthored
Fix compatibility issues between rust-web3 and alloy, Fallback to firehose or RPC on deserialization errors (#6240)
* Add warning logs on block deserialization failures * add Firehose/RPC fallback for stale block cache in ancestor_block * chain/ethereum: Fix ABI conversion issues in alloy migration * store, chain/ethereum: Handle pre-Byzantium receipt status correctly * graph: Normalize ABI JSON to handle undefined stateMutability 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 <noreply@anthropic.com> * graph: Handle duplicate constructors in ABIs 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. * extend normalizer to handle all alloy parsing incompatibilities * Add fallback for ancestor_block to handle cache truncation (#6262) * ethereum: Add RPC fallback for ancestor_block to handle cache truncation * ethereum: Extract walk_back_ancestor logic and add tests * ethereum: Fetch full blocks with receipts in ancestor_block RPC fallback When ancestor_block falls back to RPC due to cache deserialization failures, fetch full blocks with receipts instead of light blocks. Empty receipts caused missing block handler call triggers and log triggers. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 23cdf79 commit e2a4704

7 files changed

Lines changed: 603 additions & 94 deletions

File tree

0 commit comments

Comments
 (0)