Documentation
¶
Overview ¶
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- Constants
- func AddSubnetIDToSidecar(subnetName string, network models.Network, subnetID string) error
- func AllPermissionlessValidatorExistsInSidecar(subnetName string, network string) (bool, error)
- func BlockchainConfigExists(blockchainName string) (bool, error)
- func ChainConfigExists(subnetName string) (bool, error)
- func CheckAllNodesAreCurrentValidators(subnetName string) (bool, error)
- func CheckEVMExists(version string) bool
- func CheckKeyEquality(keyPath1, keyPath2 string) (bool, error)
- func CheckLuxExists(version string) bool
- func CheckSnapshotExists(snapshotName string) bool
- func CheckUpgradeIsDeployed(rpcEndpoint string, deployedUpgrades extras.UpgradeConfig) error
- func CleanupLogs(nodesInfo map[string]NodeInfo, blockchainID string)
- func CleanupTmpFile(path string) error
- func CreateTmpDir(prefix string) (string, error)
- func CreateTmpFile(namePrefix string, content []byte) (string, error)
- func DeleteBins() error
- func DeleteConfigs(subnetName string) error
- func DeleteCustomBinary(vmName string)
- func DeleteKey(keyName string) error
- func DeleteLPMBin(vmid string)
- func DeleteSnapshot(snapshotName string) error
- func DownloadCustomVMBin(evmVersion string) (string, error)
- func ElasticChainConfigExists(subnetName string) (bool, error)
- func FundAddress(addr ids.ShortID, amount uint64) error
- func FundLedgerAddress(amount uint64) error
- func GetAPILargeContext() (context.Context, context.CancelFunc)
- func GetApp() *application.Lux
- func GetBaseDir() string
- func GetBlockchainID(blockchainName string) (string, error)
- func GetCurrentSupply(subnetName string) error
- func GetE2EHostInstanceID() (string, error)
- func GetERC20TokenAddress(output string) (string, error)
- func GetEVMMainnetChainID(subnetName string) (uint, error)
- func GetFileHash(filename string) (string, error)
- func GetKeyTransferFee(output string, chain string) (uint64, error)
- func GetLPMDir() string
- func GetLatestEVMVersion() string
- func GetLedgerAddress(network models.Network, index uint32) (string, error)
- func GetLocalClusterNodesInfo() (map[string]NodeInfo, error)
- func GetLocalClusterUris() ([]string, error)
- func GetLocalNetworkNodesInfo() (map[string]NodeInfo, error)
- func GetNodeVMVersion(nodeURI string, vmid string) (string, error)
- func GetNodesInfo() (map[string]NodeInfo, error)
- func GetPluginBinaries() ([]string, error)
- func GetPreviousEVMVersion() string
- func GetSideCar(subnetName string) (models.Sidecar, error)
- func GetSignatureAggregatorContext() (context.Context, context.CancelFunc)
- func GetSnapshotsDir() string
- func GetSubnetValidators(subnetID ids.ID) ([]string, error)
- func GetTmpFilePath(prefix string) (string, error)
- func GetTokenTransferrerAddresses(output string) (string, string, error)
- func GetValidators(subnetName string) ([]string, error)
- func GetVersionMapping(mapper VersionMapper) (map[string]string, error)
- func GetWhitelistedSubnetsFromConfigFile(configFile string) (string, error)
- func IsCustomVM(subnetName string) (bool, error)
- func IsNodeInPendingValidator(subnetName string, nodeID string) (bool, error)
- func KeyExists(keyName string) (bool, error)
- func LPMConfigExists(subnetName string) (bool, error)
- func ParseAddrBalanceFromKeyListOutput(output string, keyName string, chain string) (string, uint64, error)
- func ParseBlockchainIDFromOutput(output string) (string, error)
- func ParseGreeterAddress(output string) error
- func ParsePublicDeployOutput(output string, parseType string) (string, error)
- func ParseRPCsFromOutput(output string) ([]string, error)
- func ParseWarpContractAddressesFromOutput(subnetName string, output string) (string, string, error)
- func PerNodeChainConfigExists(subnetName string) (bool, error)
- func PermissionlessValidatorExistsInSidecar(subnetName string, nodeID string, network string) (bool, error)
- func PrintStdErr(err error)
- func RemoveLPMRepo()
- func RestartNodes() error
- func RestartNodesWithWhitelistedChains(whitelistedChains string) error
- func RunHardhatScript(script string) (string, string, error)
- func RunHardhatTests(test string) error
- func SetHardhatRPC(rpc string) error
- func StartLedgerSim(interactionCount int, seed string, verbose bool) (chan struct{}, chan struct{})
- func SubnetConfigExists(subnetName string) (bool, error)
- func SubnetCustomVMExists(subnetName string) (bool, error)
- func SubnetLPMVMExists(subnetName string) (bool, error)
- func TestCommand(cmd, subCmd string, args []string, globalFlags GlobalFlags, ...) (string, error)
- func WaitSubnetValidators(subnetIDStr string, nodeInfos map[string]NodeInfo) error
- type GlobalFlags
- type NodeInfo
- type TestFlags
- type VersionMapper
Constants ¶
const ( // Test blockchain and node names BlockchainName = "test-blockchain" TestLocalNodeName = "test-local-node" // LPM related constants LPMDir = ".lpm" LPMPluginDir = "plugins" BaseTest = "./test/index.ts" GreeterScript = "./scripts/deploy.ts" GreeterCheck = "./scripts/checkGreeting.ts" SoloEVMKey1 = "soloEVMVersion1" SoloEVMKey2 = "soloEVMVersion2" SoloLuxKey = "soloLuxVersion" SoloLuxdKey = "soloLuxdVersion" OnlyLuxKey = "onlyLuxVersion" MultiLuxEVMKey = "multiLuxEVMVersion" MultiLux1Key = "multiLuxVersion1" MultiLux2Key = "multiLuxVersion2" LatestEVM2LuxKey = "latestEVM2Lux" LatestLux2EVMKey = "latestLux2EVM" OnlyLuxValue = "latest" EVMGenesisPath = "tests/e2e/assets/test_evm_genesis.json" EVMGenesis2Path = "tests/e2e/assets/test_evm_genesis_2.json" EVMGenesisPoaPath = "tests/e2e/assets/test_evm_genesis.json" // POA uses same genesis for now LocalKeyPath = "tests/e2e/assets/local_test_key.pk" // Test key for E2E tests (deprecated ewoq) // Deprecated: Use LocalKeyPath instead EwoqKeyPath = LocalKeyPath EVMAllowFeeRecpPath = "tests/e2e/assets/test_evm_allowFeeRecps_genesis.json" EVMGenesisBadPath = "tests/e2e/assets/test_evm_genesis_bad.json" BootstrapValidatorPath = "tests/e2e/assets/test_bootstrap_validator.json" BootstrapValidatorPath2 = "tests/e2e/assets/test_bootstrap_validator2.json" PluginDirExt = "plugins" // Parse types for ParsePublicDeployOutput SubnetIDParseType = "subnetID" BlockchainIDParseType = "blockchainID" )
const ( // LatestEVM2LuxdKey represents the latest EVM to Luxd compatibility key LatestEVM2LuxdKey = "v0.14.0" // LatestLuxd2EVMKey represents the latest Luxd to EVM compatibility key LatestLuxd2EVMKey = "v1.12.0" // LocalTestEVMAddress is the EVM address for the local test key (used in E2E tests) // NOTE: Tests still use this fixed address for compatibility; production uses env vars LocalTestEVMAddress = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" // Deprecated: Use LocalTestEVMAddress instead EwoqEVMAddress = LocalTestEVMAddress )
Test key constants
Variables ¶
This section is empty.
Functions ¶
func AddSubnetIDToSidecar ¶
func BlockchainConfigExists ¶ added in v1.9.5
BlockchainConfigExists checks if a blockchain configuration exists
func ChainConfigExists ¶
func CheckEVMExists ¶
func CheckKeyEquality ¶
func CheckLuxExists ¶
func CheckSnapshotExists ¶ added in v1.9.5
CheckSnapshotExists checks if a snapshot with the given name exists
func CheckUpgradeIsDeployed ¶
func CheckUpgradeIsDeployed(rpcEndpoint string, deployedUpgrades extras.UpgradeConfig) error
func CleanupLogs ¶ added in v1.9.5
CleanupLogs removes log files for a specific blockchain from all nodes
func CleanupTmpFile ¶ added in v1.9.5
CleanupTmpFile removes a temporary file if it exists
func CreateTmpDir ¶ added in v1.9.5
CreateTmpDir creates a temporary directory with the given prefix
func CreateTmpFile ¶ added in v1.9.5
CreateTmpFile creates a temporary file with the given name prefix and content
func DeleteBins ¶
func DeleteBins() error
func DeleteConfigs ¶
func DeleteCustomBinary ¶
func DeleteCustomBinary(vmName string)
func DeleteLPMBin ¶
func DeleteLPMBin(vmid string)
func DeleteSnapshot ¶ added in v1.9.5
DeleteSnapshot removes a snapshot with the given name
func DownloadCustomVMBin ¶
Currently downloads evm, but that suffices to test the custom vm functionality
func ElasticChainConfigExists ¶ added in v1.21.41
func FundAddress ¶ added in v1.9.5
FundAddress funds an address with LUX tokens from the local test key account
func FundLedgerAddress ¶
func GetAPILargeContext ¶ added in v1.9.5
func GetAPILargeContext() (context.Context, context.CancelFunc)
GetAPILargeContext returns a context with a larger timeout suitable for API calls
func GetApp ¶ added in v1.9.5
func GetApp() *application.Lux
GetApp returns a new application instance for testing
func GetBaseDir ¶
func GetBaseDir() string
func GetBlockchainID ¶ added in v1.9.5
GetBlockchainID returns the blockchain ID for a given blockchain name
func GetCurrentSupply ¶
func GetE2EHostInstanceID ¶ added in v1.9.5
GetE2EHostInstanceID returns the instance ID for E2E testing
func GetERC20TokenAddress ¶ added in v1.9.5
GetERC20TokenAddress extracts the ERC20 token contract address from deployment output
func GetEVMMainnetChainID ¶ added in v1.21.40
GetEVMMainnetChainID retrieves the mainnet chain ID for a EVM
func GetFileHash ¶
func GetKeyTransferFee ¶ added in v1.9.5
GetKeyTransferFee extracts the transfer fee from the transfer command output
func GetLatestEVMVersion ¶ added in v1.21.40
func GetLatestEVMVersion() string
GetLatestEVMVersion returns the latest available EVM version
func GetLedgerAddress ¶ added in v1.9.5
GetLedgerAddress retrieves the address from a ledger device
func GetLocalClusterNodesInfo ¶ added in v1.9.5
GetLocalClusterNodesInfo retrieves information about local cluster nodes
func GetLocalClusterUris ¶ added in v1.9.5
GetLocalClusterUris returns the URIs for all nodes in the local network
func GetLocalNetworkNodesInfo ¶ added in v1.9.5
GetLocalNetworkNodesInfo returns node information for all local network nodes
func GetNodesInfo ¶
func GetPluginBinaries ¶
func GetPreviousEVMVersion ¶ added in v1.21.40
func GetPreviousEVMVersion() string
GetPreviousEVMVersion returns a previous EVM version for testing
func GetSideCar ¶ added in v1.9.5
GetSideCar returns the sidecar configuration for a given subnet name
func GetSignatureAggregatorContext ¶ added in v1.9.5
func GetSignatureAggregatorContext() (context.Context, context.CancelFunc)
GetSignatureAggregatorContext returns a context with timeout suitable for signature aggregation
func GetSnapshotsDir ¶ added in v1.9.5
func GetSnapshotsDir() string
GetSnapshotsDir returns the directory where snapshots are stored
func GetSubnetValidators ¶ added in v1.9.5
GetSubnetValidators returns the validators for a subnet
func GetTmpFilePath ¶ added in v1.9.5
GetTmpFilePath creates and returns a temporary file path with the given prefix
func GetTokenTransferrerAddresses ¶ added in v1.9.5
GetTokenTransferrerAddresses extracts the home and remote transferrer addresses from deployment output
func GetValidators ¶
func GetVersionMapping ¶
func GetVersionMapping(mapper VersionMapper) (map[string]string, error)
GetVersionMapping returns a map of specific VMs resp. Lux e2e context keys to the actual version which corresponds to that key. This allows the e2e test to know what version to download and run. Returns an error if there was a problem reading the URL compatibility json or some other issue.
func IsCustomVM ¶ added in v1.9.5
IsCustomVM checks if a subnet is using a custom VM
func LPMConfigExists ¶
func ParseAddrBalanceFromKeyListOutput ¶ added in v1.9.5
func ParseAddrBalanceFromKeyListOutput(output string, keyName string, chain string) (string, uint64, error)
ParseAddrBalanceFromKeyListOutput parses the balance for a specific key and chain from key list output
func ParseBlockchainIDFromOutput ¶ added in v1.9.5
ParseBlockchainIDFromOutput parses the blockchain ID from deployment output
func ParseGreeterAddress ¶
func ParsePublicDeployOutput ¶
func ParseRPCsFromOutput ¶
func ParseWarpContractAddressesFromOutput ¶ added in v1.9.5
ParseWarpContractAddressesFromOutput parses the Warp Messenger and Registry contract addresses from deploy output
func PrintStdErr ¶
func PrintStdErr(err error)
func RemoveLPMRepo ¶
func RemoveLPMRepo()
func RestartNodes ¶ added in v1.9.5
func RestartNodes() error
RestartNodes restarts all nodes in the local network
func RestartNodesWithWhitelistedChains ¶ added in v1.21.38
func RunHardhatTests ¶
func SetHardhatRPC ¶
func StartLedgerSim ¶ added in v1.9.5
StartLedgerSim simulates ledger interaction for testing Returns two channels: interactionEndCh and ledgerSimEndCh
func SubnetConfigExists ¶
func SubnetCustomVMExists ¶
func SubnetLPMVMExists ¶
func TestCommand ¶ added in v1.9.5
func TestCommand(cmd, subCmd string, args []string, globalFlags GlobalFlags, testFlags TestFlags) (string, error)
TestCommand executes a command with the given flags for testing
Types ¶
type GlobalFlags ¶ added in v1.9.5
type GlobalFlags map[string]interface{}
GlobalFlags represents global command flags as a map for flexible flag passing
type TestFlags ¶ added in v1.9.5
type TestFlags map[string]interface{}
TestFlags represents test-specific flags as a map for flexible flag passing
type VersionMapper ¶
type VersionMapper interface {
GetCompatURL(vmType models.VMType) string
GetLuxURL() string
GetApp() *application.Lux
GetLatestLuxByProtoVersion(app *application.Lux, rpcVersion int, url string) (string, error)
GetEligibleVersions(sortedVersions []string, repoName string, app *application.Lux) ([]string, error)
}
VersionMapper is an abstraction for retrieving version compatibility URLs allowing unit tests without requiring external http calls. The idea is to finally calculate which VM is compatible with which Lux, so that the e2e tests can always download and run the latest compatible versions, without having to manually update the e2e tests periodically.
func NewVersionMapper ¶
func NewVersionMapper() VersionMapper
NewVersionMapper returns the default VersionMapper for e2e tests