Documentation ¶
Index ¶
- Constants
- Variables
- func BodiesForward(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg BodiesCfg, ...) error
- func BorHeimdallForward(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg BorHeimdallCfg, ...) (err error)
- func BorHeimdallUnwind(u *UnwindState, ctx context.Context, _ *StageState, tx kv.RwTx, ...) (err error)
- func CollectTableSizes(db kv.RoDB, tx kv.Tx, buckets []string) []interface{}
- func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.RwTx, cfg SnapshotsCfg, ...) error
- func ExecBlockV3(s *StageState, u Unwinder, txc wrap.TxContainer, toBlock uint64, ...) (err error)
- func ExecV3(ctx context.Context, execStage *StageState, u Unwinder, workerCount int, ...) error
- func FetchSpanZeroForMiningIfNeeded(ctx context.Context, db kv.RwDB, blockReader services.FullBlockReader, ...) error
- func FillDBFromSnapshots(logPrefix string, ctx context.Context, tx kv.RwTx, dirs datadir.Dirs, ...) error
- func FinishForward(s *StageState, tx kv.RwTx, cfg FinishCfg) error
- func ForwardPolygonSyncStage(ctx context.Context, tx kv.RwTx, stageState *StageState, unwinder Unwinder, ...) error
- func HeadersPOW(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg HeadersCfg, ...) error
- func HeadersUnwind(ctx context.Context, u *UnwindState, s *StageState, tx kv.RwTx, cfg HeadersCfg, ...) (err error)
- func MiningBorHeimdallForward(ctx context.Context, cfg BorHeimdallCfg, stageStage *StageState, ...) error
- func NotifyNewHeaders(ctx context.Context, notifyFrom, notifyTo uint64, notifier ChainEventNotifier, ...) error
- func NotifyPendingLogs(logPrefix string, notifier ChainEventNotifier, logs types.Logs, ...)
- func PruneBlockHashStage(p *PruneState, tx kv.RwTx, cfg BlockHashesCfg, ctx context.Context) (err error)
- func PruneExecutionStage(s *PruneState, tx kv.RwTx, cfg ExecuteBlockCfg, ctx context.Context) (err error)
- func PruneFinish(u *PruneState, tx kv.RwTx, cfg FinishCfg, ctx context.Context) (err error)
- func PruneSendersStage(s *PruneState, tx kv.RwTx, cfg SendersCfg, ctx context.Context) (err error)
- func PruneTxLookup(s *PruneState, tx kv.RwTx, cfg TxLookupCfg, ctx context.Context, ...) (err error)
- func PruneVerkleTries(s *PruneState, tx kv.RwTx, cfg TrieCfg, ctx context.Context) (err error)
- func RebuildPatriciaTrieBasedOnFiles(ctx context.Context, cfg TrieCfg) (libcommon.Hash, error)
- func SnapshotsPrune(s *PruneState, cfg SnapshotsCfg, ctx context.Context, tx kv.RwTx, ...) (err error)
- func SpawnBlockHashStage(s *StageState, tx kv.RwTx, cfg BlockHashesCfg, ctx context.Context, ...) (err error)
- func SpawnCustomTrace(cfg CustomTraceCfg, ctx context.Context, logger log.Logger) error
- func SpawnExecuteBlocksStage(s *StageState, u Unwinder, txc wrap.TxContainer, toBlock uint64, ...) (err error)
- func SpawnMiningCreateBlockStage(s *StageState, txc wrap.TxContainer, cfg MiningCreateBlockCfg, ...) (err error)
- func SpawnMiningExecStage(s *StageState, txc wrap.TxContainer, cfg MiningExecCfg, sendersCfg SendersCfg, ...) error
- func SpawnMiningFinishStage(s *StageState, tx kv.RwTx, cfg MiningFinishCfg, quit <-chan struct{}, ...) error
- func SpawnPostExecStage(s *StageState, tx kv.RwTx, cfg PostExecCfg, ctx context.Context) error
- func SpawnRecoverSendersStage(cfg SendersCfg, s *StageState, u Unwinder, tx kv.RwTx, toBlock uint64, ...) error
- func SpawnStageHeaders(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg HeadersCfg, ...) error
- func SpawnStageSnapshots(s *StageState, ctx context.Context, tx kv.RwTx, cfg SnapshotsCfg, ...) (err error)
- func SpawnTxLookup(s *StageState, tx kv.RwTx, toBlock uint64, cfg TxLookupCfg, ...) (err error)
- func SpawnVerkleTrie(s *StageState, u Unwinder, tx kv.RwTx, cfg TrieCfg, ctx context.Context, ...) (libcommon.Hash, error)
- func UnwindBlockHashStage(u *UnwindState, tx kv.RwTx, cfg BlockHashesCfg, ctx context.Context) (err error)
- func UnwindBodiesStage(u *UnwindState, tx kv.RwTx, cfg BodiesCfg, ctx context.Context) (err error)
- func UnwindExecutionStage(u *UnwindState, s *StageState, txc wrap.TxContainer, ctx context.Context, ...) (err error)
- func UnwindFinish(u *UnwindState, tx kv.RwTx, cfg FinishCfg, ctx context.Context) (err error)
- func UnwindPolygonSyncStage(ctx context.Context, tx kv.RwTx, u *UnwindState, cfg PolygonSyncStageCfg) error
- func UnwindPostExecStage(u *UnwindState, s *StageState, tx kv.RwTx, cfg PostExecCfg, ...) (err error)
- func UnwindSendersStage(u *UnwindState, tx kv.RwTx, cfg SendersCfg, ctx context.Context) (err error)
- func UnwindTxLookup(u *UnwindState, s *StageState, tx kv.RwTx, cfg TxLookupCfg, ...) (err error)
- func UnwindVerkleTrie(u *UnwindState, s *StageState, tx kv.RwTx, cfg TrieCfg, ctx context.Context, ...) (err error)
- type BlockHashesCfg
- type BodiesCfg
- type BorHeimdallCfg
- type ChainEventNotifier
- type ChainReader
- func (cr ChainReader) BorEventsByBlock(_ libcommon.Hash, _ uint64) []rlp.RawValue
- func (cr ChainReader) BorSpan(spanId uint64) *heimdall.Span
- func (cr ChainReader) BorStartEventId(_ libcommon.Hash, _ uint64) uint64
- func (cr ChainReader) Config() *chain.Config
- func (cr ChainReader) CurrentFinalizedHeader() *types.Header
- func (cr ChainReader) CurrentHeader() *types.Header
- func (cr ChainReader) CurrentSafeHeader() *types.Header
- func (cr ChainReader) FrozenBlocks() uint64
- func (cr ChainReader) FrozenBorBlocks() uint64
- func (cr ChainReader) GetBlock(hash libcommon.Hash, number uint64) *types.Block
- func (cr ChainReader) GetHeader(hash libcommon.Hash, number uint64) *types.Header
- func (cr ChainReader) GetHeaderByHash(hash libcommon.Hash) *types.Header
- func (cr ChainReader) GetHeaderByNumber(number uint64) *types.Header
- func (cr ChainReader) GetTd(hash libcommon.Hash, number uint64) *big.Int
- func (cr ChainReader) HasBlock(hash libcommon.Hash, number uint64) bool
- type ChainReaderImpl
- func (cr ChainReaderImpl) BorEventsByBlock(hash libcommon.Hash, number uint64) []rlp.RawValue
- func (cr ChainReaderImpl) BorSpan(spanId uint64) *heimdall.Span
- func (cr ChainReaderImpl) BorStartEventId(hash libcommon.Hash, blockNum uint64) uint64
- func (cr ChainReaderImpl) Config() *chain.Config
- func (cr ChainReaderImpl) CurrentFinalizedHeader() *types.Header
- func (cr ChainReaderImpl) CurrentHeader() *types.Header
- func (cr ChainReaderImpl) CurrentSafeHeader() *types.Header
- func (cr ChainReaderImpl) FrozenBlocks() uint64
- func (cr ChainReaderImpl) FrozenBorBlocks() uint64
- func (cr ChainReaderImpl) GetBlock(hash libcommon.Hash, number uint64) *types.Block
- func (cr ChainReaderImpl) GetHeader(hash libcommon.Hash, number uint64) *types.Header
- func (cr ChainReaderImpl) GetHeaderByHash(hash libcommon.Hash) *types.Header
- func (cr ChainReaderImpl) GetHeaderByNumber(number uint64) *types.Header
- func (cr ChainReaderImpl) GetTd(hash libcommon.Hash, number uint64) *big.Int
- func (cr ChainReaderImpl) HasBlock(hash libcommon.Hash, number uint64) bool
- type CurrentSyncCycleInfo
- type CustomTraceCfg
- type DownloaderGlue
- type ExecFunc
- type ExecuteBlockCfg
- type FinishCfg
- type HeadersCfg
- type MiningBlock
- type MiningCreateBlockCfg
- type MiningExecCfg
- type MiningFinishCfg
- type MiningState
- type PolygonSyncStageCfg
- type PostExecCfg
- type Progress
- type PruneFunc
- type PruneOrder
- type PruneState
- type SendersCfg
- type SnapshotsCfg
- type Stage
- func DefaultStages(ctx context.Context, snapshots SnapshotsCfg, headers HeadersCfg, ...) []*Stage
- func DownloadSyncStages(ctx context.Context, snapshots SnapshotsCfg) []*Stage
- func MiningStages(ctx context.Context, createBlockCfg MiningCreateBlockCfg, ...) []*Stage
- func PipelineStages(ctx context.Context, snapshots SnapshotsCfg, blockHashCfg BlockHashesCfg, ...) []*Stage
- func PolygonSyncStages(ctx context.Context, snapshots SnapshotsCfg, ...) []*Stage
- func StateStages(ctx context.Context, headers HeadersCfg, bodies BodiesCfg, ...) []*Stage
- func UploaderPipelineStages(ctx context.Context, snapshots SnapshotsCfg, headers HeadersCfg, ...) []*Stage
- type StageState
- type Sync
- func (s *Sync) Cfg() ethconfig.Sync
- func (s *Sync) DisableAllStages() []stages.SyncStage
- func (s *Sync) DisableStages(ids ...stages.SyncStage)
- func (s *Sync) EnableStages(ids ...stages.SyncStage)
- func (s *Sync) HasUnwindPoint() bool
- func (s *Sync) IsAfter(stage1, stage2 stages.SyncStage) bool
- func (s *Sync) IsBefore(stage1, stage2 stages.SyncStage) bool
- func (s *Sync) IsDone() bool
- func (s *Sync) Len() int
- func (s *Sync) LogPrefix() string
- func (s *Sync) MockExecFunc(id stages.SyncStage, f ExecFunc)
- func (s *Sync) NewUnwindState(id stages.SyncStage, unwindPoint, currentProgress uint64, ...) *UnwindState
- func (s *Sync) NextStage()
- func (s *Sync) PrevUnwindPoint() *uint64
- func (s *Sync) PrintTimings() []interface{}
- func (s *Sync) PruneStageState(id stages.SyncStage, forwardProgress uint64, tx kv.Tx, db kv.RwDB, ...) (*PruneState, error)
- func (s *Sync) Run(db kv.RwDB, txc wrap.TxContainer, initialCycle, firstCycle bool) (bool, error)
- func (s *Sync) RunNoInterrupt(db kv.RwDB, txc wrap.TxContainer) error
- func (s *Sync) RunPrune(db kv.RwDB, tx kv.RwTx, initialCycle bool) error
- func (s *Sync) RunUnwind(db kv.RwDB, txc wrap.TxContainer) error
- func (s *Sync) SetCurrentStage(id stages.SyncStage) error
- func (s *Sync) StageState(stage stages.SyncStage, tx kv.Tx, db kv.RoDB, initialCycle, firstCycle bool) (*StageState, error)
- func (s *Sync) StagesIdsList() []string
- func (s *Sync) UnwindPoint() uint64
- func (s *Sync) UnwindReason() UnwindReason
- func (s *Sync) UnwindTo(unwindPoint uint64, reason UnwindReason, tx kv.Tx) error
- type Timing
- type TrieCfg
- type TxLookupCfg
- type TxPoolForMining
- type UnwindFunc
- type UnwindOrder
- type UnwindReason
- type UnwindState
- type Unwinder
Constants ¶
const ShortPoSReorgThresholdBlocks = 10
The number of blocks we should be able to re-org sub-second on commodity hardware. See https://hackmd.io/TdJtNs0dS56q-In8h-ShSg
Variables ¶
var ( ErrHeaderValidatorsLengthMismatch = errors.New("header validators length mismatch") ErrHeaderValidatorsBytesMismatch = errors.New("header validators bytes mismatch") )
var DefaultForwardOrder = UnwindOrder{ stages.Snapshots, stages.Headers, stages.BorHeimdall, stages.BlockHashes, stages.Bodies, stages.Senders, stages.Execution, stages.TxLookup, stages.Finish, }
var DefaultPruneOrder = PruneOrder{ stages.Finish, stages.TxLookup, stages.Execution, stages.Senders, stages.Bodies, stages.BlockHashes, stages.BorHeimdall, stages.Headers, stages.Snapshots, }
var DefaultUnwindOrder = UnwindOrder{ stages.Finish, stages.TxLookup, stages.Execution, stages.Senders, stages.Bodies, stages.BlockHashes, stages.BorHeimdall, stages.Headers, }
var ErrInvalidStateRootHash = errors.New("invalid state root hash")
var ErrTooDeepUnwind = errors.New("too deep unwind")
var ExecUnwind = UnwindReason{nil, nil}
var ForkChoice = UnwindReason{nil, nil}
var MiningPruneOrder = PruneOrder{} // nothing to unwind in mining - because mining does not commit db changes
var MiningUnwindOrder = UnwindOrder{} // nothing to unwind in mining - because mining does not commit db changes
var PipelinePruneOrder = PruneOrder{ stages.Finish, stages.TxLookup, stages.Execution, stages.Senders, stages.BlockHashes, stages.Snapshots, }
var PipelineUnwindOrder = UnwindOrder{ stages.Finish, stages.TxLookup, stages.Execution, stages.Senders, stages.BlockHashes, }
var PolygonSyncPruneOrder = PruneOrder{ stages.Finish, stages.TxLookup, stages.Execution, stages.Senders, stages.PolygonSync, stages.Snapshots, }
var PolygonSyncUnwindOrder = UnwindOrder{ stages.Finish, stages.TxLookup, stages.Execution, stages.Senders, stages.PolygonSync, }
var StagedUnwind = UnwindReason{nil, nil}
var StateUnwindOrder = UnwindOrder{ stages.Execution, stages.Senders, stages.Bodies, stages.BlockHashes, stages.Headers, }
Functions ¶
func BodiesForward ¶
func BodiesForward(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg BodiesCfg, test bool, logger log.Logger) error
BodiesForward progresses Bodies stage in the forward direction
func BorHeimdallForward ¶
func BorHeimdallForward( s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg BorHeimdallCfg, logger log.Logger, ) (err error)
func BorHeimdallUnwind ¶
func BorHeimdallUnwind(u *UnwindState, ctx context.Context, _ *StageState, tx kv.RwTx, cfg BorHeimdallCfg) (err error)
func CollectTableSizes ¶
func DownloadAndIndexSnapshotsIfNeed ¶
func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.RwTx, cfg SnapshotsCfg, logger log.Logger) error
func ExecBlockV3 ¶
func ExecBlockV3(s *StageState, u Unwinder, txc wrap.TxContainer, toBlock uint64, ctx context.Context, cfg ExecuteBlockCfg, initialCycle bool, logger log.Logger, isMining bool) (err error)
func ExecV3 ¶
func ExecV3(ctx context.Context, execStage *StageState, u Unwinder, workerCount int, cfg ExecuteBlockCfg, txc wrap.TxContainer, parallel bool, maxBlockNum uint64, logger log.Logger, initialCycle bool, isMining bool, ) error
func FillDBFromSnapshots ¶
func FinishForward ¶
func FinishForward(s *StageState, tx kv.RwTx, cfg FinishCfg) error
func ForwardPolygonSyncStage ¶
func ForwardPolygonSyncStage( ctx context.Context, tx kv.RwTx, stageState *StageState, unwinder Unwinder, cfg PolygonSyncStageCfg, ) error
func HeadersPOW ¶
func HeadersPOW(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg HeadersCfg, test bool, useExternalTx bool, logger log.Logger) error
HeadersPOW progresses Headers stage for Proof-of-Work headers
func HeadersUnwind ¶
func HeadersUnwind(ctx context.Context, u *UnwindState, s *StageState, tx kv.RwTx, cfg HeadersCfg, test bool) (err error)
func MiningBorHeimdallForward ¶
func MiningBorHeimdallForward( ctx context.Context, cfg BorHeimdallCfg, stageStage *StageState, unwinder Unwinder, tx kv.RwTx, logger log.Logger, ) error
func NotifyNewHeaders ¶
func NotifyNewHeaders(ctx context.Context, notifyFrom, notifyTo uint64, notifier ChainEventNotifier, tx kv.Tx, logger log.Logger) error
[from,to)
func NotifyPendingLogs ¶
func NotifyPendingLogs(logPrefix string, notifier ChainEventNotifier, logs types.Logs, logger log.Logger)
func PruneBlockHashStage ¶
func PruneBlockHashStage(p *PruneState, tx kv.RwTx, cfg BlockHashesCfg, ctx context.Context) (err error)
func PruneExecutionStage ¶
func PruneExecutionStage(s *PruneState, tx kv.RwTx, cfg ExecuteBlockCfg, ctx context.Context) (err error)
func PruneFinish ¶
func PruneSendersStage ¶
func PruneSendersStage(s *PruneState, tx kv.RwTx, cfg SendersCfg, ctx context.Context) (err error)
func PruneTxLookup ¶
func PruneTxLookup(s *PruneState, tx kv.RwTx, cfg TxLookupCfg, ctx context.Context, logger log.Logger) (err error)
func PruneVerkleTries ¶
func SnapshotsPrune ¶
func SnapshotsPrune(s *PruneState, cfg SnapshotsCfg, ctx context.Context, tx kv.RwTx, logger log.Logger) (err error)
====== PRUNING ======
snapshots pruning sections works more as a retiring of blocks retiring blocks means moving block data from db into snapshots
func SpawnBlockHashStage ¶
func SpawnBlockHashStage(s *StageState, tx kv.RwTx, cfg BlockHashesCfg, ctx context.Context, logger log.Logger) (err error)
func SpawnCustomTrace ¶
func SpawnCustomTrace(cfg CustomTraceCfg, ctx context.Context, logger log.Logger) error
func SpawnExecuteBlocksStage ¶
func SpawnExecuteBlocksStage(s *StageState, u Unwinder, txc wrap.TxContainer, toBlock uint64, ctx context.Context, cfg ExecuteBlockCfg, logger log.Logger) (err error)
func SpawnMiningCreateBlockStage ¶
func SpawnMiningCreateBlockStage(s *StageState, txc wrap.TxContainer, cfg MiningCreateBlockCfg, quit <-chan struct{}, logger log.Logger) (err error)
SpawnMiningCreateBlockStage TODO: - resubmitAdjustCh - variable is not implemented
func SpawnMiningExecStage ¶
func SpawnMiningExecStage(s *StageState, txc wrap.TxContainer, cfg MiningExecCfg, sendersCfg SendersCfg, execCfg ExecuteBlockCfg, ctx context.Context, logger log.Logger, u Unwinder) error
SpawnMiningExecStage TODO: - resubmitAdjustCh - variable is not implemented
func SpawnMiningFinishStage ¶
func SpawnMiningFinishStage(s *StageState, tx kv.RwTx, cfg MiningFinishCfg, quit <-chan struct{}, logger log.Logger) error
func SpawnPostExecStage ¶
func SpawnPostExecStage(s *StageState, tx kv.RwTx, cfg PostExecCfg, ctx context.Context) error
func SpawnRecoverSendersStage ¶
func SpawnRecoverSendersStage(cfg SendersCfg, s *StageState, u Unwinder, tx kv.RwTx, toBlock uint64, ctx context.Context, logger log.Logger) error
func SpawnStageHeaders ¶
func SpawnStageHeaders(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, cfg HeadersCfg, test bool, logger log.Logger) error
func SpawnStageSnapshots ¶
func SpawnStageSnapshots( s *StageState, ctx context.Context, tx kv.RwTx, cfg SnapshotsCfg, logger log.Logger, ) (err error)
func SpawnTxLookup ¶
func SpawnTxLookup(s *StageState, tx kv.RwTx, toBlock uint64, cfg TxLookupCfg, ctx context.Context, logger log.Logger) (err error)
func SpawnVerkleTrie ¶
func UnwindBlockHashStage ¶
func UnwindBlockHashStage(u *UnwindState, tx kv.RwTx, cfg BlockHashesCfg, ctx context.Context) (err error)
func UnwindBodiesStage ¶
func UnwindExecutionStage ¶
func UnwindExecutionStage(u *UnwindState, s *StageState, txc wrap.TxContainer, ctx context.Context, cfg ExecuteBlockCfg, logger log.Logger) (err error)
func UnwindFinish ¶
func UnwindPolygonSyncStage ¶
func UnwindPolygonSyncStage(ctx context.Context, tx kv.RwTx, u *UnwindState, cfg PolygonSyncStageCfg) error
func UnwindPostExecStage ¶
func UnwindPostExecStage(u *UnwindState, s *StageState, tx kv.RwTx, cfg PostExecCfg, ctx context.Context) (err error)
func UnwindSendersStage ¶
func UnwindSendersStage(u *UnwindState, tx kv.RwTx, cfg SendersCfg, ctx context.Context) (err error)
func UnwindTxLookup ¶
func UnwindTxLookup(u *UnwindState, s *StageState, tx kv.RwTx, cfg TxLookupCfg, ctx context.Context, logger log.Logger) (err error)
func UnwindVerkleTrie ¶
func UnwindVerkleTrie(u *UnwindState, s *StageState, tx kv.RwTx, cfg TrieCfg, ctx context.Context, logger log.Logger) (err error)
Types ¶
type BlockHashesCfg ¶
type BlockHashesCfg struct {
// contains filtered or unexported fields
}
func StageBlockHashesCfg ¶
func StageBlockHashesCfg(db kv.RwDB, tmpDir string, cc *chain.Config, headerWriter *blockio.BlockWriter) BlockHashesCfg
type BodiesCfg ¶
type BodiesCfg struct {
// contains filtered or unexported fields
}
func StageBodiesCfg ¶
func StageBodiesCfg(db kv.RwDB, bd *bodydownload.BodyDownload, bodyReqSend func(context.Context, *bodydownload.BodyRequest) ([64]byte, bool), penalise func(context.Context, []headerdownload.PenaltyItem), blockPropagator adapter.BlockPropagator, timeout int, chanConfig chain.Config, blockReader services.FullBlockReader, blockWriter *blockio.BlockWriter, ) BodiesCfg
type BorHeimdallCfg ¶
type BorHeimdallCfg struct {
// contains filtered or unexported fields
}
func StageBorHeimdallCfg ¶
func StageBorHeimdallCfg( db kv.RwDB, snapDb kv.RwDB, miningState MiningState, chainConfig chain.Config, heimdallClient heimdall.HeimdallClient, heimdallStore heimdall.Store, bridgeStore bridge.Store, blockReader services.FullBlockReader, hd *headerdownload.HeaderDownload, penalize func(context.Context, []headerdownload.PenaltyItem), recents *lru.ARCCache[libcommon.Hash, *bor.Snapshot], signatures *lru.ARCCache[libcommon.Hash, libcommon.Address], recordWaypoints bool, userUnwindTypeOverrides []string, ) BorHeimdallCfg
type ChainEventNotifier ¶
type ChainReader ¶
type ChainReader struct { Cfg chain.Config Db kv.Tx BlockReader services.FullBlockReader Logger log.Logger }
ChainReader implements consensus.ChainReader
func (ChainReader) BorEventsByBlock ¶
func (ChainReader) BorStartEventId ¶
func (cr ChainReader) BorStartEventId(_ libcommon.Hash, _ uint64) uint64
func (ChainReader) Config ¶
func (cr ChainReader) Config() *chain.Config
Config retrieves the blockchain's chain configuration.
func (ChainReader) CurrentFinalizedHeader ¶
func (cr ChainReader) CurrentFinalizedHeader() *types.Header
CurrentFinalizedHeader retrieves the current finalized header from the local chain.
func (ChainReader) CurrentHeader ¶
func (cr ChainReader) CurrentHeader() *types.Header
CurrentHeader retrieves the current header from the local chain.
func (ChainReader) CurrentSafeHeader ¶
func (cr ChainReader) CurrentSafeHeader() *types.Header
func (ChainReader) FrozenBlocks ¶
func (cr ChainReader) FrozenBlocks() uint64
func (ChainReader) FrozenBorBlocks ¶
func (cr ChainReader) FrozenBorBlocks() uint64
func (ChainReader) GetHeader ¶
GetHeader retrieves a block header from the database by hash and number.
func (ChainReader) GetHeaderByHash ¶
func (cr ChainReader) GetHeaderByHash(hash libcommon.Hash) *types.Header
GetHeaderByHash retrieves a block header from the database by its hash.
func (ChainReader) GetHeaderByNumber ¶
func (cr ChainReader) GetHeaderByNumber(number uint64) *types.Header
GetHeaderByNumber retrieves a block header from the database by number.
type ChainReaderImpl ¶
type ChainReaderImpl struct {
// contains filtered or unexported fields
}
func NewChainReaderImpl ¶
func NewChainReaderImpl(config *chain.Config, tx kv.Tx, blockReader services.FullBlockReader, logger log.Logger) *ChainReaderImpl
func (ChainReaderImpl) BorEventsByBlock ¶
func (ChainReaderImpl) BorStartEventId ¶
func (cr ChainReaderImpl) BorStartEventId(hash libcommon.Hash, blockNum uint64) uint64
func (ChainReaderImpl) Config ¶
func (cr ChainReaderImpl) Config() *chain.Config
func (ChainReaderImpl) CurrentFinalizedHeader ¶
func (cr ChainReaderImpl) CurrentFinalizedHeader() *types.Header
func (ChainReaderImpl) CurrentHeader ¶
func (cr ChainReaderImpl) CurrentHeader() *types.Header
func (ChainReaderImpl) CurrentSafeHeader ¶
func (cr ChainReaderImpl) CurrentSafeHeader() *types.Header
func (ChainReaderImpl) FrozenBlocks ¶
func (cr ChainReaderImpl) FrozenBlocks() uint64
func (ChainReaderImpl) FrozenBorBlocks ¶
func (cr ChainReaderImpl) FrozenBorBlocks() uint64
func (ChainReaderImpl) GetHeaderByHash ¶
func (cr ChainReaderImpl) GetHeaderByHash(hash libcommon.Hash) *types.Header
func (ChainReaderImpl) GetHeaderByNumber ¶
func (cr ChainReaderImpl) GetHeaderByNumber(number uint64) *types.Header
type CurrentSyncCycleInfo ¶
type CustomTraceCfg ¶
type CustomTraceCfg struct {
// contains filtered or unexported fields
}
type DownloaderGlue ¶
type DownloaderGlue interface { SpawnHeaderDownloadStage([]func() error, *StageState, Unwinder) error SpawnBodyDownloadStage(string, string, *StageState, Unwinder, *bodydownload.PrefetchedBlocks) (bool, error) }
type ExecFunc ¶
type ExecFunc func(badBlockUnwind bool, s *StageState, unwinder Unwinder, txc wrap.TxContainer, logger log.Logger) error
ExecFunc is the execution function for the stage to move forward. * state - is the current state of the stage and contains stage data. * unwinder - if the stage needs to cause unwinding, `unwinder` methods can be used.
type ExecuteBlockCfg ¶
type ExecuteBlockCfg struct {
// contains filtered or unexported fields
}
func StageExecuteBlocksCfg ¶
func StageExecuteBlocksCfg( db kv.RwDB, pm prune.Mode, batchSize datasize.ByteSize, chainConfig *chain.Config, engine consensus.Engine, vmConfig *vm.Config, notifications *shards.Notifications, stateStream bool, badBlockHalt bool, keepAllChangesets bool, dirs datadir.Dirs, blockReader services.FullBlockReader, hd headerDownloader, genesis *types.Genesis, syncCfg ethconfig.Sync, silkworm *silkworm.Silkworm, ) ExecuteBlockCfg
type FinishCfg ¶
type FinishCfg struct {
// contains filtered or unexported fields
}
func StageFinishCfg ¶
func StageFinishCfg(db kv.RwDB, tmpDir string, forkValidator *engine_helpers.ForkValidator) FinishCfg
type HeadersCfg ¶
type HeadersCfg struct {
// contains filtered or unexported fields
}
func StageHeadersCfg ¶
func StageHeadersCfg( db kv.RwDB, headerDownload *headerdownload.HeaderDownload, bodyDownload *bodydownload.BodyDownload, chainConfig chain.Config, syncConfig ethconfig.Sync, headerReqSend func(context.Context, *headerdownload.HeaderRequest) ([64]byte, bool), announceNewHashes func(context.Context, []headerdownload.Announce), penalize func(context.Context, []headerdownload.PenaltyItem), batchSize datasize.ByteSize, noP2PDiscovery bool, blockReader services.FullBlockReader, blockWriter *blockio.BlockWriter, tmpdir string, notifications *shards.Notifications, ) HeadersCfg
type MiningBlock ¶
type MiningBlock struct { ParentHeaderTime uint64 Header *types.Header Uncles []*types.Header Txs types.Transactions Receipts types.Receipts Withdrawals []*types.Withdrawal PreparedTxs types.TransactionsStream Requests types.FlatRequests }
type MiningCreateBlockCfg ¶
type MiningCreateBlockCfg struct {
// contains filtered or unexported fields
}
func StageMiningCreateBlockCfg ¶
func StageMiningCreateBlockCfg(db kv.RwDB, miner MiningState, chainConfig chain.Config, engine consensus.Engine, txPoolDB kv.RoDB, blockBuilderParameters *core.BlockBuilderParameters, tmpdir string, blockReader services.FullBlockReader) MiningCreateBlockCfg
type MiningExecCfg ¶
type MiningExecCfg struct {
// contains filtered or unexported fields
}
func StageMiningExecCfg ¶
func StageMiningExecCfg( db kv.RwDB, miningState MiningState, notifier ChainEventNotifier, chainConfig chain.Config, engine consensus.Engine, vmConfig *vm.Config, tmpdir string, interrupt *int32, payloadId uint64, txPool TxPoolForMining, txPoolDB kv.RoDB, blockReader services.FullBlockReader, ) MiningExecCfg
type MiningFinishCfg ¶
type MiningFinishCfg struct {
// contains filtered or unexported fields
}
func StageMiningFinishCfg ¶
func StageMiningFinishCfg( db kv.RwDB, chainConfig chain.Config, engine consensus.Engine, miningState MiningState, sealCancel chan struct{}, blockReader services.FullBlockReader, latestBlockBuiltStore *builder.LatestBlockBuiltStore, ) MiningFinishCfg
type MiningState ¶
type MiningState struct { MiningConfig *params.MiningConfig PendingResultCh chan *types.Block MiningResultCh chan *types.BlockWithReceipts MiningBlock *MiningBlock }
func NewMiningState ¶
func NewMiningState(cfg *params.MiningConfig) MiningState
type PolygonSyncStageCfg ¶
type PolygonSyncStageCfg struct {
// contains filtered or unexported fields
}
func NewPolygonSyncStageCfg ¶
func NewPolygonSyncStageCfg( logger log.Logger, chainConfig *chain.Config, db kv.RwDB, heimdallClient heimdall.HeimdallClient, heimdallStore heimdall.Store, bridgeStore bridge.Store, sentry sentryproto.SentryClient, maxPeers int, statusDataProvider *sentry.StatusDataProvider, blockReader services.FullBlockReader, stopNode func() error, blockLimit uint, userUnwindTypeOverrides []string, ) PolygonSyncStageCfg
type PostExecCfg ¶
type PostExecCfg struct {
// contains filtered or unexported fields
}
func StagePostExecCfg ¶
func StagePostExecCfg(db kv.RwDB, borDb kv.RwDB) PostExecCfg
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶
type PruneFunc ¶
type PruneFunc func(p *PruneState, tx kv.RwTx, logger log.Logger) error
PruneFunc is the execution function for the stage to prune old data. * state - is the current state of the stage and contains stage data.
type PruneOrder ¶
type PruneState ¶
type PruneState struct { ID stages.SyncStage ForwardProgress uint64 // progress of stage forward move PruneProgress uint64 // progress of stage prune move. after sync cycle it become equal to ForwardProgress by Done() method CurrentSyncCycle CurrentSyncCycleInfo // contains filtered or unexported fields }
func (*PruneState) LogPrefix ¶
func (s *PruneState) LogPrefix() string
type SendersCfg ¶
type SendersCfg struct {
// contains filtered or unexported fields
}
func StageSendersCfg ¶
func StageSendersCfg(db kv.RwDB, chainCfg *chain.Config, syncCfg ethconfig.Sync, badBlockHalt bool, tmpdir string, prune prune.Mode, blockReader services.FullBlockReader, hd *headerdownload.HeaderDownload) SendersCfg
type SnapshotsCfg ¶
type SnapshotsCfg struct {
// contains filtered or unexported fields
}
func StageSnapshotsCfg ¶
func StageSnapshotsCfg(db kv.RwDB, chainConfig chain.Config, syncConfig ethconfig.Sync, dirs datadir.Dirs, blockRetire services.BlockRetire, snapshotDownloader protodownloader.DownloaderClient, blockReader services.FullBlockReader, notifier *shards.Notifications, agg *state.Aggregator, caplin bool, blobs bool, silkworm *silkworm.Silkworm, prune prune.Mode, ) SnapshotsCfg
type Stage ¶
type Stage struct { // Description is a string that is shown in the logs. Description string // DisabledDescription shows in the log with a message if the stage is disabled. Here, you can show which command line flags should be provided to enable the page. DisabledDescription string // Forward is called when the stage is executed. The main logic of the stage should be here. Should always end with `s.Done()` to allow going to the next stage. MUST NOT be nil! Forward ExecFunc // Unwind is called when the stage should be unwound. The unwind logic should be there. MUST NOT be nil! Unwind UnwindFunc Prune PruneFunc // ID of the sync stage. Should not be empty and should be unique. It is recommended to prefix it with reverse domain to avoid clashes (`com.example.my-stage`). ID stages.SyncStage // Disabled defines if the stage is disabled. It sets up when the stage is build by its `StageBuilder`. Disabled bool }
Stage is a single sync stage in staged sync.
func DefaultStages ¶
func DefaultStages(ctx context.Context, snapshots SnapshotsCfg, headers HeadersCfg, borHeimdallCfg BorHeimdallCfg, blockHashCfg BlockHashesCfg, bodies BodiesCfg, senders SendersCfg, exec ExecuteBlockCfg, txLookup TxLookupCfg, finish FinishCfg, test bool) []*Stage
func DownloadSyncStages ¶
func DownloadSyncStages( ctx context.Context, snapshots SnapshotsCfg, ) []*Stage
func MiningStages ¶
func MiningStages( ctx context.Context, createBlockCfg MiningCreateBlockCfg, borHeimdallCfg BorHeimdallCfg, executeBlockCfg ExecuteBlockCfg, sendersCfg SendersCfg, execCfg MiningExecCfg, finish MiningFinishCfg, ) []*Stage
func PipelineStages ¶
func PipelineStages(ctx context.Context, snapshots SnapshotsCfg, blockHashCfg BlockHashesCfg, senders SendersCfg, exec ExecuteBlockCfg, txLookup TxLookupCfg, finish FinishCfg, test bool) []*Stage
func PolygonSyncStages ¶
func PolygonSyncStages( ctx context.Context, snapshots SnapshotsCfg, polygonSyncStageCfg PolygonSyncStageCfg, senders SendersCfg, exec ExecuteBlockCfg, txLookup TxLookupCfg, finish FinishCfg, ) []*Stage
func StateStages ¶
func StateStages(ctx context.Context, headers HeadersCfg, bodies BodiesCfg, blockHashCfg BlockHashesCfg, senders SendersCfg, exec ExecuteBlockCfg) []*Stage
StateStages are all stages necessary for basic unwind and stage computation, it is primarily used to process side forks and memory execution.
func UploaderPipelineStages ¶
func UploaderPipelineStages(ctx context.Context, snapshots SnapshotsCfg, headers HeadersCfg, blockHashCfg BlockHashesCfg, senders SendersCfg, bodies BodiesCfg, exec ExecuteBlockCfg, txLookup TxLookupCfg, finish FinishCfg, test bool) []*Stage
when uploading - potentially from zero we need to include headers and bodies stages otherwise we won't recover the POW portion of the chain
type StageState ¶
type StageState struct { ID stages.SyncStage BlockNumber uint64 // BlockNumber is the current block number of the stage at the beginning of the state execution. CurrentSyncCycle CurrentSyncCycleInfo // contains filtered or unexported fields }
StageState is the state of the stage.
func (*StageState) ExecutionAt ¶
func (s *StageState) ExecutionAt(db kv.Getter) (uint64, error)
ExecutionAt gets the current state of the "Execution" stage, which block is currently executed.
func (*StageState) LogPrefix ¶
func (s *StageState) LogPrefix() string
func (*StageState) Update ¶
func (s *StageState) Update(db kv.Putter, newBlockNum uint64) error
Update updates the stage state (current block number) in the database. Can be called multiple times during stage execution.
func (*StageState) UpdatePrune ¶
func (s *StageState) UpdatePrune(db kv.Putter, blockNum uint64) error
type Sync ¶
type Sync struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg ethconfig.Sync, stagesList []*Stage, unwindOrder UnwindOrder, pruneOrder PruneOrder, logger log.Logger) *Sync
func (*Sync) DisableAllStages ¶
DisableAllStages - including their unwinds
func (*Sync) DisableStages ¶
func (*Sync) EnableStages ¶
func (*Sync) HasUnwindPoint ¶
func (*Sync) NewUnwindState ¶
func (*Sync) PrevUnwindPoint ¶
func (*Sync) PrintTimings ¶
func (s *Sync) PrintTimings() []interface{}
func (*Sync) PruneStageState ¶
func (s *Sync) PruneStageState(id stages.SyncStage, forwardProgress uint64, tx kv.Tx, db kv.RwDB, initialCycle bool) (*PruneState, error)
Get the current prune status from the DB
func (*Sync) RunNoInterrupt ¶
func (*Sync) RunPrune ¶
Run pruning for stages as per the defined pruning order, if enabled for that stage
func (*Sync) StageState ¶
func (*Sync) StagesIdsList ¶
func (*Sync) UnwindPoint ¶
func (*Sync) UnwindReason ¶
func (s *Sync) UnwindReason() UnwindReason
type TrieCfg ¶
type TrieCfg struct {
// contains filtered or unexported fields
}
func StageTrieCfg ¶
func StageTrieCfg(db kv.RwDB, checkRoot, saveNewHashesToDB, badBlockHalt bool, tmpDir string, blockReader services.FullBlockReader, hd *headerdownload.HeaderDownload, historyV3 bool, agg *state.Aggregator) TrieCfg
type TxLookupCfg ¶
type TxLookupCfg struct {
// contains filtered or unexported fields
}
func StageTxLookupCfg ¶
func StageTxLookupCfg( db kv.RwDB, prune prune.Mode, tmpdir string, borConfigInterface chain.BorConfig, blockReader services.FullBlockReader, ) TxLookupCfg
type TxPoolForMining ¶
type UnwindFunc ¶
type UnwindFunc func(u *UnwindState, s *StageState, txc wrap.TxContainer, logger log.Logger) error
UnwindFunc is the unwinding logic of the stage. * unwindState - contains information about the unwind itself. * stageState - represents the state of this stage at the beginning of unwind.
type UnwindOrder ¶
UnwindOrder represents the order in which the stages needs to be unwound. The unwind order is important and not always just stages going backwards. Let's say, there is txn pool can be unwound only after execution. It's ok to remove some stage from here to disable only unwind of stage
type UnwindReason ¶
type UnwindReason struct { // If we're unwinding due to a fork - we want to unlink blocks but not mark // them as bad - as they may get replayed then deselected Block *libcommon.Hash // If unwind is caused by a bad block, this error is not empty Err error }
func ForkReset ¶
func ForkReset(badBlock libcommon.Hash) UnwindReason
func (UnwindReason) IsBadBlock ¶
func (u UnwindReason) IsBadBlock() bool
type UnwindState ¶
type UnwindState struct { ID stages.SyncStage // UnwindPoint is the block to unwind to. UnwindPoint uint64 CurrentBlockNumber uint64 Reason UnwindReason CurrentSyncCycle CurrentSyncCycleInfo // contains filtered or unexported fields }
UnwindState contains the information about unwind.
func (*UnwindState) Done ¶
func (u *UnwindState) Done(db kv.Putter) error
Done updates the DB state of the stage.
func (*UnwindState) LogPrefix ¶
func (u *UnwindState) LogPrefix() string
Source Files ¶
- bor_heimdall_shared.go
- chain_reader.go
- default_stages.go
- exec3.go
- exec3_parallel.go
- stage.go
- stage_blockhashes.go
- stage_bodies.go
- stage_bor_heimdall.go
- stage_commit_rebuild.go
- stage_custom_trace.go
- stage_execute.go
- stage_finish.go
- stage_headers.go
- stage_mining_bor_heimdall.go
- stage_mining_create_block.go
- stage_mining_exec.go
- stage_mining_finish.go
- stage_polygon_sync.go
- stage_postexec.go
- stage_senders.go
- stage_snapshots.go
- stage_txlookup.go
- stage_verkle_trie.go
- stagebuilder.go
- sync.go
- testutil.go
- types.go