hvm

package
v0.0.0-...-5e88e9b Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOutOfGas                 = errors.New("out of gas")
	ErrCodeStoreOutOfGas        = errors.New("contract creation code storage out of gas")
	ErrDepth                    = errors.New("max call depth exceeded")
	ErrTraceLimitReached        = errors.New("the number of logs reached the specified limit")
	ErrInsufficientBalance      = errors.New("insufficient balance for transfer")
	ErrContractAddressCollision = errors.New("contract address collision")
	// ErrGasLimitReached is returned by the gas pool if the amount of gas required
	// by a transaction is higher than what's left in the block.
	ErrGasLimitReached = errors.New("gas limit reached")
)

Functions

func CanTransfer

func CanTransfer(db evm.StateDB, addr common.Address, amount *big.Int) bool

CanTransfer checks wether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.

func GetHashFn

func GetHashFn(ref *types.Header, chain ChainContext) func(n uint64) common.Hash

GetHashFn returns a GetHashFunc which retrieves header hashes by number

func NewEVMContext

func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author *common.Address) evm.Context

NewEVMContext creates a new context for use in the EVM.

func Transfer

func Transfer(db evm.StateDB, sender, recipient common.Address, amount *big.Int)

Transfer subtracts amount from sender and adds amount to recipient using the given Db

Types

type ChainContext

type ChainContext interface {
	// Engine retrieves the chain's consensus engine.
	Engine() consensus.Engine

	// GetHeader returns the hash corresponding to their hash.
	GetHeader(common.Hash, uint64) *types.Header
}

ChainContext supports retrieving headers and consensus parameters from the current blockchain to be used during transaction processing.

type GasPool

type GasPool big.Int

GasPool tracks the amount of gas available during execution of the transactions in a block. The zero value is a pool with zero gas available.

func (*GasPool) AddGas

func (gp *GasPool) AddGas(amount *big.Int) *GasPool

AddGas makes gas available for execution.

func (*GasPool) String

func (gp *GasPool) String() string

func (*GasPool) SubGas

func (gp *GasPool) SubGas(amount *big.Int) error

SubGas deducts the given amount from the pool if enough gas is available and returns an error otherwise.

type Message

type Message interface {
	From() common.Address
	//FromFrontier() (common.Address, error)
	To() *common.Address

	GasPrice() *big.Int
	Gas() *big.Int
	Value() *big.Int

	Nonce() uint64
	CheckNonce() bool
	Data() []byte
}

Message represents a message sent to a contract.

Directories

Path Synopsis
evm
package evm implements the Hpb Virtual Machine.
package evm implements the Hpb Virtual Machine.
runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.

Jump to

Keyboard shortcuts

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