wasmvm

package
v1.11.2-patch-devnet Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: GPL-3.0 Imports: 33 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EsdtTokenIdentifier = []byte("TTT-010101")

EsdtTokenIdentifier is the token identifier in tests

View Source
var InitialEsdt = uint64(100)

InitialEsdt is the initial amount minted for esdt

View Source
var MockInitialBalance = big.NewInt(10_000_000)

MockInitialBalance represents a mock balance

View Source
var WalletAddressPrefix = []byte("..........")

WalletAddressPrefix is the prefix of any smart contract address used for testing.

Functions

func CreateHostAndInstanceBuilder added in v1.6.0

func CreateHostAndInstanceBuilder(t *testing.T,
	net *integrationTests.TestNetwork,
	vmContainer process.VirtualMachinesContainer,
	vmKeys [][]byte) (map[uint32]map[string]vmhost.VMHost, map[uint32]map[string]*contextmock.ExecutorMock)

CreateHostAndInstanceBuilder creates a new host and instance builder

func DeployAndExecuteERC20WithBigInt

func DeployAndExecuteERC20WithBigInt(
	numRun int,
	numTransferInBatch int,
	gasSchedule map[string]map[string]uint64,
	fileName string,
	functionName string,
) ([]time.Duration, error)

DeployAndExecuteERC20WithBigInt will stress test the erc20 contract

func GetAddressForNewAccount added in v1.6.0

GetAddressForNewAccount -

func GetAddressForNewAccountOnWalletAndNode added in v1.6.0

func GetAddressForNewAccountOnWalletAndNode(
	t *testing.T,
	net *integrationTests.TestNetwork,
	wallet *integrationTests.TestWalletAccount,
	node *integrationTests.TestProcessorNode,
) ([]byte, state.UserAccountHandler)

GetAddressForNewAccountOnWalletAndNode -

func GetAddressForNewAccountOnWalletAndNodeWithVM added in v1.6.0

func GetAddressForNewAccountOnWalletAndNodeWithVM(
	t *testing.T,
	net *integrationTests.TestNetwork,
	wallet *integrationTests.TestWalletAccount,
	node *integrationTests.TestProcessorNode,
	vmType []byte,
) ([]byte, state.UserAccountHandler)

GetAddressForNewAccountOnWalletAndNodeWithVM -

func GetAddressForNewAccountWithVM added in v1.6.0

func GetAddressForNewAccountWithVM(
	t *testing.T,
	net *integrationTests.TestNetwork,
	node *integrationTests.TestProcessorNode,
	vmType []byte) ([]byte, state.UserAccountHandler)

GetAddressForNewAccountWithVM -

func InitializeMockContracts added in v1.6.0

func InitializeMockContracts(
	t *testing.T,
	net *integrationTests.TestNetwork,
	mockSCs ...testcommon.MockTestSmartContract,
)

InitializeMockContracts -

func InitializeMockContractsWithVMContainer added in v1.6.0

func InitializeMockContractsWithVMContainer(
	t *testing.T,
	net *integrationTests.TestNetwork,
	_ process.VirtualMachinesContainer,
	mockSCs ...testcommon.MockTestSmartContract,
)

InitializeMockContractsWithVMContainer -

func InitializeMockContractsWithVMContainerAndVMTypes added in v1.6.0

func InitializeMockContractsWithVMContainerAndVMTypes(
	t *testing.T,
	net *integrationTests.TestNetwork,
	vmContainer process.VirtualMachinesContainer,
	vmKeys [][]byte,
	mockSCs ...testcommon.MockTestSmartContract,
)

InitializeMockContractsWithVMContainerAndVMTypes -

func MakeHeaderHandlerStub

func MakeHeaderHandlerStub(epoch uint32) data.HeaderHandler

MakeHeaderHandlerStub prepares a HeaderHandlerStub with the provided epoch

func MakeTestWalletAddress added in v1.6.0

func MakeTestWalletAddress(identifier string) []byte

MakeTestWalletAddress generates a new wallet address to be used for testing based on the given identifier.

func RegisterAsyncCallForMockContract added in v1.6.0

func RegisterAsyncCallForMockContract(host vmhost.VMHost, config interface{}, destinationAddress []byte, egldValue []byte, callData *txDataBuilder.TxDataBuilder) error

RegisterAsyncCallForMockContract is resued also in some tests before async context serialization

func RunERC20TransactionSet

func RunERC20TransactionSet(testContext *vm.VMTestContext) error

RunERC20TransactionSet performs a predetermined set of ERC20 token transfers

func RunERC20TransactionsWithBenchmarksInVMTestContext

func RunERC20TransactionsWithBenchmarksInVMTestContext(
	testContext *vm.VMTestContext,
	numRun int,
	numTransferInBatch int,
	functionName string,
	transferOnCalls *big.Int,
) ([]time.Duration, error)

RunERC20TransactionsWithBenchmarksInVMTestContext executes a configurable set of ERC20 token transfers

func SetCodeMetadata added in v1.6.0

func SetCodeMetadata(
	t *testing.T,
	codeMetadata []byte,
	node *integrationTests.TestProcessorNode,
	account state.UserAccountHandler,
)

SetCodeMetadata -

func SetupERC20Test

func SetupERC20Test(
	testContext *vm.VMTestContext,
	contractCodeFile string,
) error

SetupERC20Test prepares an ERC20 contract and the accounts to transfer tokens between

func ValidateERC20TransactionsInVMTestContext

func ValidateERC20TransactionsInVMTestContext(
	testContext *vm.VMTestContext,
	numRun int,
	numTransferInBatch int,
	transferOnCalls *big.Int,
) error

ValidateERC20TransactionsInVMTestContext verifies whether the ERC20 transfers were executed correctly

Types

type ResultInfo

type ResultInfo struct {
	FunctionName      string
	GasUsed           uint64
	ExecutionTimeSpan time.Duration
}

ResultInfo will hold the result information after running the tests

func RunTest

func RunTest(
	fileSC string,
	testingValue uint64,
	function string,
	arguments [][]byte,
	numRun int,
	gasSchedule map[string]map[string]uint64,
	txGasLimit uint64,
) (ResultInfo, error)

RunTest runs a test with the provided parameters

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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