Version: v1.65.3 Latest Latest

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

Go to latest
Published: Oct 19, 2021 License: BSD-3-Clause Imports: 5 Imported by: 6




This section is empty.


This section is empty.


func MemoryCall

func MemoryCall(stack *Stack) (uint64, bool)

MemoryCall call所需内存大小

func MemoryCallDataCopy

func MemoryCallDataCopy(stack *Stack) (uint64, bool)

MemoryCallDataCopy callDataCopy所需内存大小

func MemoryCodeCopy

func MemoryCodeCopy(stack *Stack) (uint64, bool)

MemoryCodeCopy codeCopy所需内存大小

func MemoryCreate

func MemoryCreate(stack *Stack) (uint64, bool)

MemoryCreate create所需内存大小

func MemoryDelegateCall

func MemoryDelegateCall(stack *Stack) (uint64, bool)

MemoryDelegateCall delegateCall所需内存大小

func MemoryExtCodeCopy

func MemoryExtCodeCopy(stack *Stack) (uint64, bool)

MemoryExtCodeCopy extCodeCopy所需内存大小

func MemoryLog

func MemoryLog(stack *Stack) (uint64, bool)

MemoryLog log所需内存大小

func MemoryMLoad

func MemoryMLoad(stack *Stack) (uint64, bool)

MemoryMLoad mload所需内存大小

func MemoryMStore

func MemoryMStore(stack *Stack) (uint64, bool)

MemoryMStore mstore所需内存大小

func MemoryMStore8

func MemoryMStore8(stack *Stack) (uint64, bool)

MemoryMStore8 mstore8所需内存大小

func MemoryReturn

func MemoryReturn(stack *Stack) (uint64, bool)

MemoryReturn return所需内存大小

func MemoryReturnDataCopy

func MemoryReturnDataCopy(stack *Stack) (uint64, bool)

MemoryReturnDataCopy returnDataCopy所需内存大小

func MemoryRevert

func MemoryRevert(stack *Stack) (uint64, bool)

MemoryRevert revert所需内存大小

func MemorySha3

func MemorySha3(stack *Stack) (uint64, bool)

MemorySha3 sha3计算所需内存大小

func MemoryStaticCall

func MemoryStaticCall(stack *Stack) (uint64, bool)

MemoryStaticCall staticCall所需内存大小

func ReturnRStack added in v1.65.1

func ReturnRStack(rs *ReturnStack)

ReturnRStack 将returnStack还给rStackPool

func Returnstack added in v1.65.1

func Returnstack(s *Stack)

Returnstack 把用完的stack还给stackpool


type Memory

type Memory struct {
	// Store 内存中存储的数据
	Store []byte
	// LastGasCost 上次开辟内存消耗的Gas
	LastGasCost uint64

Memory 内存操作封装,在EVM中使用此对象模拟物理内存

func NewMemory

func NewMemory() *Memory

NewMemory 创建内存对象结构

func (*Memory) Data

func (m *Memory) Data() []byte

Data 返回内存中的原始数据引用

func (*Memory) Get

func (m *Memory) Get(offset, size int64) (cpy []byte)

Get 获取内存中制定偏移量开始的指定长度的数据,返回数据的拷贝而非引用

func (*Memory) GetCopy added in v1.65.3

func (m *Memory) GetCopy(offset, size int64) (cpy []byte)

Get returns offset + size as a new slice

func (*Memory) GetPtr

func (m *Memory) GetPtr(offset, size int64) []byte

GetPtr 同Get操作,不过这里返回的是数据引用

func (*Memory) Len

func (m *Memory) Len() int

Len 返回内存中已开辟空间的大小(以字节计算)

func (*Memory) Print

func (m *Memory) Print()

Print 打印内存中的数据(调试用)

func (*Memory) Resize

func (m *Memory) Resize(size uint64)

Resize 扩充内存到指定大小

func (*Memory) Set

func (m *Memory) Set(offset, size uint64, value []byte) (err error)

Set 设置内存中的值, value => offset:offset + size

func (*Memory) Set32

func (m *Memory) Set32(offset uint64, val *uint256.Int) (err error)

Set32 从offset开始设置32个字节的内存值,如果值长度不足32个字节,左零值填充

type MemorySizeFunc

type MemorySizeFunc func(*Stack) (size uint64, overflow bool)

MemorySizeFunc 计算所需内存大小

type ReturnStack added in v1.65.1

type ReturnStack struct {
	// contains filtered or unexported fields

ReturnStack 返回栈对象

func NewReturnStack added in v1.65.1

func NewReturnStack() *ReturnStack

NewReturnStack 返回栈对象封装,提供常用的返回栈操作

func (*ReturnStack) Data added in v1.65.1

func (st *ReturnStack) Data() []uint32

Data 返回栈中的所有底层数据

func (*ReturnStack) Len added in v1.65.1

func (st *ReturnStack) Len() int

Len ReturnStack大小

func (*ReturnStack) Pop added in v1.65.1

func (st *ReturnStack) Pop() (ret uint32)

Pop A uint32 is sufficient as for code below 4.2G

func (*ReturnStack) Push added in v1.65.1

func (st *ReturnStack) Push(d uint32)

Push 压栈

type Stack

type Stack struct {
	// contains filtered or unexported fields

Stack 栈对象封装,提供常用的栈操作

func NewStack

func NewStack() *Stack

NewStack 新创建栈对象

func (*Stack) Back

func (st *Stack) Back(n int) *uint256.Int

Back 返回第n个取值

func (*Stack) Data

func (st *Stack) Data() []uint256.Int

Data 返回栈中的所有底层数据

func (*Stack) Dup

func (st *Stack) Dup(n int)

Dup 复制栈中指定位置的数据的栈顶

func (*Stack) Len

func (st *Stack) Len() int

Len 栈长度

func (*Stack) Peek

func (st *Stack) Peek() *uint256.Int

Peek 返回顶端数据

func (*Stack) Pop

func (st *Stack) Pop() (ret uint256.Int)

Pop 弹出栈顶数据

func (*Stack) Print

func (st *Stack) Print()

Print 印栈对象(调试用)

func (*Stack) Push

func (st *Stack) Push(d *uint256.Int)

Push 数据入栈

func (*Stack) PushN

func (st *Stack) PushN(ds ...uint256.Int)

PushN 同时压栈多个数据

func (*Stack) Require

func (st *Stack) Require(n int) error

Require 检查栈是否满足长度要求

func (*Stack) Swap

func (st *Stack) Swap(n int)

Swap 将栈顶数据和栈中指定位置的数据互换位置

type StackValidationFunc

type StackValidationFunc func(*Stack) error

StackValidationFunc 校验栈中数据是否满足计算要求

func MakeDupStackFunc

func MakeDupStackFunc(n int) StackValidationFunc

MakeDupStackFunc 创建栈大小计算方法对象

func MakeStackFunc

func MakeStackFunc(pop, push int) StackValidationFunc

MakeStackFunc 栈校验的通用逻辑封装(主要就是检查栈的深度和空间是否够用)

func MakeSwapStackFunc

func MakeSwapStackFunc(n int) StackValidationFunc

MakeSwapStackFunc 创建栈大小计算方法对象

Jump to

Keyboard shortcuts

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