vmpart

package
v1.2.51 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockchainHookGateway

type BlockchainHookGateway struct {
	// contains filtered or unexported fields
}

BlockchainHookGateway forwards requests to the actual hook

func NewBlockchainHookGateway

func NewBlockchainHookGateway(messenger *VMMessenger) *BlockchainHookGateway

NewBlockchainHookGateway creates a new gateway

func (*BlockchainHookGateway) ClearCompiledCodes

func (blockchain *BlockchainHookGateway) ClearCompiledCodes()

ClearCompiledCodes nothing to do - this needs to be called by nodepart only

func (*BlockchainHookGateway) CurrentEpoch

func (blockchain *BlockchainHookGateway) CurrentEpoch() uint32

CurrentEpoch forwards a message to the actual hook

func (*BlockchainHookGateway) CurrentNonce

func (blockchain *BlockchainHookGateway) CurrentNonce() uint64

CurrentNonce forwards a message to the actual hook

func (*BlockchainHookGateway) CurrentRandomSeed

func (blockchain *BlockchainHookGateway) CurrentRandomSeed() []byte

CurrentRandomSeed forwards a message to the actual hook

func (*BlockchainHookGateway) CurrentRound

func (blockchain *BlockchainHookGateway) CurrentRound() uint64

CurrentRound forwards a message to the actual hook

func (*BlockchainHookGateway) CurrentTimeStamp

func (blockchain *BlockchainHookGateway) CurrentTimeStamp() uint64

CurrentTimeStamp forwards a message to the actual hook

func (*BlockchainHookGateway) GetAllState

func (blockchain *BlockchainHookGateway) GetAllState(address []byte) (map[string][]byte, error)

GetAllState forwards a message to the actual hook

func (*BlockchainHookGateway) GetBlockhash

func (blockchain *BlockchainHookGateway) GetBlockhash(nonce uint64) ([]byte, error)

GetBlockhash forwards a message to the actual hook

func (*BlockchainHookGateway) GetBuiltinFunctionNames

func (blockchain *BlockchainHookGateway) GetBuiltinFunctionNames() vmcommon.FunctionNames

GetBuiltinFunctionNames forwards a message to the actual hook

func (*BlockchainHookGateway) GetCode

func (blockchain *BlockchainHookGateway) GetCode(account vmcommon.UserAccountHandler) []byte

GetCode forwards a message to the actual hook

func (*BlockchainHookGateway) GetCompiledCode

func (blockchain *BlockchainHookGateway) GetCompiledCode(codeHash []byte) (bool, []byte)

GetCompiledCode forwards a message to the actual hook

func (*BlockchainHookGateway) GetESDTToken

func (blockchain *BlockchainHookGateway) GetESDTToken(address []byte, tokenID []byte, nonce uint64) (*esdt.ESDigitalToken, error)

ProcessBuiltInFunction forwards a message to the actual hook

func (*BlockchainHookGateway) GetShardOfAddress

func (blockchain *BlockchainHookGateway) GetShardOfAddress(address []byte) uint32

GetShardOfAddress forwards a message to the actual hook

func (*BlockchainHookGateway) GetSnapshot

func (blockchain *BlockchainHookGateway) GetSnapshot() int

GetSnapshot - not used in v1.2

func (*BlockchainHookGateway) GetStateRootHash

func (blockchain *BlockchainHookGateway) GetStateRootHash() []byte

GetStateRootHash forwards a message to the actual hook

func (*BlockchainHookGateway) GetStorageData

func (blockchain *BlockchainHookGateway) GetStorageData(address []byte, index []byte) ([]byte, uint32, error)

GetStorageData forwards a message to the actual hook

func (*BlockchainHookGateway) GetUserAccount

func (blockchain *BlockchainHookGateway) GetUserAccount(address []byte) (vmcommon.UserAccountHandler, error)

GetUserAccount forwards a message to the actual hook TODO: Perhaps cache GetUserAccount()? Since when it is called with address == contract address, the whole code is fetched.

func (*BlockchainHookGateway) IsInterfaceNil

func (blockchain *BlockchainHookGateway) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying implementation is nil

func (*BlockchainHookGateway) IsLimitedTransfer

func (blockchain *BlockchainHookGateway) IsLimitedTransfer(_ []byte) bool

IsLimitedTransfer - not used in v1.2

func (*BlockchainHookGateway) IsPaused

func (blockchain *BlockchainHookGateway) IsPaused(_ []byte) bool

IsPaused - not used in v1.2

func (*BlockchainHookGateway) IsPayable

func (blockchain *BlockchainHookGateway) IsPayable(_ []byte, rcvAddress []byte) (bool, error)

IsPayable forwards a message to the actual hook

func (*BlockchainHookGateway) IsSmartContract

func (blockchain *BlockchainHookGateway) IsSmartContract(address []byte) bool

IsSmartContract forwards a message to the actual hook

func (*BlockchainHookGateway) LastEpoch

func (blockchain *BlockchainHookGateway) LastEpoch() uint32

LastEpoch forwards a message to the actual hook

func (*BlockchainHookGateway) LastNonce

func (blockchain *BlockchainHookGateway) LastNonce() uint64

LastNonce forwards a message to the actual hook

func (*BlockchainHookGateway) LastRandomSeed

func (blockchain *BlockchainHookGateway) LastRandomSeed() []byte

LastRandomSeed forwards a message to the actual hook

func (*BlockchainHookGateway) LastRound

func (blockchain *BlockchainHookGateway) LastRound() uint64

LastRound forwards a message to the actual hook

func (*BlockchainHookGateway) LastTimeStamp

func (blockchain *BlockchainHookGateway) LastTimeStamp() uint64

LastTimeStamp forwards a message to the actual hook

func (*BlockchainHookGateway) NewAddress

func (blockchain *BlockchainHookGateway) NewAddress(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)

NewAddress forwards a message to the actual hook

func (*BlockchainHookGateway) ProcessBuiltInFunction

func (blockchain *BlockchainHookGateway) ProcessBuiltInFunction(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

ProcessBuiltInFunction forwards a message to the actual hook

func (*BlockchainHookGateway) RevertToSnapshot

func (blockchain *BlockchainHookGateway) RevertToSnapshot(_ int) error

RevertToSnapshot - not used in v1.2

func (*BlockchainHookGateway) SaveCompiledCode

func (blockchain *BlockchainHookGateway) SaveCompiledCode(codeHash []byte, code []byte)

SaveCompiledCode forwards a message to the actual hook

type CryptoHookGateway

type CryptoHookGateway struct {
}

CryptoHookGateway is a copy of the CryptoHook implementation from the node TODO: Remove this implementation and reference multiversx/common/crypto when it becomes available

func NewCryptoHookGateway

func NewCryptoHookGateway() *CryptoHookGateway

NewCryptoHookGateway creates a new crypto hook gateway

func (*CryptoHookGateway) Ecrecover

func (hook *CryptoHookGateway) Ecrecover(_ []byte, _ []byte, _ []byte, _ []byte) ([]byte, error)

Ecrecover calculates the corresponding Ethereum address for the public key which created the given signature https://ewasm.readthedocs.io/en/mkdocs/system_contracts/

func (*CryptoHookGateway) IsInterfaceNil

func (hook *CryptoHookGateway) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying implementation is nil

func (*CryptoHookGateway) Keccak256

func (hook *CryptoHookGateway) Keccak256(data []byte) ([]byte, error)

Keccak256 returns a keccak 256 hash of the input string. Should return in hex format

func (*CryptoHookGateway) Ripemd160

func (hook *CryptoHookGateway) Ripemd160(data []byte) ([]byte, error)

Ripemd160 is a legacy hash and should not be used for new applications

func (*CryptoHookGateway) Sha256

func (hook *CryptoHookGateway) Sha256(data []byte) ([]byte, error)

Sha256 returns a sha 256 hash of the input string. Should return in hex format

type VMMessenger

type VMMessenger struct {
	common.Messenger
}

VMMessenger is the messenger on VM's part of the pipe

func NewVMMessenger

func NewVMMessenger(reader *os.File, writer *os.File, marshalizer marshaling.Marshalizer) *VMMessenger

NewVMMessenger creates a new messenger

func (*VMMessenger) ReceiveNodeRequest

func (messenger *VMMessenger) ReceiveNodeRequest() (common.MessageHandler, error)

ReceiveNodeRequest waits for a request from Node

func (*VMMessenger) SendContractResponse

func (messenger *VMMessenger) SendContractResponse(response common.MessageHandler) error

SendContractResponse sends a contract response to the Node

func (*VMMessenger) SendHookCallRequest

func (messenger *VMMessenger) SendHookCallRequest(request common.MessageHandler) (common.MessageHandler, error)

SendHookCallRequest makes a hook call (over the pipe) and waits for the response

type VMPart

type VMPart struct {
	Messenger *VMMessenger
	VMHost    vmcommon.VMExecutionHandler
	Repliers  []common.MessageReplier
	Version   string
}

VMPart is the endpoint that implements the message loop on VM's side

func NewVMPart

func NewVMPart(
	version string,
	input *os.File,
	output *os.File,
	vmHostParameters *vmhost.VMHostParameters,
	marshalizer marshaling.Marshalizer,
) (*VMPart, error)

NewVMPart creates the VM part

func (*VMPart) StartLoop

func (part *VMPart) StartLoop() error

StartLoop runs the main loop

Jump to

Keyboard shortcuts

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