magi
magi copied to clipboard
feat: use execution client to find restart block
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.
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
Yep this seems like a good plan!