transition

package
v0.0.0-...-de85661 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntrinsicGas

func IntrinsicGas(data []byte) (uint64, error)

计算给定数据的gas费用

Types

type ExecutionResult

type ExecutionResult struct {
	UsedGas    uint64 // 总gas,包括退还gas
	Err        error  // 执行过程中遇到的任何错误
	ReturnData []byte // 从evm返回的数据
}

执行结果返回体

func ApplyMessage

func ApplyMessage(ovm *vm.OVM, msg block2.Message, gp *GasPool) (*ExecutionResult, error)

请求虚拟机处理,返回gas费用,账单

func (*ExecutionResult) Failed

func (result *ExecutionResult) Failed() bool

Failed返回执行是否成功的指示器

func (*ExecutionResult) Return

func (result *ExecutionResult) Return() []byte

Return是一个帮助函数,用于帮助调用方区分还原原因和函数Return。 如果没有发生错误,Return返回执行后的数据。

func (*ExecutionResult) Revert

func (result *ExecutionResult) Revert() []byte

如果执行被“Revert”操作码中止,Revert返回具体的还原原因。注意:如果没有随还原操作码提供的数据,则原因可能为零。

type GasPool

type GasPool uint64

* gaspool

GasPool跟踪交易执行期间的可用气体量

func (*GasPool) AddGas

func (gp *GasPool) AddGas(amount uint64) *GasPool

gas可用于执行

func (*GasPool) Gas

func (gp *GasPool) Gas() uint64

gas返回池中剩余的gas量。

func (*GasPool) SubGas

func (gp *GasPool) SubGas(amount uint64) error

type Message

type Message interface {
	From() entity.Address
	To() *entity.Address

	GasPrice() *big.Int
	GasFeeCap() *big.Int
	GasTipCap() *big.Int
	Gas() uint64
	Value() *big.Int

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

消息表示发送到合同的消息。

type StateTransition

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

交易过渡结构体

func NewTransition

func NewTransition(ovm *vm.OVM, msg block2.Message, gp *GasPool) *StateTransition

交易过渡结构创建

func (*StateTransition) TransitionDb

func (st *StateTransition) TransitionDb() (*ExecutionResult, error)

当前核心消息处理并返回结果 1.使用的gas总量 2.evm返回的数据 3.错误信息

Jump to

Keyboard shortcuts

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