Documentation
¶
Index ¶
- Constants
- func AssertEVMReverts(t *testing.T, state mipsevm.FPVMState, contracts *ContractMetadata, ...)
- func AssertPreimageOracleReverts(t *testing.T, preimageKey [32]byte, preimageValue []byte, ...)
- 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 GetInstruction(mem *memory.Memory, pc arch.Word) uint32
- 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(t testing.TB, contracts *ContractMetadata) (*vm.EVM, *state.StateDB)
- func ProgramPath(programName string, goTarget GoTarget) string
- func RandomizeWordAndSetUint32(mem *memory.Memory, addr Word, val uint32, randomizeWordSeed int64)
- func SelectOracleFixture(t *testing.T, programName string) mipsevm.PreimageOracle
- func SetMemoryUint64(t require.TestingT, mem *memory.Memory, addr Word, value uint64)
- func SourceMapTracer(t require.TestingT, version MipsVersion, mips *foundry.Artifact, ...) *tracing.Hooks
- func StoreInstruction(mem *memory.Memory, pc arch.Word, insn uint32)
- func ToSignedInteger(x Word) arch.SignedInteger
- func Uint32ToBytes(val uint32) []byte
- func Uint64ToBytes(val uint64) []byte
- func ValidateEVM(t *testing.T, stepWitness *mipsevm.StepWitness, step uint64, goVm mipsevm.FPVM, ...)
- func WithLocalOracle(oracle mipsevm.PreimageOracle) evmOption
- func WithSourceMapTracer(t *testing.T, ver MipsVersion) evmOption
- func WithTracingHooks(tracer *tracing.Hooks) evmOption
- type Addresses
- type Artifacts
- type ContractMetadata
- type ErrMatcher
- type EvmValidator
- type GoTarget
- 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 TestOracle
- type Word
Constants ¶
const BaseAddrEnd = 0xbf_ff_ff_f0
0xbf_c0_00_00 ... BaseAddrEnd is used in tests to write the results to
const EndAddr = 0xa7ef00d0
EndAddr is used as return-address for tests
Variables ¶
This section is empty.
Functions ¶
func AssertEVMReverts ¶ added in v1.9.2
func AssertEVMReverts(t *testing.T, state mipsevm.FPVMState, contracts *ContractMetadata, tracer *tracing.Hooks, ProofData []byte, matcher ErrMatcher)
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 ProgramPath ¶ added in v1.9.5
ProgramPath returns the appropriate ELF test program for the current architecture
func RandomizeWordAndSetUint32 ¶ added in v1.11.0
RandomizeWordAndSetUint32 writes a uint32 value and randomizes the rest of the Word containing the uint32 in memory
func SelectOracleFixture ¶
func SelectOracleFixture(t *testing.T, programName string) mipsevm.PreimageOracle
func SetMemoryUint64 ¶ added in v1.9.5
SetMemoryUint64 sets 8 bytes of memory (1 or 2 Words depending on architecture) and enforces the use of addresses that are compatible across 32- and 64-bit architectures
func SourceMapTracer ¶ added in v1.9.1
func StoreInstruction ¶ added in v1.9.5
StoreInstruction writes a 4-byte instruction to memory
func ToSignedInteger ¶ added in v1.9.5
func ToSignedInteger(x Word) arch.SignedInteger
ToSignedInteger converts the unsigned Word to a SignedInteger. Useful for avoiding Go compiler warnings for literals that don't fit in a signed type
func Uint32ToBytes ¶ added in v1.9.5
func Uint64ToBytes ¶ added in v1.9.5
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, opts ...evmOption)
ValidateEVM runs a single evm step and validates against an FPVM poststate
func WithLocalOracle ¶ added in v1.9.5
func WithLocalOracle(oracle mipsevm.PreimageOracle) evmOption
func WithSourceMapTracer ¶ added in v1.9.5
func WithSourceMapTracer(t *testing.T, ver MipsVersion) evmOption
func WithTracingHooks ¶ added in v1.9.5
Types ¶
type ContractMetadata ¶ added in v1.9.1
type ContractMetadata struct { Artifacts *Artifacts Addresses *Addresses Version uint8 // versions.StateVersion can't be used as it causes dependency cycles }
func TestContractsSetup ¶ added in v1.9.1
func TestContractsSetup(t require.TestingT, version MipsVersion, stateVersion uint8) *ContractMetadata
type ErrMatcher ¶ added in v1.9.5
func CreateCustomErrorMatcher ¶ added in v1.9.5
func CreateCustomErrorMatcher(sig string) ErrMatcher
CreateCustomErrorMatcher matches a custom error given the error signature
func CreateErrorStringMatcher ¶ added in v1.9.5
func CreateErrorStringMatcher(expect string) ErrMatcher
CreateErrorStringMatcher matches an Error(string)
func CreateNoopErrorMatcher ¶ added in v1.9.5
func CreateNoopErrorMatcher() ErrMatcher
type EvmValidator ¶ added in v1.9.5
type EvmValidator struct {
// contains filtered or unexported fields
}
func NewEvmValidator ¶ added in v1.9.5
func NewEvmValidator(t *testing.T, hashFn mipsevm.HashFn, contracts *ContractMetadata, opts ...evmOption) *EvmValidator
NewEvmValidator creates a validator that can be run repeatedly across multiple steps
func (*EvmValidator) ValidateEVM ¶ added in v1.9.5
func (v *EvmValidator) ValidateEVM(t *testing.T, stepWitness *mipsevm.StepWitness, step uint64, goVm mipsevm.FPVM)
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 (*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 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)