evm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: LGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OfficialAddress     = "0x7752b42608a0f1943c19fc5802cb027e60b4c911"
	StateRemoveEmptyObj = true
	APP_NAME            = "evm"
	DatabaseCache       = 128
	DatabaseHandles     = 1024
)

Variables

View Source
var (
	ErrRevertFromBackup = errors.New("revert from backup,not find data")
	ErrDataTransfer     = errors.New("data transfer err")
)
View Source
var (
	ReceiptsPrefix = []byte("receipts-")
	ABIPrefix      = []byte("solidity-abi-")

	EVMTag                 = []byte{'e', 'v', 'm'}
	EVMTxTag               = append(EVMTag, 0x01)
	EVMCreateContractTxTag = append(EVMTag, 0x02)
)
View Source
var (
	EmptyTrieRoot = ethcmn.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
	EthSigner     = ethtypes.HomesteadSigner{}
	IsHomestead   = true
)

Functions

func EncodeCreateContract

func EncodeCreateContract(tx CreateContractTx) ([]byte, error)

func OpenDatabase

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

Types

type AppTool

type AppTool struct {
	agtypes.BaseAppTool
	// contains filtered or unexported fields
}

func (*AppTool) BackupLastBlock

func (t *AppTool) BackupLastBlock(branchName string) error

func (*AppTool) Init

func (t *AppTool) Init(datadir string) error

func (*AppTool) LastHeightHash

func (t *AppTool) LastHeightHash() (def.INT, []byte)

func (*AppTool) SaveNewLastBlock

func (t *AppTool) SaveNewLastBlock(fromHeight def.INT, fromAppHash []byte) error

type CreateContractTx

type CreateContractTx struct {
	EthTx  []byte
	EthAbi []byte
}

CreateContractTx wraps ethereum tx bytes with the abi json bytes for this contract

func DecodeCreateContract

func DecodeCreateContract(bs []byte) (*CreateContractTx, error)

type EVMApp

type EVMApp struct {
	agtypes.BaseApplication
	agtypes.CommApplication

	civil.EventAppBase

	Config      *viper.Viper
	AngineHooks agtypes.Hooks
	// contains filtered or unexported fields
}

func NewEVMApp

func NewEVMApp(logger *zap.Logger, config *viper.Viper, privkey crypto.PrivKey) (*EVMApp, error)

func (*EVMApp) CheckTx

func (app *EVMApp) CheckTx(bs []byte) error

func (*EVMApp) CompatibleWithAngine

func (app *EVMApp) CompatibleWithAngine()

func (*EVMApp) ExecuteEVMTx

func (app *EVMApp) ExecuteEVMTx(stateDup *stateDup, header *ethtypes.Header, blockHash ethcmn.Hash, tx *ethtypes.Transaction, txIndex int) (hash []byte, err error)

ExecuteEVMTx execute tx one by one in the loop, without lock, so should always be called between Lock() and Unlock() on the *stateDup

func (*EVMApp) GetAngineHooks

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

func (*EVMApp) HandleEvent

func (app *EVMApp) HandleEvent(eventData civil.EventData, notification *civil.EventNotificationTx)

func (*EVMApp) Info

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

func (*EVMApp) OnCommit

func (app *EVMApp) OnCommit(height, round def.INT, block *agtypes.BlockCache) (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 def.INT, block *agtypes.BlockCache) (interface{}, error)

func (*EVMApp) OnNewRound

func (app *EVMApp) OnNewRound(height, round def.INT, block *agtypes.BlockCache) (interface{}, error)

func (*EVMApp) OnPrevote

func (app *EVMApp) OnPrevote(height, round def.INT, block *agtypes.BlockCache) (interface{}, error)

OnPrevote deprecated

func (*EVMApp) Query

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

func (*EVMApp) SaveReceipts

func (app *EVMApp) SaveReceipts(stdup *stateDup) []byte

func (*EVMApp) SetCore

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

func (*EVMApp) Start

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

func (*EVMApp) Stop

func (app *EVMApp) Stop()

type LastBlockInfo

type LastBlockInfo struct {
	Height  def.INT
	AppHash []byte
}

Jump to

Keyboard shortcuts

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