vm

package
v1.9.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SnapsDir     = "snapshots"
	PreimagesDir = "preimages"
)

Variables

This section is empty.

Functions

func FinalStatePath added in v1.9.3

func FinalStatePath(dir string, binarySnapshots bool) string

func FindStartingSnapshot

func FindStartingSnapshot(logger log.Logger, snapDir string, absolutePreState string, traceIndex uint64, binarySnapshots bool) (string, error)

FindStartingSnapshot finds the closest snapshot before the specified traceIndex in snapDir. If no suitable snapshot can be found it returns absolutePreState.

func PreimageDir

func PreimageDir(dir string) string

func RunCmd

func RunCmd(ctx context.Context, l log.Logger, binary string, args ...string) error

Types

type CmdExecutor

type CmdExecutor func(ctx context.Context, l log.Logger, binary string, args ...string) error

type Config

type Config struct {
	// VM Configuration
	VmType          types.TraceType
	VmBin           string // Path to the vm executable to run when generating trace data
	SnapshotFreq    uint   // Frequency of snapshots to create when executing (in VM instructions)
	InfoFreq        uint   // Frequency of progress log messages (in VM instructions)
	DebugInfo       bool   // Whether to record debug info from the execution
	BinarySnapshots bool   // Whether to use binary snapshots instead of JSON

	// Host Configuration
	L1               string
	L1Beacon         string
	L2               string
	Server           string // Path to the executable that provides the pre-image oracle server
	Network          string
	RollupConfigPath string
	L2GenesisPath    string
}

type Executor

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

func NewExecutor

func NewExecutor(logger log.Logger, m Metricer, cfg Config, oracleServer OracleServerExecutor, prestate string, inputs utils.LocalGameInputs) *Executor

func (*Executor) DoGenerateProof

func (e *Executor) DoGenerateProof(ctx context.Context, dir string, begin uint64, end uint64, extraVmArgs ...string) error

DoGenerateProof executes vm from the specified starting trace index until the end trace index. The proof is stored at the specified directory.

func (*Executor) GenerateProof

func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) error

GenerateProof executes vm to generate a proof at the specified trace index. The proof is stored at the specified directory.

type KonaExecutor added in v1.9.3

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

func NewKonaExecutor added in v1.9.3

func NewKonaExecutor() *KonaExecutor

func NewNativeKonaExecutor added in v1.9.3

func NewNativeKonaExecutor(clientBinPath string) *KonaExecutor

func (*KonaExecutor) OracleCommand added in v1.9.3

func (s *KonaExecutor) OracleCommand(cfg Config, dataDir string, inputs utils.LocalGameInputs) ([]string, error)

type Metricer

type Metricer interface {
	RecordExecutionTime(t time.Duration)
	RecordMemoryUsed(memoryUsed uint64)
}

type OpProgramServerExecutor added in v1.9.1

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

func NewOpProgramServerExecutor added in v1.9.1

func NewOpProgramServerExecutor(logger log.Logger) *OpProgramServerExecutor

func (*OpProgramServerExecutor) OracleCommand added in v1.9.1

func (s *OpProgramServerExecutor) OracleCommand(cfg Config, dataDir string, inputs utils.LocalGameInputs) ([]string, error)

type OracleServerExecutor added in v1.9.0

type OracleServerExecutor interface {
	OracleCommand(cfg Config, dataDir string, inputs utils.LocalGameInputs) ([]string, error)
}

type PrestateProvider added in v1.9.3

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

func NewPrestateProvider added in v1.9.3

func NewPrestateProvider(prestate string, converter StateConverter) *PrestateProvider

func (*PrestateProvider) AbsolutePreStateCommitment added in v1.9.3

func (p *PrestateProvider) AbsolutePreStateCommitment(ctx context.Context) (common.Hash, error)

func (*PrestateProvider) PrestatePath added in v1.9.3

func (p *PrestateProvider) PrestatePath() string

type SnapshotSelect

type SnapshotSelect func(logger log.Logger, dir string, absolutePreState string, i uint64, binary bool) (string, error)

type StateConverter added in v1.9.3

type StateConverter interface {
	// ConvertStateToProof reads the state snapshot at the specified path and converts it to ProofData.
	// Returns the proof data, the VM step the state is from and whether or not the VM had exited.
	ConvertStateToProof(ctx context.Context, statePath string) (*utils.ProofData, uint64, bool, error)
}

Jump to

Keyboard shortcuts

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