Skip to content

Commit feceac1

Browse files
committed
fix: avoid crashing processor when upgarded methods are called in the same upgrade transaction
1 parent 2f4d0d3 commit feceac1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/templates/origin-arm/origin-arm.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,12 @@ export const createOriginARMProcessors = ({
292292
return armStateEntity
293293
}
294294
const previousState = await getPreviousState(block)
295-
const upgraded = armEntity.upgradeBlock != null && block.header.height >= armEntity.upgradeBlock
295+
// An upgrade transaction can emit state-triggering events before BaseAssetAdded.
296+
// eth_call sees the upgraded implementation for the entire block, so consider
297+
// the ARM upgraded when BaseAssetAdded appears anywhere in the current block.
298+
const upgraded =
299+
(armEntity.upgradeBlock != null && block.header.height >= armEntity.upgradeBlock) ||
300+
block.logs.some((log) => baseAssetAddedFilter.matches(log))
296301
const armContract = new originOsArmAbi.Contract(ctx, block.header, armAddress)
297302
const lidoArmContract = new originLidoArmAbi.Contract(ctx, block.header, armAddress)
298303
const ethenaArmContract = new originEthenaArmAbi.Contract(ctx, block.header, armAddress)

0 commit comments

Comments
 (0)