vm

package
v1.1.66 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountExists

func AccountExists(accnts state.AccountsAdapter, addressBytes []byte) bool

AccountExists -

func ComputeExpectedBalance

func ComputeExpectedBalance(
	existing *big.Int,
	transferred *big.Int,
	gasLimit uint64,
	gasPrice uint64,
) *big.Int

ComputeExpectedBalance -

func ComputeGasLimit

func ComputeGasLimit(gasSchedule map[string]map[string]uint64, testContext *VMTestContext, tx *dataTx.Transaction) uint64

ComputeGasLimit -

func CreateAccount

func CreateAccount(accnts state.AccountsAdapter, pubKey []byte, nonce uint64, balance *big.Int) ([]byte, error)

CreateAccount -

func CreateDeployTx

func CreateDeployTx(
	senderAddressBytes []byte,
	senderNonce uint64,
	value *big.Int,
	gasPrice uint64,
	gasLimit uint64,
	scCodeAndVMType string,
) *dataTransaction.Transaction

CreateDeployTx -

func CreateEmptyAddress

func CreateEmptyAddress() []byte

CreateEmptyAddress -

func CreateInMemoryShardAccountsDB

func CreateInMemoryShardAccountsDB() *state.AccountsDB

CreateInMemoryShardAccountsDB -

func CreateMemUnit

func CreateMemUnit() storage.Storer

CreateMemUnit -

func CreateOneSCExecutorMockVM

func CreateOneSCExecutorMockVM(accnts state.AccountsAdapter) vmcommon.VMExecutionHandler

CreateOneSCExecutorMockVM -

func CreatePreparedTxProcessorAndAccountsWithMockedVM

func CreatePreparedTxProcessorAndAccountsWithMockedVM(
	vmOpGas uint64,
	senderNonce uint64,
	senderAddressBytes []byte,
	senderBalance *big.Int,
	argEnableEpoch ArgEnableEpoch,
) (process.TransactionProcessor, state.AccountsAdapter, error)

CreatePreparedTxProcessorAndAccountsWithMockedVM -

func CreateTestIndexer

func CreateTestIndexer(
	t testing.TB,
	coordinator sharding.Coordinator,
	economicsDataHandler process.EconomicsDataHandler,
) *testIndexer

CreateTestIndexer -

func CreateTransaction

func CreateTransaction(
	nonce uint64,
	value *big.Int,
	sndAddress []byte,
	rcvAddress []byte,
	gasprice uint64,
	gasLimit uint64,
	data []byte,
) *dataTransaction.Transaction

CreateTransaction -

func CreateTransferTokenTx

func CreateTransferTokenTx(
	nonce uint64,
	functionName string,
	value *big.Int,
	scAddrress []byte,
	sndAddress []byte,
	rcvAddress []byte,
) *dataTransaction.Transaction

CreateTransferTokenTx -

func CreateTx

func CreateTx(
	senderAddressBytes []byte,
	receiverAddressBytes []byte,
	senderNonce uint64,
	value *big.Int,
	gasPrice uint64,
	gasLimit uint64,
	scCodeOrFunc string,
) *dataTransaction.Transaction

CreateTx -

func CreateTxProcessorWithOneSCExecutorMockVM

func CreateTxProcessorWithOneSCExecutorMockVM(
	accnts state.AccountsAdapter,
	opGas uint64,
	argEnableEpoch ArgEnableEpoch,
) (process.TransactionProcessor, error)

CreateTxProcessorWithOneSCExecutorMockVM -

func CreateTxProcessorWithOneSCExecutorWithVMs

CreateTxProcessorWithOneSCExecutorWithVMs -

func CreateVMAndBlockchainHook

func CreateVMAndBlockchainHook(
	accnts state.AccountsAdapter,
	gasSchedule map[string]map[string]uint64,
	shardCoordinator sharding.Coordinator,
) (process.VirtualMachinesContainer, *hooks.BlockChainHookImpl)

CreateVMAndBlockchainHook -

func CreateVMAndBlockchainHookMeta

func CreateVMAndBlockchainHookMeta(
	accnts state.AccountsAdapter,
	gasSchedule map[string]map[string]uint64,
	shardCoordinator sharding.Coordinator,
	arg ArgEnableEpoch,
) (process.VirtualMachinesContainer, *hooks.BlockChainHookImpl)

CreateVMAndBlockchainHookMeta -

func GetIntValueFromSC

func GetIntValueFromSC(gasSchedule map[string]map[string]uint64, accnts state.AccountsAdapter, scAddressBytes []byte, funcName string, args ...[]byte) *big.Int

GetIntValueFromSC -

func GetNodeIndex

GetNodeIndex -

func GetVmOutput

func GetVmOutput(gasSchedule map[string]map[string]uint64, accnts state.AccountsAdapter, scAddressBytes []byte, funcName string, args ...[]byte) *vmcommon.VMOutput

GetVmOutput -

func TestAccount

func TestAccount(
	t *testing.T,
	accnts state.AccountsAdapter,
	senderAddressBytes []byte,
	expectedNonce uint64,
	expectedBalance *big.Int,
) *big.Int

TestAccount -

func TestDeployedContractContents

func TestDeployedContractContents(
	t *testing.T,
	destinationAddressBytes []byte,
	accnts state.AccountsAdapter,
	requiredBalance *big.Int,
	scCode string,
	dataValues map[string]*big.Int,
)

TestDeployedContractContents -

Types

type ArgEnableEpoch

type ArgEnableEpoch struct {
	PenalizedTooMuchGasEnableEpoch uint32
	BuiltinEnableEpoch             uint32
	DeployEnableEpoch              uint32
	MetaProtectionEnableEpoch      uint32
	RelayedTxEnableEpoch           uint32
	UnbondTokensV2EnableEpoch      uint32
}

ArgEnableEpoch will specify the enable epoch values for certain flags

type VMTestContext

type VMTestContext struct {
	TxProcessor      process.TransactionProcessor
	ScProcessor      *smartContract.TestScProcessor
	Accounts         state.AccountsAdapter
	BlockchainHook   vmcommon.BlockchainHook
	VMContainer      process.VirtualMachinesContainer
	TxFeeHandler     process.TransactionFeeHandler
	ShardCoordinator sharding.Coordinator
	ScForwarder      process.IntermediateTransactionHandler
	EconomicsData    process.EconomicsDataHandler
	Marshalizer      marshal.Marshalizer
}

VMTestContext -

func CreatePreparedTxProcessorAndAccountsWithVMs

func CreatePreparedTxProcessorAndAccountsWithVMs(
	senderNonce uint64,
	senderAddressBytes []byte,
	senderBalance *big.Int,
	argEnableEpoch ArgEnableEpoch,
) (*VMTestContext, error)

CreatePreparedTxProcessorAndAccountsWithVMs -

func CreatePreparedTxProcessorWithVMs

func CreatePreparedTxProcessorWithVMs(argEnableEpoch ArgEnableEpoch) (*VMTestContext, error)

CreatePreparedTxProcessorWithVMs -

func CreatePreparedTxProcessorWithVMsMultiShard

func CreatePreparedTxProcessorWithVMsMultiShard(selfShardID uint32, argEnableEpoch ArgEnableEpoch) (*VMTestContext, error)

CreatePreparedTxProcessorWithVMsMultiShard -

func CreateTxProcessorArwenVMWithGasSchedule

func CreateTxProcessorArwenVMWithGasSchedule(
	senderNonce uint64,
	senderAddressBytes []byte,
	senderBalance *big.Int,
	gasSchedule map[string]map[string]uint64,
	argEnableEpoch ArgEnableEpoch,
) (*VMTestContext, error)

CreateTxProcessorArwenVMWithGasSchedule -

func (*VMTestContext) Close

func (vmTestContext *VMTestContext) Close()

Close -

func (*VMTestContext) CreateBlockStarted

func (vmTestContext *VMTestContext) CreateBlockStarted()

CreateBlockStarted -

func (*VMTestContext) GetGasRemaining

func (vmTestContext *VMTestContext) GetGasRemaining() uint64

GetGasRemaining -

func (*VMTestContext) GetIntermediateTransactions

func (vmTestContext *VMTestContext) GetIntermediateTransactions(t *testing.T) []data.TransactionHandler

GetIntermediateTransactions -

func (*VMTestContext) GetLatestError

func (vmTestContext *VMTestContext) GetLatestError() error

GetLatestError -

Directories

Path Synopsis
txsFee

Jump to

Keyboard shortcuts

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