magi icon indicating copy to clipboard operation
magi copied to clipboard

feat: use execution client to find restart block

Open ncitron opened this issue 1 year ago • 2 comments

Currently when Magi starts up it initializes itself by reading from the database. This really isn't needed, since we can just query the L2 rpc of the execution client to fetch the most recent finalized block. We can then find the epoch data we need by decoding the attributes deposited transaction (the first tx in the block).

This would allow us to remove the database entirely.

ncitron avatar Apr 17 '23 17:04 ncitron

I'd like to work on this too, just to confirm the basic steps to get this to work and my understanding of how op works:

  • Request the latest finalized block to the L2 client
  • Get the first transaction from the transactions array which is the attributes deposited transaction
  • Decode the transaction data field which should be the call to setL1BlockValues as explained here
  • Extract the L1 block data to get the data needed to build the HeadInfo struct

Any suggestion is welcome

xeno097 avatar Apr 21 '23 00:04 xeno097

Yep this seems like a good plan!

ncitron avatar Apr 21 '23 00:04 ncitron