Skip to content

Commit a4fb1b7

Browse files
sameh-faroukclaude
andcommitted
fix: patch dedicatedFarm field for pre-V14 Farm event decoding
Existing indexer snapshots on all networks were built with an old typesBundle that had a typo: "dedicatedFarm:" (trailing colon) in the Farm struct. The stored JSON has "dedicatedFarm:" as the key, but the processor expects "dedicatedFarm" (no colon) after the typesBundle was corrected. This causes an assertion failure when decoding pre-V14 FarmStored/FarmUpdated events (specs 63-70). Production 2.12.3 had this workaround in the isV101 branch, which was removed by the typegen automation (PR #207) when relabeling the hash as isV63. The patch sets dedicatedFarm = false on the raw args before decoding. This is safe because farmStored hardcodes dedicatedFarm = false anyway. Remove this workaround after all indexers are resynced with the corrected typesBundle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 01e6b28 commit a4fb1b7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/mappings/farms.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ export async function farmStored(
3030
} else if (farmStoredEvent.isV50) {
3131
farmStoredEventParsed = farmStoredEvent.asV50
3232
} else if (farmStoredEvent.isV63) {
33+
// Workaround: existing indexer snapshots were built with an old typesBundle
34+
// that had a typo "dedicatedFarm:" (trailing colon) in the Farm struct.
35+
// The stored JSON has "dedicatedFarm:" as the key, but the processor expects
36+
// "dedicatedFarm" (no colon). Patching the raw args prevents the decode assertion
37+
// failure. Safe because farmStored hardcodes dedicatedFarm = false anyway.
38+
// Remove this after all indexers are resynced with the corrected typesBundle.
39+
(item.event.args as any).dedicatedFarm = false
3340
farmStoredEventParsed = farmStoredEvent.asV63
3441
}
3542

@@ -133,6 +140,8 @@ export async function farmUpdated(
133140
} else if (farmUpdatedEvent.isV50) {
134141
farmUpdatedEventParsed = farmUpdatedEvent.asV50
135142
} else if (farmUpdatedEvent.isV63) {
143+
// Workaround: see comment in farmStored above for the dedicatedFarm colon typo.
144+
(item.event.args as any).dedicatedFarm = false
136145
farmUpdatedEventParsed = farmUpdatedEvent.asV63
137146
switch (farmUpdatedEvent.asV63.certification.__kind) {
138147
case "Gold": {

0 commit comments

Comments
 (0)