Documentation ¶
Index ¶
- Constants
- Variables
- 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 DefaultTestVMForCallSigSegv(tb testing.TB, code []byte, balance *big.Int, passthrough bool) (*vmHost, *contextmock.BlockchainHookStub)
- func GetSCCode(fileName string) []byte
- func GetTestSCCode(scName string, prefixToTestSCs string) []byte
- func GetTestSCCodeModule(scName string, moduleName string, prefixToTestSCs string) []byte
- func LoadGasScheduleConfig(filepath string) (config.GasScheduleMap, error)
- func LoadTomlFileToMap(relativePath string) (map[string]interface{}, error)
- func MakeTestSCAddress(identifier string) []byte
- func MakeVMOutput() *vmcommon.VMOutput
- func MakeVMOutputError() *vmcommon.VMOutput
- func NewVMHost(blockChainHook vmcommon.BlockchainHook, ...) (*vmHost, error)
- 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 TryCatch(try TryFunction, catch CatchFunction, catchFallbackMessage string)
- type CatchFunction
- type TryFunction
Constants ¶
const ( // SCDeployFlag defines the flag that activates the sc deploy SCDeployFlag core.EnableEpochFlag = "SCDeployFlag" // BuiltInFunctionsFlag defines the flag that activates the builtin functions BuiltInFunctionsFlag core.EnableEpochFlag = "BuiltInFunctionsFlag" // RepairCallbackFlag defines the flag that activates the repair callback fix RepairCallbackFlag core.EnableEpochFlag = "RepairCallbackFlag" // AheadOfTimeGasUsageFlag defines the flag that activates the ahead of time gas usage fix AheadOfTimeGasUsageFlag core.EnableEpochFlag = "AheadOfTimeGasUsageFlag" )
const AddressSize = 32
AddressSize is the size of an account address, in bytes.
Variables ¶
var MaximumWasmerInstanceCount = uint64(10)
MaximumWasmerInstanceCount represents the maximum number of Wasmer instances that can be active at the same time
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.
Functions ¶
func AddFinishData ¶
AddFinishData appends the provided []byte to the ReturnData of the given vmOutput
func AddNewOutputAccount ¶
func AddNewOutputAccount(vmOutput *vmcommon.VMOutput, sender []byte, address []byte, balanceDelta int64, data []byte) *vmcommon.OutputAccount
AddNewOutputAccount 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 BuildSCModule ¶
BuildSCModule invokes erdpy to build the contract into a WASM module
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 DefaultTestVMForCallSigSegv ¶
func DefaultTestVMForCallSigSegv(tb testing.TB, code []byte, balance *big.Int, passthrough bool) (*vmHost, *contextmock.BlockchainHookStub)
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 LoadGasScheduleConfig ¶
func LoadGasScheduleConfig(filepath string) (config.GasScheduleMap, error)
LoadGasScheduleConfig parses and prepares a gas schedule read from file.
func LoadTomlFileToMap ¶
LoadTomlFileToMap opens and decodes a toml file as a map[string]interface{}
func MakeTestSCAddress ¶
MakeTestSCAddress generates a new smart contract address to be used for testing based on the given identifier.
func MakeVMOutput ¶
MakeVMOutput creates a vmcommon.VMOutput struct with default values
func MakeVMOutputError ¶
MakeVMOutputError creates a vmcommon.VMOutput struct with default values for errors
func NewVMHost ¶
func NewVMHost( blockChainHook vmcommon.BlockchainHook, hostParameters *vmhost.VMHostParameters, ) (*vmHost, error)
NewVMHost creates a new VM vmHost
func SetStorageUpdate ¶
func SetStorageUpdate(account *vmcommon.OutputAccount, key []byte, data []byte)
SetStorageUpdate sets a storage update to the provided vmcommon.OutputAccount
func SetStorageUpdateStrings ¶
func SetStorageUpdateStrings(account *vmcommon.OutputAccount, key string, data string)
SetStorageUpdateStrings sets a storage update to the provided vmcommon.OutputAccount, from string arguments
func TryCatch ¶
func TryCatch(try TryFunction, catch CatchFunction, catchFallbackMessage string)
TryCatch simulates a try/catch block using golang's recover() functionality
Types ¶
type CatchFunction ¶
type CatchFunction func(error)
CatchFunction corresponds to the catch() part of a try / catch block
type TryFunction ¶
type TryFunction func()
TryFunction corresponds to the try() part of a try / catch block