node

package
v1.0.0-beta.11 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EvPrefix = "0"

prefixes used in KV store to separate rollkit data from execution environment data (if the same data base is reused)

Functions

func Retry

func Retry(tries int, durationBetweenAttempts time.Duration, fn func() error) (err error)

Retry attempts to execute the provided function up to the specified number of tries, with a delay between attempts. It returns nil if the function succeeds, or the last error encountered if all attempts fail.

Parameters:

  • tries: The maximum number of attempts to make
  • durationBetweenAttempts: The duration to wait between attempts
  • fn: The function to retry, which returns an error on failure

Returns:

  • error: nil if the function succeeds, or the last error encountered

Types

type FullNode

type FullNode struct {
	service.BaseService

	Store store.Store
	// contains filtered or unexported fields
}

FullNode represents a client node in Rollkit network. It connects all the components and orchestrates their work.

func (*FullNode) GetGenesis

func (n *FullNode) GetGenesis() genesispkg.Genesis

GetGenesis returns entire genesis doc.

func (*FullNode) GetGenesisChunks

func (n *FullNode) GetGenesisChunks() ([]string, error)

GetGenesisChunks returns chunked version of genesis.

func (*FullNode) IsRunning

func (n *FullNode) IsRunning() bool

IsRunning returns true if the node is running.

func (*FullNode) Run

func (n *FullNode) Run(parentCtx context.Context) error

Run implements the Service interface. It starts all subservices and manages the node's lifecycle.

type LightNode

type LightNode struct {
	service.BaseService

	P2P *p2p.Client

	Store store.Store
	// contains filtered or unexported fields
}

LightNode is a chain node that only needs the header service

func (*LightNode) IsRunning

func (ln *LightNode) IsRunning() bool

IsRunning returns true if the node is running.

func (*LightNode) Run

func (ln *LightNode) Run(parentCtx context.Context) error

Run implements the Service interface. It starts all subservices and manages the node's lifecycle.

type MetricsProvider

type MetricsProvider func(chainID string) (*block.Metrics, *p2p.Metrics)

MetricsProvider returns a consensus, p2p and mempool Metrics.

func DefaultMetricsProvider

func DefaultMetricsProvider(config *config.InstrumentationConfig) MetricsProvider

DefaultMetricsProvider returns Metrics build using Prometheus client library if Prometheus is enabled. Otherwise, it returns no-op Metrics.

type MockTester

type MockTester struct {
}

MockTester is a mock testing.T

func (MockTester) Errorf

func (m MockTester) Errorf(format string, args ...any)

Errorf is used to log an error to the test logger

func (MockTester) Fail

func (m MockTester) Fail()

Fail is used to fail the test

func (MockTester) FailNow

func (m MockTester) FailNow()

FailNow is used to fail the test immediately

func (MockTester) Logf

func (m MockTester) Logf(format string, args ...any)

Logf is used to log a message to the test logger

type Node

type Node interface {
	service.Service

	IsRunning() bool
}

Node is the interface for an application node

func NewNode

func NewNode(
	conf config.Config,
	exec coreexecutor.Executor,
	sequencer coresequencer.Sequencer,
	da coreda.DA,
	signer signer.Signer,
	p2pClient *p2p.Client,
	genesis genesis.Genesis,
	database ds.Batching,
	metricsProvider MetricsProvider,
	logger zerolog.Logger,
	nodeOptions NodeOptions,
) (Node, error)

NewNode returns a new Full or Light Node based on the config This is the entry point for composing a node, when compiling a node, you need to provide an executor Example executors can be found in apps/

type NodeOptions

type NodeOptions struct {
	BlockOptions block.BlockOptions
}

type Source

type Source int

Source is an enum representing different sources of height

const (
	// Header is the source of height from the header sync service
	Header Source = iota
	// Data is the source of height from the data sync service
	Data
	// Store is the source of height from the block manager store
	Store
)

Jump to

Keyboard shortcuts

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