Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh0g0-1758 committed Aug 20, 2024
1 parent 19f4782 commit c212f0b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/hintrunner/core/hint_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func BenchmarkAssertLeFindSmallArc(b *testing.B) {

rand := utils.DefaultRandGenerator()
ctx := hinter.SetContextWithScope(map[string]any{"excluded": 0})
rangeCheckPtr := vm.Memory.AllocateBuiltinSegment(&builtins.RangeCheck{RANGE_CHECK_N_PARTS: 8})
rangeCheckPtr := vm.Memory.AllocateBuiltinSegment(&builtins.RangeCheck{RangeCheckNParts: 8})

b.ResetTimer()
for i := 0; i < b.N; i++ {
Expand Down
2 changes: 1 addition & 1 deletion pkg/hintrunner/core/hint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ func TestAssertLeFindSmallArc(t *testing.T) {
vm.Context.Ap = 0
vm.Context.Fp = 0
// The addr that the range check pointer will point to
addr := vm.Memory.AllocateBuiltinSegment(&builtins.RangeCheck{RANGE_CHECK_N_PARTS: 8})
addr := vm.Memory.AllocateBuiltinSegment(&builtins.RangeCheck{RangeCheckNParts: 8})
utils.WriteTo(vm, VM.ExecutionSegment, vm.Context.Ap, mem.MemoryValueFromMemoryAddress(&addr))

hint := AssertLeFindSmallArc{
Expand Down
2 changes: 1 addition & 1 deletion pkg/runners/zero/zero.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (runner *ZeroRunner) checkRangeCheckUsage() error {
}
rangeCheckSegment, ok := runner.vm.Memory.FindSegmentWithBuiltin(rangeCheckRunner.String())
if ok {
rcUnitsUsedByBuiltins += rangeCheckSegment.Len() * rangeCheckRunner.RANGE_CHECK_N_PARTS
rcUnitsUsedByBuiltins += rangeCheckSegment.Len() * rangeCheckRunner.RangeCheckNParts
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/vm/builtins/layouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func getSmallLayout() Layout {
return Layout{Name: "small", RcUnits: 16, Builtins: []LayoutBuiltin{
{Runner: &Output{}, Builtin: starknet.Output},
{Runner: &Pedersen{ratio: 8}, Builtin: starknet.Pedersen},
{Runner: &RangeCheck{ratio: 8, RANGE_CHECK_N_PARTS: 8}, Builtin: starknet.RangeCheck},
{Runner: &RangeCheck{ratio: 8, RangeCheckNParts: 8}, Builtin: starknet.RangeCheck},
{Runner: &ECDSA{ratio: 512}, Builtin: starknet.ECDSA},
}}
}
Expand All @@ -41,7 +41,7 @@ func getStarknetWithKeccakLayout() Layout {
return Layout{Name: "starknet_with_keccak", RcUnits: 4, Builtins: []LayoutBuiltin{
{Runner: &Output{}, Builtin: starknet.Output},
{Runner: &Pedersen{ratio: 32}, Builtin: starknet.Pedersen},
{Runner: &RangeCheck{ratio: 16, RANGE_CHECK_N_PARTS: 8}, Builtin: starknet.RangeCheck},
{Runner: &RangeCheck{ratio: 16, RangeCheckNParts: 8}, Builtin: starknet.RangeCheck},
{Runner: &ECDSA{ratio: 2048}, Builtin: starknet.ECDSA},
{Runner: &Bitwise{ratio: 64}, Builtin: starknet.Bitwise},
{Runner: &EcOp{ratio: 1024, cache: make(map[uint64]fp.Element)}, Builtin: starknet.ECOP},
Expand Down
10 changes: 5 additions & 5 deletions pkg/vm/builtins/range_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const inputCellsPerRangeCheck = 1
const cellsPerRangeCheck = 1
const instancesPerComponentRangeCheck = 1

// Each range check instance consists of RANGE_CHECK_N_PARTS 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.
// 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.
const INNER_RC_BOUND_SHIFT = 16
const INNER_RC_BOUND_MASK = (1 << 16) - 1

type RangeCheck struct {
ratio uint64
RANGE_CHECK_N_PARTS uint64
ratio uint64
RangeCheckNParts uint64
}

func (r *RangeCheck) CheckWrite(segment *memory.Segment, offset uint64, value *memory.MemoryValue) error {
Expand All @@ -29,7 +29,7 @@ func (r *RangeCheck) CheckWrite(segment *memory.Segment, offset uint64, value *m
return fmt.Errorf("check write: %w", err)
}

if r.RANGE_CHECK_N_PARTS == 6 {
if r.RangeCheckNParts == 6 {
// 2**96
BOUND_96, err := new(fp.Element).SetString("79228162514264337593543950336")
if err != nil {
Expand All @@ -55,7 +55,7 @@ func (r *RangeCheck) InferValue(segment *memory.Segment, offset uint64) error {
}

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

0 comments on commit c212f0b

Please sign in to comment.