Documentation
¶
Index ¶
- type FinalityData
- type Finalizer
- func (fi *Finalizer) Finalize(ctx context.Context, l1Origin eth.L1BlockRef)
- func (fi *Finalizer) FinalizedL1() (out eth.L1BlockRef)
- func (fi *Finalizer) OnDerivationL1End(ctx context.Context, derivedFrom eth.L1BlockRef) error
- func (fi *Finalizer) PostProcessSafeL2(l2Safe eth.L2BlockRef, derivedFrom eth.L1BlockRef)
- func (fi *Finalizer) Reset()
- type FinalizerEngine
- type FinalizerL1Interface
- type PlasmaBackend
- type PlasmaFinalizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FinalityData ¶
type FinalityData struct {
// The last L2 block that was fully derived and inserted into the L2 engine while processing this L1 block.
L2Block eth.L2BlockRef
// The L1 block this stage was at when inserting the L2 block.
// When this L1 block is finalized, the L2 chain up to this block can be fully reproduced from finalized L1 data.
L1Block eth.BlockID
}
type Finalizer ¶
type Finalizer struct {
// contains filtered or unexported fields
}
func NewFinalizer ¶
func NewFinalizer(log log.Logger, cfg *rollup.Config, l1Fetcher FinalizerL1Interface, ec FinalizerEngine) *Finalizer
func (*Finalizer) Finalize ¶
func (fi *Finalizer) Finalize(ctx context.Context, l1Origin eth.L1BlockRef)
Finalize applies a L1 finality signal, without any fork-choice or L2 state changes.
func (*Finalizer) FinalizedL1 ¶
func (fi *Finalizer) FinalizedL1() (out eth.L1BlockRef)
FinalizedL1 identifies the L1 chain (incl.) that included and/or produced all the finalized L2 blocks. This may return a zeroed ID if no finalization signals have been seen yet.
func (*Finalizer) OnDerivationL1End ¶
OnDerivationL1End is called when a L1 block has been fully exhausted (i.e. no more L2 blocks to derive from).
Since finality applies to all L2 blocks fully derived from the same block, it optimal to only check after the derivation from the L1 block has been exhausted.
This will look at what has been buffered so far, sanity-check we are on the finalizing L1 chain, and finalize any L2 blocks that were fully derived from known finalized L1 blocks.
func (*Finalizer) PostProcessSafeL2 ¶
func (fi *Finalizer) PostProcessSafeL2(l2Safe eth.L2BlockRef, derivedFrom eth.L1BlockRef)
PostProcessSafeL2 buffers the L1 block the safe head was fully derived from, to finalize it once the derived-from L1 block, or a later L1 block, finalizes.
type FinalizerEngine ¶
type FinalizerEngine interface {
Finalized() eth.L2BlockRef
SetFinalizedHead(eth.L2BlockRef)
}
type FinalizerL1Interface ¶
type PlasmaBackend ¶
type PlasmaBackend interface {
// Finalize notifies the L1 finalized head so plasma finality is always behind L1.
Finalize(ref eth.L1BlockRef)
// OnFinalizedHeadSignal sets the engine finalization signal callback.
OnFinalizedHeadSignal(f plasma.HeadSignalFn)
}
type PlasmaFinalizer ¶
type PlasmaFinalizer struct {
*Finalizer
// contains filtered or unexported fields
}
PlasmaFinalizer is a special type of Finalizer, wrapping a regular Finalizer, but overriding the finality signal handling: it proxies L1 finality signals to the plasma backend, and relies on the backend to then signal when finality is really applicable.
func NewPlasmaFinalizer ¶
func NewPlasmaFinalizer(log log.Logger, cfg *rollup.Config, l1Fetcher FinalizerL1Interface, ec FinalizerEngine, backend PlasmaBackend) *PlasmaFinalizer
func (*PlasmaFinalizer) Finalize ¶
func (fi *PlasmaFinalizer) Finalize(ctx context.Context, l1Origin eth.L1BlockRef)