vm

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: GPL-3.0, LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

View Source
const (
	// ParentsToFetch is the number of the block parents the state syncs to.
	// The last 256 block hashes are necessary to support the BLOCKHASH opcode.
	ParentsToFetch = 256
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAcceptor

type BlockAcceptor interface {
	PutLastAcceptedID(ids.ID) error
}

BlockAcceptor provides a mechanism to update the last accepted block ID during state synchronization. This interface is used by the state sync process to ensure the blockchain state is properly updated when new blocks are synchronized from the network.

type Client

type Client interface {
	// Methods that implement the client side of [block.StateSyncableVM].
	StateSyncEnabled(context.Context) (bool, error)
	GetOngoingSyncStateSummary(context.Context) (block.StateSummary, error)
	ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)

	// Additional methods required by the evm package.
	ClearOngoingSummary() error
	Shutdown() error
	Error() error
}

func NewClient

func NewClient(config *ClientConfig) Client

type ClientConfig

type ClientConfig struct {
	Chain      *eth.Ethereum
	State      *chain.State
	ChainDB    ethdb.Database
	Acceptor   BlockAcceptor
	VerDB      *versiondb.Database
	MetadataDB database.Database

	// Extension points.
	Parser message.SyncableParser

	// Extender is an optional extension point for the state sync process, and can be nil.
	Extender      synccommon.Extender
	Client        syncclient.Client
	StateSyncDone chan struct{}

	// Specifies the number of blocks behind the latest state summary that the chain must be
	// in order to prefer performing state sync over falling back to the normal bootstrapping
	// algorithm.
	MinBlocks          uint64
	LastAcceptedHeight uint64
	RequestSize        uint16 // number of key/value pairs to ask peers for per request
	Enabled            bool
	SkipResume         bool
}

type EthBlockWrapper

type EthBlockWrapper interface {
	GetEthBlock() *types.Block
}

EthBlockWrapper can be implemented by a concrete block wrapper type to return *types.Block, which is needed to update chain pointers at the end of the sync operation.

type Server

type Server interface {
	GetLastStateSummary(context.Context) (block.StateSummary, error)
	GetStateSummary(context.Context, uint64) (block.StateSummary, error)
}

func NewServer

func NewServer(chain *core.BlockChain, provider synccommon.SummaryProvider, syncableInterval uint64) Server

type SyncerRegistry

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

SyncerRegistry manages a collection of syncers for sequential execution.

func NewSyncerRegistry

func NewSyncerRegistry() *SyncerRegistry

NewSyncerRegistry creates a new empty syncer registry.

func (*SyncerRegistry) Register

func (r *SyncerRegistry) Register(name string, syncer synccommon.Syncer) error

Register adds a syncer to the registry. Returns an error if a syncer with the same name is already registered.

func (*SyncerRegistry) RunSyncerTasks

func (r *SyncerRegistry) RunSyncerTasks(ctx context.Context, client *client) error

RunSyncerTasks executes all registered syncers.

type SyncerTask

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

SyncerTask represents a single syncer with its name for identification.

Jump to

Keyboard shortcuts

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