Commit 1492eda
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 <[email protected]>1 parent ade80f1 commit 1492eda
1 file changed
+58
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
27 | 47 | | |
28 | 48 | | |
29 | 49 | | |
| |||
364 | 384 | | |
365 | 385 | | |
366 | 386 | | |
367 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
368 | 391 | | |
369 | 392 | | |
370 | 393 | | |
371 | | - | |
| 394 | + | |
372 | 395 | | |
373 | 396 | | |
374 | 397 | | |
| |||
2103 | 2126 | | |
2104 | 2127 | | |
2105 | 2128 | | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
2106 | 2162 | | |
2107 | 2163 | | |
2108 | 2164 | | |
| |||
0 commit comments