evm

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName         = "evm"
	DatabaseCache   = 128
	DatabaseHandles = 1024
	MaxKey          = 256
	MaxValue        = 4096

	// With 2.2 GHz Intel Core i7, 16 GB 2400 MHz DDR4, 256GB SSD, we tested following contract, it takes about 24157 gas and 171.193µs.
	// function setVal(uint256 _val) public {
	//	val = _val;
	//	emit SetVal(_val,_val);
	//  emit SetValByWho("a name which length is bigger than 32 bytes",msg.sender, _val);
	// }
	// So we estimate that running out of 100000000 gas may be taken at least 1s to 10s
	EVMGasLimit uint64 = 100000000
)
View Source
const (
	PageNumLen  = 4
	PageSizeLen = 4
)

Variables

View Source
var (
	ReceiptsPrefix = []byte("receipts-")
	KvPrefix       = []byte("kvstore-")

	EmptyTrieRoot = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")

	IsHomestead = true
)
View Source
var (
	KvHistoryPrefix = []byte("kvh_")
	KvSizePrefix    = []byte("_size_")
)

Functions

func NewEthTxPool

func NewEthTxPool(app *EVMApp, conf *viper.Viper) *ethTxPool

func OpenDatabase

func OpenDatabase(datadir string, name string, cache int, handles int) (ethdb.Database, error)

Types

type BeginExecFunc

type BeginExecFunc func() (ExecFunc, EndExecFunc)

type BlockChainEvm

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

reference ethereum BlockChain

func NewBlockChain

func NewBlockChain(db ethdb.Database) *BlockChainEvm

func (*BlockChainEvm) GetHeader

func (bc *BlockChainEvm) GetHeader(hash common.Hash, number uint64) *etypes.Header

type EVMApp

type EVMApp struct {
	gtypes.BaseApplication
	AngineHooks gtypes.Hooks

	Config *viper.Viper

	Signer etypes.Signer
	// contains filtered or unexported fields
}

func NewEVMApp

func NewEVMApp(config *viper.Viper) (*EVMApp, error)

func (*EVMApp) BeginExecute

func (app *EVMApp) BeginExecute()

func (*EVMApp) CheckTx

func (app *EVMApp) CheckTx(bs []byte) (from common.Address, nonce uint64, err error)

func (*EVMApp) CompatibleWithAngine

func (app *EVMApp) CompatibleWithAngine()

func (*EVMApp) GetAddressFromTx added in v1.4.3

func (app *EVMApp) GetAddressFromTx(tx *etypes.Transaction) (from common.Address, err error)

func (*EVMApp) GetAngineHooks

func (app *EVMApp) GetAngineHooks() gtypes.Hooks

func (*EVMApp) GetTxPool

func (app *EVMApp) GetTxPool() gtypes.TxPool

func (*EVMApp) Info

func (app *EVMApp) Info() (resInfo gtypes.ResultInfo)

func (*EVMApp) OnCommit

func (app *EVMApp) OnCommit(height, round int64, block *gtypes.Block) (interface{}, error)

OnCommit run in a sync way, we don't need to lock stateDupMtx, but stateMtx is still needed

func (*EVMApp) OnExecute

func (app *EVMApp) OnExecute(height, round int64, block *gtypes.Block) (interface{}, error)

func (*EVMApp) OnNewRound

func (app *EVMApp) OnNewRound(height, round int64, block *gtypes.Block) (interface{}, error)

func (*EVMApp) OnPrevote

func (app *EVMApp) OnPrevote(height, round int64, block *gtypes.Block) (interface{}, error)

func (*EVMApp) Query

func (app *EVMApp) Query(query []byte) (res gtypes.Result)

func (*EVMApp) SaveReceipts

func (app *EVMApp) SaveReceipts() ([]byte, error)

func (*EVMApp) SetCore

func (app *EVMApp) SetCore(core gtypes.Core)

func (*EVMApp) Start

func (app *EVMApp) Start() (err error)

func (*EVMApp) Stop

func (app *EVMApp) Stop()

type EndExecFunc

type EndExecFunc func(bs []byte, err error) bool

type ExecFunc

type ExecFunc func(index int, raw []byte, tx *etypes.Transaction) error

type KeyValueHistoryManager added in v1.5.0

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

func NewKeyValueHistoryManager added in v1.5.0

func NewKeyValueHistoryManager(db ethdb.Database) *KeyValueHistoryManager

func (*KeyValueHistoryManager) Close added in v1.5.0

func (m *KeyValueHistoryManager) Close()

func (*KeyValueHistoryManager) Get added in v1.5.0

func (m *KeyValueHistoryManager) Get(key []byte, index uint32) (history *types.ValueUpdateHistory, err error)

func (*KeyValueHistoryManager) GetKeyHistorySize added in v1.5.0

func (m *KeyValueHistoryManager) GetKeyHistorySize(key []byte) (uint32, error)

func (*KeyValueHistoryManager) NewBatch added in v1.5.0

func (m *KeyValueHistoryManager) NewBatch() *kvBatch

func (*KeyValueHistoryManager) Query added in v1.5.0

func (m *KeyValueHistoryManager) Query(key []byte, pageNo uint32, pageSize uint32) (histories []*types.ValueUpdateHistory, total uint32, err error)

func (*KeyValueHistoryManager) SaveKeyHistory added in v1.5.0

func (m *KeyValueHistoryManager) SaveKeyHistory(kvs types.KeyValueHistories) error

type LastBlockInfo

type LastBlockInfo struct {
	Height  int64
	AppHash []byte
}

Jump to

Keyboard shortcuts

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