Documentation ¶
Overview ¶
Package executor contains the interfaces and definitions for the VM Executor
Index ¶
- Variables
- func MemLoadFromMemory(memory Memory, memPtr MemPtr, length MemLength) ([]byte, error)
- func MemStoreToMemory(memory Memory, memPtr MemPtr, data []byte) error
- type BigFloatVMHooks
- type BigIntVMHooks
- type CompilationOptions
- type CryptoVMHooks
- type Executor
- type ExecutorAbstractFactory
- type ExecutorFactoryArgs
- type Instance
- type MainVMHooks
- type ManagedBufferVMHooks
- type ManagedMapVMHooks
- type ManagedVMHooks
- type MemLength
- type MemPtr
- type Memory
- type SmallIntVMHooks
- type VMHooks
- type WASMOpcodeCost
Constants ¶
This section is empty.
Variables ¶
var ErrFuncNotFound = fmt.Errorf("%w (not found)", ErrInvalidFunction)
ErrFuncNotFound signals that the the function does not exist
var ErrFunctionNonvoidSignature = fmt.Errorf("%w (nonvoid signature)", ErrInvalidFunction)
ErrFunctionNonvoidSignature signals that the signature for the function is invalid
var ErrInvalidFunction = errors.New("invalid function")
ErrInvalidFunction signals that the function is invalid
var ErrMemoryBadBounds = errors.New("bad bounds")
ErrMemoryBadBounds signals that a certain variable is out of bounds
var ErrMemoryBadBoundsLower = fmt.Errorf("%w (lower)", ErrMemoryBadBounds)
ErrMemoryBadBoundsLower signals that a certain variable is lower than allowed
var ErrMemoryBadBoundsUpper = fmt.Errorf("%w (upper)", ErrMemoryBadBounds)
ErrMemoryBadBoundsUpper signals that a certain variable is higher than allowed
var ErrMemoryNegativeLength = errors.New("negative length")
ErrMemoryNegativeLength signals that the given length is less than 0
Functions ¶
func MemLoadFromMemory ¶
MemLoadFromMemory is a bridge to the old Memory interface. We are moving away from that, this is to ease the transition.
Types ¶
type BigFloatVMHooks ¶
type BigFloatVMHooks interface { BigFloatNewFromParts(integralPart int32, fractionalPart int32, exponent int32) int32 BigFloatNewFromFrac(numerator int64, denominator int64) int32 BigFloatNewFromSci(significand int64, exponent int64) int32 BigFloatAdd(destinationHandle int32, op1Handle int32, op2Handle int32) BigFloatSub(destinationHandle int32, op1Handle int32, op2Handle int32) BigFloatMul(destinationHandle int32, op1Handle int32, op2Handle int32) BigFloatDiv(destinationHandle int32, op1Handle int32, op2Handle int32) BigFloatNeg(destinationHandle int32, opHandle int32) BigFloatClone(destinationHandle int32, opHandle int32) BigFloatCmp(op1Handle int32, op2Handle int32) int32 BigFloatAbs(destinationHandle int32, opHandle int32) BigFloatSign(opHandle int32) int32 BigFloatSqrt(destinationHandle int32, opHandle int32) BigFloatPow(destinationHandle int32, opHandle int32, exponent int32) BigFloatFloor(destBigIntHandle int32, opHandle int32) BigFloatCeil(destBigIntHandle int32, opHandle int32) BigFloatTruncate(destBigIntHandle int32, opHandle int32) BigFloatSetInt64(destinationHandle int32, value int64) BigFloatIsInt(opHandle int32) int32 BigFloatSetBigInt(destinationHandle int32, bigIntHandle int32) BigFloatGetConstPi(destinationHandle int32) BigFloatGetConstE(destinationHandle int32) }
type BigIntVMHooks ¶
type BigIntVMHooks interface { BigIntGetUnsignedArgument(id int32, destinationHandle int32) BigIntGetSignedArgument(id int32, destinationHandle int32) BigIntStorageStoreUnsigned(keyOffset MemPtr, keyLength MemLength, sourceHandle int32) int32 BigIntStorageLoadUnsigned(keyOffset MemPtr, keyLength MemLength, destinationHandle int32) int32 BigIntGetCallValue(destinationHandle int32) BigIntGetESDTCallValue(destination int32) BigIntGetESDTCallValueByIndex(destinationHandle int32, index int32) BigIntGetExternalBalance(addressOffset MemPtr, result int32) BigIntGetESDTExternalBalance(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, nonce int64, resultHandle int32) BigIntNew(smallValue int64) int32 BigIntUnsignedByteLength(referenceHandle int32) int32 BigIntSignedByteLength(referenceHandle int32) int32 BigIntGetUnsignedBytes(referenceHandle int32, byteOffset MemPtr) int32 BigIntGetSignedBytes(referenceHandle int32, byteOffset MemPtr) int32 BigIntSetUnsignedBytes(destinationHandle int32, byteOffset MemPtr, byteLength MemLength) BigIntSetSignedBytes(destinationHandle int32, byteOffset MemPtr, byteLength MemLength) BigIntIsInt64(destinationHandle int32) int32 BigIntGetInt64(destinationHandle int32) int64 BigIntSetInt64(destinationHandle int32, value int64) BigIntAdd(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntSub(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntMul(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntTDiv(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntTMod(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntEDiv(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntEMod(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntSqrt(destinationHandle int32, opHandle int32) BigIntPow(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntLog2(op1Handle int32) int32 BigIntAbs(destinationHandle int32, opHandle int32) BigIntNeg(destinationHandle int32, opHandle int32) BigIntSign(opHandle int32) int32 BigIntCmp(op1Handle int32, op2Handle int32) int32 BigIntNot(destinationHandle int32, opHandle int32) BigIntAnd(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntOr(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntXor(destinationHandle int32, op1Handle int32, op2Handle int32) BigIntShr(destinationHandle int32, opHandle int32, bits int32) BigIntShl(destinationHandle int32, opHandle int32, bits int32) BigIntFinishUnsigned(referenceHandle int32) BigIntFinishSigned(referenceHandle int32) BigIntToString(bigIntHandle int32, destinationHandle int32) }
type CompilationOptions ¶
type CompilationOptions struct { GasLimit uint64 UnmeteredLocals uint64 MaxMemoryGrow uint64 MaxMemoryGrowDelta uint64 OpcodeTrace bool Metering bool RuntimeBreakpoints bool }
CompilationOptions contains configurations for instantiating an executor instance.
type CryptoVMHooks ¶
type CryptoVMHooks interface { Sha256(dataOffset MemPtr, length MemLength, resultOffset MemPtr) int32 ManagedSha256(inputHandle int32, outputHandle int32) int32 Keccak256(dataOffset MemPtr, length MemLength, resultOffset MemPtr) int32 ManagedKeccak256(inputHandle int32, outputHandle int32) int32 Ripemd160(dataOffset MemPtr, length MemLength, resultOffset MemPtr) int32 ManagedRipemd160(inputHandle int32, outputHandle int32) int32 VerifyBLS(keyOffset MemPtr, messageOffset MemPtr, messageLength MemLength, sigOffset MemPtr) int32 ManagedVerifyBLS(keyHandle int32, messageHandle int32, sigHandle int32) int32 VerifyEd25519(keyOffset MemPtr, messageOffset MemPtr, messageLength MemLength, sigOffset MemPtr) int32 ManagedVerifyEd25519(keyHandle int32, messageHandle int32, sigHandle int32) int32 VerifyCustomSecp256k1(keyOffset MemPtr, keyLength MemLength, messageOffset MemPtr, messageLength MemLength, sigOffset MemPtr, hashType int32) int32 ManagedVerifyCustomSecp256k1(keyHandle int32, messageHandle int32, sigHandle int32, hashType int32) int32 VerifySecp256k1(keyOffset MemPtr, keyLength MemLength, messageOffset MemPtr, messageLength MemLength, sigOffset MemPtr) int32 ManagedVerifySecp256k1(keyHandle int32, messageHandle int32, sigHandle int32) int32 EncodeSecp256k1DerSignature(rOffset MemPtr, rLength MemLength, sOffset MemPtr, sLength MemLength, sigOffset MemPtr) int32 ManagedEncodeSecp256k1DerSignature(rHandle int32, sHandle int32, sigHandle int32) int32 AddEC(xResultHandle int32, yResultHandle int32, ecHandle int32, fstPointXHandle int32, fstPointYHandle int32, sndPointXHandle int32, sndPointYHandle int32) DoubleEC(xResultHandle int32, yResultHandle int32, ecHandle int32, pointXHandle int32, pointYHandle int32) IsOnCurveEC(ecHandle int32, pointXHandle int32, pointYHandle int32) int32 ScalarBaseMultEC(xResultHandle int32, yResultHandle int32, ecHandle int32, dataOffset MemPtr, length MemLength) int32 ManagedScalarBaseMultEC(xResultHandle int32, yResultHandle int32, ecHandle int32, dataHandle int32) int32 ScalarMultEC(xResultHandle int32, yResultHandle int32, ecHandle int32, pointXHandle int32, pointYHandle int32, dataOffset MemPtr, length MemLength) int32 ManagedScalarMultEC(xResultHandle int32, yResultHandle int32, ecHandle int32, pointXHandle int32, pointYHandle int32, dataHandle int32) int32 MarshalEC(xPairHandle int32, yPairHandle int32, ecHandle int32, resultOffset MemPtr) int32 ManagedMarshalEC(xPairHandle int32, yPairHandle int32, ecHandle int32, resultHandle int32) int32 MarshalCompressedEC(xPairHandle int32, yPairHandle int32, ecHandle int32, resultOffset MemPtr) int32 ManagedMarshalCompressedEC(xPairHandle int32, yPairHandle int32, ecHandle int32, resultHandle int32) int32 UnmarshalEC(xResultHandle int32, yResultHandle int32, ecHandle int32, dataOffset MemPtr, length MemLength) int32 ManagedUnmarshalEC(xResultHandle int32, yResultHandle int32, ecHandle int32, dataHandle int32) int32 UnmarshalCompressedEC(xResultHandle int32, yResultHandle int32, ecHandle int32, dataOffset MemPtr, length MemLength) int32 ManagedUnmarshalCompressedEC(xResultHandle int32, yResultHandle int32, ecHandle int32, dataHandle int32) int32 GenerateKeyEC(xPubKeyHandle int32, yPubKeyHandle int32, ecHandle int32, resultOffset MemPtr) int32 ManagedGenerateKeyEC(xPubKeyHandle int32, yPubKeyHandle int32, ecHandle int32, resultHandle int32) int32 CreateEC(dataOffset MemPtr, dataLength MemLength) int32 ManagedCreateEC(dataHandle int32) int32 GetCurveLengthEC(ecHandle int32) int32 GetPrivKeyByteLengthEC(ecHandle int32) int32 EllipticCurveGetValues(ecHandle int32, fieldOrderHandle int32, basePointOrderHandle int32, eqConstantHandle int32, xBasePointHandle int32, yBasePointHandle int32) int32 ManagedVerifySecp256r1(keyHandle int32, messageHandle int32, sigHandle int32) int32 ManagedVerifyBLSAggregatedSignature(keyHandle int32, messageHandle int32, sigHandle int32) int32 }
type Executor ¶
type Executor interface { check.NilInterfaceChecker // SetOpcodeCosts sets gas costs globally inside an executor. SetOpcodeCosts(opcodeCosts *WASMOpcodeCost) // FunctionNames return the low-level function names provided to contracts. FunctionNames() vmcommon.FunctionNames // NewInstanceWithOptions creates a new executor instance. NewInstanceWithOptions( contractCode []byte, options CompilationOptions) (Instance, error) // NewInstanceFromCompiledCodeWithOptions is used to restore an executor instance from cache. NewInstanceFromCompiledCodeWithOptions( compiledCode []byte, options CompilationOptions) (Instance, error) }
Executor defines the functionality needed to create any executor instance.
type ExecutorAbstractFactory ¶
type ExecutorAbstractFactory interface { check.NilInterfaceChecker // CreateExecutor produces a new Executor instance. CreateExecutor(args ExecutorFactoryArgs) (Executor, error) }
ExecutorAbstractFactory defines an object to be passed to the VM to configure the instantiation of the Executor. The VM needs to create the Executor, because the VM hooks, gas costs and other configurations come from it.
type ExecutorFactoryArgs ¶
type ExecutorFactoryArgs struct { VMHooks VMHooks OpcodeCosts *WASMOpcodeCost RkyvSerializationEnabled bool WasmerSIGSEGVPassthrough bool }
ExecutorFactoryArgs define the Executor configurations that come from the VM, especially the hooks and the gas costs.
type Instance ¶
type Instance interface { GetPointsUsed() uint64 SetPointsUsed(points uint64) SetGasLimit(gasLimit uint64) SetBreakpointValue(value uint64) GetBreakpointValue() uint64 Cache() ([]byte, error) Clean() bool CallFunction(functionName string) error HasFunction(functionName string) bool GetFunctionNames() []string ValidateFunctionArities() error HasMemory() bool MemLoad(memPtr MemPtr, length MemLength) ([]byte, error) MemStore(memPtr MemPtr, data []byte) error MemLength() uint32 MemGrow(pages uint32) error MemDump() []byte IsFunctionImported(name string) bool IsInterfaceNil() bool Reset() bool SetVMHooksPtr(vmHooksPtr uintptr) GetVMHooksPtr() uintptr ID() string IsAlreadyCleaned() bool }
Instance defines the functionality of a Wasmer instance
type MainVMHooks ¶
type MainVMHooks interface { GetGasLeft() int64 GetSCAddress(resultOffset MemPtr) GetOwnerAddress(resultOffset MemPtr) GetShardOfAddress(addressOffset MemPtr) int32 IsSmartContract(addressOffset MemPtr) int32 SignalError(messageOffset MemPtr, messageLength MemLength) GetExternalBalance(addressOffset MemPtr, resultOffset MemPtr) GetBlockHash(nonce int64, resultOffset MemPtr) int32 GetESDTBalance(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, nonce int64, resultOffset MemPtr) int32 GetESDTNFTNameLength(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, nonce int64) int32 GetESDTNFTAttributeLength(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, nonce int64) int32 GetESDTNFTURILength(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, nonce int64) int32 GetESDTTokenData(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, nonce int64, valueHandle int32, propertiesOffset MemPtr, hashOffset MemPtr, nameOffset MemPtr, attributesOffset MemPtr, creatorOffset MemPtr, royaltiesHandle int32, urisOffset MemPtr) int32 GetESDTLocalRoles(tokenIdHandle int32) int64 ValidateTokenIdentifier(tokenIdHandle int32) int32 TransferValue(destOffset MemPtr, valueOffset MemPtr, dataOffset MemPtr, length MemLength) int32 TransferValueExecute(destOffset MemPtr, valueOffset MemPtr, gasLimit int64, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 TransferESDTExecute(destOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, valueOffset MemPtr, gasLimit int64, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 TransferESDTNFTExecute(destOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength, valueOffset MemPtr, nonce int64, gasLimit int64, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 MultiTransferESDTNFTExecute(destOffset MemPtr, numTokenTransfers int32, tokenTransfersArgsLengthOffset MemPtr, tokenTransferDataOffset MemPtr, gasLimit int64, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 CreateAsyncCall(destOffset MemPtr, valueOffset MemPtr, dataOffset MemPtr, dataLength MemLength, successOffset MemPtr, successLength MemLength, errorOffset MemPtr, errorLength MemLength, gas int64, extraGasForCallback int64) int32 SetAsyncContextCallback(callback MemPtr, callbackLength MemLength, data MemPtr, dataLength MemLength, gas int64) int32 UpgradeContract(destOffset MemPtr, gasLimit int64, valueOffset MemPtr, codeOffset MemPtr, codeMetadataOffset MemPtr, length MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) UpgradeFromSourceContract(destOffset MemPtr, gasLimit int64, valueOffset MemPtr, sourceContractAddressOffset MemPtr, codeMetadataOffset MemPtr, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) DeleteContract(destOffset MemPtr, gasLimit int64, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) AsyncCall(destOffset MemPtr, valueOffset MemPtr, dataOffset MemPtr, length MemLength) GetArgumentLength(id int32) int32 GetArgument(id int32, argOffset MemPtr) int32 GetFunction(functionOffset MemPtr) int32 GetNumArguments() int32 StorageStore(keyOffset MemPtr, keyLength MemLength, dataOffset MemPtr, dataLength MemLength) int32 StorageLoadLength(keyOffset MemPtr, keyLength MemLength) int32 StorageLoadFromAddress(addressOffset MemPtr, keyOffset MemPtr, keyLength MemLength, dataOffset MemPtr) int32 StorageLoad(keyOffset MemPtr, keyLength MemLength, dataOffset MemPtr) int32 SetStorageLock(keyOffset MemPtr, keyLength MemLength, lockTimestamp int64) int32 GetStorageLock(keyOffset MemPtr, keyLength MemLength) int64 IsStorageLocked(keyOffset MemPtr, keyLength MemLength) int32 ClearStorageLock(keyOffset MemPtr, keyLength MemLength) int32 GetCaller(resultOffset MemPtr) CheckNoPayment() GetCallValue(resultOffset MemPtr) int32 GetESDTValue(resultOffset MemPtr) int32 GetESDTValueByIndex(resultOffset MemPtr, index int32) int32 GetESDTTokenName(resultOffset MemPtr) int32 GetESDTTokenNameByIndex(resultOffset MemPtr, index int32) int32 GetESDTTokenNonce() int64 GetESDTTokenNonceByIndex(index int32) int64 GetCurrentESDTNFTNonce(addressOffset MemPtr, tokenIDOffset MemPtr, tokenIDLen MemLength) int64 GetESDTTokenType() int32 GetESDTTokenTypeByIndex(index int32) int32 GetNumESDTTransfers() int32 GetCallValueTokenName(callValueOffset MemPtr, tokenNameOffset MemPtr) int32 GetCallValueTokenNameByIndex(callValueOffset MemPtr, tokenNameOffset MemPtr, index int32) int32 IsReservedFunctionName(nameHandle int32) int32 WriteLog(dataPointer MemPtr, dataLength MemLength, topicPtr MemPtr, numTopics int32) WriteEventLog(numTopics int32, topicLengthsOffset MemPtr, topicOffset MemPtr, dataOffset MemPtr, dataLength MemLength) GetBlockTimestamp() int64 GetBlockNonce() int64 GetBlockRound() int64 GetBlockEpoch() int64 GetBlockRandomSeed(pointer MemPtr) GetStateRootHash(pointer MemPtr) GetPrevBlockTimestamp() int64 GetPrevBlockNonce() int64 GetPrevBlockRound() int64 GetPrevBlockEpoch() int64 GetPrevBlockRandomSeed(pointer MemPtr) Finish(pointer MemPtr, length MemLength) ExecuteOnSameContext(gasLimit int64, addressOffset MemPtr, valueOffset MemPtr, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 ExecuteOnDestContext(gasLimit int64, addressOffset MemPtr, valueOffset MemPtr, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 ExecuteReadOnly(gasLimit int64, addressOffset MemPtr, functionOffset MemPtr, functionLength MemLength, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 CreateContract(gasLimit int64, valueOffset MemPtr, codeOffset MemPtr, codeMetadataOffset MemPtr, length MemLength, resultOffset MemPtr, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 DeployFromSourceContract(gasLimit int64, valueOffset MemPtr, sourceContractAddressOffset MemPtr, codeMetadataOffset MemPtr, resultAddressOffset MemPtr, numArguments int32, argumentsLengthOffset MemPtr, dataOffset MemPtr) int32 GetNumReturnData() int32 GetReturnDataSize(resultID int32) int32 GetReturnData(resultID int32, dataOffset MemPtr) int32 CleanReturnData() DeleteFromReturnData(resultID int32) GetOriginalTxHash(dataOffset MemPtr) GetCurrentTxHash(dataOffset MemPtr) GetPrevTxHash(dataOffset MemPtr) }
type ManagedBufferVMHooks ¶
type ManagedBufferVMHooks interface { MBufferNew() int32 MBufferNewFromBytes(dataOffset MemPtr, dataLength MemLength) int32 MBufferGetLength(mBufferHandle int32) int32 MBufferGetBytes(mBufferHandle int32, resultOffset MemPtr) int32 MBufferGetByteSlice(sourceHandle int32, startingPosition int32, sliceLength int32, resultOffset MemPtr) int32 MBufferCopyByteSlice(sourceHandle int32, startingPosition int32, sliceLength int32, destinationHandle int32) int32 MBufferEq(mBufferHandle1 int32, mBufferHandle2 int32) int32 MBufferSetBytes(mBufferHandle int32, dataOffset MemPtr, dataLength MemLength) int32 MBufferSetByteSlice(mBufferHandle int32, startingPosition int32, dataLength MemLength, dataOffset MemPtr) int32 MBufferAppend(accumulatorHandle int32, dataHandle int32) int32 MBufferAppendBytes(accumulatorHandle int32, dataOffset MemPtr, dataLength MemLength) int32 MBufferToBigIntUnsigned(mBufferHandle int32, bigIntHandle int32) int32 MBufferToBigIntSigned(mBufferHandle int32, bigIntHandle int32) int32 MBufferFromBigIntUnsigned(mBufferHandle int32, bigIntHandle int32) int32 MBufferFromBigIntSigned(mBufferHandle int32, bigIntHandle int32) int32 MBufferToBigFloat(mBufferHandle int32, bigFloatHandle int32) int32 MBufferFromBigFloat(mBufferHandle int32, bigFloatHandle int32) int32 MBufferStorageStore(keyHandle int32, sourceHandle int32) int32 MBufferStorageLoad(keyHandle int32, destinationHandle int32) int32 MBufferStorageLoadFromAddress(addressHandle int32, keyHandle int32, destinationHandle int32) MBufferGetArgument(id int32, destinationHandle int32) int32 MBufferFinish(sourceHandle int32) int32 MBufferSetRandom(destinationHandle int32, length int32) int32 }
type ManagedMapVMHooks ¶
type ManagedMapVMHooks interface { ManagedMapNew() int32 ManagedMapPut(mMapHandle int32, keyHandle int32, valueHandle int32) int32 ManagedMapGet(mMapHandle int32, keyHandle int32, outValueHandle int32) int32 ManagedMapRemove(mMapHandle int32, keyHandle int32, outValueHandle int32) int32 ManagedMapContains(mMapHandle int32, keyHandle int32) int32 }
type ManagedVMHooks ¶
type ManagedVMHooks interface { ManagedSCAddress(destinationHandle int32) ManagedOwnerAddress(destinationHandle int32) ManagedCaller(destinationHandle int32) ManagedGetOriginalCallerAddr(destinationHandle int32) ManagedGetRelayerAddr(destinationHandle int32) ManagedSignalError(errHandle int32) ManagedWriteLog(topicsHandle int32, dataHandle int32) ManagedGetOriginalTxHash(resultHandle int32) ManagedGetStateRootHash(resultHandle int32) ManagedGetBlockRandomSeed(resultHandle int32) ManagedGetPrevBlockRandomSeed(resultHandle int32) ManagedGetReturnData(resultID int32, resultHandle int32) ManagedGetMultiESDTCallValue(multiCallValueHandle int32) ManagedGetBackTransfers(esdtTransfersValueHandle int32, egldValueHandle int32) ManagedGetESDTBalance(addressHandle int32, tokenIDHandle int32, nonce int64, valueHandle int32) ManagedGetESDTTokenData(addressHandle int32, tokenIDHandle int32, nonce int64, valueHandle int32, propertiesHandle int32, hashHandle int32, nameHandle int32, attributesHandle int32, creatorHandle int32, royaltiesHandle int32, urisHandle int32) ManagedAsyncCall(destHandle int32, valueHandle int32, functionHandle int32, argumentsHandle int32) ManagedCreateAsyncCall(destHandle int32, valueHandle int32, functionHandle int32, argumentsHandle int32, successOffset MemPtr, successLength MemLength, errorOffset MemPtr, errorLength MemLength, gas int64, extraGasForCallback int64, callbackClosureHandle int32) int32 ManagedGetCallbackClosure(callbackClosureHandle int32) ManagedUpgradeFromSourceContract(destHandle int32, gas int64, valueHandle int32, addressHandle int32, codeMetadataHandle int32, argumentsHandle int32, resultHandle int32) ManagedUpgradeContract(destHandle int32, gas int64, valueHandle int32, codeHandle int32, codeMetadataHandle int32, argumentsHandle int32, resultHandle int32) ManagedDeleteContract(destHandle int32, gasLimit int64, argumentsHandle int32) ManagedDeployFromSourceContract(gas int64, valueHandle int32, addressHandle int32, codeMetadataHandle int32, argumentsHandle int32, resultAddressHandle int32, resultHandle int32) int32 ManagedCreateContract(gas int64, valueHandle int32, codeHandle int32, codeMetadataHandle int32, argumentsHandle int32, resultAddressHandle int32, resultHandle int32) int32 ManagedExecuteReadOnly(gas int64, addressHandle int32, functionHandle int32, argumentsHandle int32, resultHandle int32) int32 ManagedExecuteOnSameContext(gas int64, addressHandle int32, valueHandle int32, functionHandle int32, argumentsHandle int32, resultHandle int32) int32 ManagedExecuteOnDestContext(gas int64, addressHandle int32, valueHandle int32, functionHandle int32, argumentsHandle int32, resultHandle int32) int32 ManagedMultiTransferESDTNFTExecute(dstHandle int32, tokenTransfersHandle int32, gasLimit int64, functionHandle int32, argumentsHandle int32) int32 ManagedMultiTransferESDTNFTExecuteByUser(userHandle int32, dstHandle int32, tokenTransfersHandle int32, gasLimit int64, functionHandle int32, argumentsHandle int32) int32 ManagedTransferValueExecute(dstHandle int32, valueHandle int32, gasLimit int64, functionHandle int32, argumentsHandle int32) int32 ManagedIsESDTFrozen(addressHandle int32, tokenIDHandle int32, nonce int64) int32 ManagedIsESDTLimitedTransfer(tokenIDHandle int32) int32 ManagedIsESDTPaused(tokenIDHandle int32) int32 ManagedBufferToHex(sourceHandle int32, destHandle int32) ManagedGetCodeMetadata(addressHandle int32, responseHandle int32) ManagedIsBuiltinFunction(functionNameHandle int32) int32 }
type MemLength ¶
type MemLength = int32
MemLength indicates that an argument refers to the length of a data section in WASM memory.
type MemPtr ¶
type MemPtr int32
MemPtr indicates that an argument refers to a location in WASM memory.
type Memory ¶
type Memory interface { Length() uint32 Data() []byte Grow(pages uint32) error Destroy() IsInterfaceNil() bool }
Memory defines the functionality of the memory of a Wasmer instance. Now considered an implementation detail and will likely stop being a public interface.
type SmallIntVMHooks ¶
type SmallIntVMHooks interface { SmallIntGetUnsignedArgument(id int32) int64 SmallIntGetSignedArgument(id int32) int64 SmallIntFinishUnsigned(value int64) SmallIntFinishSigned(value int64) SmallIntStorageStoreUnsigned(keyOffset MemPtr, keyLength MemLength, value int64) int32 SmallIntStorageStoreSigned(keyOffset MemPtr, keyLength MemLength, value int64) int32 SmallIntStorageLoadUnsigned(keyOffset MemPtr, keyLength MemLength) int64 SmallIntStorageLoadSigned(keyOffset MemPtr, keyLength MemLength) int64 Int64getArgument(id int32) int64 Int64finish(value int64) Int64storageStore(keyOffset MemPtr, keyLength MemLength, value int64) int32 Int64storageLoad(keyOffset MemPtr, keyLength MemLength) int64 }
type VMHooks ¶
type VMHooks interface { MainVMHooks ManagedVMHooks BigFloatVMHooks BigIntVMHooks ManagedBufferVMHooks ManagedMapVMHooks SmallIntVMHooks CryptoVMHooks }
VMHooks contains all VM functions that can be called by the executor during SC execution.
type WASMOpcodeCost ¶
type WASMOpcodeCost struct { AtomicFence uint32 AtomicNotify uint32 Block uint32 Br uint32 BrIf uint32 BrTable uint32 Call uint32 CallIndirect uint32 Catch uint32 CatchAll uint32 DataDrop uint32 Delegate uint32 Drop uint32 ElemDrop uint32 Else uint32 End uint32 F32Abs uint32 F32Add uint32 F32Ceil uint32 F32Const uint32 F32ConvertI32S uint32 F32ConvertI32U uint32 F32ConvertI64S uint32 F32ConvertI64U uint32 F32Copysign uint32 F32DemoteF64 uint32 F32Div uint32 F32Eq uint32 F32Floor uint32 F32Ge uint32 F32Gt uint32 F32Le uint32 F32Load uint32 F32Lt uint32 F32Max uint32 F32Min uint32 F32Mul uint32 F32Ne uint32 F32Nearest uint32 F32Neg uint32 F32ReinterpretI32 uint32 F32Sqrt uint32 F32Store uint32 F32Sub uint32 F32Trunc uint32 F32x4Abs uint32 F32x4Add uint32 F32x4Ceil uint32 F32x4ConvertI32x4S uint32 F32x4ConvertI32x4U uint32 F32x4DemoteF64x2Zero uint32 F32x4Div uint32 F32x4Eq uint32 F32x4ExtractLane uint32 F32x4Floor uint32 F32x4Ge uint32 F32x4Gt uint32 F32x4Le uint32 F32x4Lt uint32 F32x4Max uint32 F32x4Min uint32 F32x4Mul uint32 F32x4Ne uint32 F32x4Nearest uint32 F32x4Neg uint32 F32x4PMax uint32 F32x4PMin uint32 F32x4ReplaceLane uint32 F32x4Splat uint32 F32x4Sqrt uint32 F32x4Sub uint32 F32x4Trunc uint32 F64Abs uint32 F64Add uint32 F64Ceil uint32 F64Const uint32 F64ConvertI32S uint32 F64ConvertI32U uint32 F64ConvertI64S uint32 F64ConvertI64U uint32 F64Copysign uint32 F64Div uint32 F64Eq uint32 F64Floor uint32 F64Ge uint32 F64Gt uint32 F64Le uint32 F64Load uint32 F64Lt uint32 F64Max uint32 F64Min uint32 F64Mul uint32 F64Ne uint32 F64Nearest uint32 F64Neg uint32 F64PromoteF32 uint32 F64ReinterpretI64 uint32 F64Sqrt uint32 F64Store uint32 F64Sub uint32 F64Trunc uint32 F64x2Abs uint32 F64x2Add uint32 F64x2Ceil uint32 F64x2ConvertI64x2S uint32 F64x2ConvertI64x2U uint32 F64x2ConvertLowI32x4S uint32 F64x2ConvertLowI32x4U uint32 F64x2Div uint32 F64x2Eq uint32 F64x2ExtractLane uint32 F64x2Floor uint32 F64x2Ge uint32 F64x2Gt uint32 F64x2Le uint32 F64x2Lt uint32 F64x2Max uint32 F64x2Min uint32 F64x2Mul uint32 F64x2Ne uint32 F64x2Nearest uint32 F64x2Neg uint32 F64x2PMax uint32 F64x2PMin uint32 F64x2PromoteLowF32x4 uint32 F64x2ReplaceLane uint32 F64x2Splat uint32 F64x2Sqrt uint32 F64x2Sub uint32 F64x2Trunc uint32 GlobalGet uint32 GlobalSet uint32 I16x8Abs uint32 I16x8Add uint32 I16x8AddSatS uint32 I16x8AddSatU uint32 I16x8AddSaturateS uint32 I16x8AddSaturateU uint32 I16x8AllTrue uint32 I16x8AnyTrue uint32 I16x8Bitmask uint32 I16x8Eq uint32 I16x8ExtAddPairwiseI8x16S uint32 I16x8ExtAddPairwiseI8x16U uint32 I16x8ExtMulHighI8x16S uint32 I16x8ExtMulHighI8x16U uint32 I16x8ExtMulLowI8x16S uint32 I16x8ExtMulLowI8x16U uint32 I16x8ExtendHighI8x16S uint32 I16x8ExtendHighI8x16U uint32 I16x8ExtendLowI8x16S uint32 I16x8ExtendLowI8x16U uint32 I16x8ExtractLaneS uint32 I16x8ExtractLaneU uint32 I16x8GeS uint32 I16x8GeU uint32 I16x8GtS uint32 I16x8GtU uint32 I16x8LeS uint32 I16x8LeU uint32 I16x8Load8x8S uint32 I16x8Load8x8U uint32 I16x8LtS uint32 I16x8LtU uint32 I16x8MaxS uint32 I16x8MaxU uint32 I16x8MinS uint32 I16x8MinU uint32 I16x8Mul uint32 I16x8NarrowI32x4S uint32 I16x8NarrowI32x4U uint32 I16x8Ne uint32 I16x8Neg uint32 I16x8Q15MulrSatS uint32 I16x8ReplaceLane uint32 I16x8RoundingAverageU uint32 I16x8Shl uint32 I16x8ShrS uint32 I16x8ShrU uint32 I16x8Splat uint32 I16x8Sub uint32 I16x8SubSatS uint32 I16x8SubSatU uint32 I16x8SubSaturateS uint32 I16x8SubSaturateU uint32 I16x8WidenHighI8x16S uint32 I16x8WidenHighI8x16U uint32 I16x8WidenLowI8x16S uint32 I16x8WidenLowI8x16U uint32 I32Add uint32 I32And uint32 I32AtomicLoad uint32 I32AtomicLoad16U uint32 I32AtomicLoad8U uint32 I32AtomicRmw16AddU uint32 I32AtomicRmw16AndU uint32 I32AtomicRmw16CmpxchgU uint32 I32AtomicRmw16OrU uint32 I32AtomicRmw16SubU uint32 I32AtomicRmw16XchgU uint32 I32AtomicRmw16XorU uint32 I32AtomicRmw8AddU uint32 I32AtomicRmw8AndU uint32 I32AtomicRmw8CmpxchgU uint32 I32AtomicRmw8OrU uint32 I32AtomicRmw8SubU uint32 I32AtomicRmw8XchgU uint32 I32AtomicRmw8XorU uint32 I32AtomicRmwAdd uint32 I32AtomicRmwAnd uint32 I32AtomicRmwCmpxchg uint32 I32AtomicRmwOr uint32 I32AtomicRmwSub uint32 I32AtomicRmwXchg uint32 I32AtomicRmwXor uint32 I32AtomicStore uint32 I32AtomicStore16 uint32 I32AtomicStore8 uint32 I32AtomicWait uint32 I32Clz uint32 I32Const uint32 I32Ctz uint32 I32DivS uint32 I32DivU uint32 I32Eq uint32 I32Eqz uint32 I32Extend16S uint32 I32Extend8S uint32 I32GeS uint32 I32GeU uint32 I32GtS uint32 I32GtU uint32 I32LeS uint32 I32LeU uint32 I32Load uint32 I32Load16S uint32 I32Load16U uint32 I32Load8S uint32 I32Load8U uint32 I32LtS uint32 I32LtU uint32 I32Mul uint32 I32Ne uint32 I32Or uint32 I32Popcnt uint32 I32ReinterpretF32 uint32 I32RemS uint32 I32RemU uint32 I32Rotl uint32 I32Rotr uint32 I32Shl uint32 I32ShrS uint32 I32ShrU uint32 I32Store uint32 I32Store16 uint32 I32Store8 uint32 I32Sub uint32 I32TruncF32S uint32 I32TruncF32U uint32 I32TruncF64S uint32 I32TruncF64U uint32 I32TruncSatF32S uint32 I32TruncSatF32U uint32 I32TruncSatF64S uint32 I32TruncSatF64U uint32 I32WrapI64 uint32 I32Xor uint32 I32x4Abs uint32 I32x4Add uint32 I32x4AllTrue uint32 I32x4AnyTrue uint32 I32x4Bitmask uint32 I32x4DotI16x8S uint32 I32x4Eq uint32 I32x4ExtAddPairwiseI16x8S uint32 I32x4ExtAddPairwiseI16x8U uint32 I32x4ExtMulHighI16x8S uint32 I32x4ExtMulHighI16x8U uint32 I32x4ExtMulLowI16x8S uint32 I32x4ExtMulLowI16x8U uint32 I32x4ExtendHighI16x8S uint32 I32x4ExtendHighI16x8U uint32 I32x4ExtendLowI16x8S uint32 I32x4ExtendLowI16x8U uint32 I32x4ExtractLane uint32 I32x4GeS uint32 I32x4GeU uint32 I32x4GtS uint32 I32x4GtU uint32 I32x4LeS uint32 I32x4LeU uint32 I32x4Load16x4S uint32 I32x4Load16x4U uint32 I32x4LtS uint32 I32x4LtU uint32 I32x4MaxS uint32 I32x4MaxU uint32 I32x4MinS uint32 I32x4MinU uint32 I32x4Mul uint32 I32x4Ne uint32 I32x4Neg uint32 I32x4ReplaceLane uint32 I32x4Shl uint32 I32x4ShrS uint32 I32x4ShrU uint32 I32x4Splat uint32 I32x4Sub uint32 I32x4TruncSatF32x4S uint32 I32x4TruncSatF32x4U uint32 I32x4TruncSatF64x2SZero uint32 I32x4TruncSatF64x2UZero uint32 I32x4WidenHighI16x8S uint32 I32x4WidenHighI16x8U uint32 I32x4WidenLowI16x8S uint32 I32x4WidenLowI16x8U uint32 I64Add uint32 I64And uint32 I64AtomicLoad uint32 I64AtomicLoad16U uint32 I64AtomicLoad32U uint32 I64AtomicLoad8U uint32 I64AtomicRmw16AddU uint32 I64AtomicRmw16AndU uint32 I64AtomicRmw16CmpxchgU uint32 I64AtomicRmw16OrU uint32 I64AtomicRmw16SubU uint32 I64AtomicRmw16XchgU uint32 I64AtomicRmw16XorU uint32 I64AtomicRmw32AddU uint32 I64AtomicRmw32AndU uint32 I64AtomicRmw32CmpxchgU uint32 I64AtomicRmw32OrU uint32 I64AtomicRmw32SubU uint32 I64AtomicRmw32XchgU uint32 I64AtomicRmw32XorU uint32 I64AtomicRmw8AddU uint32 I64AtomicRmw8AndU uint32 I64AtomicRmw8CmpxchgU uint32 I64AtomicRmw8OrU uint32 I64AtomicRmw8SubU uint32 I64AtomicRmw8XchgU uint32 I64AtomicRmw8XorU uint32 I64AtomicRmwAdd uint32 I64AtomicRmwAnd uint32 I64AtomicRmwCmpxchg uint32 I64AtomicRmwOr uint32 I64AtomicRmwSub uint32 I64AtomicRmwXchg uint32 I64AtomicRmwXor uint32 I64AtomicStore uint32 I64AtomicStore16 uint32 I64AtomicStore32 uint32 I64AtomicStore8 uint32 I64AtomicWait uint32 I64Clz uint32 I64Const uint32 I64Ctz uint32 I64DivS uint32 I64DivU uint32 I64Eq uint32 I64Eqz uint32 I64Extend16S uint32 I64Extend32S uint32 I64Extend8S uint32 I64ExtendI32S uint32 I64ExtendI32U uint32 I64GeS uint32 I64GeU uint32 I64GtS uint32 I64GtU uint32 I64LeS uint32 I64LeU uint32 I64Load uint32 I64Load16S uint32 I64Load16U uint32 I64Load32S uint32 I64Load32U uint32 I64Load8S uint32 I64Load8U uint32 I64LtS uint32 I64LtU uint32 I64Mul uint32 I64Ne uint32 I64Or uint32 I64Popcnt uint32 I64ReinterpretF64 uint32 I64RemS uint32 I64RemU uint32 I64Rotl uint32 I64Rotr uint32 I64Shl uint32 I64ShrS uint32 I64ShrU uint32 I64Store uint32 I64Store16 uint32 I64Store32 uint32 I64Store8 uint32 I64Sub uint32 I64TruncF32S uint32 I64TruncF32U uint32 I64TruncF64S uint32 I64TruncF64U uint32 I64TruncSatF32S uint32 I64TruncSatF32U uint32 I64TruncSatF64S uint32 I64TruncSatF64U uint32 I64Xor uint32 I64x2Abs uint32 I64x2Add uint32 I64x2AllTrue uint32 I64x2AnyTrue uint32 I64x2Bitmask uint32 I64x2Eq uint32 I64x2ExtMulHighI32x4S uint32 I64x2ExtMulHighI32x4U uint32 I64x2ExtMulLowI32x4S uint32 I64x2ExtMulLowI32x4U uint32 I64x2ExtendHighI32x4S uint32 I64x2ExtendHighI32x4U uint32 I64x2ExtendLowI32x4S uint32 I64x2ExtendLowI32x4U uint32 I64x2ExtractLane uint32 I64x2GeS uint32 I64x2GtS uint32 I64x2LeS uint32 I64x2Load32x2S uint32 I64x2Load32x2U uint32 I64x2LtS uint32 I64x2Mul uint32 I64x2Ne uint32 I64x2Neg uint32 I64x2ReplaceLane uint32 I64x2Shl uint32 I64x2ShrS uint32 I64x2ShrU uint32 I64x2Splat uint32 I64x2Sub uint32 I64x2TruncSatF64x2S uint32 I64x2TruncSatF64x2U uint32 I8x16Abs uint32 I8x16Add uint32 I8x16AddSatS uint32 I8x16AddSatU uint32 I8x16AddSaturateS uint32 I8x16AddSaturateU uint32 I8x16AllTrue uint32 I8x16AnyTrue uint32 I8x16Bitmask uint32 I8x16Eq uint32 I8x16ExtractLaneS uint32 I8x16ExtractLaneU uint32 I8x16GeS uint32 I8x16GeU uint32 I8x16GtS uint32 I8x16GtU uint32 I8x16LeS uint32 I8x16LeU uint32 I8x16LtS uint32 I8x16LtU uint32 I8x16MaxS uint32 I8x16MaxU uint32 I8x16MinS uint32 I8x16MinU uint32 I8x16Mul uint32 I8x16NarrowI16x8S uint32 I8x16NarrowI16x8U uint32 I8x16Ne uint32 I8x16Neg uint32 I8x16Popcnt uint32 I8x16ReplaceLane uint32 I8x16RoundingAverageU uint32 I8x16Shl uint32 I8x16ShrS uint32 I8x16ShrU uint32 I8x16Shuffle uint32 I8x16Splat uint32 I8x16Sub uint32 I8x16SubSatS uint32 I8x16SubSatU uint32 I8x16SubSaturateS uint32 I8x16SubSaturateU uint32 I8x16Swizzle uint32 If uint32 LocalGet uint32 LocalSet uint32 LocalTee uint32 LocalAllocate uint32 LocalsUnmetered uint32 Loop uint32 MaxMemoryGrow uint32 MaxMemoryGrowDelta uint32 MemoryAtomicNotify uint32 MemoryAtomicWait32 uint32 MemoryAtomicWait64 uint32 MemoryCopy uint32 MemoryFill uint32 MemoryGrow uint32 MemoryInit uint32 MemorySize uint32 Nop uint32 RefFunc uint32 RefIsNull uint32 RefNull uint32 Rethrow uint32 Return uint32 ReturnCall uint32 ReturnCallIndirect uint32 Select uint32 TableCopy uint32 TableFill uint32 TableGet uint32 TableGrow uint32 TableInit uint32 TableSet uint32 TableSize uint32 Throw uint32 Try uint32 TypedSelect uint32 Unreachable uint32 Unwind uint32 V128And uint32 V128AndNot uint32 V128AnyTrue uint32 V128Bitselect uint32 V128Const uint32 V128Load uint32 V128Load16Lane uint32 V128Load16Splat uint32 V128Load16x4S uint32 V128Load16x4U uint32 V128Load32Lane uint32 V128Load32Splat uint32 V128Load32Zero uint32 V128Load32x2S uint32 V128Load32x2U uint32 V128Load64Lane uint32 V128Load64Splat uint32 V128Load64Zero uint32 V128Load8Lane uint32 V128Load8Splat uint32 V128Load8x8S uint32 V128Load8x8U uint32 V128Not uint32 V128Or uint32 V128Store uint32 V128Store16Lane uint32 V128Store32Lane uint32 V128Store64Lane uint32 V128Store8Lane uint32 V128Xor uint32 V16x8LoadSplat uint32 V32x4LoadSplat uint32 V64x2LoadSplat uint32 V8x16LoadSplat uint32 V8x16Shuffle uint32 V8x16Swizzle uint32 }