Documentation
¶
Index ¶
- Variables
- func NewBLSSignerWrapper(key *bls.SecretKey) bls.Signer
- func NewResourceManagerWrapper(manager resource.Manager) tracker.ResourceManager
- func NewRouterAdapter(r Router) router.Router
- type BLSSignerWrapper
- type CoreVM
- type HealthConfig
- type Node
- type PluginSpec
- type Router
- type Targeter
- type ValidatorManager
- func (v *ValidatorManager) AddChain(ctx context.Context, chainID ids.ID, h handler.Handler)
- func (v *ValidatorManager) Benched(chainID ids.ID, nodeID ids.NodeID)
- func (v *ValidatorManager) Connected(nodeID ids.NodeID, nodeVersion *version.Application, netID ids.ID)
- func (v *ValidatorManager) Deprecated()
- func (v *ValidatorManager) Disconnected(nodeID ids.NodeID)
- func (v *ValidatorManager) HandleInbound(ctx context.Context, msg message.InboundMessage)
- func (v *ValidatorManager) HealthCheck(ctx context.Context) (interface{}, error)
- func (v *ValidatorManager) Initialize(nodeID ids.NodeID, logger log.Logger, ...) error
- func (v *ValidatorManager) RegisterRequest(ctx context.Context, nodeID ids.NodeID, chainID ids.ID, requestID uint32, ...)
- func (v *ValidatorManager) Shutdown(ctx context.Context)
- func (v *ValidatorManager) Unbenched(chainID ids.ID, nodeID ids.NodeID)
- type ValidatorManagerConfig
Constants ¶
This section is empty.
Variables ¶
var CoreVMs = map[ids.ID]CoreVM{ constants.PlatformVMID: {Name: "platformvm (P-Chain)", RegisteredInNodeGo: true}, constants.XVMID: {Name: "xvm (X-Chain)", RegisteredInNodeGo: true}, constants.QuantumVMID: {Name: "quantumvm (Q-Chain)", Factory: &quantumvm.Factory{Config: quantumvmconfig.DefaultConfig()}}, constants.ZKVMID: {Name: "zkvm (Z-Chain)", Factory: &zkvm.Factory{}}, }
CoreVMs is the authoritative set of in-process VMs. Q and Z carry their concrete factory (registerCoreVMs installs them); P and X are registered in node.go with runtime dependencies (RegisteredInNodeGo=true, Factory nil).
This map is the single source for "what is core". The anti-shadow guards iterate its keys; tests assert all four are present and that none also appears in OptionalVMs.
var OptionalVMs = map[ids.ID]PluginSpec{ constants.DexVMID: {Name: "dexvm", Restricted: true}, constants.BridgeVMID: {Name: "bridgevm", Restricted: true}, constants.EVMID: {Name: "evm"}, constants.AIVMID: {Name: "aivm"}, constants.GraphVMID: {Name: "graphvm"}, constants.IdentityVMID: {Name: "identityvm"}, constants.KeyVMID: {Name: "keyvm"}, constants.OracleVMID: {Name: "oraclevm"}, constants.RelayVMID: {Name: "relayvm"}, constants.MPCVMID: {Name: "mpcvm"}, constants.FHEVMID: {Name: "fhevm"}, }
OptionalVMs is the authoritative set of plugin-only VMs and their activation rules. It is the single source for both (a) which VMs MUST NOT be linked in-process, and (b) which chains are restricted to entitled nodes.
D (dexvm) and B (bridgevm) are restricted: a node may track/validate them only if the M-Chain holds an ownership attestation naming it. That attestation is what makes the credential unforgeable by the node's own operator — it lives in consensus state, not in local config.
C (evm) and the remaining app VMs are plugin-loaded but open.
Declaring a VM here is a statement of intent, not a guarantee that a binary exists: the registry scan simply finds nothing and the chain cannot start. fhevm (F-Chain) is exactly that case today — see its entry below.
Functions ¶
func NewBLSSignerWrapper ¶ added in v1.16.16
func NewResourceManagerWrapper ¶ added in v1.16.16
func NewResourceManagerWrapper(manager resource.Manager) tracker.ResourceManager
NewResourceManagerWrapper creates a new resource manager wrapper
func NewRouterAdapter ¶ added in v1.16.16
NewRouterAdapter creates a new router adapter
Types ¶
type BLSSignerWrapper ¶ added in v1.16.16
type BLSSignerWrapper struct {
// contains filtered or unexported fields
}
BLSSignerWrapper wraps a SecretKey to implement the Signer interface with error returns
func (*BLSSignerWrapper) PublicKey ¶ added in v1.16.16
func (s *BLSSignerWrapper) PublicKey() *bls.PublicKey
func (*BLSSignerWrapper) Sign ¶ added in v1.16.16
func (s *BLSSignerWrapper) Sign(msg []byte) (*bls.Signature, error)
func (*BLSSignerWrapper) SignProofOfPossession ¶ added in v1.16.16
func (s *BLSSignerWrapper) SignProofOfPossession(msg []byte) (*bls.Signature, error)
type CoreVM ¶ added in v1.30.16
CoreVM describes a VM that runs in-process (linked into luxd), never loaded from PluginDir and never restricted.
Factory is the concrete in-process factory for VMs whose construction needs no node runtime state (Q, Z) — registerCoreVMs installs these. It is nil for P and X, whose factories must be built with live node dependencies (chainManager, validators, security profile, classical-compat registry) and are therefore registered explicitly in node.go; RegisteredInNodeGo records that ownership so the nil Factory is self-documenting, not a footgun.
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 (*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.
type PluginSpec ¶ added in v1.30.16
type PluginSpec struct {
// Name is the chain VM's package/plugin name (e.g. "dexvm"). For the nine
// luxfi/chains VMs the plugin main is github.com/luxfi/chains/<Name>/cmd/
// plugin and the built artifact is placed at <plugin-dir>/<VMID-CB58> by the
// Dockerfile Chain VM Plugin Stage. The C-Chain EVM ("evm") is also
// plugin-loaded but its plugin main lives in the EVM repo, not chains.
Name string
// Restricted means a node may activate this VM's chain only when the M-Chain
// holds an ownership attestation naming it. False means plugin-loaded but open
// to any node that tracks the chain.
//
// WHICH collection confers the entitlement is deliberately not stated here. It
// is asserted once, by whoever reads that collection and asks the M-Chain to
// sign; a second copy of that pin in the node would be a second source of
// truth, able to drift from the first.
Restricted bool
}
PluginSpec describes a VM that is loaded ONLY from PluginDir (never linked in-process), and whether its chain is restricted to entitled nodes.
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
RegisterRequest(
ctx context.Context,
nodeID ids.NodeID,
chainID ids.ID,
requestID uint32,
op message.Op,
failedMsg message.InboundMessage,
engineType p2p.EngineType,
)
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)
Deprecated() // Required for router.Router compatibility
}
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
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) 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) Deprecated ¶ added in v1.22.22
func (v *ValidatorManager) Deprecated()
Router interface methods - forward to underlying router
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) RegisterRequest ¶ added in v1.22.22
func (v *ValidatorManager) RegisterRequest( ctx context.Context, nodeID ids.NodeID, chainID ids.ID, requestID uint32, op message.Op, failedMsg message.InboundMessage, engineType p2p.EngineType, )
func (*ValidatorManager) Shutdown ¶ added in v1.22.22
func (v *ValidatorManager) Shutdown(ctx context.Context)
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