Skip to content

Commit

Permalink
ecMulInner integration test (#496)
Browse files Browse the repository at this point in the history
* ecMulInner

* fmt

* fmt

* put alloc and hintref in right folder
  • Loading branch information
TAdev0 committed Jul 3, 2024
1 parent 6d939e4 commit f1df68d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions integration_tests/cairo_zero_hint_tests/ec.small.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
%builtins range_check

from starkware.cairo.common.cairo_secp.bigint import BigInt3
from starkware.cairo.common.cairo_secp.ec import EcPoint, ec_negate, compute_doubling_slope, compute_slope, ec_double, fast_ec_add

from starkware.cairo.common.cairo_secp.ec import EcPoint, ec_negate, compute_doubling_slope, compute_slope, ec_double, fast_ec_add, ec_mul_inner
func test_ec_negate{range_check_ptr}() {
let p = EcPoint(BigInt3(1, 2, 3), BigInt3(1, 2, 3));
let (res) = ec_negate(p);
Expand Down Expand Up @@ -84,11 +83,24 @@ func test_fast_ec_add{range_check_ptr}() {
return ();
}

func test_ec_muller_inner{range_check_ptr}() {
let (pow2, res) = ec_mul_inner(
EcPoint(
BigInt3(65162296, 359657, 04862662171381), BigInt3(-5166641367474701, -63029418, 793)
),
123,
298,
);

return ();
}

func main{range_check_ptr}() {
test_ec_negate();
test_compute_doubling_slope();
test_compute_slope();
test_ec_double();
test_fast_ec_add();
test_ec_muller_inner();
return ();
}
1 change: 1 addition & 0 deletions pkg/hintrunner/zero/zerohint_ec.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ func newEcMulInnerHint(scalar hinter.ResOperander) hinter.Hinter {
resultFelt := new(fp.Element).SetBytes(resultUint256.Bytes())
resultMv := mem.MemoryValueFromFieldElement(resultFelt)
apAddr := vm.Context.AddressAp()

return vm.Memory.WriteToAddress(&apAddr, &resultMv)
},
}
Expand Down

0 comments on commit f1df68d

Please sign in to comment.