Documentation ¶
Index ¶
- Constants
- func AddHintLengthPrefix(data []byte) []byte
- func AddPreimageLengthPrefix(data []byte) []byte
- func AlignPC(pc arch.Word) arch.Word
- func AssertEVMReverts(t *testing.T, state mipsevm.FPVMState, contracts *ContractMetadata, ...)
- func AssertPreimageOracleReverts(t *testing.T, preimageKey [32]byte, preimageValue []byte, ...)
- func BoundStep(step uint64) uint64
- func ClaimTestOracle(t *testing.T) (po mipsevm.PreimageOracle, stdOut string, stdErr string)
- func CreateLogger() log.Logger
- func EncodeStepInput(t *testing.T, wit *mipsevm.StepWitness, localContext mipsevm.LocalContext, ...) []byte
- func LoadELFProgram[T mipsevm.FPVMState](t require.TestingT, name string, initState program.CreateInitialFPVMState[T], ...) (T, *program.Metadata)
- func LogStepFailureAtCleanup(t *testing.T, mipsEvm *MIPSEVM)
- func MarkdownTracer() *tracing.Hooks
- func NewEVMEnv(contracts *ContractMetadata) (*vm.EVM, *state.StateDB)
- func RunVMTest_Claim[T mipsevm.FPVMState](t *testing.T, initState program.CreateInitialFPVMState[T], ...)
- func RunVMTest_Hello[T mipsevm.FPVMState](t *testing.T, initState program.CreateInitialFPVMState[T], ...)
- func RunVMTests_OpenMips[T mipsevm.FPVMState](t *testing.T, stateFactory StateFactory[T], vmFactory VMFactory[T], ...)
- func SelectOracleFixture(t *testing.T, programName string) mipsevm.PreimageOracle
- func SourceMapTracer(t require.TestingT, version MipsVersion, mips *foundry.Artifact, ...) *tracing.Hooks
- func ValidateEVM(t *testing.T, stepWitness *mipsevm.StepWitness, step uint64, goVm mipsevm.FPVM, ...)
- type Addresses
- type Artifacts
- type ContractMetadata
- type ExpectedState
- type HintTrackingOracle
- type MIPSEVM
- type MipsVersion
- type RandHelper
- func (h *RandHelper) Fraction() float64
- func (h *RandHelper) Intn(n int) int
- func (h *RandHelper) RandHash() common.Hash
- func (h *RandHelper) RandHint() []byte
- func (h *RandHelper) RandPC() arch.Word
- func (h *RandHelper) RandRegisters() *[32]arch.Word
- func (h *RandHelper) RandStep() uint64
- func (h *RandHelper) RandomBytes(t require.TestingT, length int) []byte
- func (h *RandHelper) Uint32() uint32
- func (h *RandHelper) Word() arch.Word
- type StateFactory
- type StateMutator
- type StateOption
- func WithHeap(addr arch.Word) StateOption
- func WithLastHint(lastHint hexutil.Bytes) StateOption
- func WithNextPC(nextPC arch.Word) StateOption
- func WithPC(pc arch.Word) StateOption
- func WithPCAndNextPC(pc arch.Word) StateOption
- func WithPreimageKey(key common.Hash) StateOption
- func WithPreimageOffset(offset arch.Word) StateOption
- func WithRandomization(seed int64) StateOption
- func WithStep(step uint64) StateOption
- type TestOracle
- type VMFactory
Constants ¶
View Source
const BaseAddrEnd = 0xbf_ff_ff_f0
0xbf_c0_00_00 ... BaseAddrEnd is used in tests to write the results to
View Source
const EndAddr = 0xa7ef00d0
EndAddr is used as return-address for tests
Variables ¶
This section is empty.
Functions ¶
func AddHintLengthPrefix ¶ added in v1.9.3
func AddPreimageLengthPrefix ¶ added in v1.9.3
func AssertEVMReverts ¶ added in v1.9.2
func AssertEVMReverts(t *testing.T, state mipsevm.FPVMState, contracts *ContractMetadata, tracer *tracing.Hooks)
AssertEVMReverts runs a single evm step from an FPVM prestate and asserts that the VM panics
func AssertPreimageOracleReverts ¶ added in v1.9.3
func ClaimTestOracle ¶
func CreateLogger ¶
func EncodeStepInput ¶
func EncodeStepInput(t *testing.T, wit *mipsevm.StepWitness, localContext mipsevm.LocalContext, mips *foundry.Artifact) []byte
func LoadELFProgram ¶
func LogStepFailureAtCleanup ¶
func MarkdownTracer ¶
func RunVMTest_Claim ¶
func RunVMTest_Hello ¶
func RunVMTests_OpenMips ¶
func SelectOracleFixture ¶
func SelectOracleFixture(t *testing.T, programName string) mipsevm.PreimageOracle
func SourceMapTracer ¶ added in v1.9.1
func ValidateEVM ¶ added in v1.9.2
func ValidateEVM(t *testing.T, stepWitness *mipsevm.StepWitness, step uint64, goVm mipsevm.FPVM, hashFn mipsevm.HashFn, contracts *ContractMetadata, tracer *tracing.Hooks)
ValidateEVM runs a single evm step and validates against an FPVM poststate
Types ¶
type ContractMetadata ¶ added in v1.9.1
func TestContractsSetup ¶ added in v1.9.1
func TestContractsSetup(t require.TestingT, version MipsVersion) *ContractMetadata
type ExpectedState ¶ added in v1.9.1
type ExpectedState struct { PreimageKey common.Hash PreimageOffset arch.Word PC arch.Word NextPC arch.Word HI arch.Word LO arch.Word Heap arch.Word ExitCode uint8 Exited bool Step uint64 LastHint hexutil.Bytes Registers [32]arch.Word MemoryRoot common.Hash // contains filtered or unexported fields }
func NewExpectedState ¶ added in v1.9.2
func NewExpectedState(fromState mipsevm.FPVMState) *ExpectedState
func (*ExpectedState) ExpectMemoryWrite ¶ added in v1.9.3
func (e *ExpectedState) ExpectMemoryWrite(addr arch.Word, val uint32)
func (*ExpectedState) ExpectStep ¶ added in v1.9.3
func (e *ExpectedState) ExpectStep()
type HintTrackingOracle ¶ added in v1.9.1
type HintTrackingOracle struct {
// contains filtered or unexported fields
}
func (*HintTrackingOracle) GetPreimage ¶ added in v1.9.1
func (t *HintTrackingOracle) GetPreimage(k [32]byte) []byte
func (*HintTrackingOracle) Hint ¶ added in v1.9.1
func (t *HintTrackingOracle) Hint(v []byte)
func (*HintTrackingOracle) Hints ¶ added in v1.9.1
func (t *HintTrackingOracle) Hints() [][]byte
type MIPSEVM ¶
type MIPSEVM struct {
// contains filtered or unexported fields
}
func NewMIPSEVM ¶
func NewMIPSEVM(contracts *ContractMetadata) *MIPSEVM
func (*MIPSEVM) SetLocalOracle ¶
func (m *MIPSEVM) SetLocalOracle(oracle mipsevm.PreimageOracle)
func (*MIPSEVM) SetSourceMapTracer ¶ added in v1.9.1
func (m *MIPSEVM) SetSourceMapTracer(t *testing.T, version MipsVersion)
type MipsVersion ¶ added in v1.9.1
type MipsVersion int
const ( MipsSingleThreaded MipsVersion = iota MipsMultithreaded )
type RandHelper ¶ added in v1.9.3
type RandHelper struct {
// contains filtered or unexported fields
}
func NewRandHelper ¶ added in v1.9.3
func NewRandHelper(seed int64) *RandHelper
func (*RandHelper) Fraction ¶ added in v1.9.3
func (h *RandHelper) Fraction() float64
func (*RandHelper) Intn ¶ added in v1.9.3
func (h *RandHelper) Intn(n int) int
func (*RandHelper) RandHash ¶ added in v1.9.3
func (h *RandHelper) RandHash() common.Hash
func (*RandHelper) RandHint ¶ added in v1.9.3
func (h *RandHelper) RandHint() []byte
func (*RandHelper) RandPC ¶ added in v1.9.3
func (h *RandHelper) RandPC() arch.Word
func (*RandHelper) RandRegisters ¶ added in v1.9.3
func (h *RandHelper) RandRegisters() *[32]arch.Word
func (*RandHelper) RandStep ¶ added in v1.9.3
func (h *RandHelper) RandStep() uint64
func (*RandHelper) RandomBytes ¶ added in v1.9.3
func (h *RandHelper) RandomBytes(t require.TestingT, length int) []byte
func (*RandHelper) Uint32 ¶ added in v1.9.3
func (h *RandHelper) Uint32() uint32
func (*RandHelper) Word ¶ added in v1.9.4
func (h *RandHelper) Word() arch.Word
type StateFactory ¶
type StateMutator ¶ added in v1.9.1
type StateMutator interface { SetPreimageKey(val common.Hash) SetPreimageOffset(val arch.Word) SetPC(val arch.Word) SetNextPC(val arch.Word) SetHI(val arch.Word) SetLO(val arch.Word) SetHeap(addr arch.Word) SetExitCode(val uint8) SetExited(val bool) SetStep(val uint64) SetLastHint(val hexutil.Bytes) Randomize(randSeed int64) }
type StateOption ¶ added in v1.9.1
type StateOption func(state StateMutator)
func WithHeap ¶ added in v1.9.1
func WithHeap(addr arch.Word) StateOption
func WithLastHint ¶ added in v1.9.1
func WithLastHint(lastHint hexutil.Bytes) StateOption
func WithNextPC ¶ added in v1.9.1
func WithNextPC(nextPC arch.Word) StateOption
func WithPC ¶ added in v1.9.1
func WithPC(pc arch.Word) StateOption
func WithPCAndNextPC ¶ added in v1.9.3
func WithPCAndNextPC(pc arch.Word) StateOption
func WithPreimageKey ¶ added in v1.9.1
func WithPreimageKey(key common.Hash) StateOption
func WithPreimageOffset ¶ added in v1.9.1
func WithPreimageOffset(offset arch.Word) StateOption
func WithRandomization ¶ added in v1.9.1
func WithRandomization(seed int64) StateOption
func WithStep ¶ added in v1.9.1
func WithStep(step uint64) StateOption
type TestOracle ¶
type TestOracle struct {
// contains filtered or unexported fields
}
func AllocOracle ¶
func AllocOracle(t *testing.T, numAllocs int, allocSize int) *TestOracle
func StaticOracle ¶
func StaticOracle(t *testing.T, preimageData []byte) *TestOracle
func StaticPrecompileOracle ¶
func (*TestOracle) GetPreimage ¶
func (t *TestOracle) GetPreimage(k [32]byte) []byte
func (*TestOracle) Hint ¶
func (t *TestOracle) Hint(v []byte)
Click to show internal directories.
Click to hide internal directories.