Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - func GetStateHashFn() mipsevm.HashFn
 - type InstructionDetails
 - type InstrumentedState
 - func (m *InstrumentedState) CheckInfiniteLoop() bool
 - func (m *InstrumentedState) EnableStats()
 - func (m *InstrumentedState) GetDebugInfo() *mipsevm.DebugInfo
 - func (m *InstrumentedState) GetState() mipsevm.FPVMState
 - func (m *InstrumentedState) InitDebug() error
 - func (m *InstrumentedState) LastPreimage() ([32]byte, []byte, arch.Word)
 - func (m *InstrumentedState) LookupSymbol(addr arch.Word) string
 - func (m *InstrumentedState) Step(proof bool) (wit *mipsevm.StepWitness, err error)
 - func (m *InstrumentedState) Traceback()
 - func (m *InstrumentedState) UpdateInstructionCache(pc arch.Word)
 
- type LLReservationStatus
 - type NoopThreadedStackTracker
 - type State
 - func (s *State) CreateVM(logger log.Logger, po mipsevm.PreimageOracle, stdOut, stdErr io.Writer, ...) mipsevm.FPVM
 - func (s *State) Deserialize(in io.Reader) error
 - func (s *State) EncodeThreadProof() []byte
 - func (s *State) EncodeWitness() ([]byte, common.Hash)
 - func (s *State) GetCpu() mipsevm.CpuScalars
 - func (s *State) GetCurrentThread() *ThreadState
 - func (s *State) GetExitCode() uint8
 - func (s *State) GetExited() bool
 - func (s *State) GetHeap() Word
 - func (s *State) GetLastHint() hexutil.Bytes
 - func (s *State) GetMemory() *memory.Memory
 - func (s *State) GetPC() Word
 - func (s *State) GetPreimageKey() common.Hash
 - func (s *State) GetPreimageOffset() Word
 - func (s *State) GetRegistersRef() *[32]Word
 - func (s *State) GetStep() uint64
 - func (s *State) Serialize(out io.Writer) error
 - func (s *State) ThreadCount() int
 - func (s *State) VMStatus() uint8
 
- type StateWitness
 - type StatsTracker
 - type ThreadState
 - type ThreadedStackTracker
 - type ThreadedStackTrackerImpl
 - type Word
 
Constants ¶
const ( MEMROOT_WITNESS_OFFSET = 0 PREIMAGE_KEY_WITNESS_OFFSET = MEMROOT_WITNESS_OFFSET + 32 PREIMAGE_OFFSET_WITNESS_OFFSET = PREIMAGE_KEY_WITNESS_OFFSET + 32 HEAP_WITNESS_OFFSET = PREIMAGE_OFFSET_WITNESS_OFFSET + arch.WordSizeBytes LL_RESERVATION_ACTIVE_OFFSET = HEAP_WITNESS_OFFSET + arch.WordSizeBytes LL_ADDRESS_OFFSET = LL_RESERVATION_ACTIVE_OFFSET + 1 LL_OWNER_THREAD_OFFSET = LL_ADDRESS_OFFSET + arch.WordSizeBytes EXITCODE_WITNESS_OFFSET = LL_OWNER_THREAD_OFFSET + arch.WordSizeBytes EXITED_WITNESS_OFFSET = EXITCODE_WITNESS_OFFSET + 1 STEP_WITNESS_OFFSET = EXITED_WITNESS_OFFSET + 1 STEPS_SINCE_CONTEXT_SWITCH_WITNESS_OFFSET = STEP_WITNESS_OFFSET + 8 TRAVERSE_RIGHT_WITNESS_OFFSET = STEPS_SINCE_CONTEXT_SWITCH_WITNESS_OFFSET + 8 LEFT_THREADS_ROOT_WITNESS_OFFSET = TRAVERSE_RIGHT_WITNESS_OFFSET + 1 RIGHT_THREADS_ROOT_WITNESS_OFFSET = LEFT_THREADS_ROOT_WITNESS_OFFSET + 32 THREAD_ID_WITNESS_OFFSET = RIGHT_THREADS_ROOT_WITNESS_OFFSET + 32 // 168 and 188 bytes for 32 and 64-bit respectively STATE_WITNESS_SIZE = THREAD_ID_WITNESS_OFFSET + arch.WordSizeBytes )
STATE_WITNESS_SIZE is the size of the state witness encoding in bytes.
const ( THREAD_ID_STATE_WITNESS_OFFSET = 0 THREAD_EXIT_CODE_WITNESS_OFFSET = THREAD_ID_STATE_WITNESS_OFFSET + arch.WordSizeBytes THREAD_EXITED_WITNESS_OFFSET = THREAD_EXIT_CODE_WITNESS_OFFSET + 1 THREAD_CPU_WITNESS_OFFSET = THREAD_EXITED_WITNESS_OFFSET + 1 THREAD_REGISTERS_WITNESS_OFFSET = THREAD_CPU_WITNESS_OFFSET + (4 * arch.WordSizeBytes) // SERIALIZED_THREAD_SIZE is the size of a serialized ThreadState object // 150 and 298 bytes for 32 and 64-bit respectively SERIALIZED_THREAD_SIZE = THREAD_REGISTERS_WITNESS_OFFSET + (32 * arch.WordSizeBytes) // THREAD_WITNESS_SIZE is the size of a thread witness encoded in bytes. // // It consists of the active thread serialized and concatenated with the // 32 byte hash onion of the active thread stack without the active thread THREAD_WITNESS_SIZE = SERIALIZED_THREAD_SIZE + 32 )
Variables ¶
var EmptyThreadsRoot common.Hash = common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5")
    The empty thread root - keccak256(bytes32(0) ++ bytes32(0))
Functions ¶
func GetStateHashFn ¶ added in v1.9.1
Types ¶
type InstructionDetails ¶ added in v1.13.6
type InstructionDetails struct {
	// contains filtered or unexported fields
}
    type InstrumentedState ¶
type InstrumentedState struct {
	// contains filtered or unexported fields
}
    func NewInstrumentedState ¶
func NewInstrumentedState(state *State, po mipsevm.PreimageOracle, stdOut, stdErr io.Writer, log log.Logger, meta mipsevm.Metadata, features mipsevm.FeatureToggles) *InstrumentedState
func (*InstrumentedState) CheckInfiniteLoop ¶
func (m *InstrumentedState) CheckInfiniteLoop() bool
func (*InstrumentedState) EnableStats ¶ added in v1.11.0
func (m *InstrumentedState) EnableStats()
func (*InstrumentedState) GetDebugInfo ¶
func (m *InstrumentedState) GetDebugInfo() *mipsevm.DebugInfo
func (*InstrumentedState) GetState ¶
func (m *InstrumentedState) GetState() mipsevm.FPVMState
func (*InstrumentedState) InitDebug ¶
func (m *InstrumentedState) InitDebug() error
func (*InstrumentedState) LastPreimage ¶
func (m *InstrumentedState) LastPreimage() ([32]byte, []byte, arch.Word)
func (*InstrumentedState) LookupSymbol ¶ added in v1.9.1
func (m *InstrumentedState) LookupSymbol(addr arch.Word) string
func (*InstrumentedState) Step ¶
func (m *InstrumentedState) Step(proof bool) (wit *mipsevm.StepWitness, err error)
func (*InstrumentedState) Traceback ¶
func (m *InstrumentedState) Traceback()
func (*InstrumentedState) UpdateInstructionCache ¶ added in v1.13.6
func (m *InstrumentedState) UpdateInstructionCache(pc arch.Word)
type LLReservationStatus ¶ added in v1.9.5
type LLReservationStatus uint8
const ( LLStatusNone LLReservationStatus = 0x0 LLStatusActive32bit LLReservationStatus = 0x1 LLStatusActive64bit LLReservationStatus = 0x2 )
type NoopThreadedStackTracker ¶
type NoopThreadedStackTracker struct {
	exec.NoopStackTracker
}
    func (*NoopThreadedStackTracker) DropThread ¶
func (n *NoopThreadedStackTracker) DropThread(threadId Word)
type State ¶
type State struct {
	Memory *memory.Memory
	PreimageKey    common.Hash
	PreimageOffset Word // note that the offset includes the 8-byte length prefix
	Heap                Word                // to handle mmap growth
	LLReservationStatus LLReservationStatus // Determines whether there is an active memory reservation, and what type
	LLAddress           Word                // The "linked" memory address reserved via the LL (load linked) op
	LLOwnerThread       Word                // The id of the thread that holds the reservation on LLAddress
	ExitCode uint8
	Exited   bool
	Step                        uint64
	StepsSinceLastContextSwitch uint64
	TraverseRight    bool
	LeftThreadStack  []*ThreadState
	RightThreadStack []*ThreadState
	NextThreadId     Word
	// LastHint is optional metadata, and not part of the VM state itself.
	LastHint hexutil.Bytes
	UseLargeICache bool
}
    func CreateEmptyState ¶
func CreateEmptyState() *State
func CreateInitialState ¶
func (*State) EncodeThreadProof ¶
func (*State) GetCpu ¶ added in v1.9.1
func (s *State) GetCpu() mipsevm.CpuScalars
func (*State) GetCurrentThread ¶ added in v1.9.1
func (s *State) GetCurrentThread() *ThreadState
func (*State) GetExitCode ¶
func (*State) GetLastHint ¶ added in v1.9.1
func (*State) GetPreimageKey ¶ added in v1.9.1
func (*State) GetPreimageOffset ¶ added in v1.9.1
func (*State) GetRegistersRef ¶ added in v1.9.1
func (*State) Serialize ¶ added in v1.9.3
Serialize writes the state in a simple binary format which can be read again using Deserialize The format is a simple concatenation of fields, with prefixed item count for repeating items and using big endian encoding for numbers.
StateVersion uint8(1) Memory As per Memory.Serialize PreimageKey [32]byte PreimageOffset Word Heap Word ExitCode uint8 Exited uint8 - 0 for false, 1 for true Step uint64 StepsSinceLastContextSwitch uint64 TraverseRight uint8 - 0 for false, 1 for true NextThreadId Word len(LeftThreadStack) Word LeftThreadStack entries as per ThreadState.Serialize len(RightThreadStack) Word RightThreadStack entries as per ThreadState.Serialize len(LastHint) Word (0 when LastHint is nil) LastHint []byte
func (*State) ThreadCount ¶ added in v1.9.2
type StateWitness ¶
type StateWitness []byte
type StatsTracker ¶ added in v1.11.0
type StatsTracker interface {
	// contains filtered or unexported methods
}
    Define stats interface
func NewStatsTracker ¶ added in v1.11.0
func NewStatsTracker() StatsTracker
func NoopStatsTracker ¶ added in v1.11.0
func NoopStatsTracker() StatsTracker
type ThreadState ¶
type ThreadState struct {
	ThreadId  Word               `json:"threadId"`
	ExitCode  uint8              `json:"exit"`
	Exited    bool               `json:"exited"`
	Cpu       mipsevm.CpuScalars `json:"cpu"`
	Registers [32]Word           `json:"registers"`
}
    func CreateEmptyThread ¶
func CreateEmptyThread() *ThreadState
func (*ThreadState) Deserialize ¶ added in v1.9.3
func (t *ThreadState) Deserialize(in io.Reader) error
type ThreadedStackTracker ¶
type ThreadedStackTracker interface {
	exec.TraceableStackTracker
	DropThread(threadId Word)
}
    type ThreadedStackTrackerImpl ¶
type ThreadedStackTrackerImpl struct {
	// contains filtered or unexported fields
}
    func NewThreadedStackTracker ¶
func NewThreadedStackTracker(state *State, meta mipsevm.Metadata) (*ThreadedStackTrackerImpl, error)
func (*ThreadedStackTrackerImpl) DropThread ¶
func (t *ThreadedStackTrackerImpl) DropThread(threadId Word)
func (*ThreadedStackTrackerImpl) PopStack ¶
func (t *ThreadedStackTrackerImpl) PopStack()
func (*ThreadedStackTrackerImpl) PushStack ¶
func (t *ThreadedStackTrackerImpl) PushStack(caller Word, target Word)
func (*ThreadedStackTrackerImpl) Traceback ¶
func (t *ThreadedStackTrackerImpl) Traceback()