Skip to content

Commit

Permalink
Replace strings with builtin name variable
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcdz committed Sep 25, 2024
1 parent 9f7a9b1 commit 648b3d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (runner *ZeroRunner) Output() []*fp.Element {
}

output := []*fp.Element{}
outputSegment, ok := runner.vm.Memory.FindSegmentWithBuiltin("output")
outputSegment, ok := runner.vm.Memory.FindSegmentWithBuiltin(builtins.OutputName)
if !ok {
return output
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func TestBitwiseBuiltin(t *testing.T) {
err := runner.Run()
require.NoError(t, err)

bitwise, ok := runner.vm.Memory.FindSegmentWithBuiltin("bitwise")
bitwise, ok := runner.vm.Memory.FindSegmentWithBuiltin(builtins.BitwiseName)
require.True(t, ok)

requireEqualSegments(t, createSegment(14, 7, 6, 9, 15), bitwise)
Expand Down Expand Up @@ -267,7 +267,7 @@ func TestPedersenBuiltin(t *testing.T) {
err := runner.Run()
require.NoError(t, err)

pedersen, ok := runner.vm.Memory.FindSegmentWithBuiltin("pedersen")
pedersen, ok := runner.vm.Memory.FindSegmentWithBuiltin(builtins.PedersenName)
require.True(t, ok)
requireEqualSegments(t, createSegment(&val1, &val2, &val3), pedersen)
}
Expand Down Expand Up @@ -349,7 +349,7 @@ func TestRangeCheck96Builtin(t *testing.T) {
err := runner.Run()
require.NoError(t, err)

rangeCheck96, ok := runner.vm.Memory.FindSegmentWithBuiltin("range_check96")
rangeCheck96, ok := runner.vm.Memory.FindSegmentWithBuiltin(builtins.RangeCheck96Name)
require.True(t, ok)

felt := &fp.Element{}
Expand Down
14 changes: 7 additions & 7 deletions pkg/vm/builtins/range_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
)

const (
RangeCheckName = "range_check"
RangeCheck96Name string = "range_check96"
inputCellsPerRangeCheck = 1
cellsPerRangeCheck = 1
instancesPerComponentRangeCheck = 1
RangeCheckName = "range_check"
RangeCheck96Name = "range_check96"
inputCellsPerRangeCheck = 1
cellsPerRangeCheck = 1
instancesPerComponentRangeCheck = 1

// Each range check instance consists of RangeCheckNParts 16-bit parts. INNER_RC_BOUND_SHIFT and INNER_RC_BOUND_MASK are used to extract 16-bit parts from the field elements stored in the range check segment.
INNER_RC_BOUND_SHIFT = 16
Expand Down Expand Up @@ -61,9 +61,9 @@ func (r *RangeCheck) InferValue(segment *memory.Segment, offset uint64) error {

func (r *RangeCheck) String() string {
if r.RangeCheckNParts == 6 {
return "range_check96"
return RangeCheck96Name
} else {
return "range_check"
return RangeCheckName
}
}

Expand Down

0 comments on commit 648b3d8

Please sign in to comment.