node

package
v1.36.186 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: BSD-3-Clause Imports: 98 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VMs = map[ids.ID]VM{

	constants.PlatformVMID: {Name: "platformvm (P-Chain)", InNodeGo: true},
	constants.XVMID:        {Name: "xvm (X-Chain)", InNodeGo: true},

	constants.QuantumVMID: {Name: "quantumvm (Q-Chain)", Factory: &quantumvm.Factory{Config: quantumvmconfig.DefaultConfig()}},
	constants.ZKVMID:      {Name: "zkvm (Z-Chain)", Factory: &zkvm.Factory{}},
	constants.EVMID:       {Name: "evm (C-Chain)", Factory: &evm.Factory{}},
	constants.BridgeVMID:  {Name: "bridgevm (B-Chain)", Factory: &bridgevm.Factory{}},
	constants.AIVMID:      {Name: "aivm (A-Chain)", Factory: &aivm.Factory{}},
	constants.GraphVMID:   {Name: "graphvm (G-Chain)", Factory: &graphvm.Factory{}},

	constants.IdentityVMID: {Name: "identityvm (I-Chain)", Factory: &identityvm.Factory{}},
	constants.KeyVMID:      {Name: "keyvm (K-Chain)", Factory: &keyvm.Factory{}},
	constants.OracleVMID:   {Name: "oraclevm (O-Chain)", Factory: &oraclevm.Factory{}},
	constants.RelayVMID:    {Name: "relayvm (R-Chain)", Factory: &relayvm.Factory{}},
	constants.MPCVMID:      {Name: "mpcvm (M-Chain)", Factory: &mpcvm.Factory{}},
	constants.FHEVMID:      {Name: "fhevm (F-Chain)", Factory: &fhevm.Factory{}},

	constants.DexVMID: {Name: "dexvm (D-Chain)"},
}

Functions

func NewResourceManagerWrapper added in v1.16.16

func NewResourceManagerWrapper(manager resource.Manager) tracker.ResourceManager

NewResourceManagerWrapper creates a new resource manager wrapper

Types

type HealthConfig added in v1.16.16

type HealthConfig struct {
	Enabled                       bool          `json:"enabled"`
	PollingInterval               time.Duration `json:"pollingInterval"`
	MaxOutstandingRequestDuration time.Duration `json:"maxOutstandingRequestDuration"`
	MaxTimeSinceMsgReceived       time.Duration `json:"maxTimeSinceMsgReceived"`
	MaxTimeSinceMsgSent           time.Duration `json:"maxTimeSinceMsgSent"`
	MaxPortionSentQueueBytesFull  float64       `json:"maxPortionSentQueueBytesFull"`
	MaxPortionSendQueueFull       float64       `json:"maxPortionSendQueueFull"`
	MaxSendFailRate               float64       `json:"maxSendFailRate"`
	MinConnectedPeers             int           `json:"minConnectedPeers"`
	ReadTimeout                   time.Duration `json:"readTimeout"`
	WriteTimeout                  time.Duration `json:"writeTimeout"`
}

HealthConfig for router health monitoring

type Node

type Node struct {
	Log          log.Logger
	VMFactoryLog log.Logger
	LogFactory   log.Factory

	// This node's unique ID used when communicating with other nodes
	// (in consensus, for example)
	ID ids.NodeID

	StakingTLSSigner crypto.Signer
	StakingTLSCert   *staking.Certificate

	// Storage for this node
	DB database.Database

	// dispatcher for events as they happen in consensus
	BlockAcceptorGroup  nodeconsensus.AcceptorGroup
	TxAcceptorGroup     nodeconsensus.AcceptorGroup
	VertexAcceptorGroup nodeconsensus.AcceptorGroup

	// Net runs the networking stack
	Net network.Network

	// Handles HTTP API calls
	APIServer server.Server

	// This node's configuration
	Config *node.Config

	// Metrics Registerer
	MetricsGatherer        metric.MultiGatherer
	MeterDBMetricsGatherer metric.MultiGatherer

	VMAliaser ids.Aliaser
	VMManager vms.Manager

	// VM endpoint registry
	VMRegistry registry.VMRegistry
	// contains filtered or unexported fields
}

Node is an instance of a Lux node.

func New added in v0.1.1

func New(
	config *node.Config,
	logFactory log.Factory,
	logger log.Logger,
) (*Node, error)

New returns an instance of Node

func (*Node) Dispatch

func (n *Node) Dispatch() error

Dispatch starts the node's servers. Returns when the node exits.

func (*Node) ExitCode added in v0.1.1

func (n *Node) ExitCode() int

func (*Node) SecurityProfile added in v1.26.11

func (n *Node) SecurityProfile() *consensusconfig.ChainSecurityProfile

SecurityProfile returns the chain-wide ChainSecurityProfile this node is operating under, or nil when the genesis carries no pin. The returned pointer is the post-Validate+ComputeHash result already stamped with ProfileHash; callers MUST NOT mutate it.

Downstream consumers (signer factory, peer handshake gate, mempool admittance, validator registry, bridge oracle co-signer) take this as a dependency at construction time. The single load happens at node bootstrap (initSecurityProfile); there is no per-request re-resolution.

Closes red-team finding F102 at the consumer API boundary.

func (*Node) Shutdown

func (n *Node) Shutdown(exitCode int)

Shutdown this node May be called multiple times All calls to shutdownOnce.Do block until the first call returns

type Router added in v1.16.16

type Router interface {
	Initialize(
		nodeID ids.NodeID,
		logger log.Logger,
		timeoutManager timer.AdaptiveTimeoutManager,
		gossipFrequency uint64,
		harshQuittersTime uint64,
		harshQuittersSlashingFraction uint64,
		appGossipValidatorSize uint64,
		appGossipNonValidatorSize uint64,
		gossipAcceptedFrontierSize uint64,
		appSendQueueSize uint64,
		peerNotConnectedF uint64,
		connectedPeers ...ids.NodeID,
	) error

	HandleInbound(ctx context.Context, msg message.InboundMessage)
	Shutdown(ctx context.Context)
	AddChain(ctx context.Context, chainID ids.ID, handler handler.Handler)
	Connected(nodeID ids.NodeID, nodeVersion *version.Application, netID ids.ID)
	Disconnected(nodeID ids.NodeID)
	Benched(chainID ids.ID, nodeID ids.NodeID)
	Unbenched(chainID ids.ID, nodeID ids.NodeID)
	HealthCheck(ctx context.Context) (interface{}, error)
}

Router handles message routing between chains

func NewRouter added in v1.22.59

func NewRouter(logger log.Logger, timeoutManager timer.AdaptiveTimeoutManager) Router

NewRouter creates a new chain router

func NewSimpleRouter added in v1.16.16

func NewSimpleRouter(logger log.Logger, timeoutManager timer.AdaptiveTimeoutManager) Router

NewSimpleRouter is deprecated - use NewRouter instead

func Trace added in v1.16.16

func Trace(router Router, name string, tracer trace.Tracer) Router

Trace wraps a router with tracing capabilities

type Targeter added in v1.16.16

type Targeter = tracker.Targeter

Type aliases

type VM added in v1.36.186

type VM struct {
	Name string
	// Factory builds the VM. Nil means this entry is not built here: either
	// InNodeGo (P and X, whose factories need live node state), or nothing
	// implements it yet (D).
	Factory vms.Factory
	// InNodeGo records that node.go owns this registration, so a nil Factory
	// is self-documenting rather than a hole.
	InNodeGo bool
	// Restricted means the chain activates only when the M-Chain holds an
	// ownership attestation naming this node. Nothing sets it today: the
	// verifier and the claim encoding exist (luxfi/chains/ownership) but there
	// is nowhere to read an attestation from, and a check that can only refuse
	// is a refusal wearing a policy's name.
	Restricted bool
}

VMs is the node's one VM registry: every chain this daemon can run, and the factory that builds it. Registration is in-process — luxd links its chains the way it links P and X, and a chain in genesis starts because the binary already contains it.

The alternative, one subprocess per chain speaking ZAP over a pipe, buys nothing here. The VMs are Go packages in the same module graph; running them out-of-process adds a serialization boundary, a supervision problem and a failure mode where a chain silently never starts because a file was not installed under the right name. It also made "which chains do I have" a question about a directory listing rather than about the program.

type ValidatorManager added in v1.22.22

type ValidatorManager struct {
	Router
	// contains filtered or unexported fields
}

ValidatorManager wraps the consensus router and handles: - Validator connection tracking - Beacon connection management for bootstrap - Sybil protection weight management

func NewValidatorManager added in v1.22.22

func NewValidatorManager(cfg ValidatorManagerConfig) *ValidatorManager

NewValidatorManager creates a new validator manager

func (*ValidatorManager) AddChain added in v1.22.22

func (v *ValidatorManager) AddChain(ctx context.Context, chainID ids.ID, h handler.Handler)

func (*ValidatorManager) Benched added in v1.22.22

func (v *ValidatorManager) Benched(chainID ids.ID, nodeID ids.NodeID)

func (*ValidatorManager) Connected added in v1.22.22

func (v *ValidatorManager) Connected(nodeID ids.NodeID, nodeVersion *version.Application, netID ids.ID)

func (*ValidatorManager) Disconnected added in v1.22.22

func (v *ValidatorManager) Disconnected(nodeID ids.NodeID)

func (*ValidatorManager) HandleInbound added in v1.22.22

func (v *ValidatorManager) HandleInbound(ctx context.Context, msg message.InboundMessage)

func (*ValidatorManager) HealthCheck added in v1.22.22

func (v *ValidatorManager) HealthCheck(ctx context.Context) (interface{}, error)

func (*ValidatorManager) Initialize added in v1.22.22

func (v *ValidatorManager) Initialize(
	nodeID ids.NodeID,
	logger log.Logger,
	timeoutManager timer.AdaptiveTimeoutManager,
	gossipFrequency uint64,
	harshQuittersTime uint64,
	harshQuittersSlashingFraction uint64,
	appGossipValidatorSize uint64,
	appGossipNonValidatorSize uint64,
	gossipAcceptedFrontierSize uint64,
	appSendQueueSize uint64,
	peerNotConnectedF uint64,
	connectedPeers ...ids.NodeID,
) error

func (*ValidatorManager) Shutdown added in v1.22.22

func (v *ValidatorManager) Shutdown(ctx context.Context)

func (*ValidatorManager) Unbenched added in v1.22.22

func (v *ValidatorManager) Unbenched(chainID ids.ID, nodeID ids.NodeID)

type ValidatorManagerConfig added in v1.22.22

type ValidatorManagerConfig struct {
	Router                  Router
	Log                     log.Logger
	Validators              validators.Manager
	Beacons                 validators.Manager
	TrackedNetworks         []ids.ID
	SybilProtectionDisabled bool
	SybilProtectionWeight   uint64
	RequiredBeaconConns     int64
	OnSufficientlyConnected chan struct{}
}

ValidatorManagerConfig configures the validator manager

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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