models

package
v1.21.41 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2020-2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

View Source
const (
	EVM         = "EVM"
	BlobVM      = "Blob VM"
	TimestampVM = "Timestamp VM"
	QuantumVM   = "Quantum VM"
	CustomVM    = "Custom"
)
View Source
const UndefinedNetwork = Undefined

Aliases for compatibility

Variables

This section is empty.

Functions

func GetRPCEndpoint

func GetRPCEndpoint(baseEndpoint string, blockchainID string) string

GetRPCEndpoint returns the RPC endpoint for a given base endpoint and blockchain ID

func GetWSEndpoint

func GetWSEndpoint(baseEndpoint string, blockchainID string) string

GetWSEndpoint returns the WebSocket endpoint for a given base endpoint and blockchain ID

func HostAnsibleIDToCloudID

func HostAnsibleIDToCloudID(hostAnsibleID string) (string, string, error)

HostAnsibleIDToCloudID converts a host Ansible ID to a cloud ID.

func HostCloudIDToAnsibleID

func HostCloudIDToAnsibleID(cloudService string, hostCloudID string) (string, error)

func NewHostConnection

func NewHostConnection(h *Host, port uint) (*goph.Client, error)

Types

type BaseMigration

type BaseMigration struct {
	FromBase        string `json:"fromBase"`
	ToBase          string `json:"toBase"`
	ProposalID      string `json:"proposalId"`
	ExecutedAt      int64  `json:"executedAt"`
	HotSwap         bool   `json:"hotSwap"`
	CheckpointBlock uint64 `json:"checkpointBlock"`
}

BaseMigration represents a base chain migration

type BridgeRoute

type BridgeRoute struct {
	From          string `json:"from"`
	To            string `json:"to"`
	Via           string `json:"via"`           // bridge provider
	EstimatedTime int    `json:"estimatedTime"` // seconds
	EstimatedCost string `json:"estimatedCost"` // in native token
}

BridgeRoute represents a cross-chain route

type CloudConfig

type CloudConfig map[string]RegionConfig

func (*CloudConfig) GetAPIInstanceIDsForRegion

func (ccm *CloudConfig) GetAPIInstanceIDsForRegion(region string) []string

GetAPIInstanceIDsForRegion returns API instance IDs for specific region

func (*CloudConfig) GetAllAPIInstanceIDs

func (ccm *CloudConfig) GetAllAPIInstanceIDs() []string

GetAllAPIInstanceIDs returns all API instance IDs

func (*CloudConfig) GetAllInstanceIDs

func (ccm *CloudConfig) GetAllInstanceIDs() []string

GetAllInstanceIDs returns all instance IDs

func (*CloudConfig) GetInstanceIDsForRegion

func (ccm *CloudConfig) GetInstanceIDsForRegion(region string) []string

GetInstanceIDsForRegion returns instance IDs for specific region

func (*CloudConfig) GetRegions

func (ccm *CloudConfig) GetRegions() []string

GetRegions returns a slice of strings representing the regions of the RegionConfig.

type ClusterConfig

type ClusterConfig struct {
	Nodes              []string
	APINodes           []string
	Network            Network
	MonitoringInstance string            // instance ID of the separate monitoring instance (if any)
	LoadTestInstance   map[string]string // maps load test name to load test cloud instance ID of the separate load test instance (if any)
	ExtraNetworkData   ExtraNetworkData
	Subnets            []string
	External           bool
	Local              bool
	HTTPAccess         constants.HTTPAccess
}

func (*ClusterConfig) GetAPIHosts

func (cc *ClusterConfig) GetAPIHosts(hosts []*Host) []*Host

GetAPINodes returns a filtered list of API nodes based on the ClusterConfig and given hosts.

func (*ClusterConfig) GetCloudIDs

func (cc *ClusterConfig) GetCloudIDs() []string

func (*ClusterConfig) GetHostRoles

func (cc *ClusterConfig) GetHostRoles(nodeConf NodeConfig) []string

func (*ClusterConfig) GetValidatorHosts

func (cc *ClusterConfig) GetValidatorHosts(hosts []*Host) []*Host

GetValidatorNodes returns the validator nodes from the ClusterConfig.

func (*ClusterConfig) IsAPIHost

func (cc *ClusterConfig) IsAPIHost(hostCloudID string) bool

func (*ClusterConfig) IsLuxdHost

func (cc *ClusterConfig) IsLuxdHost(hostCloudID string) bool

type ClustersConfig

type ClustersConfig struct {
	Version   string
	KeyPair   map[string]string        // maps key pair name to cert path
	Clusters  map[string]ClusterConfig // maps clusterName to nodeID list + network kind
	GCPConfig GCPConfig                // stores GCP project name and filepath to service account JSON key
}

type ClustersConfigV0

type ClustersConfigV0 struct {
	KeyPair   map[string]string   // maps key pair name to cert path
	Clusters  map[string][]string // maps clusterName to nodeID list
	GCPConfig GCPConfig           // stores GCP project name and filepath to service account JSON key
}

type ElasticChain added in v1.21.41

type ElasticChain struct {
	SubnetID    ids.ID
	AssetID     ids.ID
	PChainTXID  ids.ID
	TokenName   string
	TokenSymbol string
	Validators  map[string]PermissionlessValidators
	Txs         map[string]ids.ID
}

type ElasticChainConfig added in v1.21.41

type ElasticChainConfig struct {
	SubnetID                 ids.ID
	AssetID                  ids.ID
	InitialSupply            uint64
	MaxSupply                uint64
	MinConsumptionRate       uint64
	MaxConsumptionRate       uint64
	MinValidatorStake        uint64
	MaxValidatorStake        uint64
	MinStakeDuration         time.Duration
	MaxStakeDuration         time.Duration
	MinDelegationFee         uint32
	MinDelegatorStake        uint64
	MaxValidatorWeightFactor byte
	UptimeRequirement        uint32
}

type ExportCluster

type ExportCluster struct {
	ClusterConfig ClusterConfig `json:"clusterConfig"`
	Nodes         []ExportNode  `json:"nodes"`
	MonitorNode   ExportNode    `json:"monitorNode"`
	LoadTestNodes []ExportNode  `json:"loadTestNodes"`
}

type ExportNode

type ExportNode struct {
	NodeConfig NodeConfig `json:"nodeConfig"`
	SignerKey  string     `json:"signerKey"`
	StakerKey  string     `json:"stakerKey"`
	StakerCrt  string     `json:"stakerCrt"`
}

type Exportable

type Exportable struct {
	Sidecar Sidecar
	Genesis []byte
}

type ExtraNetworkData

type ExtraNetworkData struct {
	CChainTeleporterMessengerAddress string
	CChainTeleporterRegistryAddress  string
}

type GCPConfig

type GCPConfig struct {
	ProjectName        string // name of GCP Project
	ServiceAccFilePath string // location of GCP service account key file path
}

type GovernanceProposal

type GovernanceProposal struct {
	ID          string `json:"id"`
	Type        string `json:"type"` // base-migration, upgrade, parameter
	Title       string `json:"title"`
	Description string `json:"description"`
	L2Name      string `json:"l2Name"`

	// For base migrations
	CurrentBase string `json:"currentBase,omitempty"`
	TargetBase  string `json:"targetBase,omitempty"`
	HotSwap     bool   `json:"hotSwap,omitempty"`

	// Voting
	CreatedAt  int64 `json:"createdAt"`
	VotingEnds int64 `json:"votingEnds"`
	Executed   bool  `json:"executed"`
	ExecutedAt int64 `json:"executedAt"`
}

GovernanceProposal for base migrations and upgrades

type Host

type Host struct {
	NodeID            string
	IP                string
	SSHUser           string
	SSHPrivateKeyPath string
	SSHCommonArgs     string
	Connection        *goph.Client
	APINode           bool
}

func (*Host) Command

func (h *Host) Command(script string, env []string, timeout time.Duration) ([]byte, error)

Command executes a shell command on a remote host.

func (*Host) Connect

func (h *Host) Connect(port uint) error

Connect starts a new SSH connection with the provided private key.

func (*Host) Connected

func (h *Host) Connected() bool

func (*Host) CreateTempDir

func (h *Host) CreateTempDir() (string, error)

CreateTempDir creates a temporary directory on the remote server.

func (*Host) CreateTempFile

func (h *Host) CreateTempFile() (string, error)

CreateTempFile creates a temporary file on the remote server.

func (*Host) Disconnect

func (h *Host) Disconnect() error

func (*Host) Download

func (h *Host) Download(remoteFile string, localFile string, timeout time.Duration) error

Download downloads a file from the remote server to the local machine.

func (*Host) ExpandHome

func (h *Host) ExpandHome(path string) string

ExpandHome expands the ~ symbol to the home directory.

func (*Host) FileExists

func (h *Host) FileExists(path string) (bool, error)

FileExists checks if a file exists on the remote server.

func (*Host) Forward

func (h *Host) Forward(httpRequest string, timeout time.Duration) ([]byte, error)

Forward forwards the TCP connection to a remote address.

func (*Host) GetAnsibleInventoryRecord

func (h *Host) GetAnsibleInventoryRecord() string

func (*Host) GetCloudID

func (h *Host) GetCloudID() string

GetCloudID returns the node ID of the host.

func (*Host) IsSystemD

func (h *Host) IsSystemD() bool

HasSystemDAvaliable checks if systemd is available on a remote host.

func (*Host) MkdirAll

func (h *Host) MkdirAll(remoteDir string, timeout time.Duration) error

MkdirAll creates a folder on the remote server.

func (*Host) ReadFileBytes

func (h *Host) ReadFileBytes(remoteFile string, timeout time.Duration) ([]byte, error)

ReadFileBytes downloads a file from the remote server to a byte array

func (*Host) Remove

func (h *Host) Remove(path string, recursive bool) error

Remove removes a file on the remote server.

func (*Host) StreamSSHCommand

func (h *Host) StreamSSHCommand(command string, env []string, timeout time.Duration) error

StreamSSHCommand streams the execution of an SSH command on the host.

func (*Host) UntimedForward

func (h *Host) UntimedForward(httpRequest string) ([]byte, error)

UntimedForward forwards the TCP connection to a remote address. Does not support timeouts on the operation.

func (*Host) UntimedMkdirAll

func (h *Host) UntimedMkdirAll(remoteDir string) error

UntimedMkdirAll creates a folder on the remote server. Does not support timeouts on the operation.

func (*Host) Upload

func (h *Host) Upload(localFile string, remoteFile string, timeout time.Duration) error

Upload uploads a local file to a remote file on the host.

func (*Host) UploadBytes

func (h *Host) UploadBytes(data []byte, remoteFile string, timeout time.Duration) error

UploadBytes uploads a byte array to a remote file on the host.

func (*Host) WaitForPort

func (h *Host) WaitForPort(port uint, timeout time.Duration) error

WaitForPort waits for the SSH port to become available on the host.

func (*Host) WaitForSSHShell

func (h *Host) WaitForSSHShell(timeout time.Duration) error

WaitForSSHShell waits for the SSH shell to be available on the host within the specified timeout.

type L2Config

type L2Config struct {
	Name              string `json:"name"`
	BaseChain         string `json:"baseChain"`        // ethereum, lux, lux-l1, op-mainnet
	RollupType        string `json:"rollupType"`       // optimistic, zk, hybrid
	DataAvailability  string `json:"dataAvailability"` // base, celestia, eigenda
	IBCEnabled        bool   `json:"ibcEnabled"`
	PreconfirmEnabled bool   `json:"preconfirmEnabled"`
	BasedRollup       bool   `json:"basedRollup"` // true for L1-sequenced

	// Contracts
	InboxContract  string `json:"inboxContract"`
	RollupContract string `json:"rollupContract"`
	BridgeContract string `json:"bridgeContract"`

	// Chain configuration
	ChainID     uint64 `json:"chainId"`
	L1BlockTime int    `json:"l1BlockTime"` // milliseconds

	// Token info
	TokenInfo TokenInfo `json:"tokenInfo"`

	// Fee configuration
	CongestionFeeShare int `json:"congestionFeeShare"` // percentage to rollup

	// Bridge configuration
	EnabledBridges []string `json:"enabledBridges"` // axelar, layerzero, wormhole, etc
	IBCChannels    []string `json:"ibcChannels"`    // IBC channel IDs

	// Deployment info
	DeployedAt    int64 `json:"deployedAt"`
	LastMigration int64 `json:"lastMigration"`
}

L2Config represents a based rollup configuration

type L3Config

type L3Config struct {
	Name   string `json:"name"`
	L2Base string `json:"l2Base"` // which L2 is the base
	// Inherits most properties from L2Config
	L2Config
}

L3Config for nested rollups

type MigrationTx

type MigrationTx struct {
	SubnetID            ids.ID `json:"subnetId"`
	BlockchainID        ids.ID `json:"blockchainId"`
	ValidatorManagement string `json:"validatorManagement"`
	RentalPlan          string `json:"rentalPlan"`
	Timestamp           int64  `json:"timestamp"`
}

MigrationTx represents a subnet to L1 migration transaction

type MultisigTxInfo

type MultisigTxInfo struct {
	Threshold uint32   `json:"threshold"`
	Addresses []string `json:"addresses"`
}

type Network

type Network int64
const (
	Undefined Network = iota
	Mainnet
	Testnet
	Local
	Devnet
)

func GetNetworkFromSidecarNetworkName

func GetNetworkFromSidecarNetworkName(name string) Network

GetNetworkFromSidecarNetworkName returns a network based on sidecar network name

func NetworkFromNetworkID

func NetworkFromNetworkID(networkID uint32) Network

func NetworkFromString

func NetworkFromString(s string) Network

func NewDevnetNetwork

func NewDevnetNetwork() Network

NewDevnetNetwork creates a new Devnet network instance

func NewLocalNetwork

func NewLocalNetwork() Network

NewLocalNetwork creates a new Local network instance

func NewMainnetNetwork

func NewMainnetNetwork() Network

NewMainnetNetwork creates a new Mainnet network instance

func NewTestnetNetwork

func NewTestnetNetwork() Network

NewTestnetNetwork creates a new Testnet network instance

func (Network) BootstrappingContext

func (s Network) BootstrappingContext() (context.Context, func())

BootstrappingContext returns a context for bootstrapping operations

func (Network) CChainEndpoint

func (s Network) CChainEndpoint() string

CChainEndpoint returns the C-Chain endpoint for the network

func (Network) CChainWSEndpoint

func (s Network) CChainWSEndpoint() string

CChainWSEndpoint returns the C-Chain WebSocket endpoint for the network

func (Network) ClusterName

func (s Network) ClusterName() string

ClusterName returns the cluster name for the network

func (Network) Endpoint

func (s Network) Endpoint() string

Endpoint returns the RPC endpoint for the network

func (Network) Equals

func (s Network) Equals(other Network) bool

Equals checks if two networks are equal

func (Network) HandlePublicNetworkSimulation

func (s Network) HandlePublicNetworkSimulation() bool

func (Network) ID

func (s Network) ID() uint32

func (Network) Kind

func (s Network) Kind() Network

func (Network) Name

func (s Network) Name() string

Name returns the network name as a string

func (Network) NetworkID

func (s Network) NetworkID() (uint32, error)

func (Network) NetworkIDFlagValue

func (s Network) NetworkIDFlagValue() string

func (Network) SDKNetwork

func (s Network) SDKNetwork() interface{}

SDKNetwork returns the network as an SDK network type This is for compatibility with the SDK package

func (Network) String

func (s Network) String() string

func (Network) WSEndpoints

func (s Network) WSEndpoints() []string

WSEndpoints returns the WebSocket endpoints for the network

type NetworkData

type NetworkData struct {
	SubnetID                   ids.ID
	BlockchainID               ids.ID
	RPCVersion                 int
	RPCEndpoints               []string          // RPC endpoints for the network
	WSEndpoints                []string          // WebSocket endpoints for the network
	TeleporterRegistryAddress  string            // Teleporter registry address
	TeleporterMessengerAddress string            // Teleporter messenger address
	ValidatorManagerAddress    string            // Validator manager contract address
	BootstrapValidators        []SubnetValidator // Bootstrap validators for the network
}

type NodeConfig

type NodeConfig struct {
	NodeID        string // instance id on cloud server
	Region        string // region where cloud server instance is deployed
	AMI           string // image id for cloud server dependent on its os (e.g. ubuntu )and region deployed (e.g. us-east-1)
	KeyPair       string // key pair name used on cloud server
	CertPath      string // where the cert is stored in user's local machine ssh directory
	SecurityGroup string // security group used on cloud server
	ElasticIP     string // public IP address of the cloud server
	CloudService  string // which cloud service node is hosted on (AWS / GCP)
	UseStaticIP   bool   // node has a static IP association
	IsMonitor     bool   // node has a monitoring dashboard
	IsWarpRelayer bool   // node has an Warp relayer service
	IsLoadTest    bool   // node is used to host load test
}

type NodeResult

type NodeResult struct {
	NodeID string
	Value  interface{}
	Err    error
}

type NodeResults

type NodeResults struct {
	Results []NodeResult
	Lock    sync.Mutex
}

func (*NodeResults) AddResult

func (nr *NodeResults) AddResult(nodeID string, value interface{}, err error)

func (*NodeResults) GetErrorHostMap

func (nr *NodeResults) GetErrorHostMap() map[string]error

func (*NodeResults) GetErrorHosts

func (nr *NodeResults) GetErrorHosts() []string

func (*NodeResults) GetNodeList

func (nr *NodeResults) GetNodeList() []string

func (*NodeResults) GetResultMap

func (nr *NodeResults) GetResultMap() map[string]interface{}

func (*NodeResults) GetResults

func (nr *NodeResults) GetResults() []NodeResult

func (*NodeResults) HasErrors

func (nr *NodeResults) HasErrors() bool

func (*NodeResults) HasIDWithError

func (nr *NodeResults) HasIDWithError(id string) bool

func (*NodeResults) Len

func (nr *NodeResults) Len() int

type PermissionlessValidators

type PermissionlessValidators struct {
	TxID ids.ID
}

type PreconfirmConfig

type PreconfirmConfig struct {
	Enabled          bool   `json:"enabled"`
	Provider         string `json:"provider"`         // eigenlayer, builders, bonded
	ConfirmationTime int    `json:"confirmationTime"` // target ms
	CommitteeSize    int    `json:"committeeSize"`
	BondAmount       string `json:"bondAmount"` // in LUX
}

PreconfirmConfig represents pre-confirmation settings

type RegionConfig

type RegionConfig struct {
	InstanceIDs       []string
	APIInstanceIDs    []string
	PublicIPs         []string
	KeyPair           string
	SecurityGroup     string
	CertFilePath      string
	ImageID           string
	Prefix            string
	CertName          string
	SecurityGroupName string
	NumNodes          int
	InstanceType      string
}

type Sidecar

type Sidecar struct {
	Name            string
	VM              VMType
	VMVersion       string
	RPCVersion      int
	Subnet          string
	SubnetID        ids.ID
	BlockchainID    ids.ID
	TokenName       string
	TokenSymbol     string
	ChainID         string
	Version         string
	Networks        map[string]NetworkData
	ElasticChain    map[string]ElasticChain
	ImportedFromLPM bool
	ImportedVMID    string

	// Custom VM support
	CustomVMRepoURL     string
	CustomVMBranch      string
	CustomVMBuildScript string

	// L1/L2 Architecture (2025)
	Sovereign     bool   `json:"sovereign"`     // true for L1, false for L2/subnet
	BaseChain     string `json:"baseChain"`     // For L2s: ethereum, lux-l1, lux, op-mainnet
	BasedRollup   bool   `json:"basedRollup"`   // true for L1-sequenced rollups
	SequencerType string `json:"sequencerType"` // based, centralized, distributed

	// Based Rollup Configuration
	InboxContract     string `json:"inboxContract"`     // Contract on base chain
	L1BlockTime       int    `json:"l1BlockTime"`       // Base chain block time in ms
	PreconfirmEnabled bool   `json:"preconfirmEnabled"` // Fast confirmations

	// Token & Economics
	TokenInfo  TokenInfo `json:"tokenInfo"`
	RentalPlan string    `json:"rentalPlan"` // For L1s: monthly, annual, perpetual

	// Validator Management
	ValidatorManagement string `json:"validatorManagement"` // proof-of-authority, proof-of-stake

	// Migration info
	MigratedAt int64 `json:"migratedAt"` // When subnet became L1

	// Chain layer (1=L1, 2=L2, 3=L3)
	ChainLayer int `json:"chainLayer"` // Default 2 for backward compat
}

func (Sidecar) GetVMID

func (sc Sidecar) GetVMID() (string, error)

func (*Sidecar) NetworkDataIsEmpty

func (sc *Sidecar) NetworkDataIsEmpty() bool

NetworkDataIsEmpty checks if the sidecar has no network data

type SubnetValidator

type SubnetValidator struct {
	NodeID string `json:"NodeID"`

	Weight uint64 `json:"Weight"`

	Balance uint64 `json:"Balance"`

	BLSPublicKey string `json:"BLSPublicKey"`

	BLSProofOfPossession string `json:"BLSProofOfPossession"`

	ChangeOwnerAddr string `json:"ChangeOwnerAddr"`

	ValidationID string `json:"ValidationID"`
}

type TokenInfo

type TokenInfo struct {
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals uint8  `json:"decimals"`
	Supply   string `json:"supply"`
}

type VMType

type VMType string

func VMTypeFromString

func VMTypeFromString(s string) VMType

func (VMType) RepoName

func (v VMType) RepoName() string

Jump to

Keyboard shortcuts

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