vm

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: GPL-3.0 Imports: 66 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 added in v1.1.32

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,
	enableEpochs config.EnableEpochs,
	arwenChangeLocker common.Locker,
) (process.TransactionProcessor, state.AccountsAdapter, error)

CreatePreparedTxProcessorAndAccountsWithMockedVM -

func CreateTransaction added in v1.1.15

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,
	enableEpochsConfig config.EnableEpochs,
	arwenChangeLocker common.Locker,
) (process.TransactionProcessor, error)

CreateTxProcessorWithOneSCExecutorMockVM -

func CreateVMAndBlockchainHookAndDataPool added in v1.2.4

func CreateVMAndBlockchainHookAndDataPool(
	accnts state.AccountsAdapter,
	gasSchedule core.GasScheduleNotifier,
	vmConfig *config.VirtualMachineConfig,
	shardCoordinator sharding.Coordinator,
	arwenChangeLocker common.Locker,
	epochNotifierInstance process.EpochNotifier,
	enableEpochsHandler common.EnableEpochsHandler,
) (process.VirtualMachinesContainer, *hooks.BlockChainHookImpl, dataRetriever.PoolsHolder)

CreateVMAndBlockchainHookAndDataPool -

func CreateVMAndBlockchainHookMeta added in v1.1.34

func CreateVMAndBlockchainHookMeta(
	accnts state.AccountsAdapter,
	gasSchedule core.GasScheduleNotifier,
	shardCoordinator sharding.Coordinator,
	enableEpochsConfig config.EnableEpochs,
) (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 added in v1.1.15

GetNodeIndex -

func GetVmOutput added in v1.1.22

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 ResultsCreateTxProcessor added in v1.3.0

type ResultsCreateTxProcessor struct {
	TxProc             process.TransactionProcessor
	SCProc             *smartContract.TestScProcessor
	IntermediateTxProc process.IntermediateTransactionHandler
	EconomicsHandler   process.EconomicsDataHandler
	CostHandler        external.TransactionCostHandler
	TxLogProc          process.TransactionLogProcessor
}

ResultsCreateTxProcessor is the struct that will hold all needed processor instances

func CreateTxProcessorWithOneSCExecutorWithVMs

func CreateTxProcessorWithOneSCExecutorWithVMs(
	accnts state.AccountsAdapter,
	vmContainer process.VirtualMachinesContainer,
	blockChainHook *hooks.BlockChainHookImpl,
	feeAccumulator process.TransactionFeeHandler,
	shardCoordinator sharding.Coordinator,
	enableEpochsConfig config.EnableEpochs,
	arwenChangeLocker common.Locker,
	poolsHolder dataRetriever.PoolsHolder,
	epochNotifierInstance process.EpochNotifier,
) (*ResultsCreateTxProcessor, error)

CreateTxProcessorWithOneSCExecutorWithVMs -

type VMTestAccount added in v1.2.1

type VMTestAccount struct {
	Balance      *big.Int
	Address      []byte
	Nonce        uint64
	TokenBalance *big.Int
}

VMTestAccount -

type VMTestContext added in v0.0.5

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
	GasSchedule         core.GasScheduleNotifier
	VMConfiguration     *config.VirtualMachineConfig
	EpochNotifier       process.EpochNotifier
	EnableEpochsHandler common.EnableEpochsHandler
	SCQueryService      *smartContract.SCQueryService

	Alice         VMTestAccount
	Bob           VMTestAccount
	ContractOwner VMTestAccount
	Contract      VMTestAccount

	TxCostHandler    external.TransactionCostHandler
	TxsLogsProcessor process.TransactionLogProcessor
}

VMTestContext -

func CreatePreparedTxProcessorAndAccountsWithVMs

func CreatePreparedTxProcessorAndAccountsWithVMs(
	senderNonce uint64,
	senderAddressBytes []byte,
	senderBalance *big.Int,
	enableEpochsConfig config.EnableEpochs,
) (*VMTestContext, error)

CreatePreparedTxProcessorAndAccountsWithVMs -

func CreatePreparedTxProcessorWithVMs added in v1.1.15

func CreatePreparedTxProcessorWithVMs(enableEpochs config.EnableEpochs) (*VMTestContext, error)

CreatePreparedTxProcessorWithVMs -

func CreatePreparedTxProcessorWithVMsMultiShard added in v1.1.15

func CreatePreparedTxProcessorWithVMsMultiShard(selfShardID uint32, enableEpochsConfig config.EnableEpochs) (*VMTestContext, error)

CreatePreparedTxProcessorWithVMsMultiShard -

func CreatePreparedTxProcessorWithVMsWithShardCoordinator added in v1.1.66

func CreatePreparedTxProcessorWithVMsWithShardCoordinator(enableEpochsConfig config.EnableEpochs, shardCoordinator sharding.Coordinator) (*VMTestContext, error)

CreatePreparedTxProcessorWithVMsWithShardCoordinator -

func CreateTxProcessorArwenVMWithGasSchedule

func CreateTxProcessorArwenVMWithGasSchedule(
	senderNonce uint64,
	senderAddressBytes []byte,
	senderBalance *big.Int,
	gasScheduleMap map[string]map[string]uint64,
	enableEpochsConfig config.EnableEpochs,
) (*VMTestContext, error)

CreateTxProcessorArwenVMWithGasSchedule -

func CreateTxProcessorArwenWithVMConfig added in v1.2.1

func CreateTxProcessorArwenWithVMConfig(
	enableEpochsConfig config.EnableEpochs,
	vmConfig *config.VirtualMachineConfig,
	gasSchedule map[string]map[string]uint64,
) (*VMTestContext, error)

CreateTxProcessorArwenWithVMConfig -

func (*VMTestContext) Close added in v0.0.5

func (vmTestContext *VMTestContext) Close()

Close -

func (*VMTestContext) CreateAccount added in v1.2.1

func (vmTestContext *VMTestContext) CreateAccount(account *VMTestAccount)

CreateAccount -

func (*VMTestContext) CreateBlockStarted added in v1.1.25

func (vmTestContext *VMTestContext) CreateBlockStarted()

CreateBlockStarted -

func (*VMTestContext) CreateTransaction added in v1.2.1

func (vmTestContext *VMTestContext) CreateTransaction(
	sender *VMTestAccount,
	receiver *VMTestAccount,
	value *big.Int,
	gasprice uint64,
	gasLimit uint64,
	data []byte,
) *dataTransaction.Transaction

CreateTransaction -

func (*VMTestContext) CreateTransferTokenTx added in v1.2.1

func (vmTestContext *VMTestContext) CreateTransferTokenTx(
	sender *VMTestAccount,
	receiver *VMTestAccount,
	value *big.Int,
	functionName string,
) *dataTransaction.Transaction

CreateTransferTokenTx -

func (*VMTestContext) GetCompositeTestError added in v1.3.19

func (vmTestContext *VMTestContext) GetCompositeTestError() error

GetCompositeTestError -

func (*VMTestContext) GetGasRemaining added in v1.1.12

func (vmTestContext *VMTestContext) GetGasRemaining() uint64

GetGasRemaining -

func (*VMTestContext) GetIntValueFromSCWithTransientVM added in v1.2.1

func (vmTestContext *VMTestContext) GetIntValueFromSCWithTransientVM(funcName string, args ...[]byte) *big.Int

GetIntValueFromSCWithTransientVM -

func (*VMTestContext) GetIntermediateTransactions added in v1.1.16

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

GetIntermediateTransactions -

func (*VMTestContext) GetVMOutputWithTransientVM added in v1.2.1

func (vmTestContext *VMTestContext) GetVMOutputWithTransientVM(funcName string, args ...[]byte) *vmcommon.VMOutput

GetVMOutputWithTransientVM -

Directories

Path Synopsis
nft
txsFee

Jump to

Keyboard shortcuts

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