Documentation ¶
Index ¶
- func GetEntryCodeInstructions(function starknet.EntryPointByFunction, finalizeForProof bool) ([]*fp.Element, map[uint64][]hinter.Hinter, error)
- func GetFooterInstructions() []*fp.Element
- type AirMemorySegmentEntry
- type AirPrivateInput
- type AirPublicInput
- type AirPublicMemoryEntry
- type CairoProgram
- type CairoRunner
- type InlineCasmContext
- type Program
- type Runner
- func (runner *Runner) BuildMemory() ([]byte, error)
- func (runner *Runner) BuildTrace() ([]byte, error)
- func (runner *Runner) EndRun() error
- func (runner *Runner) FinalizeSegments() error
- func (runner *Runner) GetAirPrivateInput(tracePath, memoryPath string) (AirPrivateInput, error)
- func (runner *Runner) GetAirPublicInput() (AirPublicInput, error)
- func (runner *Runner) Output() []*fp.Element
- func (runner *Runner) Run() error
- func (runner *Runner) RunEntryPoint(pc uint64) error
- func (runner *Runner) RunFor(steps uint64) error
- func (runner *Runner) RunUntilPc(pc *mem.MemoryAddress) error
- type RunnerMode
- type TokenGasCost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFooterInstructions ¶
Types ¶
type AirMemorySegmentEntry ¶
type AirPrivateInput ¶
type AirPrivateInput struct { TracePath string `json:"trace_path"` MemoryPath string `json:"memory_path"` Pedersen []builtins.AirPrivateBuiltinPedersen `json:"pedersen"` RangeCheck []builtins.AirPrivateBuiltinRangeCheck `json:"range_check"` Ecdsa []builtins.AirPrivateBuiltinECDSA `json:"ecdsa"` Bitwise []builtins.AirPrivateBuiltinBitwise `json:"bitwise"` EcOp []builtins.AirPrivateBuiltinEcOp `json:"ec_op"` Keccak []builtins.AirPrivateBuiltinKeccak `json:"keccak"` Poseidon []builtins.AirPrivateBuiltinPoseidon `json:"poseidon"` }
type AirPublicInput ¶
type AirPublicInput struct { Layout string `json:"layout"` RcMin uint16 `json:"rc_min"` RcMax uint16 `json:"rc_max"` NSteps int `json:"n_steps"` DynamicParams interface{} `json:"dynamic_params"` MemorySegments map[string]AirMemorySegmentEntry `json:"memory_segments"` PublicMemory []AirPublicMemoryEntry `json:"public_memory"` }
type AirPublicMemoryEntry ¶
type CairoProgram ¶
type CairoProgram struct{}
type CairoRunner ¶
type CairoRunner struct{}
type InlineCasmContext ¶
type InlineCasmContext struct {
// contains filtered or unexported fields
}
func (*InlineCasmContext) AddInlineCASM ¶
func (ctx *InlineCasmContext) AddInlineCASM(code string)
type Program ¶
type Program struct { // the bytecode in string format Bytecode []*fp.Element // given a string it returns the pc for that function call Entrypoints map[string]uint64 // it stores the start and end label pcs Labels map[string]uint64 // builtins Builtins []builtins.BuiltinType }
func AssembleProgram ¶
func LoadCairoProgram ¶
func LoadCairoProgram(cairoProgram *sn.StarknetProgram) (*Program, error)
func LoadCairoZeroProgram ¶
func LoadCairoZeroProgram(cairoZeroJson *zero.ZeroProgram) (*Program, error)
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(program *Program, hints map[uint64][]hinter.Hinter, runnerMode RunnerMode, collectTrace bool, maxsteps uint64, layoutName string, userArgs []starknet.CairoFuncArgs) (Runner, error)
Creates a new Runner of a Cairo Zero program
func (*Runner) BuildMemory ¶
BuildMemory relocates the memory and returns it
func (*Runner) BuildTrace ¶
BuildTrace relocates the trace and returns it
func (*Runner) EndRun ¶
EndRun is responsible for running the additional steps after the program was executed, until the checkUsedCells doesn't return any error. Since this vm always finishes the run of the program at the number of steps that is a power of two in the proof mode, there is no need to run additional steps before the loop.
func (*Runner) FinalizeSegments ¶
FinalizeSegments calculates the final size of the builtins segments, using number of allocated instances and memory cells per builtin instance. Additionally it sets the final size of the program segment to the program size.
func (*Runner) GetAirPrivateInput ¶
func (runner *Runner) GetAirPrivateInput(tracePath, memoryPath string) (AirPrivateInput, error)
func (*Runner) GetAirPublicInput ¶
func (runner *Runner) GetAirPublicInput() (AirPublicInput, error)
func (*Runner) RunEntryPoint ¶
RunEntryPoint is like Run, but it executes the program starting from the given PC offset. This PC offset is expected to be a start from some function inside the loaded program.
func (*Runner) RunUntilPc ¶
func (runner *Runner) RunUntilPc(pc *mem.MemoryAddress) error
run until the program counter equals the `pc` parameter
type RunnerMode ¶
type RunnerMode uint8
const ( ExecutionModeZero RunnerMode = iota + 1 ProofModeZero ExecutionModeCairo ProofModeCairo )
type TokenGasCost ¶
type TokenGasCost uint8
const ( ConstToken TokenGasCost = iota + 1 PedersenToken PoseidonToken BitwiseToken EcOpToken AddModToken MulModToken )