cmd

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT, MIT Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LoadELFVMTypeFlag = &cli.StringFlag{
		Name:     "type",
		Usage:    "VM type to create state for. Valid options: " + openum.EnumString(stateVersions()),
		Required: true,
	}
	LoadELFPathFlag = &cli.PathFlag{
		Name:      "path",
		Usage:     "Path to 32/64-bit big-endian MIPS ELF file",
		TakesFile: true,
		Required:  true,
	}
	LoadELFOutFlag = &cli.PathFlag{
		Name:     "out",
		Usage:    "Output path to write state to. State is dumped to stdout if set to '-'. Not written if empty. Use file extension '.bin', '.bin.gz', or '.json' for binary, compressed binary, or JSON formats.",
		Value:    "state.bin.gz",
		Required: false,
	}
	LoadELFMetaFlag = &cli.PathFlag{
		Name:     "meta",
		Usage:    "Write metadata file, for symbol lookup during program execution. None if empty.",
		Value:    "meta.json",
		Required: false,
	}
)
View Source
var (
	RunInputFlag = &cli.PathFlag{
		Name:      "input",
		Usage:     "path of input binary state. Stdin if left empty.",
		TakesFile: true,
		Value:     "state.bin.gz",
		Required:  true,
	}
	RunOutputFlag = &cli.PathFlag{
		Name:      "output",
		Usage:     "path of output binary state. Not written if empty, use - to write to Stdout.",
		TakesFile: true,
		Value:     "out.bin.gz",
		Required:  false,
	}

	RunProofAtFlag = &cli.GenericFlag{
		Name:     "proof-at",
		Usage:    "step pattern to output proof at: " + patternHelp,
		Value:    new(StepMatcherFlag),
		Required: false,
	}
	RunProofFmtFlag = &cli.StringFlag{
		Name:     "proof-fmt",
		Usage:    "format for proof data output file names. Proof data is written to stdout if -.",
		Value:    "proof-%d.json",
		Required: false,
	}
	RunSnapshotAtFlag = &cli.GenericFlag{
		Name:     "snapshot-at",
		Usage:    "step pattern to output snapshots at: " + patternHelp,
		Value:    new(StepMatcherFlag),
		Required: false,
	}
	RunSnapshotFmtFlag = &cli.StringFlag{
		Name:     "snapshot-fmt",
		Usage:    "format for snapshot output file names.",
		Value:    "state-%d.bin.gz",
		Required: false,
	}
	RunStopAtFlag = &cli.GenericFlag{
		Name:     "stop-at",
		Usage:    "step pattern to stop at: " + patternHelp,
		Value:    new(StepMatcherFlag),
		Required: false,
	}
	RunStopAtPreimageFlag = &cli.StringFlag{
		Name:     "stop-at-preimage",
		Usage:    "stop at the first preimage request matching this key",
		Required: false,
	}
	RunStopAtPreimageTypeFlag = &cli.StringFlag{
		Name:     "stop-at-preimage-type",
		Usage:    "stop at the first preimage request matching this type",
		Required: false,
	}
	RunStopAtPreimageLargerThanFlag = &cli.StringFlag{
		Name:     "stop-at-preimage-larger-than",
		Usage:    "stop at the first step that requests a preimage larger than the specified size (in bytes)",
		Required: false,
	}
	RunMetaFlag = &cli.PathFlag{
		Name:     "meta",
		Usage:    "path to metadata file for symbol lookup for enhanced debugging info during execution.",
		Value:    "meta.json",
		Required: false,
	}
	RunInfoAtFlag = &cli.GenericFlag{
		Name:     "info-at",
		Usage:    "step pattern to print info at: " + patternHelp,
		Value:    MustStepMatcherFlag("%100000"),
		Required: false,
	}
	RunPProfCPU = &cli.BoolFlag{
		Name:  "pprof.cpu",
		Usage: "enable pprof cpu profiling",
	}
	RunDebugFlag = &cli.BoolFlag{
		Name:  "debug",
		Usage: "enable debug mode, which includes stack traces and other debug info in the output. Requires --meta.",
	}
	RunDebugInfoFlag = &cli.PathFlag{
		Name:      "debug-info",
		Usage:     "path to write debug info to",
		TakesFile: true,
		Required:  false,
	}

	OutFilePerm = os.FileMode(0o755)
)
View Source
var (
	WitnessInputFlag = &cli.PathFlag{
		Name:      "input",
		Usage:     "path of input JSON state.",
		TakesFile: true,
		Required:  true,
	}
	WitnessOutputFlag = &cli.PathFlag{
		Name:      "output",
		Usage:     "path to write binary witness.",
		TakesFile: true,
	}
)
View Source
var LoadELFCommand = CreateLoadELFCommand(LoadELF)
View Source
var RunCommand = CreateRunCommand(Run)
View Source
var WitnessCommand = CreateWitnessCommand(Witness)

Functions

func CreateLoadELFCommand added in v1.9.3

func CreateLoadELFCommand(action cli.ActionFunc) *cli.Command

func CreateRunCommand added in v1.9.3

func CreateRunCommand(action cli.ActionFunc) *cli.Command

func CreateWitnessCommand added in v1.9.3

func CreateWitnessCommand(action cli.ActionFunc) *cli.Command

func LoadELF

func LoadELF(ctx *cli.Context) error

func Logger

func Logger(w io.Writer, lvl slog.Level) log.Logger

func Run

func Run(ctx *cli.Context) error

func Witness added in v1.1.4

func Witness(ctx *cli.Context) error

Types

type ProcessPreimageOracle

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

func NewProcessPreimageOracle

func NewProcessPreimageOracle(name string, args []string, stdout log.Logger, stderr log.Logger) (*ProcessPreimageOracle, error)

func (*ProcessPreimageOracle) Close

func (p *ProcessPreimageOracle) Close() error

func (*ProcessPreimageOracle) GetPreimage

func (p *ProcessPreimageOracle) GetPreimage(k [32]byte) []byte

func (*ProcessPreimageOracle) Hint

func (p *ProcessPreimageOracle) Hint(v []byte)

func (*ProcessPreimageOracle) Start

func (p *ProcessPreimageOracle) Start() error

type Proof

type Proof struct {
	Step uint64 `json:"step"`

	Pre  common.Hash `json:"pre"`
	Post common.Hash `json:"post"`

	StateData hexutil.Bytes `json:"state-data"`
	ProofData hexutil.Bytes `json:"proof-data"`

	OracleKey    hexutil.Bytes `json:"oracle-key,omitempty"`
	OracleValue  hexutil.Bytes `json:"oracle-value,omitempty"`
	OracleOffset arch.Word     `json:"oracle-offset,omitempty"`
}

type StepFn

type StepFn func(proof bool) (*mipsevm.StepWitness, error)

func Guard

func Guard(proc *os.ProcessState, fn StepFn) StepFn

type StepMatcher

type StepMatcher func(st VMState) bool

type StepMatcherFlag

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

func MustStepMatcherFlag

func MustStepMatcherFlag(pattern string) *StepMatcherFlag

func (*StepMatcherFlag) Clone added in v1.2.0

func (m *StepMatcherFlag) Clone() any

func (*StepMatcherFlag) Matcher

func (m *StepMatcherFlag) Matcher() StepMatcher

func (*StepMatcherFlag) Set

func (m *StepMatcherFlag) Set(value string) error

func (*StepMatcherFlag) String

func (m *StepMatcherFlag) String() string

type VMState added in v1.5.1

type VMState interface {
	GetStep() uint64
}

Jump to

Keyboard shortcuts

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