cmd

package
v0.0.0-...-91385b4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadELFCommand = &cli.Command{
	Name:        "load-elf",
	Usage:       "Load ELF file into Asterisc JSON state",
	Description: "Load ELF file into Asterisc JSON state, optionally patch out functions",
	Action:      LoadELF,
	Flags: []cli.Flag{
		cannon.LoadELFPathFlag,
		cannon.LoadELFOutFlag,
		cannon.LoadELFMetaFlag,
	},
}
View Source
var OutFilePerm = os.FileMode(0o755)
View Source
var RunCommand = &cli.Command{
	Name:        "run",
	Usage:       "Run VM step(s) and generate proof data to replicate onchain.",
	Description: "Run VM step(s) and generate proof data to replicate onchain. See flags to match when to output a proof, a snapshot, or to stop early.",
	Action:      Run,
	Flags: []cli.Flag{
		cannon.RunInputFlag,
		cannon.RunOutputFlag,
		cannon.RunProofAtFlag,
		cannon.RunProofFmtFlag,
		cannon.RunSnapshotAtFlag,
		cannon.RunSnapshotFmtFlag,
		cannon.RunStopAtFlag,
		cannon.RunStopAtPreimageTypeFlag,
		cannon.RunStopAtPreimageLargerThanFlag,
		cannon.RunMetaFlag,
		cannon.RunInfoAtFlag,
		cannon.RunPProfCPU,
	},
}
View Source
var WitnessCommand = &cli.Command{
	Name:        "witness",
	Usage:       "Convert an Asterisc JSON state into a binary witness",
	Description: "Convert an Asterisc JSON state into a binary witness. The statehash is written to stdout",
	Action:      Witness,
	Flags: []cli.Flag{
		cannon.WitnessInputFlag,
		cannon.WitnessOutputFlag,
	},
}

Functions

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

func Witness(ctx *cli.Context) error

Types

type HexU32

type HexU32 uint32

HexU32 to lazy-format integer attributes for logging

func (HexU32) MarshalText

func (v HexU32) MarshalText() ([]byte, error)

func (HexU32) String

func (v HexU32) String() string

type LoggingWriter

type LoggingWriter struct {
	Name string
	Log  log.Logger
}

LoggingWriter is a simple util to wrap a logger, and expose an io Writer interface, for the program running within the VM to write to.

func (*LoggingWriter) Write

func (lw *LoggingWriter) Write(b []byte) (int, error)

type Metadata

type Metadata struct {
	Symbols []Symbol `json:"symbols"`
}

func MakeMetadata

func MakeMetadata(elfProgram *elf.File) (*Metadata, error)

func (*Metadata) LookupSymbol

func (m *Metadata) LookupSymbol(addr uint64) string

func (*Metadata) SymbolMatcher

func (m *Metadata) SymbolMatcher(name string) func(addr uint64) bool

type ProcessPreimageOracle

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

func NewProcessPreimageOracle

func NewProcessPreimageOracle(name string, args []string) (*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 uint64        `json:"oracle-offset,omitempty"`
}

type StepFn

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

func Guard

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

type Symbol

type Symbol struct {
	Name  string `json:"name"`
	Start uint64 `json:"start"`
	Size  uint64 `json:"size"`
}

type WitnessOutput

type WitnessOutput struct {
	Witness   []byte   `json:"witness"`
	StateHash [32]byte `json:"stateHash"`
}

Jump to

Keyboard shortcuts

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