rpcchainvm

package
v1.22.84 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: BSD-3-Clause Imports: 27 Imported by: 2

Documentation

Overview

Package rpcchainvm provides the RPC infrastructure for Chain VMs (linear blockchains). This package is a thin wrapper that re-exports the shared implementation from github.com/luxfi/vm/rpc/chain for backward compatibility.

Package rpcchainvm provides the RPC infrastructure for Chain VMs. This file provides backward-compatible type aliases to the shared implementation in github.com/luxfi/vm/rpc/chain.

Package rpcchainvm provides the RPC infrastructure for Chain VMs. This file provides backward-compatible type aliases to the shared implementation in github.com/luxfi/vm/rpc/chain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory added in v0.1.1

func NewFactory(
	path string,
	processTracker resource.ProcessTracker,
	runtimeTracker runtime.Tracker,
	metricsGatherer metric.MultiGatherer,
) vms.Factory

func Serve added in v0.1.1

func Serve(ctx context.Context, log log.Logger, vm block.ChainVM, opts ...grpcutils.ServerOption) error

Serve starts the RPC Chain VM server and performs a handshake with the VM runtime service. The address of the Runtime server is expected to be passed via ENV `runtime.EngineAddressKey`. This address is used by the Runtime client to send Initialize RPC to server.

This function delegates to the shared implementation in github.com/luxfi/vm/rpc/chain.

Types

type Context added in v1.16.56

type Context struct {
	NetworkID       uint32
	NetID           ids.ID
	ChainID         ids.ID
	NodeID          ids.NodeID
	PublicKey       *bls.PublicKey
	NetworkUpgrades upgrade.Config

	XChainID     ids.ID
	CChainID     ids.ID
	LUXAssetID   ids.ID
	ChainDataDir string

	Log            log.Logger
	SharedMemory   atomic.SharedMemory
	BCLookup       ids.AliaserReader
	Metrics        metrics.MultiGatherer
	WarpSigner     warp.Signer
	ValidatorState validators.State
}

Context is the node-specific context for RPC chain VM

func (*Context) PublicKeyBytes added in v1.16.56

func (c *Context) PublicKeyBytes() []byte

PublicKeyBytes returns the public key as bytes

func (*Context) ToConsensusContext added in v1.16.56

func (c *Context) ToConsensusContext() interface{}

ToConsensusContext converts node Context to consensus Context This is explicit - we know exactly what we're doing

type Message added in v1.16.56

type Message uint32

Message represents a notification message type

const (

	// PendingTxs indicates pending transactions notification
	PendingTxs Message
)

func (Message) String added in v1.16.56

func (m Message) String() string

type NotificationForwarder added in v1.16.56

type NotificationForwarder struct {
	Engine    Notifier
	Subscribe Subscription
	Log       log.Logger
	// contains filtered or unexported fields
}

NotificationForwarder is a component that listens for notifications from a Subscription, and forwards them to a Notifier. When CheckForEvent is called mid-subscription, it retries the subscription. After Notify is called, it waits for CheckForEvent to be called before subscribing again.

func NewNotificationForwarder added in v1.16.56

func NewNotificationForwarder(
	engine Notifier,
	subscribe Subscription,
	log log.Logger,
) *NotificationForwarder

func (*NotificationForwarder) CheckForEvent added in v1.16.56

func (nf *NotificationForwarder) CheckForEvent()

CheckForEvent cancels any outstanding WaitForEvent calls and schedules a new WaitForEvent call.

func (*NotificationForwarder) Close added in v1.16.56

func (nf *NotificationForwarder) Close()

Close cancels any outstanding WaitForEvent calls and waits for them to return. After Close returns, no future WaitForEvent calls will be made by the notification forwarder.

type Notifier added in v1.16.56

type Notifier interface {
	Notify(context.Context, Message) error
}

type Subscription added in v1.16.56

type Subscription func(ctx context.Context) (Message, error)

Subscription is a function that blocks until either the given context is cancelled, or a message is returned. It is used to receive messages from a VM such as Pending transactions, state sync completion, etc. The function returns the message received, or an error if the context is cancelled.

type VMClient

type VMClient = chain.Client

VMClient is a type alias for backward compatibility. The actual implementation is in github.com/luxfi/vm/rpc/chain.Client.

func NewClient

func NewClient(
	clientConn *grpc.ClientConn,
	runtime runtime.Stopper,
	pid int,
	processTracker resource.ProcessTracker,
	metricsGatherer metrics.MultiGatherer,
	logger log.Logger,
) *VMClient

NewClient returns a VM connected to a remote VM. This delegates to the shared implementation in github.com/luxfi/vm/rpc/chain.

type VMServer

type VMServer = chain.Server

VMServer is a type alias for backward compatibility. The actual implementation is in github.com/luxfi/vm/rpc/chain.Server.

func NewServer

func NewServer(vm block.ChainVM, allowShutdown *atomic.Atomic[bool]) *VMServer

NewServer creates a new VMServer for the given ChainVM. This delegates to the shared implementation in github.com/luxfi/vm/rpc/chain.

Directories

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

Jump to

Keyboard shortcuts

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