paradigmxyz / reth-exex-examples

Collection of ExEx examples built on Reth
https://reth.rs/developers/exex/exex.html
Apache License 2.0
96 stars 12 forks source link

feat(kona): Execution Extension that uses Kona to derive L2 Payload Attributes #7

Closed refcell closed 2 weeks ago

refcell commented 1 month ago

Description

An execution extension that pulls in the kona-derive crate from kona and runs the derivation pipeline over newly committed L1 blocks.

Once it generates L2AttributesWithParent from the pipeline, it can go about verifying the pipeline in a number of ways. The first, more resilient or less trustful method is to send the payload attributes over the engine api through engine_newPayloadV2. The block hash is now verified and can be checked against the sequencer for further redundancy.

Another, more simple approach to verify kona-derive is to validate the payload attributes against a "trusted" L2 endpoint. Once the pipeline returns valid payload attributes, they can be compared to payloads retrieved by rpc. This is effectively what the trusted-sync example does in kona.

Ideally, the execution extension can provide both methods, by toggling on a cli flag and abstracting the validation logic away from the main pipeline loop.

Pipeline Inputs

The kona-derive crate (Kona's derivation pipeline) provides a Pipeline Builder that exposes a builder pattern to construct the pipeline. If the online feature flag is enabled on kona-derive, you can also use the new_online_pipeline convenience method. It requires a few inputs:

Prior Work

This was drafted in https://github.com/paradigmxyz/reth/pull/9030.

Metadata

Fixes https://github.com/ethereum-optimism/kona/issues/211

merklefruit commented 1 month ago

I'd like to take this! @refcell can you give a status update on the draft PR that you recently closed, to have an idea of how much work is left?

gakonst commented 1 month ago

All the online stuff should be possible via direct db reads, ie should be able to skip json RPC altogether

shekhirin commented 2 weeks ago

@refcell I believe this can be closed as it evolved into a separate project?