teleportvm

package
v1.24.18 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Overview

Package teleportvm implements the Teleport Virtual Machine (T-Chain) for the Lux network. TeleportVM is the unified cross-chain data movement VM that handles:

  • Bridge: deposit/mint/burn/release proofs with MPC threshold signing
  • Relay: cross-chain message relay with channels and receipts
  • Oracle: price feeds and data attestation

One VM, one signer set, one bond, one chain.

Index

Constants

View Source
const (
	// Message states
	MessagePending   = "pending"
	MessageVerified  = "verified"
	MessageDelivered = "delivered"
	MessageFailed    = "failed"
)

Variables

View Source
var (
	ErrMessageNotSigned       = errors.New("bridge message not signed")
	ErrInvalidBridgeSignature = errors.New("invalid bridge signature")
	ErrDeliveryNotConfirmed   = errors.New("delivery not confirmed")
)
View Source
var (
	ErrInsufficientSigners = errors.New("insufficient active signers for threshold")
	ErrSigningTimeout      = errors.New("signing timeout")
	ErrInvalidShare        = errors.New("invalid signature share")
	ErrNoKeyShare          = errors.New("no key share available")
)
View Source
var VMID = ids.ID{'t', 'e', 'l', 'e', 'p', 'o', 'r', 't', 'v', 'm'}

VMID is the unique identifier for TeleportVM (T-Chain)

View Source
var (
	Version = &version.Semantic{
		Major: 1,
		Minor: 0,
		Patch: 0,
	}
)

Functions

func ComputeRequestID

func ComputeRequestID(serviceID, sessionID, txID ids.ID, step, retry uint32) [32]byte

ComputeRequestID computes the deterministic request ID

Types

type AggregatedValue

type AggregatedValue struct {
	FeedID       ids.ID    `json:"feedId"`
	Epoch        uint64    `json:"epoch"`
	Value        []byte    `json:"value"`
	Timestamp    time.Time `json:"timestamp"`
	Observations int       `json:"observationCount"`
	AggProof     []byte    `json:"aggProof,omitempty"`
	QuorumCert   []byte    `json:"quorumCert,omitempty"`
}

AggregatedValue represents the canonical output for a feed

type Block

type Block struct {
	ParentID_      ids.ID `json:"parentId"`
	BlockHeight    uint64 `json:"height"`
	BlockTimestamp int64  `json:"timestamp"`

	// Bridge data
	BridgeRequests []*BridgeRequest      `json:"bridgeRequests,omitempty"`
	MPCSignatures  map[ids.NodeID][]byte `json:"mpcSignatures,omitempty"`

	// Relay data
	RelayMessages []*Message        `json:"relayMessages,omitempty"`
	Receipts      []*MessageReceipt `json:"receipts,omitempty"`
	StateRoot     []byte            `json:"stateRoot,omitempty"`

	// Oracle data
	Observations []*Observation     `json:"observations,omitempty"`
	Aggregations []*AggregatedValue `json:"aggregations,omitempty"`
	FeedUpdates  []*Feed            `json:"feedUpdates,omitempty"`

	// Cached values
	ID_ ids.ID
	// contains filtered or unexported fields
}

Block represents a unified block in the Teleport chain. It can contain bridge requests, relay messages, and oracle observations.

func (*Block) Accept

func (b *Block) Accept(ctx context.Context) error

Accept marks the block as accepted

func (*Block) Bytes

func (b *Block) Bytes() []byte

Bytes returns the block bytes

func (*Block) Height

func (b *Block) Height() uint64

Height returns the block height

func (*Block) ID

func (b *Block) ID() ids.ID

ID returns the block ID

func (*Block) Parent

func (b *Block) Parent() ids.ID

Parent returns the parent block ID

func (*Block) ParentID

func (b *Block) ParentID() ids.ID

ParentID returns the parent block ID

func (*Block) Reject

func (b *Block) Reject(ctx context.Context) error

Reject marks the block as rejected

func (*Block) Status

func (b *Block) Status() uint8

Status returns the block's status

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

Timestamp returns the block timestamp

func (*Block) Verify

func (b *Block) Verify(ctx context.Context) error

Verify verifies the block

type BridgeMessage

type BridgeMessage struct {
	ID        ids.ID    `json:"id"`
	Nonce     uint64    `json:"nonce"`
	Timestamp time.Time `json:"timestamp"`

	SourceChain string `json:"sourceChain"`
	DestChain   string `json:"destChain"`

	Asset     ids.ID `json:"asset"`
	Amount    uint64 `json:"amount"`
	Recipient []byte `json:"recipient"`
	Sender    []byte `json:"sender"`

	SourceTxID    ids.ID `json:"sourceTxId"`
	Confirmations uint32 `json:"confirmations"`

	Signature []byte `json:"signature"`
	SignedBy  []int  `json:"signedBy"`

	DeliveryConfirmation *DeliveryConfirmation `json:"deliveryConfirmation,omitempty"`
}

BridgeMessage represents a signed cross-chain message

func (*BridgeMessage) SigningMessage

func (m *BridgeMessage) SigningMessage() []byte

SigningMessage returns the canonical bytes to sign

func (*BridgeMessage) Verify

func (m *BridgeMessage) Verify(groupPublicKey []byte, verifier func([]byte, []byte) bool) error

Verify verifies the threshold signature

type BridgeMessageValidator

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

BridgeMessageValidator validates bridge messages

func NewBridgeMessageValidator

func NewBridgeMessageValidator(
	bridgeSigner *BridgeSigner,
	deliverySigner *DeliveryConfirmationSigner,
	minConfirmations uint32,
	requireDeliveryConfirm bool,
	logger log.Logger,
) *BridgeMessageValidator

NewBridgeMessageValidator creates a new validator

func (*BridgeMessageValidator) ValidateAfterRelay

func (v *BridgeMessageValidator) ValidateAfterRelay(message *BridgeMessage) error

ValidateAfterRelay validates delivery confirmation after relay

func (*BridgeMessageValidator) ValidateBeforeRelay

func (v *BridgeMessageValidator) ValidateBeforeRelay(message *BridgeMessage) error

ValidateBeforeRelay validates a message before relaying

func (*BridgeMessageValidator) ValidateMessage

func (v *BridgeMessageValidator) ValidateMessage(message *BridgeMessage) error

ValidateMessage performs full validation

type BridgeRegistry

type BridgeRegistry struct {
	Validators       map[ids.NodeID]*BridgeValidator
	CompletedBridges map[ids.ID]*CompletedBridge
	DailyVolume      map[string]uint64
	// contains filtered or unexported fields
}

BridgeRegistry tracks bridge operations

type BridgeRequest

type BridgeRequest struct {
	ID            ids.ID    `json:"id"`
	SourceChain   string    `json:"sourceChain"`
	DestChain     string    `json:"destChain"`
	Asset         ids.ID    `json:"asset"`
	Amount        uint64    `json:"amount"`
	Recipient     []byte    `json:"recipient"`
	SourceTxID    ids.ID    `json:"sourceTxId"`
	Confirmations uint32    `json:"confirmations"`
	Status        string    `json:"status"`
	MPCSignatures [][]byte  `json:"mpcSignatures"`
	CreatedAt     time.Time `json:"createdAt"`
}

BridgeRequest represents a cross-chain bridge request

type BridgeSigner

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

BridgeSigner handles signing of bridge messages using MPC

func NewBridgeSigner

func NewBridgeSigner(keyManager *MPCKeyManager, coordinator *MPCCoordinator, logger log.Logger) *BridgeSigner

NewBridgeSigner creates a new bridge signer

func (*BridgeSigner) CreateSignatureShare

func (s *BridgeSigner) CreateSignatureShare(ctx context.Context, message *BridgeMessage) ([]byte, []byte, error)

CreateSignatureShare creates this node's signature share

func (*BridgeSigner) GetSignature

func (s *BridgeSigner) GetSignature(ctx context.Context, sessionID string) ([]byte, error)

GetSignature retrieves the completed signature

func (*BridgeSigner) RequestSignature

func (s *BridgeSigner) RequestSignature(ctx context.Context, message *BridgeMessage, signerIndices []int) (string, error)

RequestSignature initiates threshold signing

func (*BridgeSigner) SignBridgeMessage

func (s *BridgeSigner) SignBridgeMessage(ctx context.Context, message *BridgeMessage, activeSigners []int) error

SignBridgeMessage coordinates complete signing

func (*BridgeSigner) VerifyBridgeMessage

func (s *BridgeSigner) VerifyBridgeMessage(message *BridgeMessage) error

VerifyBridgeMessage verifies a bridge message signature

type BridgeValidator

type BridgeValidator struct {
	NodeID       ids.NodeID
	StakeAmount  uint64
	MPCPublicKey []byte
	Active       bool
	TotalBridged uint64
	SuccessRate  float64
}

BridgeValidator represents a bridge validator node

type ChainClient

type ChainClient interface {
	GetTransaction(ctx context.Context, txID ids.ID) (interface{}, error)
	GetConfirmations(ctx context.Context, txID ids.ID) (uint32, error)
	SendTransaction(ctx context.Context, tx interface{}) (ids.ID, error)
	ValidateAddress(address []byte) error
}

ChainClient interface for interacting with different chains

type Channel

type Channel struct {
	ID          ids.ID            `json:"id"`
	SourceChain ids.ID            `json:"sourceChain"`
	DestChain   ids.ID            `json:"destChain"`
	Ordering    string            `json:"ordering"`
	Version     string            `json:"version"`
	State       string            `json:"state"`
	CreatedAt   time.Time         `json:"createdAt"`
	Metadata    map[string]string `json:"metadata"`
}

Channel represents a cross-chain communication channel

type CloseChannelArgs

type CloseChannelArgs struct {
	ChannelID string `json:"channelId"`
}

type CompletedBridge

type CompletedBridge struct {
	RequestID    ids.ID
	SourceTxID   ids.ID
	DestTxID     ids.ID
	CompletedAt  time.Time
	MPCSignature []byte
}

CompletedBridge represents a completed bridge operation

type Config

type Config struct {
	// Bridge settings
	MinConfirmations uint32   `json:"minConfirmations"`
	BridgeFee        uint64   `json:"bridgeFee"`
	SupportedChains  []string `json:"supportedChains"`
	MaxBridgeAmount  uint64   `json:"maxBridgeAmount"`
	DailyBridgeLimit uint64   `json:"dailyBridgeLimit"`

	// Signer set (LP-333)
	RequireValidatorBond uint64  `json:"requireValidatorBond"` // 1M LUX bond (slashable)
	MaxSigners           int     `json:"maxSigners"`
	ThresholdRatio       float64 `json:"thresholdRatio"`

	// MPC
	MPCThreshold    int `json:"mpcThreshold"`
	MPCTotalParties int `json:"mpcTotalParties"`

	// Relay settings
	MaxMessageSize    int      `json:"maxMessageSize"`
	ConfirmationDepth int      `json:"confirmationDepth"`
	RelayTimeout      int      `json:"relayTimeout"`
	TrustedRelayers   []string `json:"trustedRelayers"`

	// Oracle settings
	MaxFeedsPerBlock    int    `json:"maxFeedsPerBlock"`
	ObservationWindow   string `json:"observationWindow"`
	MinObservers        int    `json:"minObservers"`
	AggregationMethod   string `json:"aggregationMethod"`
	DeviationThreshold  uint64 `json:"deviationThreshold"`
	EnableZKAggregation bool   `json:"enableZkAggregation"`
	ZKProofSystem       string `json:"zkProofSystem"`
	RequireQuorumCert   bool   `json:"requireQuorumCert"`
	QuorumThreshold     int    `json:"quorumThreshold"`
}

Config contains unified TeleportVM configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns sane defaults

type CrossChainMPCRequest

type CrossChainMPCRequest struct {
	Type          MPCRequestType `json:"type"`
	SessionID     string         `json:"sessionId"`
	Epoch         uint64         `json:"epoch"`
	OldPartyIDs   []party.ID     `json:"oldPartyIds"`
	NewPartyIDs   []party.ID     `json:"newPartyIds"`
	Threshold     int            `json:"threshold"`
	SourceChainID []byte         `json:"sourceChainId"`
	Timestamp     int64          `json:"timestamp"`
}

CrossChainMPCRequest represents a cross-chain request for MPC operations

type DeliveryConfirmation

type DeliveryConfirmation struct {
	DestTxID         ids.ID    `json:"destTxId"`
	DestBlockHeight  uint64    `json:"destBlockHeight"`
	DestConfirms     uint32    `json:"destConfirms"`
	ConfirmedAt      time.Time `json:"confirmedAt"`
	ConfirmSignature []byte    `json:"confirmSignature"`
}

DeliveryConfirmation proves message was delivered on destination chain

func (*DeliveryConfirmation) SigningMessage

func (dc *DeliveryConfirmation) SigningMessage(messageID ids.ID) []byte

SigningMessage returns the canonical bytes to sign for a delivery confirmation

type DeliveryConfirmationSigner

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

DeliveryConfirmationSigner handles signing of delivery confirmations

func NewDeliveryConfirmationSigner

func NewDeliveryConfirmationSigner(keyManager *MPCKeyManager, coordinator *MPCCoordinator, logger log.Logger) *DeliveryConfirmationSigner

NewDeliveryConfirmationSigner creates a new delivery confirmation signer

func (*DeliveryConfirmationSigner) SignDeliveryConfirmation

func (s *DeliveryConfirmationSigner) SignDeliveryConfirmation(ctx context.Context, messageID ids.ID, confirmation *DeliveryConfirmation, activeSigners []int) error

SignDeliveryConfirmation creates a threshold signature for delivery confirmation

func (*DeliveryConfirmationSigner) VerifyDeliveryConfirmation

func (s *DeliveryConfirmationSigner) VerifyDeliveryConfirmation(messageID ids.ID, confirmation *DeliveryConfirmation) error

VerifyDeliveryConfirmation verifies a delivery confirmation signature

type Factory

type Factory struct{}

Factory creates new TeleportVM instances

func (*Factory) New

func (f *Factory) New(logger log.Logger) (interface{}, error)

New returns a new instance of the TeleportVM

type Feed

type Feed struct {
	ID          ids.ID            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Sources     []string          `json:"sources"`
	UpdateFreq  time.Duration     `json:"updateFreq"`
	PolicyHash  [32]byte          `json:"policyHash"`
	Operators   []ids.NodeID      `json:"operators"`
	CreatedAt   time.Time         `json:"createdAt"`
	Status      string            `json:"status"`
	Metadata    map[string]string `json:"metadata"`
}

Feed represents an oracle data feed

type Genesis

type Genesis struct {
	Timestamp int64      `json:"timestamp"`
	Message   string     `json:"message,omitempty"`
	Config    *Config    `json:"config,omitempty"`
	Channels  []*Channel `json:"channels,omitempty"`
	Feeds     []*Feed    `json:"initialFeeds,omitempty"`
}

Genesis represents the genesis state

type GetAttestationArgs

type GetAttestationArgs struct {
	FeedID string `json:"feedId"`
	Epoch  uint64 `json:"epoch"`
}

type GetChannelArgs

type GetChannelArgs struct {
	ChannelID string `json:"channelId"`
}

type GetFeedArgs

type GetFeedArgs struct {
	FeedID string `json:"feedId"`
}

type GetMessageArgs

type GetMessageArgs struct {
	MessageID string `json:"messageId"`
}

type GetValueArgs

type GetValueArgs struct {
	FeedID string `json:"feedId"`
}

type HasSignerArgs

type HasSignerArgs struct {
	NodeID string `json:"nodeId"`
}

type ListChannelsArgs

type ListChannelsArgs struct {
	State string `json:"state"`
}

type MPCCoordinator

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

MPCCoordinator coordinates threshold signing across multiple parties

func NewMPCCoordinator

func NewMPCCoordinator(keyManager *MPCKeyManager, logger log.Logger) *MPCCoordinator

NewMPCCoordinator creates a new MPC coordinator

func (*MPCCoordinator) GetSession

func (c *MPCCoordinator) GetSession(sessionID string) (*SigningSession, bool)

GetSession returns an active signing session

func (*MPCCoordinator) StartSigning

func (c *MPCCoordinator) StartSigning(ctx context.Context, sessionID string, message []byte, signers []int, timeout time.Duration) (*SigningSession, error)

StartSigning initiates a new signing session

type MPCKeyManager

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

MPCKeyManager manages threshold key generation and shares

func NewMPCKeyManager

func NewMPCKeyManager(logger log.Logger) (*MPCKeyManager, error)

NewMPCKeyManager creates a new MPC key manager

func (*MPCKeyManager) AggregateSignature

func (m *MPCKeyManager) AggregateSignature(ctx context.Context, message []byte, shares []threshold.SignatureShare) ([]byte, error)

AggregateSignature combines shares into a final signature

func (*MPCKeyManager) GenerateKeys

func (m *MPCKeyManager) GenerateKeys(ctx context.Context, t, totalParties int) error

GenerateKeys performs distributed key generation

func (*MPCKeyManager) GetGroupPublicKey

func (m *MPCKeyManager) GetGroupPublicKey() []byte

GetGroupPublicKey returns the threshold group public key

func (*MPCKeyManager) GetKeyShareBytes

func (m *MPCKeyManager) GetKeyShareBytes() []byte

GetKeyShareBytes returns the serialized key share

func (*MPCKeyManager) SetKeyShare

func (m *MPCKeyManager) SetKeyShare(share threshold.KeyShare) error

SetKeyShare sets this node's key share

func (*MPCKeyManager) SignShare

func (m *MPCKeyManager) SignShare(ctx context.Context, message []byte) (threshold.SignatureShare, error)

SignShare creates a signature share for a message

func (*MPCKeyManager) VerifyShare

func (m *MPCKeyManager) VerifyShare(message []byte, share threshold.SignatureShare, publicShare []byte) error

VerifyShare verifies a signature share

func (*MPCKeyManager) VerifySignature

func (m *MPCKeyManager) VerifySignature(message, signature []byte) bool

VerifySignature verifies a final threshold signature

type MPCRequestType

type MPCRequestType uint8

MPCRequestType defines the type of MPC cross-chain request

const (
	MPCRequestReshare MPCRequestType = iota
	MPCRequestSign
	MPCRequestRefresh
)

type Message

type Message struct {
	ID           ids.ID     `json:"id"`
	ChannelID    ids.ID     `json:"channelId"`
	SourceChain  ids.ID     `json:"sourceChain"`
	DestChain    ids.ID     `json:"destChain"`
	Sequence     uint64     `json:"sequence"`
	Payload      []byte     `json:"payload"`
	Proof        []byte     `json:"proof"`
	SourceHeight uint64     `json:"sourceHeight"`
	Sender       []byte     `json:"sender"`
	Receiver     []byte     `json:"receiver"`
	Timeout      int64      `json:"timeout"`
	State        string     `json:"state"`
	RelayedBy    ids.NodeID `json:"relayedBy,omitempty"`
	RelayedAt    int64      `json:"relayedAt,omitempty"`
	ConfirmedAt  int64      `json:"confirmedAt,omitempty"`
}

Message represents a cross-chain message

type MessageReceipt

type MessageReceipt struct {
	MessageID   ids.ID `json:"messageId"`
	ChannelID   ids.ID `json:"channelId"`
	Success     bool   `json:"success"`
	ResultHash  []byte `json:"resultHash"`
	BlockHeight uint64 `json:"blockHeight"`
	Timestamp   int64  `json:"timestamp"`
}

MessageReceipt is generated when a message is verified

type Observation

type Observation struct {
	FeedID     ids.ID     `json:"feedId"`
	Value      []byte     `json:"value"`
	Timestamp  time.Time  `json:"timestamp"`
	SourceMeta [32]byte   `json:"sourceMetaHash"`
	OperatorID ids.NodeID `json:"operatorId"`
	Signature  []byte     `json:"signature"`
}

Observation represents a signed observation from an operator

type OpenChannelArgs

type OpenChannelArgs struct {
	SourceChain string `json:"sourceChain"`
	DestChain   string `json:"destChain"`
	Ordering    string `json:"ordering"`
	Version     string `json:"version"`
}

Relay

type OracleCommit

type OracleCommit struct {
	RequestID   [32]byte    `json:"requestId"`
	Kind        RequestKind `json:"kind"`
	Root        [32]byte    `json:"root"`
	RecordCount uint32      `json:"recordCount"`
	Window      struct {
		Start uint64 `json:"start"`
		End   uint64 `json:"end"`
	} `json:"window"`
	CommittedAt time.Time `json:"committedAt"`
}

OracleCommit represents a Merkle root commitment for a request

type OracleRecord

type OracleRecord struct {
	RequestID   [32]byte   `json:"requestId"`
	Executor    ids.NodeID `json:"executor"`
	Timestamp   uint64     `json:"timestamp"`
	Endpoint    string     `json:"endpoint"`
	BodyHash    [32]byte   `json:"bodyHash"`
	ResultCode  uint32     `json:"resultCode"`
	ExternalRef []byte     `json:"externalRef"`
	Signature   []byte     `json:"signature"`
}

OracleRecord represents a single execution record from an executor

type OracleRequest

type OracleRequest struct {
	RequestID      [32]byte      `json:"requestId"`
	ServiceID      ids.ID        `json:"serviceId"`
	SessionID      ids.ID        `json:"sessionId"`
	Step           uint32        `json:"step"`
	Retry          uint32        `json:"retry"`
	TxID           ids.ID        `json:"txId"`
	Kind           RequestKind   `json:"kind"`
	Target         []byte        `json:"target"`
	PayloadHash    [32]byte      `json:"payloadHash"`
	SchemaHash     [32]byte      `json:"schemaHash"`
	DeadlineHeight uint64        `json:"deadlineHeight"`
	Executors      []ids.NodeID  `json:"executors"`
	CreatedAt      time.Time     `json:"createdAt"`
	Status         RequestStatus `json:"status"`
}

OracleRequest represents a deterministic request from PlatformVM

type ReceiptCommit

type ReceiptCommit struct {
	CommitID     [32]byte `json:"commitId"`
	SessionID    [32]byte `json:"sessionId,omitempty"`
	Root         [32]byte `json:"root"`
	ReceiptCount uint32   `json:"receiptCount"`
	BlockHeight  uint64   `json:"blockHeight"`
	Window       struct {
		Start uint64 `json:"start"`
		End   uint64 `json:"end"`
	} `json:"window"`
	CommittedAt time.Time `json:"committedAt"`
}

ReceiptCommit represents a Merkle root commitment over a set of receipts

type ReceiveMessageArgs

type ReceiveMessageArgs struct {
	MessageID    string `json:"messageId"`
	Proof        string `json:"proof"`
	SourceHeight uint64 `json:"sourceHeight"`
}

type RegisterFeedArgs

type RegisterFeedArgs struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Sources     []string          `json:"sources"`
	UpdateFreq  string            `json:"updateFreq"`
	Operators   []string          `json:"operators"`
	Metadata    map[string]string `json:"metadata"`
}

Oracle

type RegisterValidatorInput

type RegisterValidatorInput struct {
	NodeID     string `json:"nodeId"`
	BondAmount string `json:"bondAmount,omitempty"`
	MPCPubKey  string `json:"mpcPubKey,omitempty"`
}

RegisterValidatorInput is the input for registering as a signer

type RegisterValidatorResult

type RegisterValidatorResult struct {
	Success        bool   `json:"success"`
	NodeID         string `json:"nodeId"`
	Registered     bool   `json:"registered"`
	Waitlisted     bool   `json:"waitlisted"`
	SignerIndex    int    `json:"signerIndex"`
	WaitlistIndex  int    `json:"waitlistIndex,omitempty"`
	TotalSigners   int    `json:"totalSigners"`
	Threshold      int    `json:"threshold"`
	ReshareNeeded  bool   `json:"reshareNeeded"`
	CurrentEpoch   uint64 `json:"currentEpoch"`
	SetFrozen      bool   `json:"setFrozen"`
	RemainingSlots int    `json:"remainingSlots"`
	Message        string `json:"message"`
}

RegisterValidatorResult is the result of registering

type ReplaceSignerArgs

type ReplaceSignerArgs struct {
	NodeID            string `json:"nodeId"`
	ReplacementNodeID string `json:"replacementNodeId"`
}

Bridge / Signer

type RequestKind

type RequestKind uint8

RequestKind indicates whether this is a write or read request

const (
	RequestKindWrite RequestKind = iota
	RequestKindRead
)

type RequestStatus

type RequestStatus uint8

RequestStatus tracks the lifecycle of an oracle request

const (
	RequestStatusPending RequestStatus = iota
	RequestStatusExecuting
	RequestStatusCommitted
	RequestStatusExpired
	RequestStatusFailed
)

type SendMessageArgs

type SendMessageArgs struct {
	ChannelID string `json:"channelId"`
	Payload   string `json:"payload"`
	Sender    string `json:"sender"`
	Receiver  string `json:"receiver"`
	Timeout   int64  `json:"timeout"`
}

type SignedReceipt

type SignedReceipt struct {
	MessageID   ids.ID     `json:"messageId"`
	SessionID   [32]byte   `json:"sessionId"`
	NodeID      ids.NodeID `json:"nodeId"`
	Timestamp   uint64     `json:"timestamp"`
	ContentHash [32]byte   `json:"contentHash"`
	Signature   []byte     `json:"signature"`
}

SignedReceipt represents a node's signed acknowledgment of message receipt

type SignerInfo

type SignerInfo struct {
	NodeID     ids.NodeID `json:"nodeId"`
	PartyID    party.ID   `json:"partyId"`
	BondAmount uint64     `json:"bondAmount"` // 1M LUX bond (slashable, NOT staked)
	MPCPubKey  []byte     `json:"mpcPubKey"`
	Active     bool       `json:"active"`
	JoinedAt   time.Time  `json:"joinedAt"`
	SlotIndex  int        `json:"slotIndex"`
	Slashed    bool       `json:"slashed"`
	SlashCount int        `json:"slashCount"`
}

SignerInfo contains information about a signer in the set

type SignerReplacementResult

type SignerReplacementResult struct {
	Success           bool   `json:"success"`
	RemovedNodeID     string `json:"removedNodeId,omitempty"`
	ReplacementNodeID string `json:"replacementNodeId,omitempty"`
	ReshareSession    string `json:"reshareSession,omitempty"`
	NewEpoch          uint64 `json:"newEpoch"`
	ActiveSigners     int    `json:"activeSigners"`
	Threshold         int    `json:"threshold"`
	Message           string `json:"message"`
}

SignerReplacementResult is the result of replacing a failed signer

type SignerSet

type SignerSet struct {
	Signers      []*SignerInfo `json:"signers"`
	Waitlist     []ids.NodeID  `json:"waitlist"`
	CurrentEpoch uint64        `json:"currentEpoch"`
	SetFrozen    bool          `json:"setFrozen"`
	ThresholdT   int           `json:"thresholdT"`
	PublicKey    []byte        `json:"publicKey"`
}

SignerSet tracks the current MPC signer set (LP-333) First 100 validators opt-in without reshare. Reshare ONLY on slot replacement.

type SignerSetInfo

type SignerSetInfo struct {
	TotalSigners   int           `json:"totalSigners"`
	Threshold      int           `json:"threshold"`
	MaxSigners     int           `json:"maxSigners"`
	CurrentEpoch   uint64        `json:"currentEpoch"`
	SetFrozen      bool          `json:"setFrozen"`
	RemainingSlots int           `json:"remainingSlots"`
	WaitlistSize   int           `json:"waitlistSize"`
	Signers        []*SignerInfo `json:"signers"`
	PublicKey      string        `json:"publicKey,omitempty"`
}

SignerSetInfo is the result of getting signer set information

type SigningSession

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

SigningSession manages a distributed signing session

func NewSigningSession

func NewSigningSession(sessionID string, message []byte, signers []int, timeout time.Duration, logger log.Logger) *SigningSession

NewSigningSession creates a new signing session

func (*SigningSession) AddShare

func (s *SigningSession) AddShare(signerIndex int, share threshold.SignatureShare, publicShare []byte) error

AddShare adds a signature share to the session

func (*SigningSession) GetShares

func (s *SigningSession) GetShares() []threshold.SignatureShare

GetShares returns all collected shares

func (*SigningSession) IsComplete

func (s *SigningSession) IsComplete(threshold int) bool

IsComplete checks if we have enough shares

func (*SigningSession) SetResult

func (s *SigningSession) SetResult(signature []byte, err error)

SetResult sets the final signature or error

func (*SigningSession) Wait

func (s *SigningSession) Wait(ctx context.Context) ([]byte, error)

Wait waits for the session to complete

type SlashSignerInput

type SlashSignerInput struct {
	NodeID       ids.NodeID `json:"nodeId"`
	Reason       string     `json:"reason"`
	SlashPercent int        `json:"slashPercent"`
	Evidence     []byte     `json:"evidence"`
}

SlashSignerInput is the input for slashing a bridge signer

type SlashSignerRPCArgs

type SlashSignerRPCArgs struct {
	NodeID       string `json:"nodeId"`
	Reason       string `json:"reason"`
	SlashPercent int    `json:"slashPercent"`
	Evidence     string `json:"evidence"`
}

type SlashSignerResult

type SlashSignerResult struct {
	Success         bool   `json:"success"`
	NodeID          string `json:"nodeId"`
	SlashedAmount   uint64 `json:"slashedAmount"`
	RemainingBond   uint64 `json:"remainingBond"`
	TotalSlashCount int    `json:"totalSlashCount"`
	RemovedFromSet  bool   `json:"removedFromSet"`
	Message         string `json:"message"`
}

SlashSignerResult is the result of slashing

type SubmitObservationArgs

type SubmitObservationArgs struct {
	FeedID    string `json:"feedId"`
	Value     []byte `json:"value"`
	Signature []byte `json:"signature"`
}

type VM

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

VM implements the unified Teleport Virtual Machine for cross-chain operations.

func (*VM) BuildBlock

func (vm *VM) BuildBlock(ctx context.Context) (chain.Block, error)

BuildBlock implements chain.ChainVM

func (*VM) CloseChannel

func (vm *VM) CloseChannel(channelID ids.ID) error

CloseChannel closes a channel

func (*VM) CommitSessionReceipts

func (vm *VM) CommitSessionReceipts(sessionID [32]byte) (*ReceiptCommit, error)

CommitSessionReceipts creates a Merkle root commitment for receipts in a session

func (*VM) Connected

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *chain.VersionInfo) error

Connected implements chain.ChainVM

func (*VM) CreateAttestation

func (vm *VM) CreateAttestation(feedID ids.ID, epoch uint64) (*artifacts.OracleAttestation, error)

CreateAttestation creates an OracleAttestation artifact

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)

CreateHandlers implements chain.ChainVM

func (*VM) CreateVerifiedMessage

func (vm *VM) CreateVerifiedMessage(msg *Message) (*artifacts.VerifiedMessage, error)

CreateVerifiedMessage creates a VerifiedMessage artifact

func (*VM) Disconnected

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected implements chain.ChainVM

func (*VM) GetBlock

func (vm *VM) GetBlock(ctx context.Context, id ids.ID) (chain.Block, error)

GetBlock implements chain.ChainVM

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)

GetBlockIDAtHeight implements chain.HeightIndexedChainVM

func (*VM) GetChannel

func (vm *VM) GetChannel(channelID ids.ID) (*Channel, error)

GetChannel returns a channel by ID

func (*VM) GetFeed

func (vm *VM) GetFeed(feedID ids.ID) (*Feed, error)

GetFeed returns a feed by ID

func (*VM) GetLatestValue

func (vm *VM) GetLatestValue(feedID ids.ID) (*AggregatedValue, error)

GetLatestValue returns the latest aggregated value for a feed

func (*VM) GetMPCStatus

func (vm *VM) GetMPCStatus() map[string]interface{}

GetMPCStatus returns the current MPC status

func (*VM) GetMessage

func (vm *VM) GetMessage(msgID ids.ID) (*Message, error)

GetMessage returns a message by ID

func (*VM) GetSignerSetInfo

func (vm *VM) GetSignerSetInfo() *SignerSetInfo

GetSignerSetInfo returns information about the current signer set

func (*VM) HandleSignatureShare

func (vm *VM) HandleSignatureShare(ctx context.Context, sessionID string, signerIndex int, shareBytes, publicShare []byte) error

HandleSignatureShare handles incoming signature shares

func (*VM) HasSigner

func (vm *VM) HasSigner(nodeID ids.NodeID) bool

HasSigner checks if a node ID is in the active signer set

func (*VM) HealthCheck

func (vm *VM) HealthCheck(ctx context.Context) (chain.HealthResult, error)

HealthCheck implements chain.ChainVM

func (*VM) Initialize

func (vm *VM) Initialize(ctx context.Context, init vmcore.Init) error

Initialize implements chain.ChainVM

func (*VM) InitializeMPCKeys

func (vm *VM) InitializeMPCKeys(ctx context.Context) error

InitializeMPCKeys performs threshold key generation

func (*VM) LastAccepted

func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)

LastAccepted implements chain.ChainVM

func (*VM) NewHTTPHandler

func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)

NewHTTPHandler returns HTTP handlers for the VM

func (*VM) OpenChannel

func (vm *VM) OpenChannel(sourceChain, destChain ids.ID, ordering, version string) (*Channel, error)

OpenChannel opens a new cross-chain channel

func (*VM) ParseBlock

func (vm *VM) ParseBlock(ctx context.Context, bytes []byte) (chain.Block, error)

ParseBlock implements chain.ChainVM

func (*VM) ReceiveMessage

func (vm *VM) ReceiveMessage(msgID ids.ID, proof []byte, sourceHeight uint64) (*MessageReceipt, error)

ReceiveMessage processes an incoming message with proof

func (*VM) RegisterFeed

func (vm *VM) RegisterFeed(feed *Feed) error

RegisterFeed registers a new oracle feed

func (*VM) RegisterNodePublicKey

func (vm *VM) RegisterNodePublicKey(nodeID ids.NodeID, publicKey ed25519.PublicKey) error

RegisterNodePublicKey registers a node's Ed25519 public key

func (*VM) RegisterRequest

func (vm *VM) RegisterRequest(req *OracleRequest) error

RegisterRequest registers a new oracle request

func (*VM) RegisterValidator

func (vm *VM) RegisterValidator(input *RegisterValidatorInput) (*RegisterValidatorResult, error)

RegisterValidator registers a new validator as a teleport signer (LP-333)

func (*VM) RemoveSigner

func (vm *VM) RemoveSigner(nodeID ids.NodeID, replacementNodeID *ids.NodeID) (*SignerReplacementResult, error)

RemoveSigner removes a failed signer and triggers reshare (LP-333)

func (*VM) SendMessage

func (vm *VM) SendMessage(channelID ids.ID, payload, sender, receiver []byte, timeout int64) (*Message, error)

SendMessage queues a message for relay

func (*VM) SetPreference

func (vm *VM) SetPreference(ctx context.Context, id ids.ID) error

SetPreference implements chain.ChainVM

func (*VM) SetState

func (vm *VM) SetState(ctx context.Context, state uint32) error

SetState implements chain.ChainVM

func (*VM) Shutdown

func (vm *VM) Shutdown(ctx context.Context) error

Shutdown implements chain.ChainVM

func (*VM) SlashSigner

func (vm *VM) SlashSigner(input *SlashSignerInput) (*SlashSignerResult, error)

SlashSigner slashes a misbehaving signer's bond

func (*VM) SubmitObservation

func (vm *VM) SubmitObservation(obs *Observation) error

SubmitObservation submits an observation for a feed

func (*VM) SubmitRecord

func (vm *VM) SubmitRecord(record *OracleRecord) error

SubmitRecord submits an execution record from an assigned executor

func (*VM) SubmitSignedReceipt

func (vm *VM) SubmitSignedReceipt(receipt *SignedReceipt) error

SubmitSignedReceipt records a signed receipt from a node

func (*VM) Version

func (vm *VM) Version(ctx context.Context) (string, error)

Version implements chain.ChainVM

func (*VM) WaitForEvent

func (vm *VM) WaitForEvent(ctx context.Context) (vmcore.Message, error)

WaitForEvent blocks until context is cancelled

Jump to

Keyboard shortcuts

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