Documentation ¶
Index ¶
- func BodiesForward(s *StageState, ctx context.Context, tx ethdb.RwTx, cfg BodiesCfg) error
- func FinishForward(s *StageState, tx ethdb.RwTx, cfg FinishCfg, btClient *snapshotsync.Client, ...) error
- func HeadersForward(s *StageState, u Unwinder, ctx context.Context, tx ethdb.RwTx, cfg HeadersCfg, ...) error
- func HeadersUnwind(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HeadersCfg) error
- func InsertBlockInStages(db ethdb.Database, config *params.ChainConfig, vmConfig *vm.Config, ...) (bool, error)
- func InsertBlocksInStages(db ethdb.Database, storageMode ethdb.StorageMode, config *params.ChainConfig, ...) (bool, error)
- func InsertHeaderChain(logPrefix string, db ethdb.Database, headers []*types.Header, ...) (bool, bool, uint64, error)
- func InsertHeadersInStages(db ethdb.Database, config *params.ChainConfig, engine consensus.Engine, ...) (bool, bool, uint64, error)
- func MigrateSnapshot(to uint64, tx ethdb.RwTx, db ethdb.RwKV, btClient *snapshotsync.Client, ...) error
- func NotifyNewHeaders(from, to uint64, notifier ChainEventNotifier, db ethdb.Database) error
- func NotifyNewHeaders2(finishStageBeforeSync, unwindTo uint64, notifier ChainEventNotifier, ...) error
- func NotifyPendingBlock(logPrefix string, notifier ChainEventNotifier, block *types.Block)
- func NotifyPendingLogs(logPrefix string, notifier ChainEventNotifier, logs types.Logs)
- func PromoteHashedStateCleanly(logPrefix string, db ethdb.RwTx, cfg HashStateCfg, quit <-chan struct{}) error
- func RegenerateIntermediateHashes(logPrefix string, db ethdb.RwTx, cfg TrieCfg, expectedRootHash common.Hash, ...) (common.Hash, error)
- func ResetHashState(tx ethdb.RwTx) error
- func ResetIH(tx ethdb.RwTx) error
- func SpawnAccountHistoryIndex(s *StageState, tx ethdb.RwTx, cfg HistoryCfg, quitCh <-chan struct{}) error
- func SpawnBlockHashStage(s *StageState, tx ethdb.RwTx, cfg BlockHashesCfg, quit <-chan struct{}) error
- func SpawnBodiesSnapshotGenerationStage(s *StageState, db ethdb.RwKV, tx ethdb.RwTx, snapshotDir string, ...) error
- func SpawnCallTraces(s *StageState, tx ethdb.RwTx, quit <-chan struct{}, cfg CallTracesCfg) error
- func SpawnExecuteBlocksStage(s *StageState, tx ethdb.RwTx, toBlock uint64, quit <-chan struct{}, ...) error
- func SpawnHashStateStage(s *StageState, tx ethdb.RwTx, cfg HashStateCfg, quit <-chan struct{}) error
- func SpawnHeaderDownloadStage(s *StageState, u Unwinder, d DownloaderGlue, headersFetchers []func() error) error
- func SpawnHeadersSnapshotGenerationStage(s *StageState, tx ethdb.RwTx, cfg HeadersSnapshotGenCfg, ...) error
- func SpawnIntermediateHashesStage(s *StageState, u Unwinder, tx ethdb.RwTx, cfg TrieCfg, quit <-chan struct{}) (common.Hash, error)
- func SpawnLogIndex(s *StageState, tx ethdb.RwTx, cfg LogIndexCfg, quit <-chan struct{}) error
- func SpawnMiningCreateBlockStage(s *StageState, tx ethdb.RwTx, current *miningBlock, ...) error
- func SpawnMiningExecStage(s *StageState, tx ethdb.RwTx, current *miningBlock, ...) error
- func SpawnMiningFinishStage(s *StageState, tx ethdb.RwTx, current *miningBlock, engine consensus.Engine, ...) error
- func SpawnRecoverSendersStage(cfg SendersCfg, s *StageState, tx ethdb.RwTx, toBlock uint64, ...) error
- func SpawnStateSnapshotGenerationStage(s *StageState, db ethdb.RwKV, tx ethdb.RwTx, snapshotDir string, ...) error
- func SpawnStorageHistoryIndex(s *StageState, tx ethdb.RwTx, cfg HistoryCfg, quitCh <-chan struct{}) error
- func SpawnTxLookup(s *StageState, tx ethdb.RwTx, cfg TxLookupCfg, quitCh <-chan struct{}) error
- func SpawnTxPool(s *StageState, tx ethdb.RwTx, cfg TxPoolCfg, quitCh <-chan struct{}) error
- func TxLookupTransform(logPrefix string, tx ethdb.RwTx, startKey, endKey []byte, ...) error
- func UnwindAccountHistoryIndex(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HistoryCfg, ...) error
- func UnwindBlockHashStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg BlockHashesCfg) error
- func UnwindBodiesStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg BodiesCfg) error
- func UnwindCallTraces(u *UnwindState, s *StageState, tx ethdb.RwTx, quitCh <-chan struct{}, ...) error
- func UnwindExecutionStage(u *UnwindState, s *StageState, tx ethdb.RwTx, quit <-chan struct{}, ...) error
- func UnwindFinish(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg FinishCfg) error
- func UnwindHashStateStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HashStateCfg, ...) error
- func UnwindIntermediateHashesStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg TrieCfg, ...) error
- func UnwindLogIndex(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg LogIndexCfg, ...) error
- func UnwindSendersStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg SendersCfg) error
- func UnwindStorageHistoryIndex(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HistoryCfg, ...) error
- func UnwindTxLookup(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg TxLookupCfg, ...) error
- func UnwindTxPool(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg TxPoolCfg, ...) error
- func UpdateMetrics(db ethdb.Getter) error
- func VerifyHeaders(db ethdb.Getter, headers []*types.Header, config *params.ChainConfig, ...) error
- type BlockHashesCfg
- type BodiesCfg
- type CallTracer
- func (ct *CallTracer) CaptureAccountRead(account common.Address) error
- func (ct *CallTracer) CaptureAccountWrite(account common.Address) error
- func (ct *CallTracer) CaptureEnd(depth int, output []byte, gasUsed uint64, t time.Duration, err error) error
- func (ct *CallTracer) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, ...) error
- func (ct *CallTracer) CaptureSelfDestruct(from common.Address, to common.Address, value *big.Int)
- func (ct *CallTracer) CaptureStart(depth int, from common.Address, to common.Address, precompile bool, ...) error
- func (ct *CallTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, ...) error
- type CallTracesCfg
- type ChainEventNotifier
- type ChainReader
- func (cr ChainReader) Config() *params.ChainConfig
- func (cr ChainReader) CurrentHeader() *types.Header
- func (cr ChainReader) GetBlock(hash common.Hash, number uint64) *types.Block
- func (cr ChainReader) GetHeader(hash common.Hash, number uint64) *types.Header
- func (cr ChainReader) GetHeaderByHash(hash common.Hash) *types.Header
- func (cr ChainReader) GetHeaderByNumber(number uint64) *types.Header
- func (cr ChainReader) HasBlock(hash common.Hash, number uint64) bool
- type ChangeSetHook
- type DownloaderGlue
- type ExecFunc
- type ExecuteBlockCfg
- type FinishCfg
- type HasChangeSetWriter
- type HashPromoter
- type HashStateCfg
- type HeadersCfg
- type HeadersSnapshotGenCfg
- type HistoryCfg
- type LogIndexCfg
- type MiningCfg
- type OldestAppearedLoad
- type OptionalParameters
- type PersistentUnwindStack
- func (s *PersistentUnwindStack) Add(u UnwindState, tx TxOrDb) error
- func (s *PersistentUnwindStack) AddFromDB(db ethdb.KVGetter, stageID stages.SyncStage) error
- func (s *PersistentUnwindStack) Empty() bool
- func (s *PersistentUnwindStack) LoadFromDB(db ethdb.KVGetter, stageID stages.SyncStage) (*UnwindState, error)
- func (s *PersistentUnwindStack) Pop() *UnwindState
- type Promoter
- type SendersCfg
- type Stage
- type StageBuilder
- type StageBuilders
- type StageParameters
- type StageState
- type StagedSync
- type State
- func (s *State) BeforeStageRun(id stages.SyncStage, f func(tx ethdb.RwTx) (ethdb.RwTx, error))
- func (s *State) BeforeStageUnwind(id stages.SyncStage, f func(tx ethdb.RwTx) (ethdb.RwTx, error))
- func (s *State) CurrentStage() (uint, *Stage)
- func (s *State) DisableAllStages()
- func (s *State) DisableStages(ids ...stages.SyncStage)
- func (s *State) EnableStages(ids ...stages.SyncStage)
- func (s *State) GetLocalHeight(db ethdb.KVGetter) (uint64, error)
- func (s *State) GetUnwindTo(db ethdb.KVGetter) (uint64, error)
- func (s *State) IsAfter(stage1, stage2 stages.SyncStage) bool
- func (s *State) IsBefore(stage1, stage2 stages.SyncStage) bool
- func (s *State) IsDone() bool
- func (s *State) Len() int
- func (s *State) LoadUnwindInfo(db ethdb.KVGetter) error
- func (s *State) LogPrefix() string
- func (s *State) MockExecFunc(id stages.SyncStage, f ExecFunc)
- func (s *State) NextStage()
- func (s *State) OnBeforeUnwind(f func(id stages.SyncStage, tx ethdb.RwTx) (ethdb.RwTx, error))
- func (s *State) Run(db ethdb.GetterPutter, tx ethdb.RwTx) error
- func (s *State) SetCurrentStage(id stages.SyncStage) error
- func (s *State) StageByID(id stages.SyncStage) (*Stage, error)
- func (s *State) StageState(stage stages.SyncStage, db ethdb.KVGetter) (*StageState, error)
- func (s *State) UnwindStage(unwind *UnwindState, db TxOrDb, tx ethdb.RwTx) error
- func (s *State) UnwindTo(blockNumber uint64, tx TxOrDb) error
- type StateReaderBuilder
- type StateWriterBuilder
- type TrieCfg
- type TxLookupCfg
- type TxOrDb
- type TxPoolCfg
- type UnwindFunc
- type UnwindOrder
- type UnwindState
- type Unwinder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodiesForward ¶
BodiesForward progresses Bodies stage in the forward direction
func FinishForward ¶
func FinishForward(s *StageState, tx ethdb.RwTx, cfg FinishCfg, btClient *snapshotsync.Client, snBuilder *snapshotsync.SnapshotMigrator) error
func HeadersForward ¶
func HeadersForward( s *StageState, u Unwinder, ctx context.Context, tx ethdb.RwTx, cfg HeadersCfg, initialCycle bool, ) error
HeadersForward progresses Headers stage in the forward direction
func HeadersUnwind ¶
func HeadersUnwind(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HeadersCfg) error
func InsertBlockInStages ¶
func InsertBlocksInStages ¶
func InsertHeaderChain ¶
func InsertHeadersInStages ¶
func MigrateSnapshot ¶
func MigrateSnapshot(to uint64, tx ethdb.RwTx, db ethdb.RwKV, btClient *snapshotsync.Client, mg *snapshotsync.SnapshotMigrator) error
func NotifyNewHeaders ¶
func NotifyNewHeaders(from, to uint64, notifier ChainEventNotifier, db ethdb.Database) error
func NotifyNewHeaders2 ¶
func NotifyNewHeaders2(finishStageBeforeSync, unwindTo uint64, notifier ChainEventNotifier, db ethdb.Database) error
func NotifyPendingBlock ¶
func NotifyPendingBlock(logPrefix string, notifier ChainEventNotifier, block *types.Block)
func NotifyPendingLogs ¶
func NotifyPendingLogs(logPrefix string, notifier ChainEventNotifier, logs types.Logs)
func PromoteHashedStateCleanly ¶
func PromoteHashedStateCleanly(logPrefix string, db ethdb.RwTx, cfg HashStateCfg, quit <-chan struct{}) error
func ResetHashState ¶
func SpawnAccountHistoryIndex ¶
func SpawnAccountHistoryIndex(s *StageState, tx ethdb.RwTx, cfg HistoryCfg, quitCh <-chan struct{}) error
func SpawnBlockHashStage ¶
func SpawnBlockHashStage(s *StageState, tx ethdb.RwTx, cfg BlockHashesCfg, quit <-chan struct{}) error
func SpawnBodiesSnapshotGenerationStage ¶
func SpawnBodiesSnapshotGenerationStage(s *StageState, db ethdb.RwKV, tx ethdb.RwTx, snapshotDir string, torrentClient *snapshotsync.Client, quit <-chan struct{}) error
func SpawnCallTraces ¶
func SpawnCallTraces(s *StageState, tx ethdb.RwTx, quit <-chan struct{}, cfg CallTracesCfg) error
func SpawnExecuteBlocksStage ¶
func SpawnExecuteBlocksStage(s *StageState, tx ethdb.RwTx, toBlock uint64, quit <-chan struct{}, cfg ExecuteBlockCfg) error
func SpawnHashStateStage ¶
func SpawnHashStateStage(s *StageState, tx ethdb.RwTx, cfg HashStateCfg, quit <-chan struct{}) error
func SpawnHeaderDownloadStage ¶
func SpawnHeaderDownloadStage(s *StageState, u Unwinder, d DownloaderGlue, headersFetchers []func() error) error
func SpawnHeadersSnapshotGenerationStage ¶
func SpawnHeadersSnapshotGenerationStage(s *StageState, tx ethdb.RwTx, cfg HeadersSnapshotGenCfg, sm *snapshotsync.SnapshotMigrator, torrentClient *snapshotsync.Client, quit <-chan struct{}) error
func SpawnLogIndex ¶
func SpawnLogIndex(s *StageState, tx ethdb.RwTx, cfg LogIndexCfg, quit <-chan struct{}) error
func SpawnMiningCreateBlockStage ¶
func SpawnMiningCreateBlockStage(s *StageState, tx ethdb.RwTx, current *miningBlock, chainConfig params.ChainConfig, engine consensus.Engine, extra hexutil.Bytes, gasFloor, gasCeil uint64, coinbase common.Address, txPool *core.TxPool, quit <-chan struct{}) error
SpawnMiningCreateBlockStage TODO: - resubmitAdjustCh - variable is not implemented
func SpawnMiningExecStage ¶
func SpawnMiningExecStage(s *StageState, tx ethdb.RwTx, current *miningBlock, chainConfig *params.ChainConfig, vmConfig *vm.Config, engine consensus.Engine, localTxs, remoteTxs types.TransactionsStream, coinbase common.Address, noempty bool, notifier ChainEventNotifier, quit <-chan struct{}) error
SpawnMiningExecStage TODO: - resubmitAdjustCh - variable is not implemented
func SpawnMiningFinishStage ¶
func SpawnRecoverSendersStage ¶
func SpawnRecoverSendersStage(cfg SendersCfg, s *StageState, tx ethdb.RwTx, toBlock uint64, quitCh <-chan struct{}) error
func SpawnStateSnapshotGenerationStage ¶
func SpawnStateSnapshotGenerationStage(s *StageState, db ethdb.RwKV, tx ethdb.RwTx, snapshotDir string, torrentClient *snapshotsync.Client, quit <-chan struct{}) error
func SpawnStorageHistoryIndex ¶
func SpawnStorageHistoryIndex(s *StageState, tx ethdb.RwTx, cfg HistoryCfg, quitCh <-chan struct{}) error
func SpawnTxLookup ¶
func SpawnTxLookup(s *StageState, tx ethdb.RwTx, cfg TxLookupCfg, quitCh <-chan struct{}) error
func SpawnTxPool ¶
func SpawnTxPool(s *StageState, tx ethdb.RwTx, cfg TxPoolCfg, quitCh <-chan struct{}) error
func TxLookupTransform ¶
func UnwindAccountHistoryIndex ¶
func UnwindAccountHistoryIndex(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HistoryCfg, quitCh <-chan struct{}) error
func UnwindBlockHashStage ¶
func UnwindBlockHashStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg BlockHashesCfg) error
func UnwindBodiesStage ¶
func UnwindBodiesStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg BodiesCfg) error
func UnwindCallTraces ¶
func UnwindCallTraces(u *UnwindState, s *StageState, tx ethdb.RwTx, quitCh <-chan struct{}, cfg CallTracesCfg) error
func UnwindExecutionStage ¶
func UnwindExecutionStage(u *UnwindState, s *StageState, tx ethdb.RwTx, quit <-chan struct{}, cfg ExecuteBlockCfg) error
func UnwindFinish ¶
func UnwindFinish(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg FinishCfg) error
func UnwindHashStateStage ¶
func UnwindHashStateStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HashStateCfg, quit <-chan struct{}) error
func UnwindIntermediateHashesStage ¶
func UnwindIntermediateHashesStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg TrieCfg, quit <-chan struct{}) error
func UnwindLogIndex ¶
func UnwindLogIndex(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg LogIndexCfg, quitCh <-chan struct{}) error
func UnwindSendersStage ¶
func UnwindSendersStage(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg SendersCfg) error
func UnwindStorageHistoryIndex ¶
func UnwindStorageHistoryIndex(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg HistoryCfg, quitCh <-chan struct{}) error
func UnwindTxLookup ¶
func UnwindTxLookup(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg TxLookupCfg, quitCh <-chan struct{}) error
func UnwindTxPool ¶
func UnwindTxPool(u *UnwindState, s *StageState, tx ethdb.RwTx, cfg TxPoolCfg, quitCh <-chan struct{}) error
func UpdateMetrics ¶
UpdateMetrics - need update metrics manually because current "metrics" package doesn't support labels need to fix it in future
Types ¶
type BlockHashesCfg ¶
type BlockHashesCfg struct {
// contains filtered or unexported fields
}
func StageBlockHashesCfg ¶
func StageBlockHashesCfg(db ethdb.RwKV, tmpDir string) BlockHashesCfg
type BodiesCfg ¶
type BodiesCfg struct {
// contains filtered or unexported fields
}
func StageBodiesCfg ¶
func StageBodiesCfg( db ethdb.RwKV, bd *bodydownload.BodyDownload, bodyReqSend func(context.Context, *bodydownload.BodyRequest) []byte, penalise func(context.Context, []headerdownload.PenaltyItem), updateHead func(ctx context.Context, head uint64, hash common.Hash, td *uint256.Int), blockPropagator adapter.BlockPropagator, timeout int, chanConfig params.ChainConfig, batchSize datasize.ByteSize, ) BodiesCfg
type CallTracer ¶
type CallTracer struct {
// contains filtered or unexported fields
}
func NewCallTracer ¶
func NewCallTracer() *CallTracer
func (*CallTracer) CaptureAccountRead ¶
func (ct *CallTracer) CaptureAccountRead(account common.Address) error
func (*CallTracer) CaptureAccountWrite ¶
func (ct *CallTracer) CaptureAccountWrite(account common.Address) error
func (*CallTracer) CaptureEnd ¶
func (*CallTracer) CaptureFault ¶
func (*CallTracer) CaptureSelfDestruct ¶
func (*CallTracer) CaptureStart ¶
type CallTracesCfg ¶
type CallTracesCfg struct { ToBlock uint64 // not setting this params means no limit BatchSize datasize.ByteSize // contains filtered or unexported fields }
func StageCallTracesCfg ¶
type ChainEventNotifier ¶
type ChainReader ¶
type ChainReader struct { Cfg params.ChainConfig Db ethdb.Getter }
Implements consensus.ChainReader
func (ChainReader) Config ¶
func (cr ChainReader) Config() *params.ChainConfig
Config retrieves the blockchain's chain configuration.
func (ChainReader) CurrentHeader ¶
func (cr ChainReader) CurrentHeader() *types.Header
CurrentHeader retrieves the current header from the local chain.
func (ChainReader) GetHeader ¶
GetHeader retrieves a block header from the database by hash and number.
func (ChainReader) GetHeaderByHash ¶
func (cr ChainReader) GetHeaderByHash(hash common.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 ChangeSetHook ¶
type ChangeSetHook func(blockNum uint64, wr *state.ChangeSetWriter)
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(state *StageState, unwinder Unwinder, tx ethdb.RwTx) 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( kv ethdb.RwKV, WriteReceipts bool, WriteCallTraces bool, BatchSize datasize.ByteSize, ReaderBuilder StateReaderBuilder, WriterBuilder StateWriterBuilder, SilkwormExecutionFunc unsafe.Pointer, ChangeSetHook ChangeSetHook, chainConfig *params.ChainConfig, engine consensus.Engine, vmConfig *vm.Config, tmpdir string, ) ExecuteBlockCfg
type HasChangeSetWriter ¶
type HasChangeSetWriter interface {
ChangeSetWriter() *state.ChangeSetWriter
}
type HashPromoter ¶
type HashPromoter struct { ChangeSetBufSize uint64 TempDir string // contains filtered or unexported fields }
func NewHashPromoter ¶
func NewHashPromoter(db ethdb.RwTx, quitCh <-chan struct{}) *HashPromoter
func (*HashPromoter) Promote ¶
func (p *HashPromoter) Promote(logPrefix string, s *StageState, from, to uint64, storage bool, load etl.LoadFunc) error
func (*HashPromoter) Unwind ¶
func (p *HashPromoter) Unwind(logPrefix string, s *StageState, u *UnwindState, storage bool, load etl.LoadFunc) error
type HashStateCfg ¶
type HashStateCfg struct {
// contains filtered or unexported fields
}
func StageHashStateCfg ¶
func StageHashStateCfg(db ethdb.RwKV, tmpDir string) HashStateCfg
type HeadersCfg ¶
type HeadersCfg struct {
// contains filtered or unexported fields
}
func StageHeadersCfg ¶
func StageHeadersCfg( db ethdb.RwKV, headerDownload *headerdownload.HeaderDownload, chainConfig params.ChainConfig, headerReqSend func(context.Context, *headerdownload.HeaderRequest) []byte, announceNewHashes func(context.Context, []headerdownload.Announce), penalize func(context.Context, []headerdownload.PenaltyItem), batchSize datasize.ByteSize, increment uint64, ) HeadersCfg
type HeadersSnapshotGenCfg ¶
type HeadersSnapshotGenCfg struct {
// contains filtered or unexported fields
}
func StageHeadersSnapshotGenCfg ¶
func StageHeadersSnapshotGenCfg(db ethdb.RwKV, snapshotDir string) HeadersSnapshotGenCfg
type HistoryCfg ¶
type HistoryCfg struct {
// contains filtered or unexported fields
}
func StageHistoryCfg ¶
func StageHistoryCfg(db ethdb.RwKV, tmpDir string) HistoryCfg
type LogIndexCfg ¶
type LogIndexCfg struct {
// contains filtered or unexported fields
}
func StageLogIndexCfg ¶
func StageLogIndexCfg(db ethdb.RwKV, tmpDir string) LogIndexCfg
type MiningCfg ¶
type MiningCfg struct { // configs params.MiningConfig // runtime dat Block *miningBlock // contains filtered or unexported fields }
func StageMiningCfg ¶
type OldestAppearedLoad ¶
type OldestAppearedLoad struct {
// contains filtered or unexported fields
}
func (*OldestAppearedLoad) LoadFunc ¶
func (l *OldestAppearedLoad) LoadFunc(k, v []byte, table etl.CurrentTableReader, next etl.LoadNextFunc) error
type OptionalParameters ¶
type OptionalParameters struct { // StateReaderBuilder is a function that returns state reader for the block execution stage. // It can be used to add someting like bloom filters to figure out non-existing accounts and similar experiments. StateReaderBuilder StateReaderBuilder // StateReaderBuilder is a function that returns state writer for the block execution stage. // It can be used to update bloom or other types of filters between block execution. StateWriterBuilder StateWriterBuilder // Notifier allows sending some data when new headers or new blocks are added Notifier ChainEventNotifier SilkwormExecutionFunc unsafe.Pointer SnapshotDir string TorrnetClient *snapshotsync.Client SnapshotMigrator *snapshotsync.SnapshotMigrator }
OptionalParameters contains any non-necessary parateres you can specify to fine-tune and experiment on StagedSync.
type PersistentUnwindStack ¶
type PersistentUnwindStack struct {
// contains filtered or unexported fields
}
func NewPersistentUnwindStack ¶
func NewPersistentUnwindStack() *PersistentUnwindStack
func (*PersistentUnwindStack) Add ¶
func (s *PersistentUnwindStack) Add(u UnwindState, tx TxOrDb) error
func (*PersistentUnwindStack) Empty ¶
func (s *PersistentUnwindStack) Empty() bool
func (*PersistentUnwindStack) LoadFromDB ¶
func (s *PersistentUnwindStack) LoadFromDB(db ethdb.KVGetter, stageID stages.SyncStage) (*UnwindState, error)
func (*PersistentUnwindStack) Pop ¶
func (s *PersistentUnwindStack) Pop() *UnwindState
type Promoter ¶
type Promoter struct { ChangeSetBufSize uint64 TempDir string // contains filtered or unexported fields }
func NewPromoter ¶
func (*Promoter) Unwind ¶
func (p *Promoter) Unwind(logPrefix string, s *StageState, u *UnwindState, storage bool, codes bool) error
type SendersCfg ¶
type SendersCfg struct {
// contains filtered or unexported fields
}
func StageSendersCfg ¶
func StageSendersCfg(db ethdb.RwKV, chainCfg *params.ChainConfig, tmpdir string) SendersCfg
type Stage ¶
type Stage struct { // 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 // Description is a string that is shown in the logs. Description string // Disabled defines if the stage is disabled. It sets up when the stage is build by its `StageBuilder`. Disabled bool // 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 // ExecFunc 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! ExecFunc ExecFunc // UnwindFunc is called when the stage should be unwound. The unwind logic should be there. MUST NOT be nil! UnwindFunc UnwindFunc }
Stage is a single sync stage in staged sync.
type StageBuilder ¶
type StageBuilder struct { // ID is the stage identifier. Should be unique. It is recommended to prefix it with reverse domain `com.example.my-stage` to avoid conflicts. ID stages.SyncStage // Build is a factory function that initializes the sync stage based on the `StageParameters` provided. Build func(StageParameters) *Stage }
StageBuilder represent an object to create a single stage for staged sync
type StageBuilders ¶
type StageBuilders []StageBuilder
StageBuilders represents an ordered list of builders to build different stages. It also contains helper methods to change the list of stages.
func DefaultStages ¶
func DefaultStages() StageBuilders
DefaultStages contains the list of default stage builders that are used by turbo-geth.
func MiningStages ¶
func MiningStages() StageBuilders
func ReplacementStages ¶
func ReplacementStages(ctx context.Context, sm ethdb.StorageMode, headers HeadersCfg, blockHashCfg BlockHashesCfg, bodies BodiesCfg, senders SendersCfg, exec ExecuteBlockCfg, hashState HashStateCfg, trieCfg TrieCfg, history HistoryCfg, logIndex LogIndexCfg, callTraces CallTracesCfg, txLookup TxLookupCfg, txPool TxPoolCfg, finish FinishCfg, ) StageBuilders
func (StageBuilders) Build ¶
func (bb StageBuilders) Build(world StageParameters) []*Stage
Build creates sync states out of builders
func (StageBuilders) MustReplace ¶
func (bb StageBuilders) MustReplace(id stages.SyncStage, newBuilder StageBuilder) StageBuilders
MustReplace finds a stage with a specific ID and then sets the new one instead of that. Chainable but panics if it can't find stage to replace.
type StageParameters ¶
type StageParameters struct { ChainConfig *params.ChainConfig Engine consensus.Engine DB ethdb.Database BatchSize datasize.ByteSize // Batch size for the execution stage TmpDir string // QuitCh is a channel that is closed. This channel is useful to listen to when // the stage can take significant time and gracefully shutdown at Ctrl+C. QuitCh <-chan struct{} InitialCycle bool SnapshotBuilder *snapshotsync.SnapshotMigrator // contains filtered or unexported fields }
StageParameters contains the stage that stages receives at runtime when initializes. Then the stage can use it to receive different useful functions.
type StageState ¶
type StageState struct { // Stage is the ID of this stage. Stage stages.SyncStage // BlockNumber is the current block number of the stage at the beginning of the state execution. BlockNumber uint64 // contains filtered or unexported fields }
StageState is the state of the stage.
func (*StageState) Done ¶
func (s *StageState) Done()
Done makes sure that the stage execution is complete and proceeds to the next state. If Done() is not called and the stage `ExecFunc` exits, then the same stage will be called again. This side effect is useful for something like block body download.
func (*StageState) DoneAndUpdate ¶
func (s *StageState) DoneAndUpdate(db ethdb.Putter, newBlockNum uint64) error
DoneAndUpdate a convenience method combining both `Done()` and `Update()` calls together.
func (*StageState) ExecutionAt ¶
func (s *StageState) ExecutionAt(db ethdb.KVGetter) (uint64, error)
ExecutionAt gets the current state of the "Execution" stage, which block is currently executed.
func (*StageState) LogPrefix ¶
func (s *StageState) LogPrefix() string
type StagedSync ¶
type StagedSync struct { PrefetchedBlocks *bodydownload.PrefetchedBlocks Notifier ChainEventNotifier // contains filtered or unexported fields }
func New ¶
func New(stages StageBuilders, unwindOrder UnwindOrder, params OptionalParameters) *StagedSync
func (*StagedSync) Prepare ¶
func (stagedSync *StagedSync) Prepare( d DownloaderGlue, chainConfig *params.ChainConfig, engine consensus.Engine, vmConfig *vm.Config, db ethdb.Database, tx ethdb.Tx, pid string, storageMode ethdb.StorageMode, tmpdir string, batchSize datasize.ByteSize, quitCh <-chan struct{}, headersFetchers []func() error, txPool *core.TxPool, initialCycle bool, miningConfig *MiningCfg, ) (*State, error)
func (*StagedSync) SetTorrentParams ¶
func (stagedSync *StagedSync) SetTorrentParams(client *snapshotsync.Client, snapshotsDir string, snapshotMigrator *snapshotsync.SnapshotMigrator)
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) BeforeStageRun ¶
func (*State) BeforeStageUnwind ¶
func (*State) CurrentStage ¶
func (*State) DisableAllStages ¶
func (s *State) DisableAllStages()
func (*State) DisableStages ¶
func (*State) EnableStages ¶
func (*State) OnBeforeUnwind ¶
func (*State) StageState ¶
func (*State) UnwindStage ¶
type StateReaderBuilder ¶
type StateReaderBuilder func(ethdb.Database) state.StateReader
type StateWriterBuilder ¶
type TxLookupCfg ¶
type TxLookupCfg struct {
// contains filtered or unexported fields
}
func StageTxLookupCfg ¶
func StageTxLookupCfg( db ethdb.RwKV, tmpdir string, ) TxLookupCfg
type UnwindFunc ¶
type UnwindFunc func(unwindState *UnwindState, state *StageState, tx ethdb.RwTx) 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 ¶
type UnwindOrder []int
UnwindOrder represents the order in which the stages needs to be unwound. Currently it is using indexes of stages, 0-based. The unwind order is important and not always just stages going backwards. Let's say, there is tx pool (state 10) can be unwound only after execution is fully unwound (stages 9...3).
func DefaultUnwindOrder ¶
func DefaultUnwindOrder() UnwindOrder
DefaultUnwindOrder contains the default unwind order for `DefaultStages()`. Just adding stages that don't do unwinding, don't require altering the default order.
func MiningUnwindOrder ¶
func MiningUnwindOrder() UnwindOrder
func ReplacementUnwindOrder ¶
func ReplacementUnwindOrder() UnwindOrder
type UnwindState ¶
type UnwindState struct { // Stage is the ID of the stage Stage stages.SyncStage // UnwindPoint is the block to unwind to. UnwindPoint uint64 }
UnwindState contains the information about unwind.
Source Files ¶
- all_stages.go
- replacement_stages.go
- stage.go
- stage_blockhashes.go
- stage_bodies.go
- stage_bodies_new.go
- stage_bodies_snapshot.go
- stage_call_traces.go
- stage_execute.go
- stage_finish.go
- stage_hashstate.go
- stage_headers.go
- stage_headers_new.go
- stage_headers_snapshot.go
- stage_indexes.go
- stage_interhashes.go
- stage_log_index.go
- stage_mining_create_block.go
- stage_mining_exec.go
- stage_mining_finish.go
- stage_senders.go
- stage_state_snapshot.go
- stage_txlookup.go
- stage_txpool.go
- stagebuilder.go
- stagedsync.go
- state.go
- testutil.go
- types.go
- unwind.go