common

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT, MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExperimentalPrefetchFailed   = errors.New("experimental prefetch failed")
	ErrExperimentalPrefetchDisabled = errors.New("experimental prefetch disabled")
)
View Source
var (
	ErrNoSources               = errors.New("no sources specified")
	ErrNoL2ForRollup           = errors.New("no L2 RPC available for rollup")
	ErrNoRollupForL2           = errors.New("no rollup config available for L2 RPC")
	ErrNoRollupForExperimental = errors.New("no rollup config available for L2 experimental RPC")
)

Functions

func FaultProofProgram

func FaultProofProgram(ctx context.Context, logger log.Logger, cfg *config.Config, opts ...ProgramOpt) error

FaultProofProgram is the programmatic entry-point for the fault proof program

func NewL2KeyValueStore

func NewL2KeyValueStore(kv kvstore.KV) *l2KeyValueStore

NewL2KeyValueStore creates a l2.KeyValueStore compatible database that's backed by a kvstore.KV

func RunPreimageServer added in v1.13.4

func RunPreimageServer(ctx context.Context, logger log.Logger, cfg *config.Config, preimageChannel preimage.FileChannel, hintChannel preimage.FileChannel, prefetcherCreator PrefetcherCreator) error

RunPreimageServer reads hints and preimage requests from the provided channels and processes those requests. This method will block until both the hinter and preimage handlers complete. If either returns an error both handlers are stopped. The supplied preimageChannel and hintChannel will be closed before this function returns.

Types

type L2Client

type L2Client struct {
	*sources.L2Client
}

func NewL2Client

func NewL2Client(client client.RPC, log log.Logger, metrics caching.Metrics, config *L2ClientConfig) (*L2Client, error)

func (*L2Client) OutputByNumber

func (s *L2Client) OutputByNumber(ctx context.Context, blockNum uint64) (eth.Output, error)

func (*L2Client) OutputByRoot

func (s *L2Client) OutputByRoot(ctx context.Context, blockRoot common.Hash) (eth.Output, error)

type L2ClientConfig

type L2ClientConfig struct {
	*sources.L2ClientConfig
}

type L2Source

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

L2Source is a source of L2 data, it abstracts away the details of how to fetch L2 data between canonical and experimental sources. It also tracks metrics for each of the apis. Once experimental sources are stable, this will only route to the "experimental" source.

func NewL2SourceFromRPC

func NewL2SourceFromRPC(logger log.Logger, rollupCfg *rollup.Config, canonicalL2RPC client.RPC, experimentalRPC client.RPC) (*L2Source, error)

func NewL2SourceWithClient

func NewL2SourceWithClient(logger log.Logger, canonicalL2Client *L2Client, canonicalDebugClient *sources.DebugClient) *L2Source

NewL2SourceWithClient creates a new L2 source with the given client as the canonical client. This doesn't configure the experimental source, but is useful for testing.

func (*L2Source) CodeByHash

func (l *L2Source) CodeByHash(ctx context.Context, hash common.Hash) ([]byte, error)

CodeByHash implements prefetcher.L2Source.

func (*L2Source) ExperimentalEnabled

func (l *L2Source) ExperimentalEnabled() bool

func (*L2Source) FetchReceipts

func (l *L2Source) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)

FetchReceipts implements prefetcher.L2Source.

func (*L2Source) GetProof

func (l *L2Source) GetProof(ctx context.Context, address common.Address, storage []common.Hash, blockTag string) (*eth.AccountResult, error)

GetProof implements prefetcher.L2Source.

func (*L2Source) InfoAndTxsByHash

func (l *L2Source) InfoAndTxsByHash(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Transactions, error)

InfoAndTxsByHash implements prefetcher.L2Source.

func (*L2Source) NodeByHash

func (l *L2Source) NodeByHash(ctx context.Context, hash common.Hash) ([]byte, error)

NodeByHash implements prefetcher.L2Source.

func (*L2Source) OutputByNumber

func (l *L2Source) OutputByNumber(ctx context.Context, blockNum uint64) (eth.Output, error)

OutputByBlockNumber implements prefetcher.L2Source.

func (*L2Source) OutputByRoot

func (l *L2Source) OutputByRoot(ctx context.Context, blockRoot common.Hash) (eth.Output, error)

OutputByRoot implements prefetcher.L2Source.

func (*L2Source) PayloadExecutionWitness added in v1.11.2

func (l *L2Source) PayloadExecutionWitness(ctx context.Context, parentHash common.Hash, payloadAttributes eth.PayloadAttributes) (*eth.ExecutionWitness, error)

PayloadExecutionWitness implements prefetcher.L2Source.

func (*L2Source) RollupConfig

func (s *L2Source) RollupConfig() *rollup.Config

type L2Sources

type L2Sources struct {
	Sources map[uint64]*L2Source
}

func NewL2Sources

func NewL2Sources(ctx context.Context, logger log.Logger, configs []*rollup.Config, l2Clients []client.RPC, l2ExperimentalClients []client.RPC) (*L2Sources, error)

func NewL2SourcesFromURLs

func NewL2SourcesFromURLs(ctx context.Context, logger log.Logger, configs []*rollup.Config, l2URLs []string, l2ExperimentalURLs []string) (*L2Sources, error)

type Prefetcher

type Prefetcher interface {
	Hint(hint string) error
	GetPreimage(ctx context.Context, key common.Hash) ([]byte, error)
}

type PrefetcherCreator

type PrefetcherCreator func(ctx context.Context, logger log.Logger, kv kvstore.KV, cfg *config.Config) (Prefetcher, error)

type PreimageServer

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

func StartPreimageServer added in v1.13.4

func StartPreimageServer(ctx context.Context, logger log.Logger, cfg *config.Config, prefetcher PrefetcherCreator) (*PreimageServer, error)

func (*PreimageServer) Close added in v1.13.4

func (p *PreimageServer) Close()

func (*PreimageServer) HintClientRW added in v1.13.4

func (p *PreimageServer) HintClientRW() preimage.FileChannel

func (*PreimageServer) PreimageClientRW added in v1.13.4

func (p *PreimageServer) PreimageClientRW() preimage.FileChannel

type ProgramOpt

type ProgramOpt func(c *programCfg)

func WithPrefetcher

func WithPrefetcher(creator PrefetcherCreator) ProgramOpt

WithPrefetcher configures the prefetcher used by the preimage server.

Jump to

Keyboard shortcuts

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