executor

package
v0.0.0-...-0abe6a2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// EvmAddress 本合约地址
	EvmAddress = address.ExecAddress(types.ExecName(evmtypes.ExecutorName))
)

Functions

func CanTransfer

func CanTransfer(db state.EVMStateDB, sender, recipient common.Address, amount uint64) bool

CanTransfer 检查合约调用账户是否有充足的金额进行转账交易操作

func GetHashFn

func GetHashFn(api client.QueueProtocolAPI) func(blockHeight uint64) common.Hash

GetHashFn 获取制定高度区块的哈希

func GetName

func GetName() string

GetName 返回本合约名称

func Init

func Init(name string, sub []byte)

Init 初始化本合约对象

func Transfer

func Transfer(db state.EVMStateDB, sender, recipient common.Address, amount uint64) bool

Transfer 在内存数据库中执行转账操作(只修改内存中的金额) 从外部账户地址到合约账户地址

Types

type EVMExecutor

type EVMExecutor struct {
	drivers.DriverBase
	// contains filtered or unexported fields
}

EVMExecutor EVM执行器结构

func NewEVMExecutor

func NewEVMExecutor() *EVMExecutor

NewEVMExecutor 新创建执行器对象

func (*EVMExecutor) Allow

func (evm *EVMExecutor) Allow(tx *types.Transaction, index int) error

Allow 允许哪些交易在本命执行器执行

func (*EVMExecutor) CheckInit

func (evm *EVMExecutor) CheckInit()

CheckInit 检查是否初始化数据库

func (*EVMExecutor) CheckReceiptExecOk

func (evm *EVMExecutor) CheckReceiptExecOk() bool

CheckReceiptExecOk return true to check if receipt ty is ok

func (*EVMExecutor) CheckTx

func (evm *EVMExecutor) CheckTx(tx *types.Transaction, index int) error

CheckTx 校验交易

func (*EVMExecutor) Exec

func (evm *EVMExecutor) Exec(tx *types.Transaction, index int) (*types.Receipt, error)

Exec 本合约执行逻辑

func (*EVMExecutor) ExecDelLocal

func (evm *EVMExecutor) ExecDelLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal 处理区块回滚

func (*EVMExecutor) ExecLocal

func (evm *EVMExecutor) ExecLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal 处理本地区块新增逻辑

func (*EVMExecutor) ExecutorOrder

func (evm *EVMExecutor) ExecutorOrder() int64

ExecutorOrder 设置localdb的EnableRead

func (*EVMExecutor) GetActionName

func (evm *EVMExecutor) GetActionName(tx *types.Transaction) string

GetActionName 获取运行状态名

func (*EVMExecutor) GetDriverName

func (evm *EVMExecutor) GetDriverName() string

GetDriverName 获取本合约驱动名称

func (*EVMExecutor) GetFuncMap

func (evm *EVMExecutor) GetFuncMap() map[string]reflect.Method

GetFuncMap 获取方法列表

func (*EVMExecutor) GetMStateDB

func (evm *EVMExecutor) GetMStateDB() *state.MemoryStateDB

GetMStateDB 获取内部状态数据库

func (*EVMExecutor) GetMessage

func (evm *EVMExecutor) GetMessage(tx *types.Transaction) (msg *common.Message, err error)

GetMessage 目前的交易中,如果是coins交易,金额是放在payload的,但是合约不行,需要修改Transaction结构

func (*EVMExecutor) GetVMConfig

func (evm *EVMExecutor) GetVMConfig() *runtime.Config

GetVMConfig 获取VM配置

func (*EVMExecutor) IsFriend

func (evm *EVMExecutor) IsFriend(myexec, writekey []byte, othertx *types.Transaction) bool

IsFriend 是否允许对应的KEY

func (*EVMExecutor) NewEVMContext

func (evm *EVMExecutor) NewEVMContext(msg *common.Message) runtime.Context

NewEVMContext 构造一个新的EVM上下文对象

func (*EVMExecutor) Query_CheckAddrExists

func (evm *EVMExecutor) Query_CheckAddrExists(in *evmtypes.CheckEVMAddrReq) (types.Message, error)

Query_CheckAddrExists 检查合约地址是否存在,此操作不会改变任何状态,所以可以直接从statedb查询

func (*EVMExecutor) Query_EstimateGas

func (evm *EVMExecutor) Query_EstimateGas(in *evmtypes.EstimateEVMGasReq) (types.Message, error)

Query_EstimateGas 此方法用来估算合约消耗的Gas,不能修改原有执行器的状态数据

func (*EVMExecutor) Query_EvmDebug

func (evm *EVMExecutor) Query_EvmDebug(in *evmtypes.EvmDebugReq) (types.Message, error)

Query_EvmDebug 此方法用来估算合约消耗的Gas,不能修改原有执行器的状态数据

func (*EVMExecutor) Query_Query

func (evm *EVMExecutor) Query_Query(in *evmtypes.EvmQueryReq) (types.Message, error)

Query_Query 此方法用来调用合约的只读接口,不修改原有执行器的状态数据

func (*EVMExecutor) Query_QueryABI

func (evm *EVMExecutor) Query_QueryABI(in *evmtypes.EvmQueryAbiReq) (types.Message, error)

Query_QueryABI 此方法用来查询合约绑定的ABI数据,不修改原有执行器的状态数据

Directories

Path Synopsis
vm
common/crypto/bn256
Package bn256 implements a particular bilinear group at the 128-bit security level.
Package bn256 implements a particular bilinear group at the 128-bit security level.
gas
mm

Jump to

Keyboard shortcuts

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