 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
      View Source
      
  const ParentsToFetch = 256
    ParentsToFetch is the number of the block parents the state syncs to. The last 256 block hashes are necessary to support the BLOCKHASH opcode.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockAcceptor ¶
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 {
	Enabled    bool
	SkipResume bool
	// 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
	RequestSize uint16 // number of key/value pairs to ask peers for per request
	LastAcceptedHeight uint64
	Chain      *eth.Ethereum
	State      *chain.State
	ChaindDB   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 Extender
	Client syncclient.Client
	StateSyncDone chan struct{}
}
    ClientConfig defines the options and dependencies needed to construct a Client
type EthBlockWrapper ¶
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 Extender ¶
type Extender interface {
	// Sync is called to perform any extension-specific state sync logic.
	Sync(ctx context.Context, client syncclient.LeafClient, verdb *versiondb.Database, syncSummary message.Syncable) error
	// OnFinishBeforeCommit is called after the state sync process has completed but before the state sync summary is committed.
	OnFinishBeforeCommit(lastAcceptedHeight uint64, syncSummary message.Syncable) error
	// OnFinishAfterCommit is called after the state sync process has completed and the state sync summary is committed.
	OnFinishAfterCommit(summaryHeight uint64) error
}
    Extender is an interface that allows for extending the state sync process.
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 SummaryProvider, syncableInterval uint64) Server
type SummaryProvider ¶
type SummaryProvider interface {
	StateSummaryAtBlock(ethBlock *types.Block) (block.StateSummary, error)
}
     Click to show internal directories. 
   Click to hide internal directories.