Skip to content

Commit

Permalink
rename collectMemory to BuildMemory
Browse files Browse the repository at this point in the history
  • Loading branch information
TAdev0 committed Jul 4, 2024
1 parent a292f7c commit 407acf9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func main() {
var proofmode bool
var collectMemory bool
var buildMemory bool
var collectTrace bool
var maxsteps uint64
var entrypointOffset uint64
Expand All @@ -37,18 +37,6 @@ func main() {
Required: false,
Destination: &proofmode,
},
&cli.BoolFlag{
Name: "collect_trace",
Usage: "builds the relocated trace after execution",
Required: false,
Destination: &collectTrace,
},
&cli.BoolFlag{
Name: "collect_memory",
Usage: "builds the relocated memory after execution",
Required: false,
Destination: &collectMemory,
},
&cli.Uint64Flag{
Name: "maxsteps",
Usage: "limits the execution steps to 'maxsteps'",
Expand All @@ -63,12 +51,24 @@ func main() {
Value: 0,
Destination: &entrypointOffset,
},
&cli.BoolFlag{
Name: "collect_trace",
Usage: "collects the trace and builds the relocated trace after execution",
Required: false,
Destination: &collectTrace,
},
&cli.StringFlag{
Name: "tracefile",
Usage: "location to store the relocated trace",
Required: false,
Destination: &traceLocation,
},
&cli.BoolFlag{
Name: "build_memory",
Usage: "builds the relocated memory after execution",
Required: false,
Destination: &buildMemory,
},
&cli.StringFlag{
Name: "memoryfile",
Usage: "location to store the relocated memory",
Expand Down Expand Up @@ -153,7 +153,7 @@ func main() {
}
}

if proofmode || collectMemory {
if proofmode || buildMemory {
memory, err := runner.BuildMemory()
if err != nil {
return fmt.Errorf("cannot build memory: %w", err)
Expand Down
2 changes: 2 additions & 0 deletions pkg/runners/zero/zero.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,13 @@ func (runner *ZeroRunner) FinalizeSegments() error {
return nil
}

// BuildMemory relocates the memory and returns it
func (runner *ZeroRunner) BuildMemory() ([]byte, error) {
relocatedMemory := runner.vm.RelocateMemory()
return vm.EncodeMemory(relocatedMemory), nil
}

// BuildMemory relocates the trace and returns it
func (runner *ZeroRunner) BuildTrace() ([]byte, error) {
relocatedTrace := runner.vm.RelocateTrace()
return vm.EncodeTrace(relocatedTrace), nil
Expand Down

0 comments on commit 407acf9

Please sign in to comment.