corepart

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: GPL-3.0 Imports: 12 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 *CoreMessenger) *BlockchainHookGateway

NewBlockchainHookGateway creates a new gateway

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) GetShardOfAddress

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

GetShardOfAddress forwards a message to the actual hook

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) IsPayable added in v0.0.2

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

type CoreMessenger

type CoreMessenger struct {
	common.Messenger
}

CoreMessenger is the messenger on Core's part of the pipe

func NewCoreMessenger

func NewCoreMessenger(reader *os.File, writer *os.File, marshalizer marshaling.Marshalizer) *CoreMessenger

NewCoreMessenger creates a new messenger

func (*CoreMessenger) ReceiveNodeRequest

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

ReceiveNodeRequest waits for a request from Node

func (*CoreMessenger) SendContractResponse

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

SendContractResponse sends a contract response to the Node

func (*CoreMessenger) SendHookCallRequest

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

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

type CorePart

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

CorePart is the endpoint that implements the message loop on Core's side

func NewCorePart

func NewCorePart(
	version string,
	input *os.File,
	output *os.File,
	vmHostParameters *core.VMHostParameters,
	marshalizer marshaling.Marshalizer,
) (*CorePart, error)

NewCorePart creates the Core part

func (*CorePart) StartLoop

func (part *CorePart) StartLoop() error

StartLoop runs the main loop

type CryptoHookGateway

type CryptoHookGateway struct {
}

CryptoHookGateway is a copy of the CryptoHook implementation from the node TODO: Remove this implementation and reference DharitriNetwork/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(hash []byte, recoveryID []byte, r []byte, s []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) 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