vm

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CodeSaveFrequency = 2
View Source
const MaxAuxStackPops = 1
View Source
const MaxStackPops = 3

Variables

View Source
var HashOfLastInstruction common.Hash
View Source
var Instructions = []Instruction(nil)

Functions

func Equal

func Equal(x, y *Machine) (bool, string)

Types

type BlockedError

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

func (BlockedError) Error

func (w BlockedError) Error() string

type Context added in v0.4.0

type Context interface {
	Send(message value.Value)
	GetLowerBoundBlock() value.IntValue
	GetUpperBoundBlock() value.IntValue
	GetLowerBoundTimestamp() value.IntValue
	GetUpperBoundTimestamp() value.IntValue
	NotifyStep(uint64)
	LoggedValue(value.Value)
	GetInbox() value.TupleValue
	ReadInbox()

	OutMessageCount() int
}

type DivideByZeroError

type DivideByZeroError struct {
}

func (DivideByZeroError) Error

func (w DivideByZeroError) Error() string

type EmptyStackError

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

func (EmptyStackError) Error

func (w EmptyStackError) Error() string

type ErrorInstructionError

type ErrorInstructionError struct {
}

func (ErrorInstructionError) Error

func (w ErrorInstructionError) Error() string

type Instruction

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

func (Instruction) GetCode

func (insn Instruction) GetCode() value.Opcode

func (Instruction) GetName

func (insn Instruction) GetName() string

type Machine

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

func NewMachine

func NewMachine(opCodes []value.Operation, staticVal value.Value, warn bool, sizeLimit int64) *Machine

func (*Machine) AuxStack

func (m *Machine) AuxStack() stack.Stack

func (*Machine) Checkpoint added in v0.4.0

func (m *Machine) Checkpoint(storage machine.CheckpointStorage) bool

func (*Machine) Clone

func (m *Machine) Clone() machine.Machine

func (*Machine) CurrentStatus

func (m *Machine) CurrentStatus() machine.Status

func (*Machine) ErrorStop

func (m *Machine) ErrorStop()

func (*Machine) ExecuteAssertion

func (m *Machine) ExecuteAssertion(
	maxSteps uint64,
	timeBounds *protocol.TimeBounds,
	inbox value.TupleValue,
	maxWallTime time.Duration,
) (*protocol.ExecutionAssertion, uint64)

ExecuteAssertion runs the machine up to maxSteps steps, stoping earlier if halted, errored or blocked

func (*Machine) GetAllOperations

func (m *Machine) GetAllOperations() []value.Operation

func (*Machine) GetErrHandler

func (m *Machine) GetErrHandler() value.CodePointValue

func (*Machine) GetInbox added in v0.4.0

func (m *Machine) GetInbox() value.TupleValue

func (*Machine) GetLowerBoundBlock added in v0.5.0

func (m *Machine) GetLowerBoundBlock() value.IntValue

func (*Machine) GetLowerBoundTimestamp added in v0.5.0

func (m *Machine) GetLowerBoundTimestamp() value.IntValue

func (*Machine) GetOperation

func (m *Machine) GetOperation() value.Operation

func (*Machine) GetPC

func (m *Machine) GetPC() value.CodePointValue

func (*Machine) GetSizeLimit

func (m *Machine) GetSizeLimit() int64

func (*Machine) GetUpperBoundBlock added in v0.5.0

func (m *Machine) GetUpperBoundBlock() value.IntValue

func (*Machine) GetUpperBoundTimestamp added in v0.5.0

func (m *Machine) GetUpperBoundTimestamp() value.IntValue

func (*Machine) Halt

func (m *Machine) Halt()

func (*Machine) Hash

func (m *Machine) Hash() common.Hash

func (*Machine) HaveSizeException

func (m *Machine) HaveSizeException() bool

func (*Machine) IncrPC

func (m *Machine) IncrPC()

func (*Machine) IsBlocked added in v0.4.0

func (m *Machine) IsBlocked(currentTime *common.TimeBlocks, newMessages bool) machine.BlockReason

func (*Machine) IsErrored

func (m *Machine) IsErrored() bool

func (*Machine) IsHalted

func (m *Machine) IsHalted() bool

func (*Machine) Log

func (m *Machine) Log(val value.Value)

func (*Machine) MarshalForProof

func (m *Machine) MarshalForProof() ([]byte, error)

func (*Machine) PrintState

func (m *Machine) PrintState()

func (*Machine) Register

func (m *Machine) Register() *MachineValue

func (*Machine) Send

func (m *Machine) Send(message value.Value)

func (*Machine) SetContext

func (m *Machine) SetContext(mc Context)

func (*Machine) SetPC

func (m *Machine) SetPC(iv value.Value) error

func (*Machine) Stack

func (m *Machine) Stack() stack.Stack

func (*Machine) Static

func (m *Machine) Static() *MachineValue

func (*Machine) Warn

func (m *Machine) Warn(str string)

type MachineAssertionContext

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

func NewMachineAssertionContext

func NewMachineAssertionContext(m *Machine, timeBounds *protocol.TimeBounds, inbox value.TupleValue) *MachineAssertionContext

func (*MachineAssertionContext) EndContext

func (ac *MachineAssertionContext) EndContext()

func (*MachineAssertionContext) Finalize

func (*MachineAssertionContext) GasCount added in v0.4.0

func (ac *MachineAssertionContext) GasCount() uint64

func (*MachineAssertionContext) GetInbox added in v0.4.0

func (*MachineAssertionContext) GetLowerBoundBlock added in v0.5.0

func (m *MachineAssertionContext) GetLowerBoundBlock() value.IntValue

func (*MachineAssertionContext) GetLowerBoundTimestamp added in v0.5.0

func (m *MachineAssertionContext) GetLowerBoundTimestamp() value.IntValue

func (*MachineAssertionContext) GetUpperBoundBlock added in v0.5.0

func (m *MachineAssertionContext) GetUpperBoundBlock() value.IntValue

func (*MachineAssertionContext) GetUpperBoundTimestamp added in v0.5.0

func (m *MachineAssertionContext) GetUpperBoundTimestamp() value.IntValue

func (*MachineAssertionContext) LoggedValue

func (ac *MachineAssertionContext) LoggedValue(data value.Value)

func (*MachineAssertionContext) NotifyStep

func (ac *MachineAssertionContext) NotifyStep(numGas uint64)

func (*MachineAssertionContext) OutMessageCount

func (ac *MachineAssertionContext) OutMessageCount() int

func (*MachineAssertionContext) ReadInbox added in v0.4.0

func (m *MachineAssertionContext) ReadInbox()

func (*MachineAssertionContext) Send

func (ac *MachineAssertionContext) Send(message value.Value)

func (*MachineAssertionContext) StepCount

func (ac *MachineAssertionContext) StepCount() uint64

type MachinePC

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

func NewMachinePC

func NewMachinePC(insns []value.Operation, handler WarningHandler) *MachinePC

func (*MachinePC) Equal

func (m *MachinePC) Equal(y *MachinePC) (bool, string)

func (MachinePC) GetCurrentCodePointHash

func (m MachinePC) GetCurrentCodePointHash() common.Hash

func (MachinePC) GetCurrentInsn

func (m MachinePC) GetCurrentInsn() value.Operation

func (MachinePC) GetCurrentInsnName

func (m MachinePC) GetCurrentInsnName() string

func (MachinePC) GetPC

func (m MachinePC) GetPC() value.CodePointValue

func (*MachinePC) IncrPC

func (m *MachinePC) IncrPC() error

func (*MachinePC) SetPCForced

func (m *MachinePC) SetPCForced(iv value.Value) error

type MachineValue

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

func NewMachineValue

func NewMachineValue(val value.Value) *MachineValue

func (*MachineValue) Clone

func (r *MachineValue) Clone() *MachineValue

func (*MachineValue) Equal

func (r *MachineValue) Equal(comp *MachineValue) (bool, string)

func (*MachineValue) Get

func (r *MachineValue) Get() value.Value

func (*MachineValue) ProofValue

func (r *MachineValue) ProofValue() value.HashOnlyValue

func (*MachineValue) Set

func (r *MachineValue) Set(value value.Value)

func (*MachineValue) Size

func (r *MachineValue) Size() int64

func (*MachineValue) StateValue

func (r *MachineValue) StateValue() value.Value

type NoContext added in v0.4.0

type NoContext struct{}

func (*NoContext) GetInbox added in v0.4.0

func (m *NoContext) GetInbox() value.TupleValue

func (*NoContext) GetLowerBoundBlock added in v0.5.0

func (m *NoContext) GetLowerBoundBlock() value.IntValue

func (*NoContext) GetLowerBoundTimestamp added in v0.5.0

func (m *NoContext) GetLowerBoundTimestamp() value.IntValue

func (*NoContext) GetUpperBoundBlock added in v0.5.0

func (m *NoContext) GetUpperBoundBlock() value.IntValue

func (*NoContext) GetUpperBoundTimestamp added in v0.5.0

func (m *NoContext) GetUpperBoundTimestamp() value.IntValue

func (*NoContext) LoggedValue added in v0.4.0

func (m *NoContext) LoggedValue(data value.Value)

func (*NoContext) NotifyStep added in v0.4.0

func (m *NoContext) NotifyStep(uint64)

func (*NoContext) OutMessageCount added in v0.4.0

func (m *NoContext) OutMessageCount() int

func (*NoContext) ReadInbox added in v0.4.0

func (m *NoContext) ReadInbox()

func (*NoContext) Send added in v0.4.0

func (m *NoContext) Send(message value.Value)

type PopTypeWarning

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

func (PopTypeWarning) Error

func (w PopTypeWarning) Error() string

type SilentWarningHandler

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

func NewSilentWarningHandler

func NewSilentWarningHandler() *SilentWarningHandler

func (*SilentWarningHandler) AnyWarnings

func (hand *SilentWarningHandler) AnyWarnings() bool

func (*SilentWarningHandler) Clone

func (hand *SilentWarningHandler) Clone() WarningHandler

func (*SilentWarningHandler) SwitchMachinePC

func (hand *SilentWarningHandler) SwitchMachinePC(m *MachinePC)

func (*SilentWarningHandler) Warn

func (hand *SilentWarningHandler) Warn(wstr string)

type StackMods

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

func NewStackMods

func NewStackMods(pops, pushes int) StackMods

func PopAuxStack

func PopAuxStack(m *Machine, mods StackMods) (value.Value, StackMods, error)

func PopStackBox

func PopStackBox(m *Machine, mods StackMods) (value.Value, StackMods, error)

func PopStackCodePoint

func PopStackCodePoint(m *Machine, mods StackMods) (value.CodePointValue, StackMods, error)

func PopStackInt

func PopStackInt(m *Machine, mods StackMods) (value.IntValue, StackMods, error)

func PopStackTuple

func PopStackTuple(m *Machine, mods StackMods) (value.TupleValue, StackMods, error)

func PopStackValue

func PopStackValue(m *Machine, mods StackMods) (value.Value, StackMods, error)

func PushStackBox

func PushStackBox(m *Machine, mods StackMods, b value.Value) StackMods

func PushStackCodePoint

func PushStackCodePoint(m *Machine, mods StackMods, v value.CodePointValue) StackMods

func PushStackInt

func PushStackInt(m *Machine, mods StackMods, v value.IntValue) StackMods

func PushStackTuple

func PushStackTuple(m *Machine, mods StackMods, v value.TupleValue) StackMods

func RunInstruction

func RunInstruction(m *Machine, op value.Operation) (StackMods, machine.BlockReason)

type VerboseWarningHandler

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

func NewVerboseWarningHandler

func NewVerboseWarningHandler(m *MachinePC) *VerboseWarningHandler

func (*VerboseWarningHandler) AnyWarnings

func (hand *VerboseWarningHandler) AnyWarnings() bool

func (*VerboseWarningHandler) Clone

func (hand *VerboseWarningHandler) Clone() WarningHandler

func (*VerboseWarningHandler) SwitchMachinePC

func (hand *VerboseWarningHandler) SwitchMachinePC(m *MachinePC)

func (*VerboseWarningHandler) Warn

func (hand *VerboseWarningHandler) Warn(wstr string)

type WarningHandler

type WarningHandler interface {
	AnyWarnings() bool
	Warn(string)
	Clone() WarningHandler
	SwitchMachinePC(stack *MachinePC)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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