Skip to content

Commit

Permalink
Bug Fix and Comment Update (#495)
Browse files Browse the repository at this point in the history
* env update

* Updated comments
  • Loading branch information
Sh0g0-1758 committed Jun 28, 2024
1 parent b5dac4c commit dd54197
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion integration_tests/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Set to run some specific file tests (ex. fib.cairo,alloc.cairo)
INTEGRATION_TESTS_FILTERS=is_zero.small.cairo
INTEGRATION_TESTS_FILTERS=
18 changes: 11 additions & 7 deletions pkg/hintrunner/zero/zerohint_ec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func newEcNegateHint(point hinter.ResOperander) hinter.Hinter {
Name: "EcNegate",
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack
//>
//> y = pack(ids.point.y, PRIME) % SECP_P
//> # The modulo operation in python always returns a nonnegative number.
//> value = (-y) % SECP_P
Expand Down Expand Up @@ -84,6 +85,7 @@ func newNondetBigint3V1Hint(res hinter.ResOperander) hinter.Hinter {
Name: "NondetBigint3V1",
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import split
//>
//> segments.write_arg(ids.res.address_, split(value))

address, err := res.GetAddress(vm)
Expand Down Expand Up @@ -146,11 +148,12 @@ func newFastEcAddAssignNewXHint(slope, point0, point1 hinter.ResOperander) hinte
Name: "FastEcAddAssignNewX",
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack
//
//>
//> slope = pack(ids.slope, PRIME)
//> x0 = pack(ids.point0.x, PRIME)
//> x1 = pack(ids.point1.x, PRIME)
//> y0 = pack(ids.point0.y, PRIME)
//>
//> value = new_x = (pow(slope, 2, SECP_P) - x0 - x1) % SECP_P

slopeAddr, err := slope.GetAddress(vm)
Expand Down Expand Up @@ -315,7 +318,7 @@ func newEcDoubleSlopeV1Hint(point hinter.ResOperander) hinter.Hinter {
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack
//> from starkware.python.math_utils import ec_double_slope
//
//>
//> # Compute the slope.
//> x = pack(ids.point.x, PRIME)
//> y = pack(ids.point.y, PRIME)
Expand Down Expand Up @@ -389,6 +392,7 @@ func newReduceV1Hint(x hinter.ResOperander) hinter.Hinter {
Name: "ReduceV1",
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack
//>
//> value = pack(ids.x, PRIME) % SECP_P

secPBig, ok := secp_utils.GetSecPBig()
Expand Down Expand Up @@ -442,11 +446,11 @@ func newEcDoubleAssignNewXV1Hint(slope, point hinter.ResOperander) hinter.Hinter
Name: "EcDoubleAssignNewXV1",
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack

//>
//> slope = pack(ids.slope, PRIME)
//> x = pack(ids.point.x, PRIME)
//> y = pack(ids.point.y, PRIME)

//>
//> value = new_x = (pow(slope, 2, SECP_P) - 2 * x) % SECP_P

slopeAddr, err := slope.GetAddress(vm)
Expand Down Expand Up @@ -593,7 +597,7 @@ func newComputeSlopeV1Hint(point0, point1 hinter.ResOperander) hinter.Hinter {
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack
//> from starkware.python.math_utils import line_slope

//>
//> # Compute the slope.
//> x0 = pack(ids.point0.x, PRIME)
//> y0 = pack(ids.point0.y, PRIME)
Expand Down Expand Up @@ -776,7 +780,7 @@ func newIsZeroPackHint(x hinter.ResOperander) hinter.Hinter {
Name: "IsZeroPack",
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack

//>
//> x = pack(ids.x, PRIME) % SECP_P

xAddr, err := x.GetAddress(vm)
Expand Down Expand Up @@ -831,7 +835,7 @@ func newIsZeroDivModHint() hinter.Hinter {
Op: func(vm *VM.VirtualMachine, ctx *hinter.HintRunnerContext) error {
//> from starkware.cairo.common.cairo_secp.secp_utils import SECP_P
//> from starkware.python.math_utils import div_mod

//>
//> value = x_inv = div_mod(1, x, SECP_P)

secPBig, ok := secp_utils.GetSecPBig()
Expand Down

0 comments on commit dd54197

Please sign in to comment.