utils

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: BSD-3-Clause Imports: 39 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (

	// 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"
	OnlyLuxKey       = "onlyLuxVersion"
	MultiLuxEVMKey   = "multiLuxEVMVersion"
	MultiLux1Key     = "multiLuxVersion1"
	MultiLux2Key     = "multiLuxVersion2"
	LatestEVM2LuxKey = "latestEVM2Lux"
	LatestLux2EVMKey = "latestLux2EVM"
	OnlyLuxValue     = "latest"

	SubnetEvmGenesisPath      = "tests/e2e/assets/test_subnet_evm_genesis.json"
	SubnetEvmGenesis2Path     = "tests/e2e/assets/test_subnet_evm_genesis_2.json"
	EwoqKeyPath               = "tests/e2e/assets/ewoq_key.pk"
	SubnetEvmAllowFeeRecpPath = "tests/e2e/assets/test_subnet_evm_allowFeeRecps_genesis.json"
	SubnetEvmGenesisBadPath   = "tests/e2e/assets/test_subnet_evm_genesis_bad.json"

	PluginDirExt = "plugins"
)

Variables

This section is empty.

Functions

func AddSubnetIDToSidecar

func AddSubnetIDToSidecar(subnetName string, network models.Network, subnetID string) error

func AllPermissionlessValidatorExistsInSidecar

func AllPermissionlessValidatorExistsInSidecar(subnetName string, network string) (bool, error)

func ChainConfigExists

func ChainConfigExists(subnetName string) (bool, error)

func CheckAllNodesAreCurrentValidators

func CheckAllNodesAreCurrentValidators(subnetName string) (bool, error)

func CheckEVMExists

func CheckEVMExists(version string) bool

func CheckKeyEquality

func CheckKeyEquality(keyPath1, keyPath2 string) (bool, error)

func CheckLuxExists

func CheckLuxExists(version string) bool

func CheckUpgradeIsDeployed

func CheckUpgradeIsDeployed(rpcEndpoint string, deployedUpgrades params.UpgradeConfig) error

func DeleteBins

func DeleteBins() error

func DeleteConfigs

func DeleteConfigs(subnetName string) error

func DeleteCustomBinary

func DeleteCustomBinary(vmName string)

func DeleteKey

func DeleteKey(keyName string) error

func DeleteLPMBin

func DeleteLPMBin(vmid string)

func DownloadCustomVMBin

func DownloadCustomVMBin(subnetEVMversion string) (string, error)

Currently downloads evm, but that suffices to test the custom vm functionality

func ElasticSubnetConfigExists

func ElasticSubnetConfigExists(subnetName string) (bool, error)

func FundLedgerAddress

func FundLedgerAddress() error

func GetBaseDir

func GetBaseDir() string

func GetCurrentSupply

func GetCurrentSupply(subnetName string) error

func GetFileHash

func GetFileHash(filename string) (string, error)

func GetLPMDir

func GetLPMDir() string

func GetNodeVMVersion

func GetNodeVMVersion(nodeURI string, vmid string) (string, error)

func GetNodesInfo

func GetNodesInfo() (map[string]NodeInfo, error)

func GetPluginBinaries

func GetPluginBinaries() ([]string, error)

func GetValidators

func GetValidators(subnetName string) ([]string, error)

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 GetWhitelistedSubnetsFromConfigFile

func GetWhitelistedSubnetsFromConfigFile(configFile string) (string, error)

func IsNodeInPendingValidator

func IsNodeInPendingValidator(subnetName string, nodeID string) (bool, error)

func KeyExists

func KeyExists(keyName string) (bool, error)

func LPMConfigExists

func LPMConfigExists(subnetName string) (bool, error)

func ParseGreeterAddress

func ParseGreeterAddress(output string) error

func ParsePublicDeployOutput

func ParsePublicDeployOutput(output string) (string, error)

func ParseRPCsFromOutput

func ParseRPCsFromOutput(output string) ([]string, error)

func PerNodeChainConfigExists

func PerNodeChainConfigExists(subnetName string) (bool, error)

func PermissionlessValidatorExistsInSidecar

func PermissionlessValidatorExistsInSidecar(subnetName string, nodeID string, network string) (bool, error)

func PrintStdErr

func PrintStdErr(err error)

func RemoveLPMRepo

func RemoveLPMRepo()

func RestartNodesWithWhitelistedSubnets

func RestartNodesWithWhitelistedSubnets(whitelistedSubnets string) error

func RunHardhatScript

func RunHardhatScript(script string) (string, string, error)

func RunHardhatTests

func RunHardhatTests(test string) error

func SetHardhatRPC

func SetHardhatRPC(rpc string) error

func SubnetConfigExists

func SubnetConfigExists(subnetName string) (bool, error)

func SubnetCustomVMExists

func SubnetCustomVMExists(subnetName string) (bool, error)

func SubnetLPMVMExists

func SubnetLPMVMExists(subnetName string) (bool, error)

func WaitSubnetValidators

func WaitSubnetValidators(subnetIDStr string, nodeInfos map[string]NodeInfo) error

Types

type NodeInfo

type NodeInfo struct {
	ID         string
	PluginDir  string
	ConfigFile string
	URI        string
	LogDir     string
}

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

Jump to

Keyboard shortcuts

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