Documentation
¶
Index ¶
- Variables
- func CrossSafeHazards(d SafeStartDeps, chainID types.ChainID, inL1DerivedFrom eth.BlockID, ...) (hazards map[types.ChainIndex]types.BlockSeal, err error)
- func CrossSafeUpdate(ctx context.Context, logger log.Logger, chainID types.ChainID, d CrossSafeDeps) error
- func CrossUnsafeHazards(d UnsafeStartDeps, chainID types.ChainID, candidate types.BlockSeal, ...) (hazards map[types.ChainIndex]types.BlockSeal, err error)
- func CrossUnsafeUpdate(ctx context.Context, logger log.Logger, chainID types.ChainID, ...) error
- func GenerateMermaidDiagram(g *graph) string
- func HazardCycleChecks(d CycleCheckDeps, inTimestamp uint64, ...) error
- func HazardSafeFrontierChecks(d SafeFrontierCheckDeps, inL1DerivedFrom eth.BlockID, ...) error
- func HazardUnsafeFrontierChecks(d UnsafeFrontierCheckDeps, hazards map[types.ChainIndex]types.BlockSeal) error
- type CrossSafeDeps
- type CrossUnsafeDeps
- type CycleCheckDeps
- type SafeFrontierCheckDeps
- type SafeStartDeps
- type UnsafeFrontierCheckDeps
- type UnsafeStartDeps
- type Worker
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CrossSafeHazards ¶
func CrossSafeHazards(d SafeStartDeps, chainID types.ChainID, inL1DerivedFrom eth.BlockID, candidate types.BlockSeal, execMsgs []*types.ExecutingMessage) (hazards map[types.ChainIndex]types.BlockSeal, err error)
CrossSafeHazards checks if the given messages all exist and pass invariants. It returns a hazard-set: if any intra-block messaging happened, these hazard blocks have to be verified.
func CrossSafeUpdate ¶
func CrossUnsafeHazards ¶
func CrossUnsafeHazards(d UnsafeStartDeps, chainID types.ChainID, candidate types.BlockSeal, execMsgs []*types.ExecutingMessage) (hazards map[types.ChainIndex]types.BlockSeal, err error)
CrossUnsafeHazards checks if the given messages all exist and pass invariants. It returns a hazard-set: if any intra-block messaging happened, these hazard blocks have to be verified.
func CrossUnsafeUpdate ¶
func GenerateMermaidDiagram ¶
func GenerateMermaidDiagram(g *graph) string
GenerateMermaidDiagram creates a Mermaid flowchart diagram from the graph data for debugging.
func HazardCycleChecks ¶
func HazardCycleChecks(d CycleCheckDeps, inTimestamp uint64, hazards map[types.ChainIndex]types.BlockSeal) error
HazardCycleChecks checks for cyclical dependencies between logs at the given timestamp. Here the timestamp invariant alone does not ensure ordering of messages.
We perform this check in 3 steps:
- Gather all logs across all hazard blocks at the given timestamp.
- Build the logs into a directed graph of dependencies between logs.
- Check the graph for cycles.
The edges of the graph are determined by:
- For all logs except the first in a block, there is an edge from the previous log.
- For all executing messages, there is an edge from the initiating message.
The edges between sequential logs ensure the graph is well-connected and free of any disjoint subgraphs that would make cycle checking more difficult.
The cycle check is performed by executing Kahn's topological sort algorithm which succeeds if and only if a graph is acyclic.
Returns nil if no cycles are found or ErrCycle if a cycle is detected.
func HazardSafeFrontierChecks ¶
func HazardSafeFrontierChecks(d SafeFrontierCheckDeps, inL1DerivedFrom eth.BlockID, hazards map[types.ChainIndex]types.BlockSeal) error
HazardSafeFrontierChecks verifies all the hazard blocks are either:
- already cross-safe.
- the first (if not first: local blocks to verify before proceeding) local-safe block, after the cross-safe block.
func HazardUnsafeFrontierChecks ¶
func HazardUnsafeFrontierChecks(d UnsafeFrontierCheckDeps, hazards map[types.ChainIndex]types.BlockSeal) error
HazardUnsafeFrontierChecks verifies all the hazard blocks are either:
- already cross-unsafe.
- the first (if not first: local blocks to verify before proceeding) local-unsafe block, after the cross-unsafe block.
Types ¶
type CrossSafeDeps ¶
type CrossSafeDeps interface {
CrossSafe(chainID types.ChainID) (derivedFrom types.BlockSeal, derived types.BlockSeal, err error)
SafeFrontierCheckDeps
SafeStartDeps
CandidateCrossSafe(chain types.ChainID) (derivedFromScope, crossSafe eth.BlockRef, err error)
NextDerivedFrom(chain types.ChainID, derivedFrom eth.BlockID) (after eth.BlockRef, err error)
PreviousDerived(chain types.ChainID, derived eth.BlockID) (prevDerived types.BlockSeal, err error)
OpenBlock(chainID types.ChainID, blockNum uint64) (ref eth.BlockRef, logCount uint32, execMsgs map[uint32]*types.ExecutingMessage, err error)
UpdateCrossSafe(chain types.ChainID, l1View eth.BlockRef, lastCrossDerived eth.BlockRef) error
}
type CrossUnsafeDeps ¶
type CrossUnsafeDeps interface {
CrossUnsafe(chainID types.ChainID) (types.BlockSeal, error)
UnsafeStartDeps
UnsafeFrontierCheckDeps
OpenBlock(chainID types.ChainID, blockNum uint64) (block eth.BlockRef, logCount uint32, execMsgs map[uint32]*types.ExecutingMessage, err error)
UpdateCrossUnsafe(chain types.ChainID, crossUnsafe types.BlockSeal) error
}
type CycleCheckDeps ¶
type CycleCheckDeps interface {
// OpenBlock returns log data for the requested block, to be used for cycle checking.
OpenBlock(chainID types.ChainID, blockNum uint64) (block eth.BlockRef, logCount uint32, execMsgs map[uint32]*types.ExecutingMessage, err error)
}
CycleCheckDeps is an interface for checking cyclical dependencies between logs.
type SafeFrontierCheckDeps ¶
type SafeStartDeps ¶
type UnsafeFrontierCheckDeps ¶
type UnsafeStartDeps ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker iterates work
func NewCrossSafeWorker ¶
func NewCrossUnsafeWorker ¶
func (*Worker) ProcessWork ¶
func (*Worker) StartBackground ¶
func (s *Worker) StartBackground()