syncer

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: Apache-2.0, MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StageIdle = SyncStateStage(iota)
	StageHeaders
	StagePersistHeaders
	StageMessages
	StageSyncComplete
	StageSyncErrored
	StageFetchingMessages
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveSync

type ActiveSync struct {
	WorkerID uint64
	Base     *block.TipSet
	Target   *block.TipSet

	Stage  SyncStateStage
	Height abi.ChainEpoch

	Start   time.Time
	End     time.Time
	Message string
}

type ChainSyncProvider

type ChainSyncProvider struct {
	// contains filtered or unexported fields
}

ChainSyncProvider provides access to chain sync operations and their status.

func NewChainSyncProvider

func NewChainSyncProvider(chainSyncer chainSync) *ChainSyncProvider

NewChainSyncProvider returns a new ChainSyncProvider.

func (*ChainSyncProvider) HandleNewTipSet

func (chs *ChainSyncProvider) HandleNewTipSet(ci *block.ChainInfo) error

HandleNewTipSet extends the Syncer's chain store with the given tipset if they represent a valid extension. It limits the length of new chains it will attempt to validate and caches invalid blocks it has encountered to help prevent DOS.

type InvocResult

type InvocResult struct {
	MsgCid         cid.Cid
	Msg            *types.UnsignedMessage
	MsgRct         *types.MessageReceipt
	GasCost        MsgGasCost
	ExecutionTrace types.ExecutionTrace
	Error          string
	Duration       time.Duration
}

type MsgGasCost

type MsgGasCost struct {
	Message            cid.Cid // Can be different than requested, in case it was replaced, but only gas values changed
	GasUsed            abi.TokenAmount
	BaseFeeBurn        abi.TokenAmount
	OverEstimationBurn abi.TokenAmount
	MinerPenalty       abi.TokenAmount
	MinerTip           abi.TokenAmount
	Refund             abi.TokenAmount
	TotalCost          abi.TokenAmount
}

type SyncState

type SyncState struct {
	ActiveSyncs []ActiveSync

	VMApplied uint64
}

type SyncStateStage

type SyncStateStage int

just compatible code lotus

func (SyncStateStage) String

func (v SyncStateStage) String() string

type SyncerAPI

type SyncerAPI struct {
	// contains filtered or unexported fields
}

func (*SyncerAPI) ChainSyncHandleNewTipSet

func (syncerAPI *SyncerAPI) ChainSyncHandleNewTipSet(ci *block.ChainInfo) error

ChainSyncHandleNewTipSet submits a chain head to the syncer for processing.

func (*SyncerAPI) ChainTipSetWeight

func (syncerAPI *SyncerAPI) ChainTipSetWeight(ctx context.Context, tsk block.TipSetKey) (big.Int, error)

func (*SyncerAPI) StateCall

func (syncerAPI *SyncerAPI) StateCall(ctx context.Context, msg *types.UnsignedMessage, tsk block.TipSetKey) (*InvocResult, error)

func (*SyncerAPI) SyncState

func (syncerAPI *SyncerAPI) SyncState(ctx context.Context) (*SyncState, error)

SyncState just compatible code lotus

func (*SyncerAPI) SyncSubmitBlock

func (syncerAPI *SyncerAPI) SyncSubmitBlock(ctx context.Context, blk *block.BlockMsg) error

func (*SyncerAPI) SyncerTracker

func (syncerAPI *SyncerAPI) SyncerTracker() *syncTypes.TargetTracker

SyncerStatus returns the current status of the active or last active chain sync operation.

type SyncerSubmodule

type SyncerSubmodule struct {
	BlockstoreModule   *blockstore.BlockstoreSubmodule
	ChainModule        *chain2.ChainSubmodule
	NetworkModule      *network.NetworkSubmodule
	DiscoverySubmodule *discovery.DiscoverySubmodule

	BlockTopic       *pubsub.Topic
	BlockSub         pubsub.Subscription
	ChainSelector    nodeChainSelector
	Consensus        consensus.Protocol
	FaultDetector    slashing.ConsensusFaultDetector
	ChainSyncManager *chainsync.Manager
	Drand            beacon.Schedule
	SyncProvider     ChainSyncProvider
	SlashFilter      *slashfilter.SlashFilter
	// cancelChainSync cancels the context for chain sync subscriptions and handlers.
	CancelChainSync context.CancelFunc
	// contains filtered or unexported fields
}

SyncerSubmodule enhances the node with chain syncing capabilities

func NewSyncerSubmodule

func NewSyncerSubmodule(ctx context.Context,
	config syncerConfig,
	blockstore *blockstore.BlockstoreSubmodule,
	network *network.NetworkSubmodule,
	discovery *discovery.DiscoverySubmodule,
	chn *chain2.ChainSubmodule,
	postVerifier consensus.ProofVerifier) (*SyncerSubmodule, error)

NewSyncerSubmodule creates a new chain submodule.

func (*SyncerSubmodule) API

func (syncer *SyncerSubmodule) API() *SyncerAPI

func (*SyncerSubmodule) Start

func (syncer *SyncerSubmodule) Start(ctx context.Context) error

Start starts the syncer submodule for a node.

func (*SyncerSubmodule) Stop

func (syncer *SyncerSubmodule) Stop(ctx context.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL