Versions in this module Expand all Collapse all v0 v0.0.1 Sep 3, 2024 Changes in this version + const AddressSize + var ChildAddress = MakeTestSCAddress("childSC") + var ChildCompilationCostDestCtx uint64 + var ChildCompilationCostSameCtx uint64 + var ChildData = []byte("childData") + var ChildFinish = []byte("childFinish") + var ChildKey = []byte("childKey........................") + var ChildTransferReceiver = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fchildTransferReceiver.") + var DCDTTestTokenKey = worldmock.MakeTokenKey(DCDTTestTokenName, 0) + var DCDTTestTokenName = []byte("TT") + var DCDTTransferGasCost = uint64(1) + var DefaultCodeMetadata = []byte + var DefaultVMType = []byte + var ErrAccountNotFound = errors.New("account not found") + var GasProvided = uint64(1000000) + var ParentAddress = MakeTestSCAddress("parentSC") + var ParentCompilationCostDestCtx uint64 + var ParentCompilationCostSameCtx uint64 + var ParentDataA = []byte("parentDataA") + var ParentDataB = []byte("parentDataB") + var ParentFinishA = []byte("parentFinishA") + var ParentFinishB = []byte("parentFinishB") + var ParentKeyA = []byte("parentKeyA......................") + var ParentKeyB = []byte("parentKeyB......................") + var ParentTransferData = []byte("parentTransferData") + var ParentTransferReceiver = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fparentTransferReceiver") + var ParentTransferValue = int64(42) + var RecursiveIterationBigCounterKey = []byte("recursiveIterationBigCounter....") + var RecursiveIterationCounterKey = []byte("recursiveIterationCounter.......") + var SCAddressPrefix = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f") + var ThirdPartyAddress = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fthirdPartyAddress.....") + var UserAddress = []byte("userAccount.....................") + var VaultAddress = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0fvaultAddress..........") + func AddFinishData(vmOutput *vmcommon.VMOutput, data []byte) + func AddNewOutputAccount(vmOutput *vmcommon.VMOutput, sender []byte, address []byte, balanceDelta int64, ...) *vmcommon.OutputAccount + func AddTestSmartContractToWorld(world *worldmock.MockWorld, identifier string, code []byte) *worldmock.Account + func BuildSCModule(scName string, prefixToTestSCs string) + func DefaultTestContractCallInput() *vmcommon.ContractCallInput + func DefaultTestContractCreateInput() *vmcommon.ContractCreateInput + func DefaultTestVM(tb testing.TB, blockchain vmcommon.BlockchainHook) vmhost.VMHost + func DefaultTestVMForCall(tb testing.TB, code []byte, balance *big.Int) (vmhost.VMHost, *contextmock.BlockchainHookStub) + func DefaultTestVMForCallSigSegv(tb testing.TB, code []byte, balance *big.Int, passthrough bool) (vmhost.VMHost, *contextmock.BlockchainHookStub) + func DefaultTestVMForCallWithInstanceMocks(tb testing.TB) (vmhost.VMHost, *worldmock.MockWorld, *contextmock.InstanceBuilderMock) + func DefaultTestVMForCallWithInstanceRecorderMock(tb testing.TB, code []byte, balance *big.Int) (vmhost.VMHost, *contextmock.InstanceBuilderRecorderMock) + func DefaultTestVMForCallWithWorldMock(tb testing.TB, code []byte, balance *big.Int) (vmhost.VMHost, *worldmock.MockWorld) + func DefaultTestVMForDeployment(t *testing.T, _ uint64, newAddress []byte) (vmhost.VMHost, *contextmock.BlockchainHookStub) + func DefaultTestVMForTwoSCs(t *testing.T, parentCode []byte, childCode []byte, parentSCBalance *big.Int, ...) (vmhost.VMHost, *contextmock.BlockchainHookStub) + func DefaultTestVMWithGasSchedule(tb testing.TB, blockchain vmcommon.BlockchainHook, ...) vmhost.VMHost + func DefaultTestVMWithWorldMock(tb testing.TB) (vmhost.VMHost, *worldmock.MockWorld) + func GetSCCode(fileName string) []byte + func GetTestSCCode(scName string, prefixToTestSCs ...string) []byte + func GetTestSCCodeModule(scName string, moduleName string, prefixToTestSCs string) []byte + func MakeTestSCAddress(identifier string) []byte + func MakeVMOutput() *vmcommon.VMOutput + func MakeVMOutputError() *vmcommon.VMOutput + func OpenFile(relativePath string) (*os.File, error) + func SetStorageUpdate(account *vmcommon.OutputAccount, key []byte, data []byte) + func SetStorageUpdateStrings(account *vmcommon.OutputAccount, key string, data string) + func SimpleWasteGasMockMethod(instanceMock *mock.InstanceMock, gas uint64) func() *mock.InstanceMock + type ContractCallInputBuilder struct + func CreateTestContractCallInputBuilder() *ContractCallInputBuilder + func (contractInput *ContractCallInputBuilder) Build() *vmcommon.ContractCallInput + func (contractInput *ContractCallInputBuilder) WithArguments(arguments ...[]byte) *ContractCallInputBuilder + func (contractInput *ContractCallInputBuilder) WithCallType(callType vm.CallType) *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) WithGasProvided(gas uint64) *ContractCallInputBuilder + func (contractInput *ContractCallInputBuilder) WithRecipientAddr(address []byte) *ContractCallInputBuilder + type ContractCreateInputBuilder struct + func CreateTestContractCreateInputBuilder() *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) WithGasProvided(gas uint64) *ContractCreateInputBuilder + type InstanceTestSmartContract struct + func CreateInstanceContract(address []byte) *InstanceTestSmartContract + func (mockSC *InstanceTestSmartContract) WithBalance(balance int64) *InstanceTestSmartContract + func (mockSC *InstanceTestSmartContract) WithCode(code []byte) *InstanceTestSmartContract + func (mockSC *InstanceTestSmartContract) WithConfig(config interface{}) *InstanceTestSmartContract + type InstancesTestTemplate struct + func BuildInstanceCallTest(t *testing.T) *InstancesTestTemplate + func (callerTest *InstancesTestTemplate) AndAssertResults(...) + func (callerTest *InstancesTestTemplate) WithContracts(usedContracts ...*InstanceTestSmartContract) *InstancesTestTemplate + func (callerTest *InstancesTestTemplate) WithInput(input *vmcommon.ContractCallInput) *InstancesTestTemplate + func (callerTest *InstancesTestTemplate) WithSetup(setup func(vmhost.VMHost, *contextmock.BlockchainHookStub)) *InstancesTestTemplate + type MockBuiltin struct + ProcessBuiltinFunctionCall func(acntSnd, _ vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) + func (m *MockBuiltin) IsActive() bool + func (m *MockBuiltin) IsInterfaceNil() bool + func (m *MockBuiltin) ProcessBuiltinFunction(acntSnd, acntRcv vmcommon.UserAccountHandler, ...) (*vmcommon.VMOutput, error) + func (m *MockBuiltin) SetNewGasConfig(gasCost *vmcommon.GasCost) + type MockInstancesTestTemplate struct + func BuildMockInstanceCallTest(t *testing.T) *MockInstancesTestTemplate + func (callerTest *MockInstancesTestTemplate) AndAssertResults(assertResults func(world *worldmock.MockWorld, verify *VMOutputVerifier)) + func (callerTest *MockInstancesTestTemplate) WithContracts(usedContracts ...MockTestSmartContract) *MockInstancesTestTemplate + func (callerTest *MockInstancesTestTemplate) WithInput(input *vmcommon.ContractCallInput) *MockInstancesTestTemplate + func (callerTest *MockInstancesTestTemplate) WithSetup(setup func(vmhost.VMHost, *worldmock.MockWorld)) *MockInstancesTestTemplate + type MockTestSmartContract struct + func CreateMockContract(address []byte) *MockTestSmartContract + func CreateMockContractOnShard(address []byte, shardID uint32) *MockTestSmartContract + func (mockSC *MockTestSmartContract) WithBalance(balance int64) *MockTestSmartContract + func (mockSC *MockTestSmartContract) WithConfig(config interface{}) *MockTestSmartContract + func (mockSC *MockTestSmartContract) WithMethods(initMethods ...func(*mock.InstanceMock, interface{})) MockTestSmartContract + type StoreEntry struct + func CreateStoreEntry(address []byte) *StoreEntry + func (storeEntry *StoreEntry) WithKey(key []byte) *StoreEntry + func (storeEntry *StoreEntry) WithValue(value []byte) StoreEntry + type TestCreateTemplateConfig struct + func BuildInstanceCreatorTest(t *testing.T) *TestCreateTemplateConfig + func (callerTest *TestCreateTemplateConfig) AndAssertResults(assertResults func(*contextmock.BlockchainHookStub, *VMOutputVerifier)) + func (callerTest *TestCreateTemplateConfig) WithAddress(address []byte) *TestCreateTemplateConfig + func (callerTest *TestCreateTemplateConfig) WithInput(input *vmcommon.ContractCreateInput) *TestCreateTemplateConfig + func (callerTest *TestCreateTemplateConfig) WithSetup(setup func(vmhost.VMHost, *contextmock.BlockchainHookStub)) *TestCreateTemplateConfig + type TransferEntry struct + func CreateTransferEntry(senderAddress []byte, receiverAddress []byte) *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 struct + AllErrors vmhost.WrappableError + T testing.TB + VmOutput *vmcommon.VMOutput + func NewVMOutputVerifier(t testing.TB, vmOutput *vmcommon.VMOutput, err error) *VMOutputVerifier + func NewVMOutputVerifierWithAllErrors(t testing.TB, vmOutput *vmcommon.VMOutput, err error, allErrors error) *VMOutputVerifier + func (v *VMOutputVerifier) Balance(address []byte, balance int64) *VMOutputVerifier + func (v *VMOutputVerifier) BalanceDelta(address []byte, balanceDelta int64) *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) GasRemaining(gas uint64) *VMOutputVerifier + func (v *VMOutputVerifier) GasUsed(address []byte, gas uint64) *VMOutputVerifier + func (v *VMOutputVerifier) HasRuntimeErrors(messages ...string) *VMOutputVerifier + func (v *VMOutputVerifier) Nonce(address []byte, nonce uint64) *VMOutputVerifier + func (v *VMOutputVerifier) Ok() *VMOutputVerifier + func (v *VMOutputVerifier) ReturnCode(code vmcommon.ReturnCode) *VMOutputVerifier + func (v *VMOutputVerifier) ReturnData(returnData ...[]byte) *VMOutputVerifier + func (v *VMOutputVerifier) ReturnMessage(message string) *VMOutputVerifier + func (v *VMOutputVerifier) ReturnMessageContains(message string) *VMOutputVerifier + func (v *VMOutputVerifier) Storage(returnData ...StoreEntry) *VMOutputVerifier + func (v *VMOutputVerifier) Transfers(transfers ...TransferEntry) *VMOutputVerifier