evm

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataStackInitialCapacity    = 1024
	MaximumAllowedBlockLookBack = 256
)

Variables

This section is empty.

Functions

func Is64BitOverflow

func Is64BitOverflow(word Word256) bool

Types

type Code added in v0.34.4

type Code struct {
	Bytecode     acm.Bytecode
	OpcodeBitset bitset.Bitset
}

func NewCode added in v0.34.4

func NewCode(code []byte) *Code

Build a Code object that includes analysis of which symbols are opcodes versus push data

func (*Code) GetBytecode added in v0.34.4

func (code *Code) GetBytecode() acm.Bytecode

func (*Code) GetSymbol added in v0.34.4

func (code *Code) GetSymbol(n uint64) asm.OpCode

func (*Code) IsOpcode added in v0.34.4

func (code *Code) IsOpcode(indexOfSymbolInCode uint64) bool

func (*Code) IsPushData added in v0.34.4

func (code *Code) IsPushData(indexOfSymbolInCode uint64) bool

func (*Code) Length added in v0.34.4

func (code *Code) Length() uint64

type Contract added in v0.34.4

type Contract struct {
	*EVM
	*Code
}

func (*Contract) Call added in v0.34.4

func (c *Contract) Call(state engine.State, params engine.CallParams) ([]byte, error)

type EVM added in v0.34.4

type EVM struct {

	// Provide any foreign dispatchers to allow calls between VMs
	engine.Externals
	// contains filtered or unexported fields
}

func Default added in v0.34.4

func Default() *EVM

func New added in v0.34.4

func New(options engine.Options) *EVM

func (*EVM) Contract added in v0.34.4

func (vm *EVM) Contract(code []byte) *Contract

func (*EVM) Dispatch added in v0.34.4

func (vm *EVM) Dispatch(acc *acm.Account) engine.Callable

func (*EVM) Execute added in v0.34.4

func (vm *EVM) Execute(st acmstate.ReaderWriter, blockchain engine.Blockchain, eventSink exec.EventSink,
	params engine.CallParams, code []byte) ([]byte, error)

Initiate an EVM call against the provided state pushing events to eventSink. code should contain the EVM bytecode, input the CallData (readable by CALLDATALOAD), value the amount of native token to transfer with the call an quantity metering the number of computational steps available to the execution according to the gas schedule.

func (*EVM) SetLogger added in v0.34.4

func (vm *EVM) SetLogger(logger *logging.Logger)

func (*EVM) SetNonce added in v0.34.4

func (vm *EVM) SetNonce(nonce []byte)

Sets a new nonce and resets the sequence number. Nonces should only be used once! A global counter or sufficient randomness will work.

type Stack

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

Not goroutine safe

func NewStack

func NewStack(errSink errors.Sink, initialCapacity uint64, maxCapacity uint64, gas *big.Int) *Stack

func (*Stack) Dup

func (st *Stack) Dup(n int)

func (*Stack) Len

func (st *Stack) Len() int

func (*Stack) Peek

func (st *Stack) Peek() Word256

Not an opcode, costs no gas.

func (*Stack) Pop

func (st *Stack) Pop() Word256

func (*Stack) Pop64

func (st *Stack) Pop64() uint64

func (*Stack) PopAddress added in v0.23.0

func (st *Stack) PopAddress() crypto.Address

func (*Stack) PopBigInt

func (st *Stack) PopBigInt() *big.Int

func (*Stack) PopBigIntSigned

func (st *Stack) PopBigIntSigned() *big.Int

func (*Stack) PopBytes

func (st *Stack) PopBytes() []byte

func (*Stack) Print

func (st *Stack) Print(n int)

func (*Stack) Push

func (st *Stack) Push(d Word256)

func (*Stack) Push64

func (st *Stack) Push64(i uint64)

func (*Stack) PushAddress added in v0.23.0

func (st *Stack) PushAddress(address crypto.Address)

func (*Stack) PushBigInt

func (st *Stack) PushBigInt(bigInt *big.Int) Word256

Pushes the bigInt as a Word256 encoding negative values in 32-byte twos complement and returns the encoded result

func (*Stack) PushBytes

func (st *Stack) PushBytes(bz []byte)

currently only called after sha3.Sha3

func (*Stack) Swap

func (st *Stack) Swap(n int)

Directories

Path Synopsis
asm
bc

Jump to

Keyboard shortcuts

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