utils

package
v1.5.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 43 Imported by: 8

Documentation

Overview

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

Index

Constants

View Source
const (
	BaseTest               = "./test/index.ts"
	GreeterScript          = "./scripts/deploy.ts"
	GreeterCheck           = "./scripts/checkGreeting.ts"
	SoloSubnetEVMKey1      = "soloSubnetEVMVersion1"
	SoloSubnetEVMKey2      = "soloSubnetEVMVersion2"
	SoloAvagoKey           = "soloAvagoVersion"
	OnlyAvagoKey           = "onlyAvagoVersion"
	MultiAvagoSubnetEVMKey = "multiAvagoSubnetEVMVersion"
	MultiAvago1Key         = "multiAvagoVersion1"
	MultiAvago2Key         = "multiAvagoVersion2"
	LatestEVM2AvagoKey     = "latestEVM2Avago"
	LatestAvago2EVMKey     = "latestAvago2EVM"
	OnlyAvagoValue         = "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 APMConfigExists added in v0.2.3

func APMConfigExists(subnetName string) (bool, error)

func AddSubnetIDToSidecar added in v1.0.0

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

func AllPermissionlessValidatorExistsInSidecar added in v1.2.1

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

func ChainConfigExists added in v1.0.4

func ChainConfigExists(subnetName string) (bool, error)

func CheckAllNodesAreCurrentValidators added in v1.2.1

func CheckAllNodesAreCurrentValidators(subnetName string) (bool, error)

func CheckAvalancheGoExists added in v0.2.2

func CheckAvalancheGoExists(version string) bool

func CheckKeyEquality added in v0.2.0

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

func CheckSubnetEVMExists added in v0.2.2

func CheckSubnetEVMExists(version string) bool

func CheckUpgradeIsDeployed added in v1.1.0

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

func DeleteAPMBin added in v0.2.3

func DeleteAPMBin(vmid string)

func DeleteBins added in v0.2.2

func DeleteBins() error

func DeleteConfigs

func DeleteConfigs(subnetName string) error

func DeleteCustomBinary added in v1.0.1

func DeleteCustomBinary(vmName string)

func DeleteKey added in v0.2.0

func DeleteKey(keyName string) error

func DownloadCustomVMBin added in v0.2.2

func DownloadCustomVMBin(subnetEVMversion string) (string, error)

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

func ElasticSubnetConfigExists added in v1.2.0

func ElasticSubnetConfigExists(subnetName string) (bool, error)

func ExecCommand added in v1.2.5

func ExecCommand(cmdName string, args []string, showStdout bool, errorIsExpected bool) string

func FundLedgerAddress added in v1.0.0

func FundLedgerAddress(amount uint64) error

func GetAPMDir added in v0.2.3

func GetAPMDir() string

func GetBaseDir

func GetBaseDir() string

func GetCurrentSupply added in v1.2.0

func GetCurrentSupply(subnetName string) error

func GetFileHash added in v1.1.0

func GetFileHash(filename string) (string, error)

func GetLedgerAddress added in v1.2.5

func GetLedgerAddress(network models.Network, index uint32) (string, error)

func GetNodeVMVersion added in v1.1.0

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

func GetNodesInfo added in v0.2.3

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

func GetPluginBinaries added in v1.1.0

func GetPluginBinaries() ([]string, error)

func GetSubnetDir added in v1.2.5

func GetSubnetDir() string

func GetSubnetEVMMainneChainID added in v1.3.5

func GetSubnetEVMMainneChainID(subnetName string) (uint, error)

func GetTmpFilePath added in v1.2.5

func GetTmpFilePath(fnamePrefix string) (string, error)

func GetValidators added in v1.2.1

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

func GetVersionMapping added in v1.0.3

func GetVersionMapping(mapper VersionMapper) (map[string]string, error)

GetVersionMapping returns a map of specific VMs resp. Avalanchego 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 added in v1.2.1

func GetWhitelistedSubnetsFromConfigFile(configFile string) (string, error)

func IsCustomVM added in v1.3.5

func IsCustomVM(subnetName string) (bool, error)

func IsNodeInValidators added in v1.4.0

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

func KeyExists added in v0.2.0

func KeyExists(keyName string) (bool, error)

func ParseAddrBalanceFromKeyListOutput added in v1.2.4

func ParseAddrBalanceFromKeyListOutput(output string, keyName string) (string, uint64, error)

func ParseGreeterAddress

func ParseGreeterAddress(output string) error

func ParsePublicDeployOutput added in v0.2.3

func ParsePublicDeployOutput(output string) (string, error)

func ParseRPCsFromOutput added in v0.2.0

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

func PerNodeChainConfigExists added in v1.0.4

func PerNodeChainConfigExists(subnetName string) (bool, error)

func PermissionlessValidatorExistsInSidecar added in v1.2.1

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

func PrintStdErr added in v0.2.0

func PrintStdErr(err error)

func RemoveAPMRepo added in v0.2.3

func RemoveAPMRepo()

func RestartNodesWithWhitelistedSubnets added in v1.1.0

func RestartNodesWithWhitelistedSubnets(whitelistedSubnets string) error

func RunHardhatScript

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

func RunHardhatTests

func RunHardhatTests(test string) error

func RunLedgerSim added in v1.2.5

func RunLedgerSim(
	iters int,
	seed string,
	ledgerSimReadyCh chan struct{},
	interactionEndCh chan struct{},
	ledgerSimEndCh chan struct{},
	showStdout bool,
) error

func SetHardhatRPC

func SetHardhatRPC(rpc string) error

func StartLedgerSim added in v1.2.5

func StartLedgerSim(
	iters int,
	seed string,
	showStdout bool,
) (chan struct{}, chan struct{})

func SubnetAPMVMExists added in v0.2.3

func SubnetAPMVMExists(subnetName string) (bool, error)

func SubnetConfigExists

func SubnetConfigExists(subnetName string) (bool, error)

func SubnetCustomVMExists added in v0.2.2

func SubnetCustomVMExists(subnetName string) (bool, error)

func WaitSubnetValidators added in v0.2.3

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

Types

type NodeInfo added in v0.2.3

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

type VersionMapper added in v1.0.3

type VersionMapper interface {
	GetCompatURL(vmType models.VMType) string
	GetAvagoURL() string
	GetApp() *application.Avalanche
	GetLatestAvagoByProtoVersion(app *application.Avalanche, rpcVersion int, url string) (string, error)
	GetEligibleVersions(sortedVersions []string, repoName string, app *application.Avalanche) ([]string, error)
	FilterAvailableVersions(versions []string) []string
}

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 Avalanchego, 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 added in v1.0.3

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