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) LastDeniedOutputV0(height uint64) (*eth.OutputV0, error)
- func (d *DenyList) PruneAtOrAfterTimestamp(timestamp uint64) (map[uint64][]common.Hash, error)
- type DenyRecord
- type InteropChain
- 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.
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
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)
SyncStatus(ctx context.Context) (*eth.SyncStatus, error)
VerifiedAt(ctx context.Context, ts uint64) (l2, l1 eth.BlockID, err error)
OptimisticAt(ctx context.Context, ts uint64) (l2, l1 eth.BlockID, err error)
OutputRootAtL2BlockNumber(ctx context.Context, l2BlockNum uint64) (eth.Bytes32, error)
OptimisticOutputAtTimestamp(ctx context.Context, ts uint64) (*eth.OutputV0, error)
RegisterVerifier(v activity.VerificationActivity)
// VerifierCurrentL1s returns the CurrentL1 from each registered verifier.
// This allows callers to determine the minimum L1 block that all verifiers have processed.
VerifierCurrentL1s() []eth.BlockID
// 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)
// 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) 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
// RewindEngine rewinds the engine to the highest block with timestamp less than
// or equal to the given timestamp. invalidatedBlock is the block that triggered
// the rewind and is passed to reset callbacks.
RewindEngine(ctx context.Context, timestamp uint64, 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. Returns true if a
// rewind was triggered, false otherwise.
InvalidateBlock(ctx context.Context, height uint64, payloadHash common.Hash, decisionTimestamp uint64, stateRoot, messagePasserStorageRoot eth.Bytes32) (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, setHandler func(chainID string, h http.Handler), addMetricsRegistry func(key string, g prometheus.Gatherer), metrics *resources.SupernodeMetrics, ) InteropChain
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.