node

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: MIT Imports: 33 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	L1 L1EndpointSetup
	L2 L2EndpointSetup

	Driver driver.Config

	Rollup rollup.Config

	// P2PSigner will be used for signing off on published content
	// if the node is sequencing and if the p2p stack is enabled
	P2PSigner p2p.SignerSetup

	RPC RPCConfig

	P2P p2p.SetupP2P

	Metrics MetricsConfig

	Pprof PprofConfig

	// Optional
	Tracer Tracer
}

func (*Config) Check

func (cfg *Config) Check() error

Check verifies that the given configuration makes sense

type L1EndpointConfig

type L1EndpointConfig struct {
	L1NodeAddr string // Address of L1 User JSON-RPC endpoint to use (eth namespace required)

	// L1TrustRPC: if we trust the L1 RPC we do not have to validate L1 response contents like headers
	// against block hashes, or cached transaction sender addresses.
	// Thus we can sync faster at the risk of the source RPC being wrong.
	L1TrustRPC bool
}

func (*L1EndpointConfig) Setup

func (cfg *L1EndpointConfig) Setup(ctx context.Context, log log.Logger) (cl *rpc.Client, trust bool, err error)

type L1EndpointSetup

type L1EndpointSetup interface {
	// Setup a RPC client to a L1 node to pull rollup input-data from.
	Setup(ctx context.Context, log log.Logger) (cl *rpc.Client, trust bool, err error)
}

type L2EndpointConfig

type L2EndpointConfig struct {
	L2EngineAddr string // Address of L2 Engine JSON-RPC endpoint to use (engine and eth namespace required)

	// JWT secrets for L2 Engine API authentication during HTTP or initial Websocket communication.
	// Any value for an IPC connection.
	L2EngineJWTSecret [32]byte
}

func (*L2EndpointConfig) Check

func (cfg *L2EndpointConfig) Check() error

func (*L2EndpointConfig) Setup

func (cfg *L2EndpointConfig) Setup(ctx context.Context, log log.Logger) (*rpc.Client, error)

type L2EndpointSetup

type L2EndpointSetup interface {
	// Setup a RPC client to a L2 execution engine to process rollup blocks with.
	Setup(ctx context.Context, log log.Logger) (cl *rpc.Client, err error)
	Check() error
}

type LogConfig

type LogConfig struct {
	Level  string // Log level: trace, debug, info, warn, error, crit. Capitals are accepted too.
	Color  bool   // Color the log output. Defaults to true if terminal is detected.
	Format string // Format the log output. Supported formats: 'text', 'json'
}

func DefaultLogConfig

func DefaultLogConfig() LogConfig

func (*LogConfig) Check

func (cfg *LogConfig) Check() error

Check verifes that the LogConfig is valid. Calls to `NewLogger` may fail if this returns an error.

func (*LogConfig) NewLogger

func (cfg *LogConfig) NewLogger() log.Logger

NewLogger creates a logger based on the supplied configuration

type MetricsConfig

type MetricsConfig struct {
	Enabled    bool
	ListenAddr string
	ListenPort int
}

func (MetricsConfig) Check

func (m MetricsConfig) Check() error

type OpNode

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

func New

func New(ctx context.Context, cfg *Config, log log.Logger, snapshotLog log.Logger, appVersion string, m *metrics.Metrics) (*OpNode, error)

func (*OpNode) Close

func (n *OpNode) Close() error

Close closes all resources.

func (*OpNode) OnNewL1Head

func (n *OpNode) OnNewL1Head(ctx context.Context, sig eth.L1BlockRef)

func (*OpNode) OnUnsafeL2Payload

func (n *OpNode) OnUnsafeL2Payload(ctx context.Context, from peer.ID, payload *eth.ExecutionPayload) error

func (*OpNode) P2P

func (n *OpNode) P2P() p2p.Node

func (*OpNode) PublishL2Payload

func (n *OpNode) PublishL2Payload(ctx context.Context, payload *eth.ExecutionPayload) error

func (*OpNode) Start

func (n *OpNode) Start(ctx context.Context) error

type PprofConfig

type PprofConfig struct {
	Enabled    bool
	ListenAddr string
	ListenPort string
}

func (PprofConfig) Check

func (p PprofConfig) Check() error

type PreparedL1Endpoint

type PreparedL1Endpoint struct {
	Client   *rpc.Client
	TrustRPC bool
}

PreparedL1Endpoint enables testing with an in-process pre-setup RPC connection to L1

func (*PreparedL1Endpoint) Setup

func (p *PreparedL1Endpoint) Setup(ctx context.Context, log log.Logger) (cl *rpc.Client, trust bool, err error)

type PreparedL2Endpoints

type PreparedL2Endpoints struct {
	Client *rpc.Client
}

PreparedL2Endpoints enables testing with in-process pre-setup RPC connections to L2 engines

func (*PreparedL2Endpoints) Check

func (p *PreparedL2Endpoints) Check() error

func (*PreparedL2Endpoints) Setup

func (p *PreparedL2Endpoints) Setup(ctx context.Context, log log.Logger) (*rpc.Client, error)

type RPCConfig

type RPCConfig struct {
	ListenAddr  string
	ListenPort  int
	EnableAdmin bool
}

func (*RPCConfig) HttpEndpoint

func (cfg *RPCConfig) HttpEndpoint() string

type Tracer

type Tracer interface {
	OnNewL1Head(ctx context.Context, sig eth.L1BlockRef)
	OnUnsafeL2Payload(ctx context.Context, from peer.ID, payload *eth.ExecutionPayload)
	OnPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayload)
}

Tracer configures the OpNode to share events

Jump to

Keyboard shortcuts

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