Documentation
¶
Index ¶
- Variables
- type ChainContainer
- type DenyList
- func (d *DenyList) Add(height uint64, payloadHash common.Hash, decisionTimestamp uint64, ...) error
- func (d *DenyList) Close() error
- func (d *DenyList) Contains(height uint64, payloadHash common.Hash) (bool, error)
- func (d *DenyList) GetDeniedHashes(height uint64) ([]common.Hash, error)
- func (d *DenyList) GetDeniedRecords(height uint64) ([]DenyRecord, error)
- func (d *DenyList) GetOutputV0(height uint64, payloadHash common.Hash) (*eth.OutputV0, error)
- func (d *DenyList) HasDeniedAtOrAfterTimestamp(timestamp uint64) (bool, error)
- func (d *DenyList) LastDeniedOutputV0(height uint64) (*eth.OutputV0, error)
- func (d *DenyList) PruneAtOrAfterTimestamp(timestamp uint64) (map[uint64][]common.Hash, error)
- type DenyRecord
- type InteropChain
- type RPCRouterGate
- type ResetCallback
Constants ¶
This section is empty.
Variables ¶
ErrHistoryUnavailable is the permanent counterpart of ethereum.NotFound: SafeDB on this node cannot and will not contain the requested history (e.g. snap/CL-sync bootstrap gap). Interop halts on this rather than retrying; recovery requires operator intervention.
var ErrSafeDBNotReady = errors.New("safedb not ready: no stable first entry yet")
ErrSafeDBNotReady is returned by FirstSafeHeadTimestamp when SafeDB does not yet have a stable first entry: either it has no entries at all, or the deriver has not advanced past the first entry's L1 (so SafeHeadUpdated may still overwrite the L2 value at that L1 key). This is a transient condition during cold start; callers should back off and retry.
Functions ¶
This section is empty.
Types ¶
type ChainContainer ¶
type ChainContainer interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
Pause(ctx context.Context) error
Resume(ctx context.Context) error
ID() eth.ChainID
ELFinalizedHead(ctx context.Context) (eth.L2BlockRef, error)
LocalSafeBlockAtTimestamp(ctx context.Context, ts uint64) (eth.L2BlockRef, error)
// TimestampToBlockNumber maps an L2 unix timestamp to the L2 block number (rollup derivation).
TimestampToBlockNumber(ctx context.Context, ts uint64) (uint64, error)
BlockNumberToTimestamp(ctx context.Context, blocknum uint64) (uint64, error)
// FirstSafeHeadTimestamp returns the L2 block timestamp of the first
// entry in this chain's SafeDB. Returns ErrSafeDBNotReady when the chain
// has not yet derived a stable first safe head.
FirstSafeHeadTimestamp(ctx context.Context) (uint64, error)
SyncStatus(ctx context.Context) (*eth.SyncStatus, error)
OptimisticAt(ctx context.Context, ts uint64) (l2, l1 eth.BlockID, err error)
// OutputRootAtL2BlockHash returns the L2 output root for the canonical
// block at the given hash. Post-Isthmus the root is derived from the
// header alone; pre-Isthmus it falls back to eth_getProof on state at
// that block. Returns ethereum.NotFound if the EL no longer has the
// block at that hash on its canonical chain.
OutputRootAtL2BlockHash(ctx context.Context, blockHash common.Hash) (eth.Bytes32, error)
OptimisticOutputAtTimestamp(ctx context.Context, ts uint64) (*eth.OutputV0, error)
RegisterVerifier(v activity.VerificationActivity)
// VerifierCurrentL1 returns the CurrentL1 of the registered verifier.
// The bool is false when no verifier is registered.
VerifierCurrentL1() (eth.BlockID, bool)
// FetchReceipts fetches the receipts for a given block by hash.
// Returns block info and receipts, or an error if the block or receipts cannot be fetched.
FetchReceipts(ctx context.Context, blockHash eth.BlockID) (eth.BlockInfo, types.Receipts, error)
// BlockTime returns the block time in seconds for this chain.
BlockTime() uint64
// PruneDeniedAtOrAfterTimestamp removes deny-list entries with DecisionTimestamp >= timestamp.
// Returns map of removed hashes by height.
PruneDeniedAtOrAfterTimestamp(timestamp uint64) (map[uint64][]common.Hash, error)
// PauseAndStopVN pauses the chain container restart loop and stops the virtual node.
// This is used to freeze a chain's VN before a multi-chain rewind begins, preventing
// the VN from issuing forkchoice updates that race with the rewind of a peer chain.
PauseAndStopVN(ctx context.Context) error
// IsDenied checks if a block hash is on the deny list at the given height.
IsDenied(height uint64, payloadHash common.Hash) (bool, error)
// GetDeniedOutput returns the reconstructed OutputV0 for a denied block.
// Returns nil if the block is not denied at that height.
GetDeniedOutput(height uint64, payloadHash common.Hash) (*eth.OutputV0, error)
// OutputV0AtBlockNumber returns the full OutputV0 for the block at the given number.
OutputV0AtBlockNumber(ctx context.Context, l2BlockNum uint64) (*eth.OutputV0, error)
// PayloadByHash returns the canonical execution payload envelope for the given block hash.
// Used by interop build paths to capture canonical payloads for WAL'd rewind operations.
PayloadByHash(ctx context.Context, hash common.Hash) (*eth.ExecutionPayloadEnvelope, error)
// PayloadByNumber returns the canonical execution payload envelope for the given block number.
// Used by interop build paths when the rewind target is below the verified frontier.
PayloadByNumber(ctx context.Context, number uint64) (*eth.ExecutionPayloadEnvelope, error)
// SetResetCallback sets a callback that is invoked when the chain resets.
// The supernode uses this to notify activities about chain resets.
SetResetCallback(cb ResetCallback)
}
type DenyList ¶
type DenyList struct {
// contains filtered or unexported fields
}
DenyList provides persistence for invalid block payload hashes using bbolt. Blocks are keyed by block height, with each height potentially having multiple denied hashes.
func OpenDenyList ¶
OpenDenyList opens or creates a DenyList at the given data directory.
func (*DenyList) Add ¶
func (d *DenyList) Add(height uint64, payloadHash common.Hash, decisionTimestamp uint64, stateRoot, messagePasserStorageRoot eth.Bytes32) error
Add adds a payload hash to the deny list at the given block height. stateRoot and messagePasserStorageRoot are the output preimage fields for optimistic root computation. Multiple hashes can be denied at the same height.
func (*DenyList) GetDeniedHashes ¶
GetDeniedHashes returns all denied payload hashes at the given block height.
func (*DenyList) GetDeniedRecords ¶
func (d *DenyList) GetDeniedRecords(height uint64) ([]DenyRecord, error)
GetDeniedRecords returns all denied records at the given block height.
func (*DenyList) GetOutputV0 ¶
GetOutputV0 reconstructs and returns the full OutputV0 for a denied block. Returns nil if the hash is not denied at that height.
func (*DenyList) HasDeniedAtOrAfterTimestamp ¶ added in v1.18.0
HasDeniedAtOrAfterTimestamp returns true if any denied payload has DecisionTimestamp >= timestamp.
func (*DenyList) LastDeniedOutputV0 ¶
LastDeniedOutputV0 returns the OutputV0 for the most recently denied block at the given height. Returns nil if no blocks are denied at that height. Note: supernode does not currently behave in well defined ways when there are multiple denied blocks at the same height.
func (*DenyList) PruneAtOrAfterTimestamp ¶
PruneAtOrAfterTimestamp iterates all keys in the bucket, decodes records, removes any where DecisionTimestamp >= timestamp, re-encodes remaining. Returns map of removed hashes by height.
type DenyRecord ¶
type DenyRecord struct {
PayloadHash common.Hash `json:"payloadHash"`
DecisionTimestamp uint64 `json:"decisionTimestamp"`
StateRoot eth.Bytes32 `json:"stateRoot"`
MessagePasserStorageRoot eth.Bytes32 `json:"messagePasserStorageRoot"`
}
DenyRecord stores a denied payload hash along with decision provenance and the output preimage fields for optimistic root computation.
type InteropChain ¶
type InteropChain interface {
ChainContainer
// HasDeniedAtOrAfterTimestamp returns true if any deny-list entry has
// DecisionTimestamp >= timestamp, without mutating the deny list.
HasDeniedAtOrAfterTimestamp(timestamp uint64) (bool, error)
// RewindEngine rewinds the engine to the supplied target block. target is the canonical
// payload at the rewind destination, loaded from durable WAL storage by the caller —
// not re-derived from the live engine. invalidatedBlock is the block that triggered the
// rewind and is passed to reset callbacks (it is purely informational).
RewindEngine(ctx context.Context, target *eth.ExecutionPayloadEnvelope, invalidatedBlock eth.BlockRef) error
// InvalidateBlock adds a block to the deny list and triggers a rewind if the chain
// currently uses that block at the specified height. parentPayload is the canonical
// payload at height-1 (the rewind destination) loaded from durable WAL storage —
// callers must capture it at build time, before the rewind starts. Returns true if
// a rewind was triggered, false otherwise.
InvalidateBlock(ctx context.Context, height uint64, payloadHash common.Hash, decisionTimestamp uint64, stateRoot, messagePasserStorageRoot eth.Bytes32, parentPayload *eth.ExecutionPayloadEnvelope) (bool, error)
}
WARNING: InteropChain exposes the reorg-triggering operations (RewindEngine, InvalidateBlock) that bypass the interop WAL model when invoked outside of interop transition application. ONLY the interop activity should accept or hold a value of this interface. Every other caller must take the narrower ChainContainer above so the misuse is caught at compile time.
func NewChainContainer ¶
func NewChainContainer( chainID eth.ChainID, vncfg *opnodecfg.Config, log gethlog.Logger, cfg config.CLIConfig, initOverload *rollupNode.InitializationOverrides, rpcHandler *oprpc.Handler, rpcRouter RPCRouterGate, addMetricsRegistry func(key string, g prometheus.Gatherer), metrics *resources.SupernodeMetrics, ) InteropChain
type RPCRouterGate ¶ added in v1.19.0
type RPCRouterGate interface {
SetHandler(chainID string, h http.Handler)
SetReadinessCheck(chainID string, fn func() bool)
RemoveHandler(chainID string)
}
RPCRouterGate is the chain container's narrow view of the shared RPC router. It lets containers swap per-chain handlers while also controlling when the router may dispatch requests to them.
type ResetCallback ¶
ResetCallback is called when the chain container resets due to an invalidated block. The supernode uses this to notify activities about the reset. invalidatedBlock is the block that was invalidated and triggered the reset.