arwenpart

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 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 ArwenMessenger

type ArwenMessenger struct {
	common.Messenger
}

ArwenMessenger is the messenger on Arwen's part of the pipe

func NewArwenMessenger

func NewArwenMessenger(reader *os.File, writer *os.File, marshalizer marshaling.Marshalizer) *ArwenMessenger

NewArwenMessenger creates a new messenger

func (*ArwenMessenger) ReceiveNodeRequest

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

ReceiveNodeRequest waits for a request from Node

func (*ArwenMessenger) SendContractResponse

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

SendContractResponse sends a contract response to the Node

func (*ArwenMessenger) SendHookCallRequest

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

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

type ArwenPart

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

ArwenPart is the endpoint that implements the message loop on Arwen's side

func NewArwenPart

func NewArwenPart(
	version string,
	input *os.File,
	output *os.File,
	vmHostParameters *arwen.VMHostParameters,
	marshalizer marshaling.Marshalizer,
) (*ArwenPart, error)

NewArwenPart creates the Arwen part

func (*ArwenPart) StartLoop

func (part *ArwenPart) StartLoop() error

StartLoop runs the main loop

type BlockchainHookGateway

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

BlockchainHookGateway forwards requests to the actual hook

func NewBlockchainHookGateway

func NewBlockchainHookGateway(messenger *ArwenMessenger) *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, 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) IsPayable

func (blockchain *BlockchainHookGateway) IsPayable(address []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(snapshot 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 ElrondNetwork/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

Jump to

Keyboard shortcuts

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