alloy icon indicating copy to clipboard operation
alloy copied to clipboard

[Bug] ChainStreamPoller doesn't handle reorgs

Open popzxc opened this issue 1 year ago • 3 comments
trafficstars

Component

provider, pubsub

What version of Alloy are you on?

No response

Operating System

None

Describe the bug

ChainStreamPoller doesn't seem to account for reorgs at all, e.g. here it always expects the chain to be continuous. And to fix that we probably need to compare block tip against next_yield here, and if block_number < next_yield, we should do some kind of search for the last non-diverging block (so probably we need to poll not only for block number, but rather for block header to use root hashes for comparison).

See this comment for more context.

popzxc avatar Jul 03 '24 13:07 popzxc