ithacaxyz / op-rs

Apache License 2.0
58 stars 6 forks source link

feat(rollup): handle exex notifications #32

Closed merklefruit closed 2 months ago

merklefruit commented 2 months ago

After initializing the pipeline, the main loop will involve taking incoming Chain notifications from the Driver and:

here is a reference implementation:

async fn handle_exex_notification(
        &mut self,
        notification: ExExNotification,
        pipeline: &mut RollupPipeline,
    ) -> Result<()> {
        if let Some(reverted_chain) = notification.reverted_chain() {
            self.chain_provider.commit(reverted_chain.clone());
            let l1_block_info = info_from_header(&reverted_chain.tip().block);

            // handle the reverted chain...
        }

        if let Some(committed_chain) = notification.committed_chain() {
            let tip_number = committed_chain.tip().number;
            self.chain_provider.commit(committed_chain);

            if let Err(err) = self.ctx.events.send(ExExEvent::FinishedHeight(tip_number)) {
                bail!("Critical: Failed to send ExEx event: {:?}", err);
            }
        }

        Ok(())
    }
GrapeBaBa commented 2 months ago

@merklefruit Could I try this one?

merklefruit commented 2 months ago

@merklefruit Could I try this one?

Hey, sorry I had already started a draft PR of this in #57, but forgot to tag it here. My bad!