stages

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MiningStep

func MiningStep(ctx context.Context, kv kv.RwDB, mining *sync_stages.Sync, tmpDir string) (err error)

func NewDefaultStages

func NewDefaultStages(ctx context.Context,
	db kv.RwDB,
	p2pCfg p2p.Config,
	cfg *ethconfig.Config,
	controlServer *sentry.MultiClient,
	notifications *shards.Notifications,
	snapDownloader proto_downloader.DownloaderClient,
	snapshots *snapshotsync.RoSnapshots,
	agg *state.AggregatorV3,
	forkValidator *engineapi.ForkValidator,
	engine consensus.Engine,
) []*sync_stages.Stage

func NewDefaultZkStages

func NewDefaultZkStages(ctx context.Context,
	db kv.RwDB,
	p2pCfg p2p.Config,
	cfg *ethconfig.Config,
	controlServer *sentry.MultiClient,
	notifications *shards.Notifications,
	snapDownloader proto_downloader.DownloaderClient,
	snapshots *snapshotsync.RoSnapshots,
	agg *state.AggregatorV3,
	forkValidator *engineapi.ForkValidator,
	engine consensus.Engine,
	l1Syncer *syncer.L1Syncer,
	datastreamClient *client.StreamClient,
) []*sync_stages.Stage

func NewInMemoryExecution

func NewInMemoryExecution(ctx context.Context, db kv.RwDB, cfg *ethconfig.Config, controlServer *sentry.MultiClient, dirs datadir.Dirs, notifications *shards.Notifications, snapshots *snapshotsync.RoSnapshots, agg *state.AggregatorV3) (*sync_stages.Sync, error)

func SendPayloadStatus

func SendPayloadStatus(hd *headerdownload.HeaderDownload, headBlockHash libcommon.Hash, err error)

func StageLoop

func StageLoop(
	ctx context.Context,
	chainConfig *chain.Config,
	db kv.RwDB,
	sync *sync_stages.Sync,
	hd *headerdownload.HeaderDownload,
	notifications *shards.Notifications,
	updateHead func(ctx context.Context, headHeight, headTime uint64, hash libcommon.Hash, td *uint256.Int),
	waitForDone chan struct{},
	loopMinTime time.Duration,
)

StageLoop runs the continuous loop of staged sync

func StageLoopStep

func StageLoopStep(ctx context.Context, chainConfig *chain.Config, db kv.RwDB, sync *sync_stages.Sync, notifications *shards.Notifications, initialCycle bool,
	updateHead func(ctx context.Context, headHeight uint64, headTime uint64, hash libcommon.Hash, td *uint256.Int),
) (headBlockHash libcommon.Hash, err error)

func StateStep

func StateStep(ctx context.Context, batch kv.RwTx, stateSync *sync_stages.Sync, Bd *bodydownload.BodyDownload, header *types.Header, body *types.RawBody, unwindPoint uint64, headersChain []*types.Header, bodiesChain []*types.RawBody, quiet bool) (err error)

Types

type MockSentry

type MockSentry struct {
	proto_sentry.UnimplementedSentryServer
	Ctx context.Context
	Log log.Logger

	DB     kv.RwDB
	Dirs   datadir.Dirs
	Engine consensus.Engine

	ChainConfig   *chain.Config
	Sync          *sync_stages.Sync
	MiningSync    *sync_stages.Sync
	PendingBlocks chan *types.Block
	MinedBlocks   chan *types.Block

	Key          *ecdsa.PrivateKey
	Genesis      *types.Block
	SentryClient direct.SentryClient
	PeerId       *ptypes.H512
	UpdateHead   func(Ctx context.Context, headHeight, headTime uint64, hash libcommon.Hash, td *uint256.Int)

	StreamWg  sync.WaitGroup
	ReceiveWg sync.WaitGroup
	Address   libcommon.Address

	Notifications *shards.Notifications

	// TxPool
	TxPoolFetch      *txpool.Fetch
	TxPoolSend       *txpool.Send
	TxPoolGrpcServer *txpool.GrpcServer
	TxPool           *txpool.TxPool

	HistoryV3      bool
	TransactionsV3 bool

	BlockSnapshots *snapshotsync.RoSnapshots
	// contains filtered or unexported fields
}

func Mock

func Mock(t *testing.T) *MockSentry

Mock is convenience function to create a mock with some pre-set values

func MockWithEverything

func MockWithEverything(t *testing.T, gspec *types.Genesis, key *ecdsa.PrivateKey, prune prune.Mode, engine consensus.Engine, withTxPool bool, withPosDownloader bool) *MockSentry

func MockWithGenesis

func MockWithGenesis(t *testing.T, gspec *types.Genesis, key *ecdsa.PrivateKey, withPosDownloader bool) *MockSentry

func MockWithGenesisEngine

func MockWithGenesisEngine(t *testing.T, gspec *types.Genesis, engine consensus.Engine, withPosDownloader bool) *MockSentry

func MockWithGenesisPruneMode

func MockWithGenesisPruneMode(t *testing.T, gspec *types.Genesis, key *ecdsa.PrivateKey, prune prune.Mode, withPosDownloader bool) *MockSentry

func MockWithTxPool

func MockWithTxPool(t *testing.T) *MockSentry

func MockWithZeroTTD

func MockWithZeroTTD(t *testing.T, withPosDownloader bool) *MockSentry

func MockWithZeroTTDGnosis

func MockWithZeroTTDGnosis(t *testing.T, withPosDownloader bool) *MockSentry

func (*MockSentry) Close

func (ms *MockSentry) Close()

func (*MockSentry) EnableLogs

func (ms *MockSentry) EnableLogs()

func (*MockSentry) HandShake

func (*MockSentry) HeaderDownload

func (ms *MockSentry) HeaderDownload() *headerdownload.HeaderDownload

func (*MockSentry) HistoryV3Components

func (ms *MockSentry) HistoryV3Components() *libstate.AggregatorV3

func (*MockSentry) InsertChain

func (ms *MockSentry) InsertChain(chain *core.ChainPack) error

func (*MockSentry) Messages

func (*MockSentry) NewHistoryStateReader

func (ms *MockSentry) NewHistoryStateReader(blockNum uint64, tx kv.Tx) state.StateReader

func (*MockSentry) NewStateReader

func (ms *MockSentry) NewStateReader(tx kv.Tx) state.StateReader

func (*MockSentry) NodeInfo

func (*MockSentry) PeerEvents

func (*MockSentry) PeerMinBlock

func (*MockSentry) Peers

func (*MockSentry) PenalizePeer

func (*MockSentry) ReceivePayloadStatus

func (ms *MockSentry) ReceivePayloadStatus() engineapi.PayloadStatus

func (*MockSentry) Send

func (ms *MockSentry) Send(req *proto_sentry.InboundMessage) (errs []error)

Stream returns stream, waiting if necessary

func (*MockSentry) SendForkChoiceRequest

func (ms *MockSentry) SendForkChoiceRequest(message *engineapi.ForkChoiceMessage)

func (*MockSentry) SendMessageById

func (*MockSentry) SendMessageToAll

func (*MockSentry) SendPayloadRequest

func (ms *MockSentry) SendPayloadRequest(message *types.Block)

func (*MockSentry) SentMessage

func (ms *MockSentry) SentMessage(i int) *proto_sentry.OutboundMessageData

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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