Documentation ¶
Overview ¶
Package testcommon contains utility definitions used in unit and integration tests
Index ¶
- Constants
- Variables
- func AddFinishData(vmOutput *vmcommon.VMOutput, data []byte)
- func AddNewOutputTransfer(vmOutput *vmcommon.VMOutput, index uint32, sender []byte, address []byte, ...) *vmcommon.OutputAccount
- func AddTestSmartContractToWorld(world *worldmock.MockWorld, identifier string, code []byte) *worldmock.Account
- func BlockchainHookStubForCall(code []byte, balance *big.Int) *contextmock.BlockchainHookStub
- func BlockchainHookStubForCallSigSegv(code []byte, balance *big.Int) *contextmock.BlockchainHookStub
- func BlockchainHookStubForContracts(contracts []*InstanceTestSmartContract) *contextmock.BlockchainHookStub
- func BlockchainHookStubForTwoSCs(parentCode []byte, childCode []byte, parentSCBalance *big.Int, ...) *contextmock.BlockchainHookStub
- func CreateSvg(file string, graphviz *gographviz.Graph)
- func CreateSvgWithLocation(folder string, file string, graphviz *gographviz.Graph)
- func DefaultTestContractCallInput() *vmcommon.ContractCallInput
- func DefaultTestContractCreateInput() *vmcommon.ContractCreateInput
- func GenerateSVGforGraph(callGraph *TestCallGraph, folder string, name string)
- func GetSCCode(fileName string) []byte
- func GetTestSCCode(scName string, prefixToTestSCs ...string) []byte
- func GetTestSCCodeModule(scName string, moduleName string, prefixToTestSCs string) []byte
- func MakeEmptyVMOutput() *vmcommon.VMOutput
- func MakeTestSCAddress(identifier string) []byte
- func MakeTestSCAddressWithDefaultVM(identifier string) []byte
- func MakeTestSCAddressWithVMType(identifier string, vmType []byte) []byte
- func SimpleWasteGasMockMethod(instanceMock *mock.InstanceMock, gas uint64) func() *mock.InstanceMock
- func ToGraphviz(graph *TestCallGraph, showGasEdgeLabels bool) *gographviz.Graph
- func WasteGasWithReturnDataMockMethod(instanceMock *mock.InstanceMock, gas uint64, returnData []byte) func() *mock.InstanceMock
- type AssertResultsFunc
- type AssertResultsWithStartNodeFunc
- type CallFinishDataItem
- type CallsFinishData
- type ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) Build() *vmcommon.ContractCallInput
- func (contractInput *ContractCallInputBuilder) NextDCDTTransfer() *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithArguments(arguments ...[]byte) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithAsyncArguments(arguments *vmcommon.AsyncArguments) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithCallType(callType vm.CallType) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithCallValue(value int64) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithCallerAddr(address []byte) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithCurrentTxHash(txHash []byte) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithDCDTTokenName(dcdtTokenName []byte) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithDCDTValue(dcdtValue *big.Int) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithFunction(function string) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithGasLocked(gas uint64) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithGasProvided(gas uint64) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithPrevTxHash(txHash []byte) *ContractCallInputBuilder
- func (contractInput *ContractCallInputBuilder) WithRecipientAddr(address []byte) *ContractCallInputBuilder
- type ContractCreateInputBuilder
- func (contractInput *ContractCreateInputBuilder) Build() *vmcommon.ContractCreateInput
- func (contractInput *ContractCreateInputBuilder) WithArguments(arguments ...[]byte) *ContractCreateInputBuilder
- func (contractInput *ContractCreateInputBuilder) WithCallValue(callValue int64) *ContractCreateInputBuilder
- func (contractInput *ContractCreateInputBuilder) WithCallerAddr(address []byte) *ContractCreateInputBuilder
- func (contractInput *ContractCreateInputBuilder) WithContractCode(code []byte) *ContractCreateInputBuilder
- func (contractInput *ContractCreateInputBuilder) WithContractCodeMetadata(codemetadata []byte) *ContractCreateInputBuilder
- func (contractInput *ContractCreateInputBuilder) WithGasProvided(gas uint64) *ContractCreateInputBuilder
- type CrossShardCall
- type CrossShardCallsQueue
- func (queue *CrossShardCallsQueue) CanExecuteLocalCallback(callbackNode *TestCallNode) bool
- func (queue *CrossShardCallsQueue) Dequeue() *CrossShardCall
- func (queue *CrossShardCallsQueue) Enqueue(callerAddress []byte, startNode *TestCallNode, callType vm.CallType, ...)
- func (queue *CrossShardCallsQueue) IsEmpty() bool
- func (queue *CrossShardCallsQueue) Len() int
- func (queue *CrossShardCallsQueue) Less(i, j int) bool
- func (queue *CrossShardCallsQueue) Requeue(crossShardCall *CrossShardCall)
- func (queue *CrossShardCallsQueue) Swap(i, j int)
- func (queue *CrossShardCallsQueue) Top() *CrossShardCall
- type InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) AndAssertResults(...)
- func (template *InstanceCallTestTemplate) AndAssertResultsWithoutReset(...)
- func (template *InstanceCallTestTemplate) GetVMHost() vmhost.VMHost
- func (template *InstanceCallTestTemplate) WithContracts(usedContracts ...*InstanceTestSmartContract) *InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) WithExecutorFactory(executorFactory executor.ExecutorAbstractFactory) *InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) WithExecutorLogs(executorLogger executorwrapper.ExecutorLogger) *InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) WithGasSchedule(gasSchedule config.GasScheduleMap) *InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) WithInput(input *vmcommon.ContractCallInput) *InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) WithSetup(setup func(vmhost.VMHost, *contextmock.BlockchainHookStub)) *InstanceCallTestTemplate
- func (template *InstanceCallTestTemplate) WithWasmerSIGSEGVPassthrough(passthrough bool) *InstanceCallTestTemplate
- type InstanceCreatorTestTemplate
- func (template *InstanceCreatorTestTemplate) AndAssertResults(assertResults func(*contextmock.BlockchainHookStub, *VMOutputVerifier))
- func (template *InstanceCreatorTestTemplate) AndAssertResultsWithoutReset(assertResults func(*contextmock.BlockchainHookStub, *VMOutputVerifier))
- func (template *InstanceCreatorTestTemplate) RunTest(reset bool) (*contextmock.BlockchainHookStub, *vmcommon.VMOutput, error)
- func (template *InstanceCreatorTestTemplate) WithAddress(address []byte) *InstanceCreatorTestTemplate
- func (template *InstanceCreatorTestTemplate) WithExecutorFactory(factory executor.ExecutorAbstractFactory) *InstanceCreatorTestTemplate
- func (template *InstanceCreatorTestTemplate) WithExecutorLogs(executorLogger executorwrapper.ExecutorLogger) *InstanceCreatorTestTemplate
- func (template *InstanceCreatorTestTemplate) WithInput(input *vmcommon.ContractCreateInput) *InstanceCreatorTestTemplate
- func (template *InstanceCreatorTestTemplate) WithSetup(setup func(vmhost.VMHost, *contextmock.BlockchainHookStub)) *InstanceCreatorTestTemplate
- func (template *InstanceCreatorTestTemplate) WithWasmerSIGSEGVPassthrough(passthrough bool) *InstanceCreatorTestTemplate
- type InstanceTestSmartContract
- func (mockSC *InstanceTestSmartContract) WithBalance(balance int64) *InstanceTestSmartContract
- func (mockSC *InstanceTestSmartContract) WithCode(code []byte) *InstanceTestSmartContract
- func (mockSC *InstanceTestSmartContract) WithCodeMetadata(metadata []byte) *InstanceTestSmartContract
- func (mockSC *InstanceTestSmartContract) WithConfig(testConfig *TestConfig) *InstanceTestSmartContract
- func (mockSC *InstanceTestSmartContract) WithOwner(owner []byte) *InstanceTestSmartContract
- type MockBuiltin
- type MockInstancesTestTemplate
- func (callerTest *MockInstancesTestTemplate) AndAssertResults(assertResults AssertResultsFunc) (*vmcommon.VMOutput, error)
- func (callerTest *MockInstancesTestTemplate) AndAssertResultsWithWorld(world *worldmock.MockWorld, createAccount bool, startNode *TestCallNode, ...) (*vmcommon.VMOutput, error)
- func (callerTest *MockInstancesTestTemplate) AndCreateAndAssertResults(assertResults AssertResultsFunc) (*vmcommon.VMOutput, error)
- func (callerTest *MockInstancesTestTemplate) RunTest(world *worldmock.MockWorld, createContractAccounts bool, testType TestType) (vmhost.VMHost, *vmcommon.VMOutput, error)
- func (callerTest *MockInstancesTestTemplate) WithContracts(usedContracts ...MockTestSmartContract) *MockInstancesTestTemplate
- func (callerTest *MockInstancesTestTemplate) WithInput(input *vmcommon.ContractCallInput) *MockInstancesTestTemplate
- func (callerTest *MockInstancesTestTemplate) WithSetup(setup SetupFunction) *MockInstancesTestTemplate
- func (callerTest *MockInstancesTestTemplate) WithWasmerSIGSEGVPassthrough(wasmerSIGSEGVPassthrough bool) *MockInstancesTestTemplate
- type MockTestSmartContract
- func (mockSC *MockTestSmartContract) GetShardID() uint32
- func (mockSC *MockTestSmartContract) GetVMType() []byte
- func (mockSC *MockTestSmartContract) Initialize(t testing.TB, host vmhost.VMHost, imb *mock.ExecutorMock, ...)
- func (mockSC *MockTestSmartContract) WithBalance(balance int64) *MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithCodeHash(codeHash []byte) *MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithCodeMetadata(codeMetadata []byte) *MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithConfig(config *TestConfig) *MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithMethods(initMethods ...func(*mock.InstanceMock, interface{})) MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithOwnerAddress(ownerAddress []byte) *MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithShardID(shardID uint32) *MockTestSmartContract
- func (mockSC *MockTestSmartContract) WithVMType(vmType []byte) *MockTestSmartContract
- type RuntimeConfigOfCall
- type SetupFunction
- type StoreEntry
- type TestCall
- type TestCallEdge
- func (edge *TestCallEdge) IsFailFail() bool
- func (edge *TestCallEdge) SetCallbackFail() *TestCallEdge
- func (edge *TestCallEdge) SetFail() *TestCallEdge
- func (edge *TestCallEdge) SetFailWithExpectedError(expectedError error) *TestCallEdge
- func (edge *TestCallEdge) SetGasLimit(gasLimit uint64) *TestCallEdge
- func (edge *TestCallEdge) SetGasLocked(gasLocked uint64) *TestCallEdge
- func (edge *TestCallEdge) SetGasUsed(gasUsed uint64) *TestCallEdge
- func (edge *TestCallEdge) SetGasUsedByCallback(gasUsedByCallback uint64) *TestCallEdge
- type TestCallEdgeType
- type TestCallGraph
- func CreateGraphTestAsyncCallIndirectFail() *TestCallGraph
- func CreateGraphTestAsyncCallIndirectFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallbackIndirectFail() *TestCallGraph
- func CreateGraphTestAsyncCallbackIndirectFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsync() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncBothCallbacksFail() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncBothCallbacksFailLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstCallbackFail() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstCallbackFailLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstFail() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstFailCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstFailLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstNoCallback() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncFirstNoCallbackLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondCallbackFail() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondCallbackFailLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondFail() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondFailCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondFailCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondFailLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondNoCallback() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossLocal() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossShard() *TestCallGraph
- func CreateGraphTestAsyncCallsAsyncSecondNoCallbackLocalCross() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard2() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard3() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard4() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard5() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard6() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard7() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard8() *TestCallGraph
- func CreateGraphTestAsyncCallsCrossShard9() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncCallbackFailCrossCross() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncCallbackFailCrossLocal() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncCallbackFailLocalCross() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncCallbackFailLocalLocal() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncCrossCross() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncCrossLocal() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncFailCrossCross() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncFailCrossLocal() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncFailLocalCross() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncFailLocalLocal() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncLocalCross() *TestCallGraph
- func CreateGraphTestCallbackCallsAsyncLocalLocal() *TestCallGraph
- func CreateGraphTestCallbackCallsSync() *TestCallGraph
- func CreateGraphTestDifferentTypeOfCallsToSameFunction() *TestCallGraph
- func CreateGraphTestOneAsyncCall() *TestCallGraph
- func CreateGraphTestOneAsyncCallCrossShard() *TestCallGraph
- func CreateGraphTestOneAsyncCallCrossShard2() *TestCallGraph
- func CreateGraphTestOneAsyncCallCustomGasLocked() *TestCallGraph
- func CreateGraphTestOneAsyncCallFail() *TestCallGraph
- func CreateGraphTestOneAsyncCallFailCrossShard() *TestCallGraph
- func CreateGraphTestOneAsyncCallFailNoCallbackCrossShard() *TestCallGraph
- func CreateGraphTestOneAsyncCallNoCallback() *TestCallGraph
- func CreateGraphTestOneAsyncCallNoCallbackCrossShard() *TestCallGraph
- func CreateGraphTestOneAsyncCallNoCallbackFail() *TestCallGraph
- func CreateGraphTestOneAsyncCallbackFail() *TestCallGraph
- func CreateGraphTestOneAsyncCallbackFailCrossShard() *TestCallGraph
- func CreateGraphTestSameContractWithDifferentSubCallsCrossCross() *TestCallGraph
- func CreateGraphTestSameContractWithDifferentSubCallsCrossLocal() *TestCallGraph
- func CreateGraphTestSameContractWithDifferentSubCallsLocalCross() *TestCallGraph
- func CreateGraphTestSameContractWithDifferentSubCallsLocalLocal() *TestCallGraph
- func CreateGraphTestSyncAndAsync1() *TestCallGraph
- func CreateGraphTestSyncAndAsync10() *TestCallGraph
- func CreateGraphTestSyncAndAsync11() *TestCallGraph
- func CreateGraphTestSyncAndAsync2() *TestCallGraph
- func CreateGraphTestSyncAndAsync3() *TestCallGraph
- func CreateGraphTestSyncAndAsync4() *TestCallGraph
- func CreateGraphTestSyncAndAsync5() *TestCallGraph
- func CreateGraphTestSyncAndAsync6() *TestCallGraph
- func CreateGraphTestSyncAndAsync7() *TestCallGraph
- func CreateGraphTestSyncAndAsync8() *TestCallGraph
- func CreateGraphTestSyncAndAsync9() *TestCallGraph
- func CreateGraphTestSyncCalls() *TestCallGraph
- func CreateGraphTestSyncCalls2() *TestCallGraph
- func CreateGraphTestSyncCallsFailPropagation() *TestCallGraph
- func CreateGraphTestTwoAsyncCalls() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothCallbacksFail() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothCallbacksFailLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothFail() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothFailCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothFailCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsBothFailLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstCallbackFail() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstCallbackFailLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstFail() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstFailCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstFailCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstFailLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstNoCallback() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondCallbackFail() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondCallbackFailLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondFail() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondFailCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondFailCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondFailLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondNoCallback() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossLocal() *TestCallGraph
- func CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossShard() *TestCallGraph
- func CreateGraphTestTwoAsyncFirstNoCallbackCallsLocalCross() *TestCallGraph
- func CreateGraphTestTwoAsyncSecondNoCallbackCallsLocalCross() *TestCallGraph
- func CreateTestCallGraph() *TestCallGraph
- func MakeGraphAndImage(graph *TestCallGraph) *TestCallGraph
- func (graph *TestCallGraph) AddAsyncCrossShardEdge(from *TestCallNode, to *TestCallNode, callBack string, group string) *TestCallEdge
- func (graph *TestCallGraph) AddAsyncEdge(from *TestCallNode, to *TestCallNode, callBack string, group string) *TestCallEdge
- func (graph *TestCallGraph) AddNode(contractID string, functionName string) *TestCallNode
- func (graph *TestCallGraph) AddNodeCopy(node *TestCallNode) *TestCallNode
- func (graph *TestCallGraph) AddStartNode(contractID string, functionName string, gasLimit uint64, gasUsed uint64) *TestCallNode
- func (graph *TestCallGraph) AddSyncEdge(from *TestCallNode, to *TestCallNode) *TestCallEdge
- func (graph *TestCallGraph) AssignExecutionRounds(_ *testing.T)
- func (graph *TestCallGraph) ComputeGasGraphFromExecutionGraph() *TestCallGraph
- func (graph *TestCallGraph) ComputeRemainingGasAfterCallbacks()
- func (graph *TestCallGraph) ComputeRemainingGasBeforeCallbacks(_ *testing.T)
- func (graph *TestCallGraph) CreateExecutionGraphFromCallGraph() *TestCallGraph
- func (graph *TestCallGraph) DfsFromNodeUntilFailures(parent *TestCallNode, node *TestCallNode, incomingEdge *TestCallEdge, ...) *TestCallNode
- func (graph *TestCallGraph) DfsGraph(processNode processNodeFunc, followCrossShardEdges bool)
- func (graph *TestCallGraph) DfsGraphFromNode(startNode *TestCallNode, processNode processNodeFunc, visits map[uint]bool, ...)
- func (graph *TestCallGraph) DfsGraphFromNodePostOrder(startNode *TestCallNode, ...)
- func (graph *TestCallGraph) FindNode(contractAddress []byte, functionName string) *TestCallNode
- func (graph *TestCallGraph) GetStartNode() *TestCallNode
- func (graph *TestCallGraph) PropagateSyncFailures()
- type TestCallNode
- func (node *TestCallNode) GetEdges() []*TestCallEdge
- func (node *TestCallNode) GetIncomingEdgeType() TestCallEdgeType
- func (node *TestCallNode) HasCallback() bool
- func (node *TestCallNode) HasFailSyncEdge() bool
- func (node *TestCallNode) IsAsync() bool
- func (node *TestCallNode) IsCallback() bool
- func (node *TestCallNode) IsGasLeaf() bool
- func (node *TestCallNode) IsIncomingEdgeFail() bool
- func (node *TestCallNode) IsLeaf() bool
- func (node *TestCallNode) IsSync() bool
- func (node *TestCallNode) WillNotExecute() bool
- type TestCallPath
- type TestConfig
- type TestHostBuilder
- func (thb *TestHostBuilder) Build() vmhost.VMHost
- func (thb *TestHostBuilder) WithBlockchainHook(blockchainHook vmcommon.BlockchainHook) *TestHostBuilder
- func (thb *TestHostBuilder) WithBuiltinFunctions() *TestHostBuilder
- func (thb *TestHostBuilder) WithExecutorFactory(executorFactory executor.ExecutorAbstractFactory) *TestHostBuilder
- func (thb *TestHostBuilder) WithExecutorLogs(executorLogger executorwrapper.ExecutorLogger) *TestHostBuilder
- func (thb *TestHostBuilder) WithGasSchedule(gasSchedule config.GasScheduleMap) *TestHostBuilder
- func (thb *TestHostBuilder) WithWasmerSIGSEGVPassthrough(wasmerSIGSEGVPassthrough bool) *TestHostBuilder
- type TestType
- type TransferEntry
- func (transferEntry *TransferEntry) IgnoreDataItems(ignoredDataArguments ...int) *TransferEntry
- func (transferEntry *TransferEntry) WithCallType(callType vm.CallType) *TransferEntry
- func (transferEntry *TransferEntry) WithData(data []byte) *TransferEntry
- func (transferEntry *TransferEntry) WithGasLimit(gas uint64) *TransferEntry
- func (transferEntry *TransferEntry) WithGasLocked(gas uint64) *TransferEntry
- func (transferEntry *TransferEntry) WithValue(value *big.Int) TransferEntry
- type VMOutputVerifier
- func (v *VMOutputVerifier) Balance(address []byte, balance int64) *VMOutputVerifier
- func (v *VMOutputVerifier) BalanceDelta(address []byte, balanceDelta int64) *VMOutputVerifier
- func (v *VMOutputVerifier) BytesAddedToStorage(address []byte, bytesAdded int) *VMOutputVerifier
- func (v *VMOutputVerifier) BytesDeletedFromStorage(address []byte, bytesDelted int) *VMOutputVerifier
- func (v *VMOutputVerifier) Code(address []byte, code []byte) *VMOutputVerifier
- func (v *VMOutputVerifier) CodeDeployerAddress(address []byte, codeDeployerAddress []byte) *VMOutputVerifier
- func (v *VMOutputVerifier) CodeMetadata(address []byte, codeMetadata []byte) *VMOutputVerifier
- func (v *VMOutputVerifier) ContractInvalid() *VMOutputVerifier
- func (v *VMOutputVerifier) ContractNotFound() *VMOutputVerifier
- func (v *VMOutputVerifier) DeletedAccounts(deletedAccounts ...[]byte) *VMOutputVerifier
- func (v *VMOutputVerifier) ExecutionFailed() *VMOutputVerifier
- func (v *VMOutputVerifier) FunctionNotFound() *VMOutputVerifier
- func (v *VMOutputVerifier) GasRemaining(gas uint64) *VMOutputVerifier
- func (v *VMOutputVerifier) GasUsed(address []byte, gas uint64) *VMOutputVerifier
- func (v *VMOutputVerifier) HasRuntimeErrorAndInfo(message string, otherInfo string) *VMOutputVerifier
- func (v *VMOutputVerifier) HasRuntimeErrors(messages ...string) *VMOutputVerifier
- func (v *VMOutputVerifier) Logs(logs ...vmcommon.LogEntry) *VMOutputVerifier
- func (v *VMOutputVerifier) Nonce(address []byte, nonce uint64) *VMOutputVerifier
- func (v *VMOutputVerifier) Ok() *VMOutputVerifier
- func (v *VMOutputVerifier) OutOfGas() *VMOutputVerifier
- func (v *VMOutputVerifier) Print() *VMOutputVerifier
- func (v *VMOutputVerifier) ReturnCode(code vmcommon.ReturnCode) *VMOutputVerifier
- func (v *VMOutputVerifier) ReturnData(returnData ...[]byte) *VMOutputVerifier
- func (v *VMOutputVerifier) ReturnDataContains(element []byte) *VMOutputVerifier
- func (v *VMOutputVerifier) ReturnDataDoesNotContain(element []byte) *VMOutputVerifier
- func (v *VMOutputVerifier) ReturnMessage(message string) *VMOutputVerifier
- func (v *VMOutputVerifier) ReturnMessageContains(message string) *VMOutputVerifier
- func (v *VMOutputVerifier) Storage(expectedEntries ...StoreEntry) *VMOutputVerifier
- func (v *VMOutputVerifier) Transfers(transfers ...TransferEntry) *VMOutputVerifier
- func (v *VMOutputVerifier) UserError() *VMOutputVerifier
Constants ¶
const ( Sync = iota Async Callback AsyncCrossShard CallbackCrossShard )
types of TestCallEdges
const AddressSize = 32
AddressSize is the size of an account address, in bytes.
const DefaultCallGraphLockedGas = 150
DefaultCallGraphLockedGas is the default gas locked value
const FakeCallbackName = "<>"
FakeCallbackName - used by test framework to reprezent visually a callback that is not present
const LeafLabel = "*"
LeafLabel - special node label for leafs
Variables ¶
var CallbackData = []byte("callbackData")
CallbackData value exposed for test usage
var CallbackKey = []byte("callbackKey.....................")
CallbackKey value exposed for test usage
var ChildAddress = MakeTestSCAddressWithDefaultVM("childSC")
ChildAddress is an exposed value to use in tests
var ChildCompilationCostDestCtx uint64
ChildCompilationCostDestCtx value exposed for test usage
var ChildCompilationCostSameCtx uint64
ChildCompilationCostSameCtx value exposed for test usage
var ChildData = []byte("childData")
ChildData value exposed for test usage
var ChildFinish = []byte("childFinish")
ChildFinish value exposed for test usage
var ChildKey = []byte("childKey........................")
ChildKey value exposed for test usage
var ChildKeyB = []byte("childKeyB........................")
ChildKeyB value exposed for test usage
var ChildTransferReceiver = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fchildTransferReceiver.")
ChildTransferReceiver value exposed for test usage
var DCDTTestTokenName = []byte("TTT-010101")
DCDTTestTokenName is an exposed value to use in tests
var DCDTTransferGasCost = uint64(1)
DCDTTransferGasCost is an exposed value to use in tests
var DefaultCodeMetadata = []byte{3, 0}
DefaultCodeMetadata is an exposed value to use in tests
var DefaultVMType = []byte{0xF, 0xF}
DefaultVMType is an exposed value to use in tests
var ErrAccountNotFound = errors.New("account not found")
ErrAccountNotFound is an exposed value to use in tests
var ErrAsyncCallFail = fmt.Errorf("async call fail")
ErrAsyncCallFail -
var ErrAsyncCallbackFail = fmt.Errorf("callback fail")
ErrAsyncCallbackFail -
var ErrAsyncRegisterFail = fmt.Errorf("unable to register async call")
ErrAsyncRegisterFail -
var ErrSyncCallFail = fmt.Errorf("sync call fail")
ErrSyncCallFail -
var GasProvided = uint64(1000000)
GasProvided value exposed for test usage
var LogGraph = logger.GetOrCreate("vm/graph")
LogGraph -
var NephewAddress = MakeTestSCAddressWithDefaultVM("NephewAddress")
NephewAddress is an exposed value to use in tests
var OriginalCallerCallback = []byte("originalCallerCallback")
OriginalCallerCallback value exposed for test usage
var OriginalCallerChild = []byte("originalCallerChild")
OriginalCallerChild value exposed for test usage
var OriginalCallerParent = []byte("originalCallerParent")
OriginalCallerParent value exposed for test usage
var ParentAddress = MakeTestSCAddressWithDefaultVM("parentSC")
ParentAddress is an exposed value to use in tests
var ParentCompilationCostDestCtx uint64
ParentCompilationCostDestCtx value exposed for test usage
var ParentCompilationCostSameCtx uint64
ParentCompilationCostSameCtx value exposed for test usage
var ParentDataA = []byte("parentDataA")
ParentDataA value exposed for test usage
var ParentDataB = []byte("parentDataB")
ParentDataB value exposed for test usage
var ParentFinishA = []byte("parentFinishA")
ParentFinishA value exposed for test usage
var ParentFinishB = []byte("parentFinishB")
ParentFinishB value exposed for test usage
var ParentKeyA = []byte("parentKeyA......................")
ParentKeyA value exposed for test usage
var ParentKeyB = []byte("parentKeyB......................")
ParentKeyB value exposed for test usage
var ParentTransferData = []byte("parentTransferData")
ParentTransferData value exposed for test usage
var ParentTransferReceiver = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fparentTransferReceiver")
ParentTransferReceiver value exposed for test usage
var ParentTransferValue = int64(42)
ParentTransferValue value exposed for test usage
var RecursiveIterationBigCounterKey = []byte("recursiveIterationBigCounter....")
RecursiveIterationBigCounterKey value exposed for test usage
var RecursiveIterationCounterKey = []byte("recursiveIterationCounter.......")
RecursiveIterationCounterKey value exposed for test usage
var SCAddressPrefix = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f")
SCAddressPrefix is the prefix of any smart contract address used for testing.
var TestCallbackPrefix = "callback_"
TestCallbackPrefix -
var TestContextCallbackFunction = "contextCallback"
TestContextCallbackFunction -
var TestReturnDataSuffix = "_returnData"
TestReturnDataSuffix -
var ThirdPartyAddress = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fthirdPartyAddress.....")
ThirdPartyAddress value exposed for test usage
var UserAddress = MakeTestSCAddressWithDefaultVM("userAccount")
UserAddress is an exposed value to use in tests
var UserAddress2 = []byte("userAccount2....................")
UserAddress2 is an exposed value to use in tests
var VaultAddress = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fvaultAddress..........")
VaultAddress value exposed for test usage
var WasmVirtualMachine = []byte{5, 0}
Functions ¶
func AddFinishData ¶
AddFinishData appends the provided []byte to the ReturnData of the given vmOutput
func AddNewOutputTransfer ¶
func AddNewOutputTransfer(vmOutput *vmcommon.VMOutput, index uint32, sender []byte, address []byte, balanceDelta int64, data []byte) *vmcommon.OutputAccount
AddNewOutputTransfer creates a new vmcommon.OutputAccount from the provided arguments and adds it to OutputAccounts of the provided vmOutput
func AddTestSmartContractToWorld ¶
func AddTestSmartContractToWorld(world *worldmock.MockWorld, identifier string, code []byte) *worldmock.Account
AddTestSmartContractToWorld directly deploys the provided code into the given MockWorld under a SC address built with the given identifier.
func BlockchainHookStubForCall ¶
func BlockchainHookStubForCall(code []byte, balance *big.Int) *contextmock.BlockchainHookStub
BlockchainHookStubForCall creates a BlockchainHookStub
func BlockchainHookStubForCallSigSegv ¶
func BlockchainHookStubForCallSigSegv(code []byte, balance *big.Int) *contextmock.BlockchainHookStub
BlockchainHookStubForCallSigSegv -
func BlockchainHookStubForContracts ¶
func BlockchainHookStubForContracts( contracts []*InstanceTestSmartContract, ) *contextmock.BlockchainHookStub
BlockchainHookStubForContracts -
func BlockchainHookStubForTwoSCs ¶
func BlockchainHookStubForTwoSCs( parentCode []byte, childCode []byte, parentSCBalance *big.Int, childSCBalance *big.Int, ) *contextmock.BlockchainHookStub
BlockchainHookStubForTwoSCs creates a world stub configured for testing calls between 2 SmartContracts
func CreateSvgWithLocation ¶
func CreateSvgWithLocation(folder string, file string, graphviz *gographviz.Graph)
CreateSvgWithLocation -
func DefaultTestContractCallInput ¶
func DefaultTestContractCallInput() *vmcommon.ContractCallInput
DefaultTestContractCallInput creates a vmcommon.ContractCallInput struct with default values.
func DefaultTestContractCreateInput ¶
func DefaultTestContractCreateInput() *vmcommon.ContractCreateInput
DefaultTestContractCreateInput creates a vmcommon.ContractCreateInput struct with default values.
func GenerateSVGforGraph ¶
func GenerateSVGforGraph(callGraph *TestCallGraph, folder string, name string)
GenerateSVGforGraph -
func GetTestSCCode ¶
GetTestSCCode retrieves the bytecode of a WASM testing contract
func GetTestSCCodeModule ¶
GetTestSCCodeModule retrieves the bytecode of a WASM testing contract, given a specific name of the WASM module
func MakeEmptyVMOutput ¶
MakeEmptyVMOutput creates a vmcommon.VMOutput struct with default values
func MakeTestSCAddress ¶
MakeTestSCAddress generates a new smart contract address to be used for testing based on the given identifier.
func MakeTestSCAddressWithDefaultVM ¶
MakeTestSCAddressWithDefaultVM generates a new smart contract address to be used for testing based on the given identifier.
func MakeTestSCAddressWithVMType ¶
MakeTestSCAddressWithVMType generates a new smart contract address to be used for testing based on the given identifier.
func SimpleWasteGasMockMethod ¶
func SimpleWasteGasMockMethod(instanceMock *mock.InstanceMock, gas uint64) func() *mock.InstanceMock
SimpleWasteGasMockMethod is a simple waste gas mock method
func ToGraphviz ¶
func ToGraphviz(graph *TestCallGraph, showGasEdgeLabels bool) *gographviz.Graph
ToGraphviz -
func WasteGasWithReturnDataMockMethod ¶
func WasteGasWithReturnDataMockMethod(instanceMock *mock.InstanceMock, gas uint64, returnData []byte) func() *mock.InstanceMock
WasteGasWithReturnDataMockMethod is a simple waste gas mock method
Types ¶
type AssertResultsFunc ¶
type AssertResultsFunc func(world *worldmock.MockWorld, verify *VMOutputVerifier)
AssertResultsFunc -
type AssertResultsWithStartNodeFunc ¶
type AssertResultsWithStartNodeFunc func(startNode *TestCallNode, world *worldmock.MockWorld, verify *VMOutputVerifier, expectedErrorsForRound []string)
AssertResultsWithStartNodeFunc -
type CallFinishDataItem ¶
type CallFinishDataItem struct { OriginalCallerAddr []byte ContractAndFunction string GasProvided uint64 GasRemaining uint64 CallID []byte CallbackAsyncInitiatorCallID []byte IsCrossShard bool FailError error }
CallFinishDataItem -
type ContractCallInputBuilder ¶
type ContractCallInputBuilder struct { vmcommon.ContractCallInput CurrentDCDTTransferIndex int }
ContractCallInputBuilder extends a ContractCallInput for extra building functionality during testing
func CreateTestContractCallInputBuilder ¶
func CreateTestContractCallInputBuilder() *ContractCallInputBuilder
CreateTestContractCallInputBuilder is a builder for ContractCallInputBuilder
func (*ContractCallInputBuilder) Build ¶
func (contractInput *ContractCallInputBuilder) Build() *vmcommon.ContractCallInput
Build completes the build of a ContractCallInput
func (*ContractCallInputBuilder) NextDCDTTransfer ¶
func (contractInput *ContractCallInputBuilder) NextDCDTTransfer() *ContractCallInputBuilder
func (*ContractCallInputBuilder) WithArguments ¶
func (contractInput *ContractCallInputBuilder) WithArguments(arguments ...[]byte) *ContractCallInputBuilder
WithArguments provides the arguments to be called for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithAsyncArguments ¶
func (contractInput *ContractCallInputBuilder) WithAsyncArguments(arguments *vmcommon.AsyncArguments) *ContractCallInputBuilder
WithAsyncArguments provides the async arguments to be called for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithCallType ¶
func (contractInput *ContractCallInputBuilder) WithCallType(callType vm.CallType) *ContractCallInputBuilder
WithCallType provides the arguments to be called for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithCallValue ¶
func (contractInput *ContractCallInputBuilder) WithCallValue(value int64) *ContractCallInputBuilder
WithCallValue provides the value transferred to the called contract
func (*ContractCallInputBuilder) WithCallerAddr ¶
func (contractInput *ContractCallInputBuilder) WithCallerAddr(address []byte) *ContractCallInputBuilder
WithCallerAddr provides the caller address of ContractCallInputBuilder
func (*ContractCallInputBuilder) WithCurrentTxHash ¶
func (contractInput *ContractCallInputBuilder) WithCurrentTxHash(txHash []byte) *ContractCallInputBuilder
WithCurrentTxHash provides the CurrentTxHash for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithDCDTTokenName ¶
func (contractInput *ContractCallInputBuilder) WithDCDTTokenName(dcdtTokenName []byte) *ContractCallInputBuilder
WithDCDTTokenName provides the DCDTTokenName for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithDCDTValue ¶
func (contractInput *ContractCallInputBuilder) WithDCDTValue(dcdtValue *big.Int) *ContractCallInputBuilder
WithDCDTValue provides the DCDTValue for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithFunction ¶
func (contractInput *ContractCallInputBuilder) WithFunction(function string) *ContractCallInputBuilder
WithFunction provides the function to be called for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithGasLocked ¶
func (contractInput *ContractCallInputBuilder) WithGasLocked(gas uint64) *ContractCallInputBuilder
WithGasLocked provides the locked gas of ContractCallInputBuilder
func (*ContractCallInputBuilder) WithGasProvided ¶
func (contractInput *ContractCallInputBuilder) WithGasProvided(gas uint64) *ContractCallInputBuilder
WithGasProvided provides the gas of ContractCallInputBuilder
func (*ContractCallInputBuilder) WithPrevTxHash ¶
func (contractInput *ContractCallInputBuilder) WithPrevTxHash(txHash []byte) *ContractCallInputBuilder
WithPrevTxHash provides the PrevTxHash for ContractCallInputBuilder
func (*ContractCallInputBuilder) WithRecipientAddr ¶
func (contractInput *ContractCallInputBuilder) WithRecipientAddr(address []byte) *ContractCallInputBuilder
WithRecipientAddr provides the recepient address of ContractCallInputBuilder
type ContractCreateInputBuilder ¶
type ContractCreateInputBuilder struct {
vmcommon.ContractCreateInput
}
ContractCreateInputBuilder extends a ContractCreateInput for extra building functionality during testing
func CreateTestContractCreateInputBuilder ¶
func CreateTestContractCreateInputBuilder() *ContractCreateInputBuilder
CreateTestContractCreateInputBuilder is a builder for ContractCreateInputBuilder
func (*ContractCreateInputBuilder) Build ¶
func (contractInput *ContractCreateInputBuilder) Build() *vmcommon.ContractCreateInput
Build completes the build of a ContractCreateInput
func (*ContractCreateInputBuilder) WithArguments ¶
func (contractInput *ContractCreateInputBuilder) WithArguments(arguments ...[]byte) *ContractCreateInputBuilder
WithArguments provides the Arguments for a ContractCreateInputBuilder
func (*ContractCreateInputBuilder) WithCallValue ¶
func (contractInput *ContractCreateInputBuilder) WithCallValue(callValue int64) *ContractCreateInputBuilder
WithCallValue provides the CallValue for a ContractCreateInputBuilder
func (*ContractCreateInputBuilder) WithCallerAddr ¶
func (contractInput *ContractCreateInputBuilder) WithCallerAddr(address []byte) *ContractCreateInputBuilder
WithCallerAddr provides the CallerAddr for a ContractCreateInputBuilder
func (*ContractCreateInputBuilder) WithContractCode ¶
func (contractInput *ContractCreateInputBuilder) WithContractCode(code []byte) *ContractCreateInputBuilder
WithContractCode provides the ContractCode for a ContractCreateInputBuilder
func (*ContractCreateInputBuilder) WithContractCodeMetadata ¶
func (contractInput *ContractCreateInputBuilder) WithContractCodeMetadata(codemetadata []byte) *ContractCreateInputBuilder
WithContractCodeMetadata provides the ContractCodeMetadata for a ContractCreateInputBuilder
func (*ContractCreateInputBuilder) WithGasProvided ¶
func (contractInput *ContractCreateInputBuilder) WithGasProvided(gas uint64) *ContractCreateInputBuilder
WithGasProvided provides the GasProvided for a ContractCreateInputBuilder
type CrossShardCall ¶
type CrossShardCall struct { CallerAddress []byte StartNode *TestCallNode CallType vm.CallType AsyncData []byte Data []byte ParentsPath []*TestCallNode }
CrossShardCall -
type CrossShardCallsQueue ¶
type CrossShardCallsQueue struct {
Data []*CrossShardCall
}
CrossShardCallsQueue -
func NewCrossShardCallQueue ¶
func NewCrossShardCallQueue() *CrossShardCallsQueue
NewCrossShardCallQueue -
func (*CrossShardCallsQueue) CanExecuteLocalCallback ¶
func (queue *CrossShardCallsQueue) CanExecuteLocalCallback(callbackNode *TestCallNode) bool
CanExecuteLocalCallback - in case of async local calls, search queue for pending children of the start of this edge
func (*CrossShardCallsQueue) Dequeue ¶
func (queue *CrossShardCallsQueue) Dequeue() *CrossShardCall
Dequeue -
func (*CrossShardCallsQueue) Enqueue ¶
func (queue *CrossShardCallsQueue) Enqueue(callerAddress []byte, startNode *TestCallNode, callType vm.CallType, asyncData []byte, data []byte)
Enqueue -
func (*CrossShardCallsQueue) Requeue ¶
func (queue *CrossShardCallsQueue) Requeue(crossShardCall *CrossShardCall)
Requeue -
type InstanceCallTestTemplate ¶
type InstanceCallTestTemplate struct {
// contains filtered or unexported fields
}
InstanceCallTestTemplate holds the data to build a contract call test
func BuildInstanceCallTest ¶
func BuildInstanceCallTest(tb testing.TB) *InstanceCallTestTemplate
BuildInstanceCallTest starts the building process for a contract call test
func (*InstanceCallTestTemplate) AndAssertResults ¶
func (template *InstanceCallTestTemplate) AndAssertResults(assertResults func(vmhost.VMHost, *contextmock.BlockchainHookStub, *VMOutputVerifier))
AndAssertResults starts the test and asserts the results
func (*InstanceCallTestTemplate) AndAssertResultsWithoutReset ¶
func (template *InstanceCallTestTemplate) AndAssertResultsWithoutReset(assertResults func(vmhost.VMHost, *contextmock.BlockchainHookStub, *VMOutputVerifier))
AndAssertResultsWithoutReset starts the test and asserts the results
func (*InstanceCallTestTemplate) GetVMHost ¶
func (template *InstanceCallTestTemplate) GetVMHost() vmhost.VMHost
GetVMHost returns the inner VMHost
func (*InstanceCallTestTemplate) WithContracts ¶
func (template *InstanceCallTestTemplate) WithContracts(usedContracts ...*InstanceTestSmartContract) *InstanceCallTestTemplate
WithContracts provides the contracts to be used by the contract call test
func (*InstanceCallTestTemplate) WithExecutorFactory ¶
func (template *InstanceCallTestTemplate) WithExecutorFactory(executorFactory executor.ExecutorAbstractFactory) *InstanceCallTestTemplate
WithExecutorFactory provides the wasmer executor for the test
func (*InstanceCallTestTemplate) WithExecutorLogs ¶
func (template *InstanceCallTestTemplate) WithExecutorLogs(executorLogger executorwrapper.ExecutorLogger) *InstanceCallTestTemplate
WithExecutorLogs sets an ExecutorLogger
func (*InstanceCallTestTemplate) WithGasSchedule ¶
func (template *InstanceCallTestTemplate) WithGasSchedule(gasSchedule config.GasScheduleMap) *InstanceCallTestTemplate
WithGasSchedule provides gas schedule for the test
func (*InstanceCallTestTemplate) WithInput ¶
func (template *InstanceCallTestTemplate) WithInput(input *vmcommon.ContractCallInput) *InstanceCallTestTemplate
WithInput provides the ContractCallInput to be used by the contract call test
func (*InstanceCallTestTemplate) WithSetup ¶
func (template *InstanceCallTestTemplate) WithSetup(setup func(vmhost.VMHost, *contextmock.BlockchainHookStub)) *InstanceCallTestTemplate
WithSetup provides the setup function to be used by the contract call test
func (*InstanceCallTestTemplate) WithWasmerSIGSEGVPassthrough ¶
func (template *InstanceCallTestTemplate) WithWasmerSIGSEGVPassthrough(passthrough bool) *InstanceCallTestTemplate
WithWasmerSIGSEGVPassthrough sets the wasmerSIGSEGVPassthrough flag
type InstanceCreatorTestTemplate ¶
type InstanceCreatorTestTemplate struct {
// contains filtered or unexported fields
}
InstanceCreatorTestTemplate holds the data to build a contract creation test
func BuildInstanceCreatorTest ¶
func BuildInstanceCreatorTest(tb testing.TB) *InstanceCreatorTestTemplate
BuildInstanceCreatorTest starts the building process for a contract creation test
func (*InstanceCreatorTestTemplate) AndAssertResults ¶
func (template *InstanceCreatorTestTemplate) AndAssertResults(assertResults func(*contextmock.BlockchainHookStub, *VMOutputVerifier))
AndAssertResults provides the function that will aserts the results
func (*InstanceCreatorTestTemplate) AndAssertResultsWithoutReset ¶
func (template *InstanceCreatorTestTemplate) AndAssertResultsWithoutReset(assertResults func(*contextmock.BlockchainHookStub, *VMOutputVerifier))
AndAssertResultsWithoutReset provides the function that will aserts the results
func (*InstanceCreatorTestTemplate) RunTest ¶
func (template *InstanceCreatorTestTemplate) RunTest(reset bool) (*contextmock.BlockchainHookStub, *vmcommon.VMOutput, error)
RunTest executes the built test directly, without any assertions.
func (*InstanceCreatorTestTemplate) WithAddress ¶
func (template *InstanceCreatorTestTemplate) WithAddress(address []byte) *InstanceCreatorTestTemplate
WithAddress provides the address for a TestCreateTemplateConfig
func (*InstanceCreatorTestTemplate) WithExecutorFactory ¶
func (template *InstanceCreatorTestTemplate) WithExecutorFactory(factory executor.ExecutorAbstractFactory) *InstanceCreatorTestTemplate
WithExecutorFactory allows caller to choose the Executor type.
func (*InstanceCreatorTestTemplate) WithExecutorLogs ¶
func (template *InstanceCreatorTestTemplate) WithExecutorLogs(executorLogger executorwrapper.ExecutorLogger) *InstanceCreatorTestTemplate
WithExecutorLogs sets an ExecutorLogger
func (*InstanceCreatorTestTemplate) WithInput ¶
func (template *InstanceCreatorTestTemplate) WithInput(input *vmcommon.ContractCreateInput) *InstanceCreatorTestTemplate
WithInput provides the ContractCreateInput for a TestCreateTemplateConfig
func (*InstanceCreatorTestTemplate) WithSetup ¶
func (template *InstanceCreatorTestTemplate) WithSetup(setup func(vmhost.VMHost, *contextmock.BlockchainHookStub)) *InstanceCreatorTestTemplate
WithSetup provides the setup function for a TestCreateTemplateConfig
func (*InstanceCreatorTestTemplate) WithWasmerSIGSEGVPassthrough ¶
func (template *InstanceCreatorTestTemplate) WithWasmerSIGSEGVPassthrough(passthrough bool) *InstanceCreatorTestTemplate
WithWasmerSIGSEGVPassthrough sets the wasmerSIGSEGVPassthrough flag
type InstanceTestSmartContract ¶
type InstanceTestSmartContract struct {
// contains filtered or unexported fields
}
InstanceTestSmartContract represents the config data for the smart contract instance to be tested
func CreateInstanceContract ¶
func CreateInstanceContract(address []byte) *InstanceTestSmartContract
CreateInstanceContract build a contract to be used in a test creted with BuildInstanceCallTest
func (*InstanceTestSmartContract) WithBalance ¶
func (mockSC *InstanceTestSmartContract) WithBalance(balance int64) *InstanceTestSmartContract
WithBalance provides the balance for the InstanceTestSmartContract
func (*InstanceTestSmartContract) WithCode ¶
func (mockSC *InstanceTestSmartContract) WithCode(code []byte) *InstanceTestSmartContract
WithCode provides the code for the InstanceTestSmartContract
func (*InstanceTestSmartContract) WithCodeMetadata ¶
func (mockSC *InstanceTestSmartContract) WithCodeMetadata(metadata []byte) *InstanceTestSmartContract
WithCodeMetadata provides the owner for the InstanceTestSmartContract
func (*InstanceTestSmartContract) WithConfig ¶
func (mockSC *InstanceTestSmartContract) WithConfig(testConfig *TestConfig) *InstanceTestSmartContract
WithConfig provides the config object for the InstanceTestSmartContract
func (*InstanceTestSmartContract) WithOwner ¶
func (mockSC *InstanceTestSmartContract) WithOwner(owner []byte) *InstanceTestSmartContract
WithOwner provides the owner for the InstanceTestSmartContract
type MockBuiltin ¶
type MockBuiltin struct { ProcessBuiltinFunctionCall func(acntSnd, _ vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) // contains filtered or unexported fields }
MockBuiltin defined the functions that can be replaced in order to mock a builtin
func (*MockBuiltin) IsInterfaceNil ¶
func (m *MockBuiltin) IsInterfaceNil() bool
IsInterfaceNil - see BuiltinFunction.IsInterfaceNil()
func (*MockBuiltin) ProcessBuiltinFunction ¶
func (m *MockBuiltin) ProcessBuiltinFunction(acntSnd, acntRcv vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
ProcessBuiltinFunction - see BuiltinFunction.ProcessBuiltInFunction()
func (*MockBuiltin) SetNewGasConfig ¶
func (m *MockBuiltin) SetNewGasConfig(gasCost *vmcommon.GasCost)
SetNewGasConfig - see BuiltinFunction.SetNewGasConfig()
type MockInstancesTestTemplate ¶
type MockInstancesTestTemplate struct {
// contains filtered or unexported fields
}
MockInstancesTestTemplate holds the data to build a mock contract call test
func BuildMockInstanceCallTest ¶
func BuildMockInstanceCallTest(tb testing.TB) *MockInstancesTestTemplate
BuildMockInstanceCallTest starts the building process for a mock contract call test
func (*MockInstancesTestTemplate) AndAssertResults ¶
func (callerTest *MockInstancesTestTemplate) AndAssertResults(assertResults AssertResultsFunc) (*vmcommon.VMOutput, error)
AndAssertResults provides the function that will aserts the results
func (*MockInstancesTestTemplate) AndAssertResultsWithWorld ¶
func (callerTest *MockInstancesTestTemplate) AndAssertResultsWithWorld( world *worldmock.MockWorld, createAccount bool, startNode *TestCallNode, expectedErrorsForRound []string, assertResults AssertResultsWithStartNodeFunc) (*vmcommon.VMOutput, error)
AndAssertResultsWithWorld provides the function that will aserts the results
func (*MockInstancesTestTemplate) AndCreateAndAssertResults ¶
func (callerTest *MockInstancesTestTemplate) AndCreateAndAssertResults(assertResults AssertResultsFunc) (*vmcommon.VMOutput, error)
AndCreateAndAssertResults provides the function that will create the contract and aserts the results
func (*MockInstancesTestTemplate) RunTest ¶
func (callerTest *MockInstancesTestTemplate) RunTest( world *worldmock.MockWorld, createContractAccounts bool, testType TestType, ) (vmhost.VMHost, *vmcommon.VMOutput, error)
RunTest executes the built test directly, without any assertions.
func (*MockInstancesTestTemplate) WithContracts ¶
func (callerTest *MockInstancesTestTemplate) WithContracts(usedContracts ...MockTestSmartContract) *MockInstancesTestTemplate
WithContracts provides the contracts to be used by the mock contract call test
func (*MockInstancesTestTemplate) WithInput ¶
func (callerTest *MockInstancesTestTemplate) WithInput(input *vmcommon.ContractCallInput) *MockInstancesTestTemplate
WithInput provides the ContractCallInput to be used by the mock contract call test
func (*MockInstancesTestTemplate) WithSetup ¶
func (callerTest *MockInstancesTestTemplate) WithSetup(setup SetupFunction) *MockInstancesTestTemplate
WithSetup provides the setup function to be used by the mock contract call test
func (*MockInstancesTestTemplate) WithWasmerSIGSEGVPassthrough ¶
func (callerTest *MockInstancesTestTemplate) WithWasmerSIGSEGVPassthrough(wasmerSIGSEGVPassthrough bool) *MockInstancesTestTemplate
WithWasmerSIGSEGVPassthrough sets the wasmerSIGSEGVPassthrough flag
type MockTestSmartContract ¶
type MockTestSmartContract struct {
// contains filtered or unexported fields
}
MockTestSmartContract represents the config data for the mock smart contract instance to be tested
func CreateMockContract ¶
func CreateMockContract(address []byte) *MockTestSmartContract
CreateMockContract build a contract to be used in a test creted with BuildMockInstanceCallTest
func CreateMockContractOnShard ¶
func CreateMockContractOnShard(address []byte, shardID uint32) *MockTestSmartContract
CreateMockContractOnShard build a contract to be used in a test creted with BuildMockInstanceCallTest
func CreateMockContractsFromAsyncTestCallGraph ¶
func CreateMockContractsFromAsyncTestCallGraph(callGraph *TestCallGraph, callsFinishData *CallsFinishData, runtimeConfigsForCalls map[string]*RuntimeConfigOfCall, testConfig *TestConfig) []MockTestSmartContract
CreateMockContractsFromAsyncTestCallGraph creates the contracts with functions that reflect the behavior specified by the call graph
func (*MockTestSmartContract) GetShardID ¶
func (mockSC *MockTestSmartContract) GetShardID() uint32
GetShardID -
func (*MockTestSmartContract) GetVMType ¶
func (mockSC *MockTestSmartContract) GetVMType() []byte
GetVMType -
func (*MockTestSmartContract) Initialize ¶
func (mockSC *MockTestSmartContract) Initialize( t testing.TB, host vmhost.VMHost, imb *mock.ExecutorMock, createContractAccounts bool, )
Initialize -
func (*MockTestSmartContract) WithBalance ¶
func (mockSC *MockTestSmartContract) WithBalance(balance int64) *MockTestSmartContract
WithBalance provides the balance for the MockTestSmartContract
func (*MockTestSmartContract) WithCodeHash ¶
func (mockSC *MockTestSmartContract) WithCodeHash(codeHash []byte) *MockTestSmartContract
WithCodeHash provides the code hash for the MockTestSmartContract
func (*MockTestSmartContract) WithCodeMetadata ¶
func (mockSC *MockTestSmartContract) WithCodeMetadata(codeMetadata []byte) *MockTestSmartContract
WithCodeMetadata provides the code metadata for the MockTestSmartContract
func (*MockTestSmartContract) WithConfig ¶
func (mockSC *MockTestSmartContract) WithConfig(config *TestConfig) *MockTestSmartContract
WithConfig provides the config object for the MockTestSmartContract
func (*MockTestSmartContract) WithMethods ¶
func (mockSC *MockTestSmartContract) WithMethods(initMethods ...func(*mock.InstanceMock, interface{})) MockTestSmartContract
WithMethods provides the methods for the MockTestSmartContract
func (*MockTestSmartContract) WithOwnerAddress ¶
func (mockSC *MockTestSmartContract) WithOwnerAddress(ownerAddress []byte) *MockTestSmartContract
WithOwnerAddress provides the owner address for the MockTestSmartContract
func (*MockTestSmartContract) WithShardID ¶
func (mockSC *MockTestSmartContract) WithShardID(shardID uint32) *MockTestSmartContract
WithShardID provides the shardID for the MockTestSmartContract
func (*MockTestSmartContract) WithVMType ¶
func (mockSC *MockTestSmartContract) WithVMType(vmType []byte) *MockTestSmartContract
WithBalance provides the balance for the MockTestSmartContract
type RuntimeConfigOfCall ¶
type RuntimeConfigOfCall struct {
// contains filtered or unexported fields
}
RuntimeConfigOfCall -
type StoreEntry ¶
type StoreEntry struct {
// contains filtered or unexported fields
}
StoreEntry holds the data for a storage assertion
func CreateStoreEntry ¶
func CreateStoreEntry(address []byte) *StoreEntry
CreateStoreEntry creates the data for a storage assertion
func (*StoreEntry) IgnoreValue ¶
func (storeEntry *StoreEntry) IgnoreValue() StoreEntry
IgnoreValue ignores the value for a storage assertion
func (*StoreEntry) WithKey ¶
func (storeEntry *StoreEntry) WithKey(key []byte) *StoreEntry
WithKey sets the key for a storage assertion
func (*StoreEntry) WithValue ¶
func (storeEntry *StoreEntry) WithValue(value []byte) StoreEntry
WithValue sets the value for a storage assertion
type TestCall ¶
type TestCall struct { ContractAddress []byte FunctionName string CallID []byte OriginalContractID string }
TestCall represents the payload of a node in the call graph
type TestCallEdge ¶
type TestCallEdge struct { ID uint Type TestCallEdgeType // callback function name Callback string // outgoing node To *TestCallNode // gas config for the outgoing node (represented by To) GasLimit uint64 GasUsed uint64 GasUsedByCallback uint64 GasLocked uint64 // used only for visualization & debugging Label string Fail bool ErrFail error CallbackFail bool }
TestCallEdge an edge between two nodes of the call graph
func (*TestCallEdge) SetCallbackFail ¶
func (edge *TestCallEdge) SetCallbackFail() *TestCallEdge
SetCallbackFail - builder style setter
func (*TestCallEdge) SetFail ¶
func (edge *TestCallEdge) SetFail() *TestCallEdge
SetFail - builder style setter
func (*TestCallEdge) SetFailWithExpectedError ¶
func (edge *TestCallEdge) SetFailWithExpectedError(expectedError error) *TestCallEdge
SetFailWithExpectedError - builder style setter
func (*TestCallEdge) SetGasLimit ¶
func (edge *TestCallEdge) SetGasLimit(gasLimit uint64) *TestCallEdge
SetGasLimit - builder style setter
func (*TestCallEdge) SetGasLocked ¶
func (edge *TestCallEdge) SetGasLocked(gasLocked uint64) *TestCallEdge
SetGasLocked - builder style setter
func (*TestCallEdge) SetGasUsed ¶
func (edge *TestCallEdge) SetGasUsed(gasUsed uint64) *TestCallEdge
SetGasUsed - builder style setter
func (*TestCallEdge) SetGasUsedByCallback ¶
func (edge *TestCallEdge) SetGasUsedByCallback(gasUsedByCallback uint64) *TestCallEdge
SetGasUsedByCallback - builder style setter
type TestCallGraph ¶
type TestCallGraph struct { Nodes []*TestCallNode StartNode *TestCallNode Crypto crypto.VMCrypto // contains filtered or unexported fields }
TestCallGraph is the call graph
func CreateGraphTestAsyncCallIndirectFail ¶
func CreateGraphTestAsyncCallIndirectFail() *TestCallGraph
CreateGraphTestAsyncCallIndirectFail -
func CreateGraphTestAsyncCallIndirectFailCrossShard ¶
func CreateGraphTestAsyncCallIndirectFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallIndirectFailCrossShard -
func CreateGraphTestAsyncCallbackIndirectFail ¶
func CreateGraphTestAsyncCallbackIndirectFail() *TestCallGraph
CreateGraphTestAsyncCallbackIndirectFail -
func CreateGraphTestAsyncCallbackIndirectFailCrossShard ¶
func CreateGraphTestAsyncCallbackIndirectFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallbackIndirectFailCrossShard -
func CreateGraphTestAsyncCallsAsync ¶
func CreateGraphTestAsyncCallsAsync() *TestCallGraph
CreateGraphTestAsyncCallsAsync -
func CreateGraphTestAsyncCallsAsyncBothCallbacksFail ¶
func CreateGraphTestAsyncCallsAsyncBothCallbacksFail() *TestCallGraph
CreateGraphTestAsyncCallsAsyncBothCallbacksFail -
func CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossLocal -
func CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossShard ¶
func CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncBothCallbacksFailCrossShard -
func CreateGraphTestAsyncCallsAsyncBothCallbacksFailLocalCross ¶
func CreateGraphTestAsyncCallsAsyncBothCallbacksFailLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncBothCallbacksFailLocalCross -
func CreateGraphTestAsyncCallsAsyncCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncCrossLocal -
func CreateGraphTestAsyncCallsAsyncCrossShard ¶
func CreateGraphTestAsyncCallsAsyncCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncCrossShard -
func CreateGraphTestAsyncCallsAsyncFirstCallbackFail ¶
func CreateGraphTestAsyncCallsAsyncFirstCallbackFail() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstCallbackFail -
func CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossLocal -
func CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossShard ¶
func CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstCallbackFailCrossShard -
func CreateGraphTestAsyncCallsAsyncFirstCallbackFailLocalCross ¶
func CreateGraphTestAsyncCallsAsyncFirstCallbackFailLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstCallbackFailLocalCross -
func CreateGraphTestAsyncCallsAsyncFirstFail ¶
func CreateGraphTestAsyncCallsAsyncFirstFail() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstFail -
func CreateGraphTestAsyncCallsAsyncFirstFailCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncFirstFailCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstFailCrossLocal -
func CreateGraphTestAsyncCallsAsyncFirstFailCrossShard ¶
func CreateGraphTestAsyncCallsAsyncFirstFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstFailCrossShard -
func CreateGraphTestAsyncCallsAsyncFirstFailLocalCross ¶
func CreateGraphTestAsyncCallsAsyncFirstFailLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstFailLocalCross -
func CreateGraphTestAsyncCallsAsyncFirstNoCallback ¶
func CreateGraphTestAsyncCallsAsyncFirstNoCallback() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstNoCallback -
func CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossLocal -
func CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossShard ¶
func CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstNoCallbackCrossShard -
func CreateGraphTestAsyncCallsAsyncFirstNoCallbackLocalCross ¶
func CreateGraphTestAsyncCallsAsyncFirstNoCallbackLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncFirstNoCallbackLocalCross -
func CreateGraphTestAsyncCallsAsyncLocalCross ¶
func CreateGraphTestAsyncCallsAsyncLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncLocalCross -
func CreateGraphTestAsyncCallsAsyncSecondCallbackFail ¶
func CreateGraphTestAsyncCallsAsyncSecondCallbackFail() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondCallbackFail -
func CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossLocal -
func CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossShard ¶
func CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondCallbackFailCrossShard -
func CreateGraphTestAsyncCallsAsyncSecondCallbackFailLocalCross ¶
func CreateGraphTestAsyncCallsAsyncSecondCallbackFailLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondCallbackFailLocalCross -
func CreateGraphTestAsyncCallsAsyncSecondFail ¶
func CreateGraphTestAsyncCallsAsyncSecondFail() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondFail -
func CreateGraphTestAsyncCallsAsyncSecondFailCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncSecondFailCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondFailCrossLocal -
func CreateGraphTestAsyncCallsAsyncSecondFailCrossShard ¶
func CreateGraphTestAsyncCallsAsyncSecondFailCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondFailCrossShard -
func CreateGraphTestAsyncCallsAsyncSecondFailLocalCross ¶
func CreateGraphTestAsyncCallsAsyncSecondFailLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondFailLocalCross -
func CreateGraphTestAsyncCallsAsyncSecondNoCallback ¶
func CreateGraphTestAsyncCallsAsyncSecondNoCallback() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondNoCallback -
func CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossLocal ¶
func CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossLocal() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossLocal -
func CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossShard ¶
func CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossShard() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondNoCallbackCrossShard -
func CreateGraphTestAsyncCallsAsyncSecondNoCallbackLocalCross ¶
func CreateGraphTestAsyncCallsAsyncSecondNoCallbackLocalCross() *TestCallGraph
CreateGraphTestAsyncCallsAsyncSecondNoCallbackLocalCross -
func CreateGraphTestAsyncCallsCrossShard2 ¶
func CreateGraphTestAsyncCallsCrossShard2() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard2 -
func CreateGraphTestAsyncCallsCrossShard3 ¶
func CreateGraphTestAsyncCallsCrossShard3() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard3 -
func CreateGraphTestAsyncCallsCrossShard4 ¶
func CreateGraphTestAsyncCallsCrossShard4() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard4 -
func CreateGraphTestAsyncCallsCrossShard5 ¶
func CreateGraphTestAsyncCallsCrossShard5() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard5 -
func CreateGraphTestAsyncCallsCrossShard6 ¶
func CreateGraphTestAsyncCallsCrossShard6() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard6 -
func CreateGraphTestAsyncCallsCrossShard7 ¶
func CreateGraphTestAsyncCallsCrossShard7() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard7 -
func CreateGraphTestAsyncCallsCrossShard8 ¶
func CreateGraphTestAsyncCallsCrossShard8() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard8 -
func CreateGraphTestAsyncCallsCrossShard9 ¶
func CreateGraphTestAsyncCallsCrossShard9() *TestCallGraph
CreateGraphTestAsyncCallsCrossShard9 -
func CreateGraphTestCallbackCallsAsyncCallbackFailCrossCross ¶
func CreateGraphTestCallbackCallsAsyncCallbackFailCrossCross() *TestCallGraph
CreateGraphTestCallbackCallsAsyncCallbackFailCrossCross -
func CreateGraphTestCallbackCallsAsyncCallbackFailCrossLocal ¶
func CreateGraphTestCallbackCallsAsyncCallbackFailCrossLocal() *TestCallGraph
CreateGraphTestCallbackCallsAsyncCallbackFailCrossLocal -
func CreateGraphTestCallbackCallsAsyncCallbackFailLocalCross ¶
func CreateGraphTestCallbackCallsAsyncCallbackFailLocalCross() *TestCallGraph
CreateGraphTestCallbackCallsAsyncCallbackFailLocalCross -
func CreateGraphTestCallbackCallsAsyncCallbackFailLocalLocal ¶
func CreateGraphTestCallbackCallsAsyncCallbackFailLocalLocal() *TestCallGraph
CreateGraphTestCallbackCallsAsyncCallbackFailLocalLocal -
func CreateGraphTestCallbackCallsAsyncCrossCross ¶
func CreateGraphTestCallbackCallsAsyncCrossCross() *TestCallGraph
CreateGraphTestCallbackCallsAsyncCrossCross -
func CreateGraphTestCallbackCallsAsyncCrossLocal ¶
func CreateGraphTestCallbackCallsAsyncCrossLocal() *TestCallGraph
CreateGraphTestCallbackCallsAsyncCrossLocal -
func CreateGraphTestCallbackCallsAsyncFailCrossCross ¶
func CreateGraphTestCallbackCallsAsyncFailCrossCross() *TestCallGraph
CreateGraphTestCallbackCallsAsyncFailCrossCross -
func CreateGraphTestCallbackCallsAsyncFailCrossLocal ¶
func CreateGraphTestCallbackCallsAsyncFailCrossLocal() *TestCallGraph
CreateGraphTestCallbackCallsAsyncFailCrossLocal -
func CreateGraphTestCallbackCallsAsyncFailLocalCross ¶
func CreateGraphTestCallbackCallsAsyncFailLocalCross() *TestCallGraph
CreateGraphTestCallbackCallsAsyncFailLocalCross -
func CreateGraphTestCallbackCallsAsyncFailLocalLocal ¶
func CreateGraphTestCallbackCallsAsyncFailLocalLocal() *TestCallGraph
CreateGraphTestCallbackCallsAsyncFailLocalLocal -
func CreateGraphTestCallbackCallsAsyncLocalCross ¶
func CreateGraphTestCallbackCallsAsyncLocalCross() *TestCallGraph
CreateGraphTestCallbackCallsAsyncLocalCross -
func CreateGraphTestCallbackCallsAsyncLocalLocal ¶
func CreateGraphTestCallbackCallsAsyncLocalLocal() *TestCallGraph
CreateGraphTestCallbackCallsAsyncLocalLocal -
func CreateGraphTestCallbackCallsSync ¶
func CreateGraphTestCallbackCallsSync() *TestCallGraph
CreateGraphTestCallbackCallsSync -
func CreateGraphTestDifferentTypeOfCallsToSameFunction ¶
func CreateGraphTestDifferentTypeOfCallsToSameFunction() *TestCallGraph
CreateGraphTestDifferentTypeOfCallsToSameFunction -
func CreateGraphTestOneAsyncCall ¶
func CreateGraphTestOneAsyncCall() *TestCallGraph
CreateGraphTestOneAsyncCall -
func CreateGraphTestOneAsyncCallCrossShard ¶
func CreateGraphTestOneAsyncCallCrossShard() *TestCallGraph
CreateGraphTestOneAsyncCallCrossShard -
func CreateGraphTestOneAsyncCallCrossShard2 ¶
func CreateGraphTestOneAsyncCallCrossShard2() *TestCallGraph
CreateGraphTestOneAsyncCallCrossShard2 -
func CreateGraphTestOneAsyncCallCustomGasLocked ¶
func CreateGraphTestOneAsyncCallCustomGasLocked() *TestCallGraph
CreateGraphTestOneAsyncCallCustomGasLocked -
func CreateGraphTestOneAsyncCallFail ¶
func CreateGraphTestOneAsyncCallFail() *TestCallGraph
CreateGraphTestOneAsyncCallFail -
func CreateGraphTestOneAsyncCallFailCrossShard ¶
func CreateGraphTestOneAsyncCallFailCrossShard() *TestCallGraph
CreateGraphTestOneAsyncCallFailCrossShard -
func CreateGraphTestOneAsyncCallFailNoCallbackCrossShard ¶
func CreateGraphTestOneAsyncCallFailNoCallbackCrossShard() *TestCallGraph
CreateGraphTestOneAsyncCallFailNoCallbackCrossShard -
func CreateGraphTestOneAsyncCallNoCallback ¶
func CreateGraphTestOneAsyncCallNoCallback() *TestCallGraph
CreateGraphTestOneAsyncCallNoCallback -
func CreateGraphTestOneAsyncCallNoCallbackCrossShard ¶
func CreateGraphTestOneAsyncCallNoCallbackCrossShard() *TestCallGraph
CreateGraphTestOneAsyncCallNoCallbackCrossShard -
func CreateGraphTestOneAsyncCallNoCallbackFail ¶
func CreateGraphTestOneAsyncCallNoCallbackFail() *TestCallGraph
CreateGraphTestOneAsyncCallNoCallbackFail -
func CreateGraphTestOneAsyncCallbackFail ¶
func CreateGraphTestOneAsyncCallbackFail() *TestCallGraph
CreateGraphTestOneAsyncCallbackFail -
func CreateGraphTestOneAsyncCallbackFailCrossShard ¶
func CreateGraphTestOneAsyncCallbackFailCrossShard() *TestCallGraph
CreateGraphTestOneAsyncCallbackFailCrossShard -
func CreateGraphTestSameContractWithDifferentSubCallsCrossCross ¶
func CreateGraphTestSameContractWithDifferentSubCallsCrossCross() *TestCallGraph
CreateGraphTestSameContractWithDifferentSubCallsCrossCross -
func CreateGraphTestSameContractWithDifferentSubCallsCrossLocal ¶
func CreateGraphTestSameContractWithDifferentSubCallsCrossLocal() *TestCallGraph
CreateGraphTestSameContractWithDifferentSubCallsCrossLocal -
func CreateGraphTestSameContractWithDifferentSubCallsLocalCross ¶
func CreateGraphTestSameContractWithDifferentSubCallsLocalCross() *TestCallGraph
CreateGraphTestSameContractWithDifferentSubCallsLocalCross -
func CreateGraphTestSameContractWithDifferentSubCallsLocalLocal ¶
func CreateGraphTestSameContractWithDifferentSubCallsLocalLocal() *TestCallGraph
CreateGraphTestSameContractWithDifferentSubCallsLocalLocal -
func CreateGraphTestSyncAndAsync1 ¶
func CreateGraphTestSyncAndAsync1() *TestCallGraph
CreateGraphTestSyncAndAsync1 -
func CreateGraphTestSyncAndAsync10 ¶
func CreateGraphTestSyncAndAsync10() *TestCallGraph
CreateGraphTestSyncAndAsync10 -
func CreateGraphTestSyncAndAsync11 ¶
func CreateGraphTestSyncAndAsync11() *TestCallGraph
CreateGraphTestSyncAndAsync11 -
func CreateGraphTestSyncAndAsync2 ¶
func CreateGraphTestSyncAndAsync2() *TestCallGraph
CreateGraphTestSyncAndAsync2 -
func CreateGraphTestSyncAndAsync3 ¶
func CreateGraphTestSyncAndAsync3() *TestCallGraph
CreateGraphTestSyncAndAsync3 -
func CreateGraphTestSyncAndAsync4 ¶
func CreateGraphTestSyncAndAsync4() *TestCallGraph
CreateGraphTestSyncAndAsync4 -
func CreateGraphTestSyncAndAsync5 ¶
func CreateGraphTestSyncAndAsync5() *TestCallGraph
CreateGraphTestSyncAndAsync5 -
func CreateGraphTestSyncAndAsync6 ¶
func CreateGraphTestSyncAndAsync6() *TestCallGraph
CreateGraphTestSyncAndAsync6 -
func CreateGraphTestSyncAndAsync7 ¶
func CreateGraphTestSyncAndAsync7() *TestCallGraph
CreateGraphTestSyncAndAsync7 -
func CreateGraphTestSyncAndAsync8 ¶
func CreateGraphTestSyncAndAsync8() *TestCallGraph
CreateGraphTestSyncAndAsync8 -
func CreateGraphTestSyncAndAsync9 ¶
func CreateGraphTestSyncAndAsync9() *TestCallGraph
CreateGraphTestSyncAndAsync9 -
func CreateGraphTestSyncCalls ¶
func CreateGraphTestSyncCalls() *TestCallGraph
CreateGraphTestSyncCalls -
func CreateGraphTestSyncCalls2 ¶
func CreateGraphTestSyncCalls2() *TestCallGraph
CreateGraphTestSyncCalls2 -
func CreateGraphTestSyncCallsFailPropagation ¶
func CreateGraphTestSyncCallsFailPropagation() *TestCallGraph
CreateGraphTestSyncCallsFailPropagation -
func CreateGraphTestTwoAsyncCalls ¶
func CreateGraphTestTwoAsyncCalls() *TestCallGraph
CreateGraphTestTwoAsyncCalls -
func CreateGraphTestTwoAsyncCallsBothCallbacksFail ¶
func CreateGraphTestTwoAsyncCallsBothCallbacksFail() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothCallbacksFail -
func CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossLocal ¶
func CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossLocal -
func CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossShard ¶
func CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothCallbacksFailCrossShard -
func CreateGraphTestTwoAsyncCallsBothCallbacksFailLocalCross ¶
func CreateGraphTestTwoAsyncCallsBothCallbacksFailLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothCallbacksFailLocalCross -
func CreateGraphTestTwoAsyncCallsBothFail ¶
func CreateGraphTestTwoAsyncCallsBothFail() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothFail -
func CreateGraphTestTwoAsyncCallsBothFailCrossLocal ¶
func CreateGraphTestTwoAsyncCallsBothFailCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothFailCrossLocal -
func CreateGraphTestTwoAsyncCallsBothFailCrossShard ¶
func CreateGraphTestTwoAsyncCallsBothFailCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothFailCrossShard -
func CreateGraphTestTwoAsyncCallsBothFailLocalCross ¶
func CreateGraphTestTwoAsyncCallsBothFailLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsBothFailLocalCross -
func CreateGraphTestTwoAsyncCallsCrossLocal ¶
func CreateGraphTestTwoAsyncCallsCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsCrossLocal -
func CreateGraphTestTwoAsyncCallsCrossShard ¶
func CreateGraphTestTwoAsyncCallsCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsCrossShard -
func CreateGraphTestTwoAsyncCallsFirstCallbackFail ¶
func CreateGraphTestTwoAsyncCallsFirstCallbackFail() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstCallbackFail -
func CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossLocal ¶
func CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossLocal -
func CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossShard ¶
func CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstCallbackFailCrossShard -
func CreateGraphTestTwoAsyncCallsFirstCallbackFailLocalCross ¶
func CreateGraphTestTwoAsyncCallsFirstCallbackFailLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstCallbackFailLocalCross -
func CreateGraphTestTwoAsyncCallsFirstFail ¶
func CreateGraphTestTwoAsyncCallsFirstFail() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstFail -
func CreateGraphTestTwoAsyncCallsFirstFailCrossLocal ¶
func CreateGraphTestTwoAsyncCallsFirstFailCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstFailCrossLocal -
func CreateGraphTestTwoAsyncCallsFirstFailCrossShard ¶
func CreateGraphTestTwoAsyncCallsFirstFailCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstFailCrossShard -
func CreateGraphTestTwoAsyncCallsFirstFailLocalCross ¶
func CreateGraphTestTwoAsyncCallsFirstFailLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstFailLocalCross -
func CreateGraphTestTwoAsyncCallsFirstNoCallback ¶
func CreateGraphTestTwoAsyncCallsFirstNoCallback() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstNoCallback -
func CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossLocal ¶
func CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossLocal -
func CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossShard ¶
func CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsFirstNoCallbackCrossShard -
func CreateGraphTestTwoAsyncCallsLocalCross ¶
func CreateGraphTestTwoAsyncCallsLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsLocalCross -
func CreateGraphTestTwoAsyncCallsSecondCallbackFail ¶
func CreateGraphTestTwoAsyncCallsSecondCallbackFail() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondCallbackFail -
func CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossLocal ¶
func CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossLocal -
func CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossShard ¶
func CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondCallbackFailCrossShard -
func CreateGraphTestTwoAsyncCallsSecondCallbackFailLocalCross ¶
func CreateGraphTestTwoAsyncCallsSecondCallbackFailLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondCallbackFailLocalCross -
func CreateGraphTestTwoAsyncCallsSecondFail ¶
func CreateGraphTestTwoAsyncCallsSecondFail() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondFail -
func CreateGraphTestTwoAsyncCallsSecondFailCrossLocal ¶
func CreateGraphTestTwoAsyncCallsSecondFailCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondFailCrossLocal -
func CreateGraphTestTwoAsyncCallsSecondFailCrossShard ¶
func CreateGraphTestTwoAsyncCallsSecondFailCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondFailCrossShard -
func CreateGraphTestTwoAsyncCallsSecondFailLocalCross ¶
func CreateGraphTestTwoAsyncCallsSecondFailLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondFailLocalCross -
func CreateGraphTestTwoAsyncCallsSecondNoCallback ¶
func CreateGraphTestTwoAsyncCallsSecondNoCallback() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondNoCallback -
func CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossLocal ¶
func CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossLocal() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossLocal -
func CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossShard ¶
func CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossShard() *TestCallGraph
CreateGraphTestTwoAsyncCallsSecondNoCallbackCrossShard -
func CreateGraphTestTwoAsyncFirstNoCallbackCallsLocalCross ¶
func CreateGraphTestTwoAsyncFirstNoCallbackCallsLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncFirstNoCallbackCallsLocalCross -
func CreateGraphTestTwoAsyncSecondNoCallbackCallsLocalCross ¶
func CreateGraphTestTwoAsyncSecondNoCallbackCallsLocalCross() *TestCallGraph
CreateGraphTestTwoAsyncSecondNoCallbackCallsLocalCross -
func CreateTestCallGraph ¶
func CreateTestCallGraph() *TestCallGraph
CreateTestCallGraph is the initial build metohd for the call graph
func MakeGraphAndImage ¶
func MakeGraphAndImage(graph *TestCallGraph) *TestCallGraph
MakeGraphAndImage -
func (*TestCallGraph) AddAsyncCrossShardEdge ¶
func (graph *TestCallGraph) AddAsyncCrossShardEdge(from *TestCallNode, to *TestCallNode, callBack string, group string) *TestCallEdge
AddAsyncCrossShardEdge adds a local async call edge between two nodes of the call graph
func (*TestCallGraph) AddAsyncEdge ¶
func (graph *TestCallGraph) AddAsyncEdge(from *TestCallNode, to *TestCallNode, callBack string, group string) *TestCallEdge
AddAsyncEdge adds a local async call edge between two nodes of the call graph
func (*TestCallGraph) AddNode ¶
func (graph *TestCallGraph) AddNode(contractID string, functionName string) *TestCallNode
AddNode adds a node to the call graph
func (*TestCallGraph) AddNodeCopy ¶
func (graph *TestCallGraph) AddNodeCopy(node *TestCallNode) *TestCallNode
AddNodeCopy adds a copy of a node to the node list
func (*TestCallGraph) AddStartNode ¶
func (graph *TestCallGraph) AddStartNode(contractID string, functionName string, gasLimit uint64, gasUsed uint64) *TestCallNode
AddStartNode adds the start node of the call graph
func (*TestCallGraph) AddSyncEdge ¶
func (graph *TestCallGraph) AddSyncEdge(from *TestCallNode, to *TestCallNode) *TestCallEdge
AddSyncEdge adds a labeled sync call edge between two nodes of the call graph
func (*TestCallGraph) AssignExecutionRounds ¶
func (graph *TestCallGraph) AssignExecutionRounds(_ *testing.T)
AssignExecutionRounds -
func (*TestCallGraph) ComputeGasGraphFromExecutionGraph ¶
func (graph *TestCallGraph) ComputeGasGraphFromExecutionGraph() *TestCallGraph
ComputeGasGraphFromExecutionGraph - creates a gas graph from an execution graph
func (*TestCallGraph) ComputeRemainingGasAfterCallbacks ¶
func (graph *TestCallGraph) ComputeRemainingGasAfterCallbacks()
ComputeRemainingGasAfterCallbacks -
func (*TestCallGraph) ComputeRemainingGasBeforeCallbacks ¶
func (graph *TestCallGraph) ComputeRemainingGasBeforeCallbacks(_ *testing.T)
ComputeRemainingGasBeforeCallbacks - adjusts the gas graph / tree remaining gas info using the gas provided to children this will not take into consideration callback nodes that don't have provided gas info computed yet (see ComputeGasStepByStep)
func (*TestCallGraph) CreateExecutionGraphFromCallGraph ¶
func (graph *TestCallGraph) CreateExecutionGraphFromCallGraph() *TestCallGraph
CreateExecutionGraphFromCallGraph - creates an execution graph from the call graph
func (*TestCallGraph) DfsFromNodeUntilFailures ¶
func (graph *TestCallGraph) DfsFromNodeUntilFailures(parent *TestCallNode, node *TestCallNode, incomingEdge *TestCallEdge, path []*TestCallNode, processNode processNodeFunc, visits map[uint]bool) *TestCallNode
DfsFromNodeUntilFailures will stop DFS going deeper at first encountered fail
func (*TestCallGraph) DfsGraph ¶
func (graph *TestCallGraph) DfsGraph( processNode processNodeFunc, followCrossShardEdges bool)
DfsGraph a standard DFS traversal for the call graph
func (*TestCallGraph) DfsGraphFromNode ¶
func (graph *TestCallGraph) DfsGraphFromNode(startNode *TestCallNode, processNode processNodeFunc, visits map[uint]bool, followCrossShardEdges bool)
DfsGraphFromNode standard DFS starting from a node
func (*TestCallGraph) DfsGraphFromNodePostOrder ¶
func (graph *TestCallGraph) DfsGraphFromNodePostOrder(startNode *TestCallNode, processNode func(*TestCallNode, *TestCallNode, *TestCallEdge) *TestCallNode)
DfsGraphFromNodePostOrder - standard post order DFS
func (*TestCallGraph) FindNode ¶
func (graph *TestCallGraph) FindNode(contractAddress []byte, functionName string) *TestCallNode
FindNode finds the corresponding node in the call graph
func (*TestCallGraph) GetStartNode ¶
func (graph *TestCallGraph) GetStartNode() *TestCallNode
GetStartNode - start node getter
func (*TestCallGraph) PropagateSyncFailures ¶
func (graph *TestCallGraph) PropagateSyncFailures()
PropagateSyncFailures -
type TestCallNode ¶
type TestCallNode struct { ID uint // entry point in call graph IsStartNode bool // node payload Call *TestCall // connected nodes AdjacentEdges []*TestCallEdge NonGasEdgeCounter int64 // labels used only for visualization & debugging VisualLabel string // needs to be unique (will be in te form of contract_function_index) Label string // back pointer / "edge" to parent for trees (not part of the actual graph, not traversed) Parent *TestCallNode IncomingEdge *TestCallEdge // info used for gas assertions // set from an incoming edge edge GasLimit uint64 GasUsed uint64 GasLocked uint64 // computed info ExecutionRound int MaxSubtreeExecutionRound int GasRemaining uint64 GasAccumulated uint64 // set automaticaly when the test is run CrtTxHash []byte ShardID uint32 /* for some processes we don't have a tree traversal, but just an execution order, so we need this info copied from the incoming edge */ // a failed edge points to this node Fail bool // error of the failed edge ErrFail error }
TestCallNode is a node in the call graph
func (*TestCallNode) GetEdges ¶
func (node *TestCallNode) GetEdges() []*TestCallEdge
GetEdges gets the outgoing edges of the node
func (*TestCallNode) GetIncomingEdgeType ¶
func (node *TestCallNode) GetIncomingEdgeType() TestCallEdgeType
GetIncomingEdgeType returns the type of the incoming edge (for a tree)
func (*TestCallNode) HasFailSyncEdge ¶
func (node *TestCallNode) HasFailSyncEdge() bool
HasFailSyncEdge -
func (*TestCallNode) IsGasLeaf ¶
func (node *TestCallNode) IsGasLeaf() bool
IsGasLeaf returns true if the node as any adjacent nodes and is "*" node
func (*TestCallNode) IsIncomingEdgeFail ¶
func (node *TestCallNode) IsIncomingEdgeFail() bool
IsIncomingEdgeFail -
func (*TestCallNode) IsLeaf ¶
func (node *TestCallNode) IsLeaf() bool
IsLeaf returns true if the node as any adjacent nodes
func (*TestCallNode) WillNotExecute ¶
func (node *TestCallNode) WillNotExecute() bool
WillNotExecute returns if node will execute based on execution round
type TestCallPath ¶
type TestCallPath struct {
// contains filtered or unexported fields
}
TestCallPath a path in a tree, len(edges) = len(nodes) - 1
type TestConfig ¶
type TestConfig struct { ParentAddress []byte ChildAddress []byte NephewAddress []byte ThirdPartyAddress []byte VaultAddress []byte GasProvided uint64 GasProvidedToChild uint64 GasProvidedToCallback uint64 GasUsedByParent uint64 GasUsedByChild uint64 GasUsedByCallback uint64 GasLockCost uint64 GasToLock uint64 ParentBalance int64 ChildBalance int64 TransferFromParentToChild int64 TransferToThirdParty int64 TransferToVault int64 TransferFromChildToParent int64 DCDTTokensToTransfer uint64 CallbackDCDTTokensToTransfer uint64 ChildCalls int RecursiveChildCalls int DeployedContractAddress []byte GasUsedByInit uint64 GasProvidedForInit uint64 AsyncCallStepCost uint64 AoTPreparePerByteCost uint64 CompilePerByteCost uint64 ContractToBeUpdatedAddress []byte Owner []byte IsFlagEnabled bool HasCallback bool CallbackFails bool IsLegacyAsync bool SuccessCallback string ErrorCallback string }
TestConfig is configuration for async call tests
func (*TestConfig) GetChildAddress ¶
func (config *TestConfig) GetChildAddress() []byte
GetChildAddress -
func (*TestConfig) GetThirdPartyAddress ¶
func (config *TestConfig) GetThirdPartyAddress() []byte
GetThirdPartyAddress -
func (*TestConfig) GetVaultAddress ¶
func (config *TestConfig) GetVaultAddress() []byte
GetVaultAddress -
type TestHostBuilder ¶
type TestHostBuilder struct {
// contains filtered or unexported fields
}
TestHostBuilder allows tests to configure and initialize the VM host and blockhain mock on which they operate.
func NewTestHostBuilder ¶
func NewTestHostBuilder(tb testing.TB) *TestHostBuilder
NewTestHostBuilder commences a test host builder pattern.
func (*TestHostBuilder) Build ¶
func (thb *TestHostBuilder) Build() vmhost.VMHost
Build initializes the VM host with all configured options.
func (*TestHostBuilder) WithBlockchainHook ¶
func (thb *TestHostBuilder) WithBlockchainHook(blockchainHook vmcommon.BlockchainHook) *TestHostBuilder
WithBlockchainHook sets a pre-built blockchain hook for the VM to work with.
func (*TestHostBuilder) WithBuiltinFunctions ¶
func (thb *TestHostBuilder) WithBuiltinFunctions() *TestHostBuilder
WithBuiltinFunctions sets up builtin functions in the blockchain hook. Only works if the blockchain hook is of type worldmock.MockWorld.
func (*TestHostBuilder) WithExecutorFactory ¶
func (thb *TestHostBuilder) WithExecutorFactory(executorFactory executor.ExecutorAbstractFactory) *TestHostBuilder
WithExecutorFactory allows tests to choose what executor to use.
func (*TestHostBuilder) WithExecutorLogs ¶
func (thb *TestHostBuilder) WithExecutorLogs(executorLogger executorwrapper.ExecutorLogger) *TestHostBuilder
WithExecutorLogs sets an ExecutorLogger, which wraps the existing OverrideVMExecutor
func (*TestHostBuilder) WithGasSchedule ¶
func (thb *TestHostBuilder) WithGasSchedule(gasSchedule config.GasScheduleMap) *TestHostBuilder
WithGasSchedule allows tests to use the gas costs. The default is config.MakeGasMapForTests().
func (*TestHostBuilder) WithWasmerSIGSEGVPassthrough ¶
func (thb *TestHostBuilder) WithWasmerSIGSEGVPassthrough(wasmerSIGSEGVPassthrough bool) *TestHostBuilder
WithWasmerSIGSEGVPassthrough allows tests to configure the WasmerSIGSEGVPassthrough flag.
type TestType ¶
type TestType int
TestType indicates whether the test is a SC call test or a SC creation test
type TransferEntry ¶
type TransferEntry struct { vmcommon.OutputTransfer // contains filtered or unexported fields }
TransferEntry holds the data for an output transfer assertion
func CreateTransferEntry ¶
func CreateTransferEntry(senderAddress []byte, receiverAddress []byte, index uint32) *TransferEntry
CreateTransferEntry creates the data for an output transfer assertion
func (*TransferEntry) IgnoreDataItems ¶
func (transferEntry *TransferEntry) IgnoreDataItems(ignoredDataArguments ...int) *TransferEntry
IgnoreDataItems specifies data arguments to be ignored in assertions
func (*TransferEntry) WithCallType ¶
func (transferEntry *TransferEntry) WithCallType(callType vm.CallType) *TransferEntry
WithCallType create sets the data for an output transfer assertion
func (*TransferEntry) WithData ¶
func (transferEntry *TransferEntry) WithData(data []byte) *TransferEntry
WithData create sets the data for an output transfer assertion
func (*TransferEntry) WithGasLimit ¶
func (transferEntry *TransferEntry) WithGasLimit(gas uint64) *TransferEntry
WithGasLimit create sets the data for an output transfer assertion
func (*TransferEntry) WithGasLocked ¶
func (transferEntry *TransferEntry) WithGasLocked(gas uint64) *TransferEntry
WithGasLocked create sets the data for an output transfer assertion
func (*TransferEntry) WithValue ¶
func (transferEntry *TransferEntry) WithValue(value *big.Int) TransferEntry
WithValue create sets the value for an output transfer assertion
type VMOutputVerifier ¶
type VMOutputVerifier struct { VmOutput *vmcommon.VMOutput AllErrors vmhost.WrappableError T testing.TB }
VMOutputVerifier holds the output to be verified
func NewVMOutputVerifier ¶
NewVMOutputVerifier builds a new verifier
func NewVMOutputVerifierWithAllErrors ¶
func NewVMOutputVerifierWithAllErrors(t testing.TB, vmOutput *vmcommon.VMOutput, err error, allErrors error) *VMOutputVerifier
NewVMOutputVerifierWithAllErrors builds a new verifier with all errors included
func (*VMOutputVerifier) Balance ¶
func (v *VMOutputVerifier) Balance(address []byte, balance int64) *VMOutputVerifier
Balance verifies if Balance of the specified account is the same as the provided one
func (*VMOutputVerifier) BalanceDelta ¶
func (v *VMOutputVerifier) BalanceDelta(address []byte, balanceDelta int64) *VMOutputVerifier
BalanceDelta verifies if BalanceDelta of the specified account is the same as the provided one
func (*VMOutputVerifier) BytesAddedToStorage ¶
func (v *VMOutputVerifier) BytesAddedToStorage(address []byte, bytesAdded int) *VMOutputVerifier
BytesAddedToStorage verifies the number of bytes added to storage
func (*VMOutputVerifier) BytesDeletedFromStorage ¶
func (v *VMOutputVerifier) BytesDeletedFromStorage(address []byte, bytesDelted int) *VMOutputVerifier
BytesDeletedFromStorage verifies the number of bytes deleted from storage
func (*VMOutputVerifier) Code ¶
func (v *VMOutputVerifier) Code(address []byte, code []byte) *VMOutputVerifier
Code verifies if Code of the specified account is the same as the provided one
func (*VMOutputVerifier) CodeDeployerAddress ¶
func (v *VMOutputVerifier) CodeDeployerAddress(address []byte, codeDeployerAddress []byte) *VMOutputVerifier
CodeDeployerAddress if CodeDeployerAddress of the specified account is the same as the provided one
func (*VMOutputVerifier) CodeMetadata ¶
func (v *VMOutputVerifier) CodeMetadata(address []byte, codeMetadata []byte) *VMOutputVerifier
CodeMetadata if CodeMetadata of the specified account is the same as the provided one
func (*VMOutputVerifier) ContractInvalid ¶
func (v *VMOutputVerifier) ContractInvalid() *VMOutputVerifier
ContractInvalid verifies if return code is vmcommon.ContractInvalid
func (*VMOutputVerifier) ContractNotFound ¶
func (v *VMOutputVerifier) ContractNotFound() *VMOutputVerifier
ContractNotFound verifies if return code is vmcommon.ContractNotFound
func (*VMOutputVerifier) DeletedAccounts ¶
func (v *VMOutputVerifier) DeletedAccounts(deletedAccounts ...[]byte) *VMOutputVerifier
DeletedAccounts verifies if DeletedAccounts is the same as the provided one
func (*VMOutputVerifier) ExecutionFailed ¶
func (v *VMOutputVerifier) ExecutionFailed() *VMOutputVerifier
ExecutionFailed verifies if return code is vmcommon.ExecutionFailed
func (*VMOutputVerifier) FunctionNotFound ¶
func (v *VMOutputVerifier) FunctionNotFound() *VMOutputVerifier
FunctionNotFound verifies if return code is vmcommon.FunctionNotFound
func (*VMOutputVerifier) GasRemaining ¶
func (v *VMOutputVerifier) GasRemaining(gas uint64) *VMOutputVerifier
GasRemaining verifies if GasRemaining of the specified account is the same as the provided one
func (*VMOutputVerifier) GasUsed ¶
func (v *VMOutputVerifier) GasUsed(address []byte, gas uint64) *VMOutputVerifier
GasUsed verifies if GasUsed of the specified account is the same as the provided one
func (*VMOutputVerifier) HasRuntimeErrorAndInfo ¶
func (v *VMOutputVerifier) HasRuntimeErrorAndInfo(message string, otherInfo string) *VMOutputVerifier
HasRuntimeErrorAndInfo verifies if the provided errors are present in the runtime context
func (*VMOutputVerifier) HasRuntimeErrors ¶
func (v *VMOutputVerifier) HasRuntimeErrors(messages ...string) *VMOutputVerifier
HasRuntimeErrors verifies if the provided errors are present in the runtime context
func (*VMOutputVerifier) Logs ¶
func (v *VMOutputVerifier) Logs(logs ...vmcommon.LogEntry) *VMOutputVerifier
Logs verifies if Logs is the same as the provided one
func (*VMOutputVerifier) Nonce ¶
func (v *VMOutputVerifier) Nonce(address []byte, nonce uint64) *VMOutputVerifier
Nonce verifies if Nonce of the specified account is the same as the provided one
func (*VMOutputVerifier) Ok ¶
func (v *VMOutputVerifier) Ok() *VMOutputVerifier
Ok verifies if return code is vmcommon.Ok
func (*VMOutputVerifier) OutOfGas ¶
func (v *VMOutputVerifier) OutOfGas() *VMOutputVerifier
OutOfGas verifies if return code is vmcommon.OutOfGas
func (*VMOutputVerifier) Print ¶
func (v *VMOutputVerifier) Print() *VMOutputVerifier
Print writes the contents of the VMOutput with log.Trace()
func (*VMOutputVerifier) ReturnCode ¶
func (v *VMOutputVerifier) ReturnCode(code vmcommon.ReturnCode) *VMOutputVerifier
ReturnCode verifies if ReturnCode of output is the same as the provided one
func (*VMOutputVerifier) ReturnData ¶
func (v *VMOutputVerifier) ReturnData(returnData ...[]byte) *VMOutputVerifier
ReturnData verifies if ReturnData is the same as the provided one
func (*VMOutputVerifier) ReturnDataContains ¶
func (v *VMOutputVerifier) ReturnDataContains(element []byte) *VMOutputVerifier
ReturnDataContains verifies that ReturnData contains the provided element
func (*VMOutputVerifier) ReturnDataDoesNotContain ¶
func (v *VMOutputVerifier) ReturnDataDoesNotContain(element []byte) *VMOutputVerifier
ReturnDataDoesNotContain verifies that ReturnData does not contain the provided element
func (*VMOutputVerifier) ReturnMessage ¶
func (v *VMOutputVerifier) ReturnMessage(message string) *VMOutputVerifier
ReturnMessage verifies if ReturnMessage of output is the same as the provided one
func (*VMOutputVerifier) ReturnMessageContains ¶
func (v *VMOutputVerifier) ReturnMessageContains(message string) *VMOutputVerifier
ReturnMessageContains verifies if ReturnMessage of output contains the provided one
func (*VMOutputVerifier) Storage ¶
func (v *VMOutputVerifier) Storage(expectedEntries ...StoreEntry) *VMOutputVerifier
Storage verifies if StorageUpdate(s) for the speficied accounts are the same as the provided ones
func (*VMOutputVerifier) Transfers ¶
func (v *VMOutputVerifier) Transfers(transfers ...TransferEntry) *VMOutputVerifier
Transfers verifies if OutputTransfer(s) for the speficied accounts are the same as the provided ones
func (*VMOutputVerifier) UserError ¶
func (v *VMOutputVerifier) UserError() *VMOutputVerifier
UserError verifies if return code is vmcommon.UserError
Source Files ¶
- graphDrawUtils.go
- instanceSmartContractCallerTest.go
- instanceSmartContractCreatorTest.go
- mockSmartContractCallerTest.go
- mockTestSmartContract.go
- queueOfCrossShardCalls.go
- testCallGraph.go
- testCallGraphUtils.go
- testExecutionVMOutputs.go
- testHostBuilder.go
- testInitializerBuiltin.go
- testInitializerInputs.go
- testInitializerVMOutput.go
- vmOutputVerifier.go
Directories ¶
Path | Synopsis |
---|---|
Package testexecutor provides with a default executor for testing
|
Package testexecutor provides with a default executor for testing |