burrow: github.com/hyperledger/burrow/execution/evm Index | Files | Directories

package evm

import "github.com/hyperledger/burrow/execution/evm"

Index

Package Files

code.go contract.go evm.go memory.go stack.go

Constants

const (
    DataStackInitialCapacity    = 1024
    MaximumAllowedBlockLookBack = 256
)

func Is64BitOverflow Uses

func Is64BitOverflow(word Word256) bool

type Code Uses

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

func NewCode Uses

func NewCode(code []byte) *Code

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

func (*Code) GetBytecode Uses

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

func (*Code) GetSymbol Uses

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

func (*Code) IsOpcode Uses

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

func (*Code) IsPushData Uses

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

func (*Code) Length Uses

func (code *Code) Length() uint64

type Contract Uses

type Contract struct {
    *EVM
    *Code
}

func (*Contract) Call Uses

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

type EVM Uses

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

func Default Uses

func Default() *EVM

func New Uses

func New(options Options) *EVM

func (*EVM) Contract Uses

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

func (*EVM) Dispatch Uses

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

func (*EVM) Execute Uses

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) SetExternals Uses

func (vm *EVM) SetExternals(externals engine.Dispatcher)

func (*EVM) SetLogger Uses

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

func (*EVM) SetNonce Uses

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 Memory Uses

type Memory interface {
    // Read a value from the memory store starting at offset
    // (index of first byte will equal offset). The value will be returned as a
    // length-bytes byte slice. Returns an error if the memory cannot be read or
    // is not allocated.
    //
    // The value returned should be copy of any underlying memory, not a reference
    // to the underlying store.
    Read(offset, length *big.Int) []byte
    // Write a value to the memory starting at offset (the index of the first byte
    // written will equal offset). The value is provided as bytes to be written
    // consecutively to the memory store. Return an error if the memory cannot be
    // written or allocated.
    Write(offset *big.Int, value []byte)
    // Returns the current capacity of the memory. For dynamically allocating
    // memory this capacity can be used as a write offset that is guaranteed to be
    // unused. Solidity in particular makes this assumption when using MSIZE to
    // get the current allocated memory.
    Capacity() *big.Int
}

Interface for a bounded linear memory indexed by a single *big.Int parameter for each byte in the memory.

func DefaultDynamicMemoryProvider Uses

func DefaultDynamicMemoryProvider(errSink errors.Sink) Memory

func NewDynamicMemory Uses

func NewDynamicMemory(initialCapacity, maximumCapacity uint64, errSink errors.Sink) Memory

Get a new DynamicMemory (note that although we take a maximumCapacity of uint64 we currently limit the maximum to int32 at runtime because we are using a single slice which we cannot guarantee to be indexable above int32 or all validators

type Options Uses

type Options struct {
    MemoryProvider           func(errors.Sink) Memory
    Natives                  *native.Natives
    Nonce                    []byte
    DebugOpcodes             bool
    DumpTokens               bool
    CallStackMaxDepth        uint64
    DataStackInitialCapacity uint64
    DataStackMaxDepth        uint64
    Logger                   *logging.Logger
}

Options are parameters that are generally stable across a burrow configuration. Defaults will be used for any zero values.

type Stack Uses

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

Not goroutine safe

func NewStack Uses

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

func (*Stack) Dup Uses

func (st *Stack) Dup(n int)

func (*Stack) Len Uses

func (st *Stack) Len() int

func (*Stack) Peek Uses

func (st *Stack) Peek() Word256

Not an opcode, costs no gas.

func (*Stack) Pop Uses

func (st *Stack) Pop() Word256

func (*Stack) Pop64 Uses

func (st *Stack) Pop64() uint64

func (*Stack) PopAddress Uses

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

func (*Stack) PopBigInt Uses

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

func (*Stack) PopBigIntSigned Uses

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

func (*Stack) PopBytes Uses

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

func (*Stack) Print Uses

func (st *Stack) Print(n int)

func (*Stack) Push Uses

func (st *Stack) Push(d Word256)

func (*Stack) Push64 Uses

func (st *Stack) Push64(i uint64)

func (*Stack) PushAddress Uses

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

func (*Stack) PushBigInt Uses

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 Uses

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

currently only called after sha3.Sha3

func (*Stack) Swap Uses

func (st *Stack) Swap(n int)

Directories

PathSynopsis
abi
asm
asm/bc

Package evm imports 21 packages (graph) and is imported by 10 packages. Updated 2020-07-24. Refresh now. Tools for package owners.