bridgevm

package
v1.7.39 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: BSD-3-Clause Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBridgeFeeRate = 0.01  // 1% on Lux-family exits
	DefaultSlippage      = 0.025 // 2.5% min-receive tolerance
	DefaultEstimatedTime = 180   // seconds
	DefaultAvgCompletion = "00:03:00"
)

Defaults match the historical SDK assumptions so the on-wire shape stays stable across the daemon migration.

Variables

View Source
var ErrGPUNotAvailable = errors.New("bridgevm: GPU backend not available")

ErrGPUNotAvailable is returned by every GPUBackend method when no plugin is loaded — either because the binary was built without CGo, no libluxgpu_backend_*.{so,dylib} was found on the dlopen search path, or the loaded plugin doesn't expose the lux_<backend>_bridgevm_* launchers (e.g. an older plugin built before the bridgevm op landed).

The error is sentinel-comparable via errors.Is so callers can route a CPU-oracle fallback cleanly:

if errors.Is(err, bridgevm.ErrGPUNotAvailable) {
    return cpuOracle.Apply(...)
}
View Source
var ErrPriceUnknown = errors.New("bridgevm: price unknown for asset")

ErrPriceUnknown is returned by PriceFeed.Price when the asset is not priced. The RPC layer maps this to JSON-RPC code -32004 so callers (e.g. the daemon) can distinguish "transient miss" from "invalid params".

View Source
var ErrSwapNotFound = errors.New("bridgevm: swap not found")

ErrSwapNotFound is returned by Get / Patch when the id isn't present. Distinct from other failures so callers can branch on it.

VMID identifies B-Chain: cross-chain settlement.

It is an immutable one-way door — the node resolves a plugin binary by this id, so a chain created under one value can never be served by a binary answering to another. It is therefore taken from luxfi/constants and nowhere else; a private literal beside the shared one is two declarations of a value that must be one.

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

Functions

This section is empty.

Types

type AttestationClient added in v1.7.4

type AttestationClient interface {
	AttestBridgeTransfer(ctx context.Context, transfer bridgeattest.BridgeTransfer) (*bridgeattest.Attestation, error)
}

AttestationClient is B's boundary to M-Chain. Given a canonical transfer, it returns M's self-describing threshold attestation (signature + group key). B verifies the attestation locally (bridgeattest.Attestation.Verify) before it broadcasts, so a faulty or malicious M-response is caught before any EVM tx.

type Backend added in v1.3.0

type Backend uint8

Backend identifies which GPU plugin is currently active.

Order matches the dlopen probe order in bridgevm_gpu.go's init(): cuda → hip → metal → vulkan → webgpu. The first plugin that resolves all five lux_<backend>_bridgevm_* symbols wins; remaining probes are skipped.

const (
	// BackendNone means no GPU plugin is loaded — calls return
	// ErrGPUNotAvailable. This is the value reported by AutoBackend()
	// under !cgo, and under cgo when no libluxgpu_backend_*.so is on
	// the dlopen search path.
	BackendNone Backend = 0
	// BackendCUDA selects libluxgpu_backend_cuda.so (NVIDIA, Linux/Windows).
	BackendCUDA Backend = 1
	// BackendHIP selects libluxgpu_backend_hip.so (AMD, Linux/Windows).
	BackendHIP Backend = 2
	// BackendMetal selects libluxgpu_backend_metal.dylib (Apple, darwin).
	BackendMetal Backend = 3
	// BackendVulkan selects libluxgpu_backend_vulkan.{so,dylib} (portable).
	BackendVulkan Backend = 4
	// BackendWebGPU selects libluxgpu_backend_webgpu.{so,dylib} (portable).
	BackendWebGPU Backend = 5
)

func AutoBackend added in v1.3.0

func AutoBackend() Backend

AutoBackend returns the GPU plugin chosen by the dlopen probe at process start. BackendNone means no plugin is loaded — every GPUBackend method returns ErrGPUNotAvailable; callers should route to the CPU oracle.

The probe runs once at init time; this getter is cheap (single atomic load) and safe to call from any goroutine. Use ActiveGPUBackend() to get an invocable GPUBackend handle.

func (Backend) String added in v1.3.0

func (b Backend) String() string

String returns the human-readable name of the backend — matches the symbol prefix component used by the dlsym probe (lux_<name>_bridgevm_*).

type Block

type Block struct {
	ParentID_      ids.ID           `json:"parentId"` // Field renamed to avoid method collision
	BlockHeight    uint64           `json:"height"`
	BlockTimestamp int64            `json:"timestamp"`
	BridgeRequests []*BridgeRequest `json:"bridgeRequests"`

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

Block is one step of the bridge chain: the transfers it settles, and where it sits in the sequence.

func (*Block) Accept

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

Accept records the block and everything it decides, in one commit.

It used to credit the daily volume, complete the requests, advance lastAcceptedID and hand the transfers to the release worker — which broadcasts on an external chain — and only then write the block. A write that failed left every one of those done and the block missing, including a release already in flight for a transfer no block records.

Whether this block still extends the tip is the store's to decide, under the lock that commits. Asking here read the tip, released it, and only then asked for the lock — so a tip that moved in between was answered with a reading taken before it moved.

func (*Block) Bytes

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

Bytes returns the block's encoding, computed once.

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) Marshal added in v1.7.4

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

Marshal encodes b. It cannot fail: every field is fixed-width or a length the builder is told in advance, so there is nothing here to refuse.

func (*Block) Parent

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

Parent returns the parent block (for block.Block interface compatibility)

func (*Block) ParentID

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

ParentID returns the parent block ID

func (*Block) Publish added in v1.7.35

func (b *Block) Publish()

Publish completes the block's transfers and hands them to the release worker. It runs after the commit, so an external release is only ever started for a transfer the chain has durably recorded.

func (*Block) Reject

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

Reject marks the block as rejected. Its transfers were never removed from the set waiting for a block, so they are proposed again rather than lost.

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 decides whether this block may become part of the chain.

It answers over the state as of the block's PARENT, not as of the tip: a block whose parent is still in flight is the ordinary shape whenever more than one block is in the air, and checking it against the tip would let two blocks in a row each spend the whole daily cap.

func (*Block) Write added in v1.7.35

func (b *Block) Write(db database.Database) error

Write stages what this block settles: the transfers, and the day's running total per destination. Both land in the same commit as the block itself, so the cap the chain enforces is the cap the chain remembers after a restart.

type BridgeConfig

type BridgeConfig struct {
	// MinConfirmations is how deep a lock must be buried on its source chain
	// before this chain will carry it. It is applied where the lock is read,
	// so a lock that is not yet deep enough is left for a later pass rather
	// than admitted and held.
	MinConfirmations uint32 `json:"minConfirmations"`
	BridgeFee        uint64 `json:"bridgeFee"` // Fee in LUX for bridge operations

	// ExternalChains is the ONE declaration of which chains this bridge
	// serves. It carries endpoints, gateway + custody addresses, and KMS paths
	// for the relayer keys — never key material. A relayer node reads this and
	// calls EnableBridgeRelease with a KMS-backed KeyProvider and a Warp-backed
	// AttestationClient; every other node uses it to name the chains it will
	// carry transfers between.
	ExternalChains []ExternalChainConfig `json:"externalChains,omitempty"`

	// The spend caps. Both are declared, never defaulted: a bridge whose cap
	// is whatever the code happens to pick is a bridge nobody decided the risk
	// of.
	MaxBridgeAmount  uint64 `json:"maxBridgeAmount"`  // Maximum amount per transfer
	DailyBridgeLimit uint64 `json:"dailyBridgeLimit"` // Maximum per destination per day

	RequireValidatorBond uint64 `json:"requireValidatorBond"` // Bond required of a signer (slashable, NOT staked)

	// MaxSigners is the size the signer set freezes at (LP-333).
	MaxSigners int `json:"maxSigners"`
}

BridgeConfig contains VM configuration

type BridgeRequest

type BridgeRequest struct {
	ID         ids.ID `json:"id"`
	SrcChainID uint32 `json:"srcChainId"`
	DstChainID uint32 `json:"dstChainId"`
	Nonce      uint64 `json:"nonce"`
	Asset      ids.ID `json:"asset"`
	Amount     uint64 `json:"amount"`
	Recipient  []byte `json:"recipient"`
	SourceTxID ids.ID `json:"sourceTxId"`
}

BridgeRequest is one cross-chain transfer this chain has been asked to settle.

ID is the transfer's digest — the same value M signs and the destination gateway keys its replay guard by — so the request's name IS its contents. Every field but SourceTxID is covered by it, and SourceTxID is a source-chain fact every node reads the same.

type BridgeRequestRecord added in v1.2.7

type BridgeRequestRecord struct {
	RequestID    string              `json:"requestId"`
	SourceChain  string              `json:"sourceChain"`
	DestChain    string              `json:"destChain"`
	SourceAsset  string              `json:"sourceAsset"`
	DestAsset    string              `json:"destAsset"`
	Amount       string              `json:"amount"`
	Recipient    string              `json:"recipient"`
	Sender       string              `json:"sender"`
	Status       BridgeRequestStatus `json:"status"`
	CreatedAt    int64               `json:"createdAt"`
	SourceTxHash string              `json:"sourceTxHash,omitempty"`
	DestTxHash   string              `json:"destTxHash,omitempty"`
	Signature    string              `json:"signature,omitempty"`
	FeeAmount    string              `json:"feeAmount,omitempty"`
	NetAmount    string              `json:"netAmount,omitempty"`
}

BridgeRequestRecord is the chain-side record of a bridge intent. Field naming matches the JSON-RPC wire shape the daemon's bchain client consumes (snake-cased via JSON tags).

type BridgeRequestStatus added in v1.2.7

type BridgeRequestStatus string

BridgeRequestStatus is the canonical on-chain lifecycle state.

const (
	StatusPending   BridgeRequestStatus = "pending"
	StatusDeposited BridgeRequestStatus = "deposited"
	StatusSigning   BridgeRequestStatus = "signing"
	StatusSigned    BridgeRequestStatus = "signed"
	StatusReleasing BridgeRequestStatus = "releasing"
	StatusCompleted BridgeRequestStatus = "completed"
	StatusFailed    BridgeRequestStatus = "failed"
	StatusCancelled BridgeRequestStatus = "cancelled"
)

type BridgeVMEpochState added in v1.3.0

type BridgeVMEpochState struct {
	CurrentEpoch      uint64
	NextEpochHeight   uint64
	TotalActiveBondLo uint64
	TotalActiveBondHi uint64
	ActiveSignerCount uint32
	PendingDropCount  uint32
	InboxCount        uint32
	OutboxCount       uint32
	SignerSetRoot     [32]byte
	LiquidityRoot     [32]byte
	InboxRoot         [32]byte
	OutboxRoot        [32]byte
	DailyLimitRoot    [32]byte
	BridgeVMStateRoot [32]byte
}

BridgeVMEpochState is the epoch summary written by transition (240 bytes).

type BridgeVMRoundDescriptor added in v1.3.0

type BridgeVMRoundDescriptor struct {
	ChainID          uint64
	Round            uint64
	TimestampNs      uint64
	Epoch            uint64
	Height           uint64
	Mode             uint32
	InboundMsgCount  uint32
	SignerOpCount    uint32
	LiquidityOpCount uint32
	OutboundReqCount uint32
	ClosingFlag      uint32

	ParentStateRoot [32]byte
	// contains filtered or unexported fields
}

BridgeVMRoundDescriptor parameterises one round invocation (112 bytes).

type BridgeVMTransitionResult added in v1.3.0

type BridgeVMTransitionResult struct {
	Status                uint32
	InboundApplyCount     uint32
	SignerApplyCount      uint32
	LiquidityApplyCount   uint32
	OutboundApplyCount    uint32
	ActiveSignerCount     uint32
	JailedCount           uint32
	TombstonedCount       uint32
	TotalActiveBondLo     uint64
	TotalActiveBondHi     uint64
	TotalInboundAmountLo  uint64
	TotalInboundAmountHi  uint64
	TotalOutboundAmountLo uint64
	TotalOutboundAmountHi uint64
	TotalFeesAccruedLo    uint64
	TotalFeesAccruedHi    uint64
	Epoch                 uint64

	SignerSetRoot     [32]byte
	LiquidityRoot     [32]byte
	InboxRoot         [32]byte
	OutboxRoot        [32]byte
	DailyLimitRoot    [32]byte
	BridgeVMStateRoot [32]byte
	// contains filtered or unexported fields
}

BridgeVMTransitionResult is the populated result of transition (304 bytes).

type CancelRequestArgs added in v1.2.7

type CancelRequestArgs struct {
	RequestID string `json:"requestId"`
}

CancelRequestArgs is the bridge_cancelRequest request body.

type CancelRequestReply added in v1.2.7

type CancelRequestReply struct {
	Success bool `json:"success"`
}

CancelRequestReply is the bridge_cancelRequest response.

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
	// IsProcessed asks the destination gateway whether it already released this
	// transfer. The release path calls it before requesting an attestation, so it
	// belongs to the contract that path depends on.
	IsProcessed(ctx context.Context, transfer bridgeattest.BridgeTransfer) (bool, error)
}

ChainClient interface for interacting with different chains

type ChainConfigReply added in v1.3.0

type ChainConfigReply struct {
	ChainID        string            `json:"chainId"`
	ChainName      string            `json:"chainName"`
	RPCEndpoint    string            `json:"rpcEndpoint"`
	BridgeContract string            `json:"bridgeContract"`
	TokenContracts map[string]string `json:"tokenContracts"`
	NativeCurrency string            `json:"nativeCurrency"`
	BlockTime      int               `json:"blockTime"`
	Confirmations  int               `json:"confirmations"`
	Enabled        bool              `json:"enabled"`
}

ChainConfigReply is one chain's bridge config (wire-stable; matches bchain.ChainConfig).

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 to ThresholdVM for MPC operations

type DailyLimit added in v1.3.0

type DailyLimit struct {
	AssetID     uint32
	Status      uint32
	DailyCapLo  uint64
	DailyCapHi  uint64
	UsedTodayLo uint64
	UsedTodayHi uint64
	ResetEpoch  uint64
	// contains filtered or unexported fields
}

DailyLimit is the on-arena per-asset daily cap record (64 bytes).

type EstimateFeeArgs added in v1.2.7

type EstimateFeeArgs struct {
	SourceChain string `json:"sourceChain"`
	DestChain   string `json:"destChain"`
	SourceAsset string `json:"sourceAsset"`
	DestAsset   string `json:"destAsset"`
	Amount      string `json:"amount"`
	Refuel      bool   `json:"refuel,omitempty"`
}

EstimateFeeArgs are the bridge_estimateFee request body.

type EstimateFeeReply added in v1.2.7

type EstimateFeeReply struct {
	FeeAmount     string `json:"feeAmount"`
	NetAmount     string `json:"netAmount"`
	EstimatedTime int    `json:"estimatedTime"`
}

EstimateFeeReply is the bridge_estimateFee response.

type ExternalChainConfig added in v1.7.4

type ExternalChainConfig struct {
	Name          string   `json:"name"`                    // logical key, e.g. "zoo-testnet", "lux-testnet-c"
	ChainID       uint64   `json:"chainId"`                 // EVM chain id (200201, 96368)
	RPCEndpoints  []string `json:"rpcEndpoints"`            // 1..N validator RPCs; release broadcast to ALL
	Gateway       string   `json:"gateway"`                 // BridgeGateway contract address (0x..)
	CustodySigner string   `json:"custodySigner"`           // MPC custody signer EVM address baked into the gateway
	MinGasPrice   string   `json:"minGasPrice,omitempty"`   // wei floor; release uses max(suggested, floor)
	GasLimit      uint64   `json:"gasLimit,omitempty"`      // release call gas limit (default 300000)
	GasKeyKMSPath string   `json:"gasKeyKmsPath,omitempty"` // KMS path for the relayer key — NEVER inline
}

ExternalChainConfig configures one external EVM chain B bridges to/from. It carries NO secret material: the gas-paying key is referenced by KMS path and resolved by the VM's KeyProvider at Initialize; the private key never lives in genesis, config JSON, or logs.

type Factory

type Factory = chain.Factory[VM]

Factory creates B-Chain VM instances.

type GPUBackend added in v1.3.0

type GPUBackend interface {
	// SignerApply runs lux_<bk>_bridgevm_signer_apply over `ops`.
	// `signers` is the in-place arena slice (modified). `applied` returns
	// the count of ops the kernel actually applied (subject to BFT
	// threshold and per-signer status). Returns ErrGPUNotAvailable when
	// no plugin is loaded.
	SignerApply(
		desc *BridgeVMRoundDescriptor,
		ops []SignerOp,
		signers []Signer,
	) (applied uint32, err error)

	// LiquidityApply runs lux_<bk>_bridgevm_liquidity_apply over `ops`.
	// Returns the count applied + the aggregated fee accrual (lo, hi).
	LiquidityApply(
		desc *BridgeVMRoundDescriptor,
		ops []LiquidityOp,
		liquidity []LiquidityEntry,
	) (applied uint32, totalFeesLo uint64, totalFeesHi uint64, err error)

	// MessageInbox runs lux_<bk>_bridgevm_message_inbox over `inMsgs`.
	// Returns the count accepted + the aggregated inbound amount.
	MessageInbox(
		desc *BridgeVMRoundDescriptor,
		inMsgs []Message,
		signers []Signer,
		daily []DailyLimit,
		inbox []Message,
	) (applied uint32, totalInLo uint64, totalInHi uint64, err error)

	// MessageOutbox runs lux_<bk>_bridgevm_message_outbox over `reqs`.
	// Returns the count emitted + the aggregated outbound amount.
	MessageOutbox(
		desc *BridgeVMRoundDescriptor,
		reqs []OutboundReq,
		daily []DailyLimit,
		outbox []Message,
		epoch *BridgeVMEpochState,
	) (applied uint32, totalOutLo uint64, totalOutHi uint64, err error)

	// BridgeTransition runs lux_<bk>_bridgevm_transition. The result is
	// written into `result` and the six roots (signer_set / liquidity /
	// inbox / outbox / daily_limit / bridgevm_state) are populated.
	BridgeTransition(
		desc *BridgeVMRoundDescriptor,
		signers []Signer,
		liquidity []LiquidityEntry,
		daily []DailyLimit,
		inbox []Message,
		outbox []Message,
		epoch *BridgeVMEpochState,
		result *BridgeVMTransitionResult,
	) error

	// Backend reports which plugin is currently loaded.
	Backend() Backend
}

============================================================================= GPUBackend — the surface the dlopen'd plugin presents to vm.go.

All five methods return ErrGPUNotAvailable when no plugin is loaded. When a plugin is loaded, the methods dispatch to the corresponding lux_<backend>_bridgevm_* host launcher via dlsym and return a non-nil error when the launcher reports a non-zero status code (mapped to a Go error including the numeric code).

Buffer ownership: callers own every slice/struct passed in. The host launcher does H2D / D2H internally (for discrete-GPU backends like CUDA and HIP this means cudaMalloc + cudaMemcpy round-trips; for unified backends like Metal, Vulkan, and WebGPU the slice is wrapped in a shader-visible buffer and the launcher submits + waits inline). On return every output slice has been overwritten with the launcher's result; the caller can read them immediately, no further sync needed.

The interface is intentionally narrow — five 1:1 mappings to the host launcher signatures in include/lux/gpu/bridgevm.h. We do NOT try to express composability here (a "full round" would call all five in sequence); composition is the caller's job (vm.go's round-applier), matching the orthogonal separation in op.yaml's notes.

func ActiveGPUBackend added in v1.3.0

func ActiveGPUBackend() GPUBackend

ActiveGPUBackend returns an invocable GPUBackend. When no plugin is loaded the returned backend's methods all return ErrGPUNotAvailable; the caller can route to the CPU oracle. Always non-nil — there is no error path here.

type Genesis

type Genesis struct {
	Timestamp int64 `json:"timestamp"`
}

Genesis represents the genesis state

type GetBridgeInfoArgs added in v1.3.0

type GetBridgeInfoArgs struct{}

GetBridgeInfoArgs are empty.

type GetBridgeInfoReply added in v1.3.0

type GetBridgeInfoReply struct {
	Version         string   `json:"version"`
	NodeID          string   `json:"nodeId"`
	ChainID         string   `json:"chainId"`
	MPCReady        bool     `json:"mpcReady"`
	MPCPublicKey    string   `json:"mpcPublicKey"`
	Threshold       int      `json:"threshold"`
	TotalParties    int      `json:"totalParties"`
	SupportedChains []string `json:"supportedChains"`
	TotalBridged    string   `json:"totalBridged"`
	TotalFees       string   `json:"totalFees"`
	Height          uint64   `json:"height"`
}

GetBridgeInfoReply is bridge_getInfo's response. Mirrors the wire shape the daemon's bchain.BridgeInfo decodes.

type GetChainConfigArgs added in v1.3.0

type GetChainConfigArgs struct {
	ChainID string `json:"chainId"`
}

GetChainConfigArgs is the bridge_getChainConfig request body.

type GetChainConfigReply added in v1.3.0

type GetChainConfigReply ChainConfigReply

GetChainConfigReply is the bridge_getChainConfig response.

type GetCurrentEpochArgs

type GetCurrentEpochArgs struct{}

GetCurrentEpochArgs are the arguments for bridge_getCurrentEpoch (empty)

type GetCurrentEpochReply

type GetCurrentEpochReply struct {
	Epoch        uint64 `json:"epoch"`
	TotalSigners int    `json:"totalSigners"`
	Threshold    int    `json:"threshold"`
	SetFrozen    bool   `json:"setFrozen"`
}

GetCurrentEpochReply is the reply for bridge_getCurrentEpoch

type GetMPCPublicKeyArgs added in v1.2.7

type GetMPCPublicKeyArgs struct{}

GetMPCPublicKeyArgs are empty.

type GetMPCPublicKeyReply added in v1.2.7

type GetMPCPublicKeyReply struct {
	PublicKey string `json:"publicKey"`
}

GetMPCPublicKeyReply is the bridge_getMPCPublicKey response.

type GetSignatureArgs added in v1.3.0

type GetSignatureArgs struct {
	RequestID string `json:"requestId"`
}

GetSignatureArgs is the bridge_getSignature request body.

type GetSignatureReply added in v1.3.0

type GetSignatureReply struct {
	Signature string `json:"signature"`
	SessionID string `json:"sessionId,omitempty"`
}

GetSignatureReply is the bridge_getSignature response.

type GetSignerSetInfoArgs

type GetSignerSetInfoArgs struct{}

GetSignerSetInfoArgs are the arguments for bridge_getSignerSetInfo (empty)

type GetSignerSetInfoReply

type GetSignerSetInfoReply 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        []SignerInfoReply `json:"signers"`
	PublicKey      string            `json:"publicKey,omitempty"`
}

GetSignerSetInfoReply is the reply for bridge_getSignerSetInfo

type GetStatusArgs added in v1.2.7

type GetStatusArgs struct {
	RequestID string `json:"requestId"`
}

GetStatusArgs is the bridge_getStatus request body.

type GetStatusReply added in v1.2.7

type GetStatusReply BridgeRequestRecord

GetStatusReply is the bridge_getStatus response.

type GetSupportedChainsArgs added in v1.3.0

type GetSupportedChainsArgs struct{}

GetSupportedChainsArgs are empty.

type GetSupportedChainsReply added in v1.3.0

type GetSupportedChainsReply struct {
	Chains []ChainConfigReply `json:"chains"`
}

GetSupportedChainsReply is the bridge_getSupportedChains response — the list of ChainConfig snapshots the VM is configured to bridge.

type GetWaitlistArgs

type GetWaitlistArgs struct{}

GetWaitlistArgs are the arguments for bridge_getWaitlist (empty)

type GetWaitlistReply

type GetWaitlistReply struct {
	WaitlistSize int      `json:"waitlistSize"`
	NodeIDs      []string `json:"nodeIds"`
}

GetWaitlistReply is the reply for bridge_getWaitlist

type HasSignerArgs

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

HasSignerArgs are the arguments for bridge_hasSigner

type HasSignerReply

type HasSignerReply struct {
	IsSigner bool `json:"isSigner"`
}

HasSignerReply is the reply for bridge_hasSigner

type HealthArgs added in v1.2.7

type HealthArgs struct{}

HealthArgs are empty (no params).

type HealthReply added in v1.2.7

type HealthReply struct {
	Status   string `json:"status"`
	MPCReady bool   `json:"mpcReady"`
	Ready    bool   `json:"ready"`
	Chains   int    `json:"chains"`
}

HealthReply is the bridge_health response.

type KeyProvider added in v1.7.4

type KeyProvider func(ctx context.Context, kmsPath string) (*ecdsa.PrivateKey, error)

KeyProvider resolves a gas-paying relayer key from a KMS path. Production wiring supplies a luxfi/kms-backed resolver; tests inject a local key. A nil KeyProvider with configured external chains is a hard error at enable time — there is no plaintext-key fallback (fail secure).

type LiquidityEntry added in v1.3.0

type LiquidityEntry struct {
	ProviderAddr [20]byte

	AssetID       uint32
	Status        uint32
	AmountLo      uint64
	AmountHi      uint64
	FeeAccrualLo  uint64
	FeeAccrualHi  uint64
	DepositHeight uint64
	// contains filtered or unexported fields
}

LiquidityEntry is the on-arena per-provider liquidity record (80 bytes).

type LiquidityOp added in v1.3.0

type LiquidityOp struct {
	ProviderAddr [20]byte

	AssetID  uint32
	Kind     uint32
	AmountLo uint64
	AmountHi uint64
	Height   uint64
	// contains filtered or unexported fields
}

LiquidityOp is one input to liquidity_apply (64 bytes).

type MPCRequestType

type MPCRequestType uint8

MPCRequestType defines the type of MPC cross-chain request

const (
	// MPCRequestReshare triggers a key reshare protocol
	MPCRequestReshare MPCRequestType = iota
	// MPCRequestSign triggers a threshold signing operation
	MPCRequestSign
	// MPCRequestRefresh triggers a proactive key refresh
	MPCRequestRefresh
)

type Message added in v1.3.0

type Message struct {
	MsgID           [32]byte
	PayloadRoot     [32]byte
	AggSignature    [96]byte
	SignersBitmapLo uint64
	SignersBitmapHi uint64
	Nonce           uint64
	SrcChain        uint32
	DstChain        uint32
	Kind            uint32
	Status          uint32
	AssetID         uint32
	SignerCount     uint32
	AmountLo        uint64
	AmountHi        uint64
	ArrivalHeight   uint64
	// contains filtered or unexported fields
}

Message is an inbox/outbox cross-chain message record (240 bytes).

type OutboundReq added in v1.3.0

type OutboundReq struct {
	PayloadRoot [32]byte
	Recipient   [20]byte

	SrcChain uint32
	DstChain uint32
	Kind     uint32
	AssetID  uint32
	Nonce    uint64
	AmountLo uint64
	AmountHi uint64
	Height   uint64
	// contains filtered or unexported fields
}

OutboundReq is one input to message_outbox (112 bytes).

type PriceFeed added in v1.2.7

type PriceFeed interface {
	// Price returns the USD value of one unit of asset. Returns
	// ErrPriceUnknown when the asset is not priced.
	Price(asset string) (float64, error)
}

PriceFeed returns USD-denominated unit prices.

type QuoteEngine added in v1.2.7

type QuoteEngine struct {
	Feed     PriceFeed
	FeeRate  float64 // zero ⇒ DefaultBridgeFeeRate
	Slippage float64 // zero ⇒ DefaultSlippage
}

QuoteEngine computes settlement quotes for the B-Chain RPC layer. Concurrency-safe — PriceFeed is the only mutable dependency.

func (*QuoteEngine) Quote added in v1.2.7

func (q *QuoteEngine) Quote(in QuoteInput) (*QuoteResult, error)

Quote computes settlement economics for one bridge intent.

type QuoteInput added in v1.2.7

type QuoteInput struct {
	Amount             float64
	SourceNetwork      string
	SourceAsset        string
	DestinationNetwork string
	DestinationAsset   string
	Refuel             bool
}

QuoteInput is the engine's call payload.

type QuoteResult added in v1.2.7

type QuoteResult struct {
	ReceiveAmount    float64
	MinReceiveAmount float64
	ServiceFee       float64
	TotalFee         float64
	Slippage         float64
	EstimatedTime    int
	AvgCompletion    string
}

QuoteResult is the engine's output. Stringified amounts are emitted via the RPC layer (canonical bridge wire encoding).

type RegisterValidatorArgs

type RegisterValidatorArgs struct {
	NodeID     string `json:"nodeId"`
	BondAmount string `json:"bondAmount,omitempty"` // 100M LUX bond (slashable)
	MPCPubKey  string `json:"mpcPubKey,omitempty"`
}

RegisterValidatorArgs are the arguments for bridge_registerValidator

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 bridge signer

type RegisterValidatorReply

type RegisterValidatorReply 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"`
}

RegisterValidatorReply is the reply for bridge_registerValidator

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"` // Always false for opt-in (LP-333)
	CurrentEpoch   uint64 `json:"currentEpoch"`
	SetFrozen      bool   `json:"setFrozen"`
	RemainingSlots int    `json:"remainingSlots"`
	Message        string `json:"message"`
}

RegisterValidatorResult is the result of registering as a bridge signer

type ReleaseCall added in v1.7.4

type ReleaseCall struct {
	Transfer  bridgeattest.BridgeTransfer
	Signature []byte // secp256k1 r||s||v (65) from the M-Chain attestation
}

ReleaseCall is the typed payload SendTransaction expects. It binds one threshold-attested transfer to its signature; the client ABI-encodes it into a gateway.release(...) call and broadcasts a signed tx.

type ReplaceSignerArgs

type ReplaceSignerArgs struct {
	NodeID            string `json:"nodeId"`            // Signer to remove
	ReplacementNodeID string `json:"replacementNodeId"` // Explicit replacement (optional, uses waitlist if empty)
}

ReplaceSignerArgs are the arguments for bridge_replaceSigner

type ReplaceSignerReply

type ReplaceSignerReply 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"`
}

ReplaceSignerReply is the reply for bridge_replaceSigner

type Service

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

Service provides JSON-RPC endpoints for BridgeVM:

  • LP-333 signer-set management (RegisterValidator, GetSignerSetInfo, …)
  • Permissionless bridge settlement (EstimateFee, SubmitRequest, GetStatus, CancelRequest, …)

Any client that can reach /v1/bc/B/rpc has equal authority — the daemon at cmd/bridge is one such client. There are no privileged methods on this surface; rate-limiting and auth (when desired) are applied at the ingress layer.

func NewService

func NewService(vm *VM) *Service

NewService returns a new Service instance

func (*Service) CancelRequest added in v1.2.7

func (s *Service) CancelRequest(_ *http.Request, args *CancelRequestArgs, reply *CancelRequestReply) error

CancelRequest answers bridge_cancelRequest. Idempotent — cancelling an already-terminal swap is a no-op success so retries are safe.

func (*Service) EstimateFee added in v1.2.7

func (s *Service) EstimateFee(_ *http.Request, args *EstimateFeeArgs, reply *EstimateFeeReply) error

EstimateFee answers bridge_estimateFee. Authoritative settlement math runs in the VM (see quote.go) so the result is what the chain will pay.

func (*Service) GetBridgeInfo added in v1.3.0

func (s *Service) GetBridgeInfo(_ *http.Request, _ *GetBridgeInfoArgs, reply *GetBridgeInfoReply) error

GetBridgeInfo answers bridge_getInfo. Read-only snapshot of node-level bridge state for dashboards + daemon discovery. Authoritative — no daemon-cached fallback. When MPC has not generated a group key the MPCPublicKey field is empty (not an error) so callers can render "MPC pending" without dispatching on an error code.

func (*Service) GetChainConfig added in v1.3.0

func (s *Service) GetChainConfig(_ *http.Request, args *GetChainConfigArgs, reply *GetChainConfigReply) error

GetChainConfig answers bridge_getChainConfig for one chain, by its numeric id or by its name. Returns an explicit error when this bridge does not serve the chain, so callers can distinguish "unknown chain" from "RPC mis-routed".

func (*Service) GetCurrentEpoch

func (s *Service) GetCurrentEpoch(_ *http.Request, _ *GetCurrentEpochArgs, reply *GetCurrentEpochReply) error

GetCurrentEpoch returns the current epoch (incremented only on reshare)

func (*Service) GetMPCPublicKey added in v1.2.7

func (s *Service) GetMPCPublicKey(_ *http.Request, _ *GetMPCPublicKeyArgs, reply *GetMPCPublicKeyReply) error

GetMPCPublicKey answers bridge_getMPCPublicKey with the active threshold-signing group public key.

func (*Service) GetSignature added in v1.3.0

func (s *Service) GetSignature(_ *http.Request, args *GetSignatureArgs, reply *GetSignatureReply) error

GetSignature answers bridge_getSignature. The signature lives on the BridgeRequestRecord (populated by the MPC signing pipeline once the threshold quorum aggregates shares). Returns an error when the swap exists but the signature is not yet available so callers can poll without conflating "no such swap" with "still signing".

func (*Service) GetSignerSetInfo

func (s *Service) GetSignerSetInfo(_ *http.Request, _ *GetSignerSetInfoArgs, reply *GetSignerSetInfoReply) error

GetSignerSetInfo returns information about the current signer set (LP-333)

func (*Service) GetStatus added in v1.2.7

func (s *Service) GetStatus(_ *http.Request, args *GetStatusArgs, reply *GetStatusReply) error

GetStatus answers bridge_getStatus from the authoritative swap store.

func (*Service) GetSupportedChains added in v1.3.0

func (s *Service) GetSupportedChains(_ *http.Request, _ *GetSupportedChainsArgs, reply *GetSupportedChainsReply) error

GetSupportedChains answers bridge_getSupportedChains from the ONE declaration of which chains this bridge serves — the same ExternalChains the release path routes by. A second list of chain names, declared beside it and used only here, could name a chain the bridge cannot reach or omit one it releases to.

The gas-key KMS path is deliberately not reported: it names where a secret lives, and this surface is unauthenticated.

func (*Service) GetWaitlist

func (s *Service) GetWaitlist(_ *http.Request, _ *GetWaitlistArgs, reply *GetWaitlistReply) error

GetWaitlist returns the current waitlist of validators waiting for signer slots

func (*Service) HasSigner

func (s *Service) HasSigner(_ *http.Request, args *HasSignerArgs, reply *HasSignerReply) error

HasSigner checks if a node is in the active signer set

func (*Service) Health added in v1.2.7

func (s *Service) Health(_ *http.Request, _ *HealthArgs, reply *HealthReply) error

Health answers bridge_health. Liveness probe used by daemons + load balancers before routing traffic at this node.

func (*Service) RegisterValidator

func (s *Service) RegisterValidator(_ *http.Request, args *RegisterValidatorArgs, reply *RegisterValidatorReply) error

RegisterValidator registers a validator as a bridge signer (LP-333 opt-in model) First 100 validators are accepted directly without reshare. After 100 signers, new validators go to waitlist.

func (*Service) ReplaceSigner

func (s *Service) ReplaceSigner(_ *http.Request, args *ReplaceSignerArgs, reply *ReplaceSignerReply) error

ReplaceSigner removes a failed signer and triggers reshare (LP-333) This is the ONLY operation that triggers a reshare.

func (*Service) SlashSigner

func (s *Service) SlashSigner(_ *http.Request, args *SlashSignerArgs, reply *SlashSignerReply) error

SlashSigner slashes a misbehaving bridge signer's bond The bond is NOT stake - it's a slashable deposit that can be partially or fully seized

func (*Service) SubmitRequest added in v1.2.7

func (s *Service) SubmitRequest(_ *http.Request, args *SubmitRequestArgs, reply *SubmitRequestReply) error

SubmitRequest creates a new bridge request server-side and snapshots the quote into the record so the daemon's signing pipeline pays out what the chain committed to.

type Signer added in v1.3.0

type Signer struct {
	SignerID   uint64
	LuxAddress [20]byte

	BondAmountLo   uint64
	BondAmountHi   uint64
	OptInHeight    uint64
	ExitEpoch      uint64
	SignCount      uint64
	BLSPubKey      [48]byte
	CoronaPubKey   [32]byte
	MLDSAPubKey    [32]byte
	Status         uint32
	JailUntilEpoch uint32
	SlashCount     uint32
	Occupied       uint32
	// contains filtered or unexported fields
}

Signer is the on-arena per-signer record (208 bytes).

type SignerInfo

type SignerInfo struct {
	NodeID     ids.NodeID `json:"nodeId"`
	PartyID    party.ID   `json:"partyId"`
	BondAmount uint64     `json:"bondAmount"` // Slashable bond, NOT stake
	MPCPubKey  []byte     `json:"mpcPubKey"`
	Active     bool       `json:"active"`
	JoinedAt   time.Time  `json:"joinedAt"`
	SlotIndex  int        `json:"slotIndex"`
	Slashed    bool       `json:"slashed"`    // True if this signer has been slashed
	SlashCount int        `json:"slashCount"` // Number of times slashed
}

SignerInfo contains information about a signer in the set

type SignerInfoReply

type SignerInfoReply struct {
	NodeID     string `json:"nodeId"`
	PartyID    string `json:"partyId"`
	BondAmount uint64 `json:"bondAmount"` // 100M LUX bond (slashable)
	Active     bool   `json:"active"`
	JoinedAt   string `json:"joinedAt"`
	SlotIndex  int    `json:"slotIndex"`
	Slashed    bool   `json:"slashed"`
	SlashCount int    `json:"slashCount"`
}

SignerInfoReply contains signer information for RPC replies

type SignerOp added in v1.3.0

type SignerOp struct {
	SignerID   uint64
	LuxAddress [20]byte

	BondAmountLo   uint64
	BondAmountHi   uint64
	OptInHeight    uint64
	BLSPubKey      [48]byte
	CoronaPubKey   [32]byte
	MLDSAPubKey    [32]byte
	Kind           uint32
	JailUntilEpoch uint32
	Epoch          uint32
	SlashAmountLo  uint32
	SlashAmountHi  uint32

	EvidenceDigest [32]byte
	// contains filtered or unexported fields
}

SignerOp is one input to signer_apply (224 bytes).

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"`      // Active signers
	Waitlist     []ids.NodeID  `json:"waitlist"`     // Validators waiting for a slot
	CurrentEpoch uint64        `json:"currentEpoch"` // Increments ONLY on reshare (slot replacement)
	SetFrozen    bool          `json:"setFrozen"`    // True when len(Signers) >= MaxSigners
	ThresholdT   int           `json:"thresholdT"`   // t, where t+1 signers are required
	PublicKey    []byte        `json:"publicKey"`    // Combined threshold public key
}

SignerSet tracks the current MPC signer set (LP-333) First MaxSigners 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 SlashSignerArgs

type SlashSignerArgs struct {
	NodeID       string `json:"nodeId"`
	Reason       string `json:"reason"`
	SlashPercent int    `json:"slashPercent"` // Percentage of bond to slash (1-100)
	Evidence     string `json:"evidence"`     // Hex-encoded proof of misbehavior
}

SlashSignerArgs are the arguments for bridge_slashSigner

type SlashSignerInput

type SlashSignerInput struct {
	NodeID       ids.NodeID `json:"nodeId"`
	Reason       string     `json:"reason"`
	SlashPercent int        `json:"slashPercent"` // Percentage of bond to slash (1-100)
	Evidence     []byte     `json:"evidence"`     // Proof of misbehavior
}

SlashSignerInput is the input for slashing a bridge signer

type SlashSignerReply

type SlashSignerReply 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"`
}

SlashSignerReply is the reply for bridge_slashSigner

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 a bridge signer

type StaticPriceFeed added in v1.2.7

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

StaticPriceFeed is a map-backed PriceFeed. Concurrency-safe. Asset symbols are matched case-insensitively.

func NewStaticPriceFeed added in v1.2.7

func NewStaticPriceFeed(prices map[string]float64) *StaticPriceFeed

NewStaticPriceFeed builds a feed from an initial table.

func (*StaticPriceFeed) Price added in v1.2.7

func (f *StaticPriceFeed) Price(asset string) (float64, error)

Price returns the USD value of one unit of asset.

func (*StaticPriceFeed) Set added in v1.2.7

func (f *StaticPriceFeed) Set(asset string, usd float64)

Set updates / inserts a price.

type SubmitRequestArgs added in v1.2.7

type SubmitRequestArgs struct {
	SourceChain string `json:"sourceChain"`
	DestChain   string `json:"destChain"`
	SourceAsset string `json:"sourceAsset"`
	DestAsset   string `json:"destAsset"`
	Amount      string `json:"amount"`
	Recipient   string `json:"recipient"`
	Sender      string `json:"sender"`
	Refuel      bool   `json:"refuel,omitempty"`
}

SubmitRequestArgs is the bridge_submitRequest request body.

type SubmitRequestReply added in v1.2.7

type SubmitRequestReply BridgeRequestRecord

SubmitRequestReply is the bridge_submitRequest response.

type SwapListFilter added in v1.2.7

type SwapListFilter struct {
	Status      BridgeRequestStatus
	SourceChain string
	Limit       int // 0 → no limit
}

SwapListFilter narrows List queries. Empty fields mean "any".

type SwapStore added in v1.2.7

type SwapStore interface {
	Put(rec *BridgeRequestRecord) error
	Get(requestID string) (*BridgeRequestRecord, error)
	Patch(requestID string, fn func(*BridgeRequestRecord)) (*BridgeRequestRecord, error)
	List(filter SwapListFilter) ([]*BridgeRequestRecord, error)
}

SwapStore is the chain-side record set. Concurrency-safe.

The interface is intentionally narrow — implementations decide whether records persist via the VM's database, are reconstructed from accepted blocks at startup, or both. The in-memory default (newInMemorySwapStore) covers the genesis case.

type VM

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

VM implements the Bridge VM for cross-chain interoperability

func (*VM) BuildBlock

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

BuildBlock implements the chain.ChainVM interface.

The candidates are ordered by id and admitted by the SAME rule Verify applies, over the state as of the same parent. A builder with its own looser rule proposes a block every node refuses, and since a refused transfer goes straight back into the pending set, it proposes it again: block production stops and does not resume.

func (*VM) Connected

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

Connected implements the common.VM interface

func (*VM) CreateHandlers

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

CreateHandlers implements the common.VM interface. The bridge's API is the JSON-RPC service in rpc.go: estimate a fee, submit a request, ask after one, read the signer set.

func (*VM) CreateRPCHandlers

func (vm *VM) CreateRPCHandlers() (map[string]http.Handler, error)

CreateRPCHandlers creates HTTP handlers for JSON-RPC endpoints

func (*VM) CreateStaticHandlers

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

CreateStaticHandlers implements the common.VM interface

func (*VM) CrossChainRequest

func (vm *VM) CrossChainRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte) error

CrossChainRequest implements the common.VM interface

func (*VM) CrossChainRequestFailed

func (vm *VM) CrossChainRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.Error) error

CrossChainRequestFailed implements the common.VM interface

func (*VM) CrossChainResponse

func (vm *VM) CrossChainResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error

CrossChainResponse implements the common.VM interface

func (*VM) Disconnected

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

Disconnected implements the common.VM interface

func (*VM) EnableBridgeRelease added in v1.7.4

func (vm *VM) EnableBridgeRelease(ctx context.Context, chains []ExternalChainConfig, kp KeyProvider, ac AttestationClient) error

EnableBridgeRelease wires the EVM release plumbing: it dials each external chain, resolves that chain's gas-paying relayer key from KMS via kp, records the clients in the id-keyed routing index, sets the attestation client, and starts the release worker. Idempotent per process: calling it twice replaces the wiring. Fail secure: any misconfigured chain or unresolved key aborts the whole enable — no partial, half-wired bridge.

func (*VM) FeePolicy added in v1.2.6

func (vm *VM) FeePolicy() fee.Policy

FeePolicy exposes the chain's declared fee policy for diagnostics and the boot-time Validate gate.

func (*VM) GetBlock

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

GetBlock implements the chain.ChainVM interface

func (*VM) GetBlockIDAtHeight

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

GetBlockIDAtHeight answers from the height index the store writes in the same commit as the block itself, so the index can never name a block the chain did not accept.

func (*VM) GetSignerSetInfo

func (vm *VM) GetSignerSetInfo() *SignerSetInfo

GetSignerSetInfo returns information about the current signer set

func (*VM) Gossip

func (vm *VM) Gossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

Gossip implements the common.VM interface

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) (vmchain.HealthResult, error)

HealthCheck implements the common.VM interface, reporting what this node can do so traffic reaches one that can bridge.

func (*VM) Initialize

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

Initialize implements the chain.ChainVM interface

func (*VM) LastAccepted

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

LastAccepted implements the chain.ChainVM interface

func (*VM) NewHTTPHandler

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

NewHTTPHandler serves the same API CreateHandlers names, mounted where it names it. Building a second route table here is how the two drift.

func (*VM) ParseBlock

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

ParseBlock implements the chain.ChainVM interface

func (*VM) RegisterValidator

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

RegisterValidator registers a new validator as a bridge signer (opt-in model) LP-333: the first MaxSigners validators are accepted directly - NO reshare on join. After that, new validators go to the waitlist until a slot opens.

func (*VM) RemoveSigner

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

RemoveSigner removes a failed/stopped signer and triggers replacement. LP-333: this is the ONLY operation that triggers a reshare, and the epoch increments only here.

func (*VM) Request

func (vm *VM) Request(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error

Request implements the common.VM interface

func (*VM) RequestFailed

func (vm *VM) RequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.Error) error

RequestFailed implements the common.VM interface

func (*VM) Response

func (vm *VM) Response(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error

Response implements the common.VM interface

func (*VM) SetPreference

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

SetPreference implements the chain.ChainVM interface

func (*VM) SetState

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

SetState implements the common.VM interface

func (*VM) Shutdown

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

Shutdown implements the common.VM interface

func (*VM) SlashSigner

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

SlashSigner slashes a misbehaving bridge signer's bond. The bond is NOT stake — it is a slashable deposit that can be partially or fully seized.

func (*VM) Version

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

Version implements the common.VM interface

func (*VM) WaitForEvent

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

WaitForEvent blocks until there is a bridge request to build a block from, or the VM stops. Waiting only on the context would mean BuildBlock is never called, so no lock the watcher found would ever reach a block.

Directories

Path Synopsis
cmd
plugin command

Jump to

Keyboard shortcuts

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