farcasterxyz / hub-monorepo

Implementation of the Farcaster Hub specification and supporting libraries for building applications on Farcaster
https://www.thehubble.xyz
MIT License
692 stars 387 forks source link

bug: re-org handling #1201

Open varunsrin opened 1 year ago

varunsrin commented 1 year ago

What is the bug?

Recently, the L2 OP Goerli chain re-orged 256 blocks. Reorgs of the blockchain are not well handled by the Farcaster system. Both Hubs and the Fname server might have serious issues if state is reverted.

We should first answer the following q's:

  1. How often does L1 reorg? What is the distribution of depths of the reorg?
  2. How often do L2's reorg? What is the distribution of depths of the reorg?
  3. What happens when a re-org occurs? Is all data potentially thrown away? Does anything need to be resubmitted?

Depending on the outcome, we may need to write a specification to determine how to handle reorgs in Hubs and in the Fname servers.

Hmac512 commented 1 year ago

Flashbots has a re-org monitor that is a good reference.

https://github.com/flashbots/reorg-monitor/blob/06dbb8c01f45cadd03a4fe6ca1a318aed928ed5b/analysis/reorg.go#L33-L112

varunsrin commented 1 year ago

more context on the reorg:

Hmac512 commented 1 year ago

https://github.com/0xsequence/reorgme

I came across this re-org simulator a while back, but have never used it.

sds commented 6 months ago

We have an initial draft of ideas here, though there are no plans to address this in the near term.