-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add NewHint#22 * Update changelog * Remove unused import * Use constant and add NOTE comment
- Loading branch information
1 parent
fe781fd
commit a199589
Showing
8 changed files
with
137 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
%builtins range_check | ||
|
||
from starkware.cairo.common.cairo_secp.bigint import BigInt3, UnreducedBigInt3, nondet_bigint3 | ||
from starkware.cairo.common.cairo_secp.field import unreduced_mul, verify_zero | ||
|
||
func is_zero_pack{range_check_ptr}(x: BigInt3) -> (res: felt) { | ||
// just to import SECP_P | ||
%{ | ||
from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack | ||
value = pack(ids.x, PRIME) % SECP_P | ||
%} | ||
%{ | ||
from starkware.cairo.common.cairo_secp.secp_utils import pack | ||
x = pack(ids.x, PRIME) % SECP_P | ||
%} | ||
if (nondet %{ x == 0 %} != 0) { | ||
return (res=1); | ||
} | ||
return (res=0); | ||
} | ||
|
||
func test_is_zero_pack{range_check_ptr}() -> () { | ||
let zero = BigInt3(0, 0, 0); | ||
|
||
let (res: felt) = is_zero_pack(zero); | ||
assert res = 1; | ||
|
||
let one = BigInt3(1, 0, 0); | ||
|
||
let (res: felt) = is_zero_pack(one); | ||
assert res = 0; | ||
|
||
let secp256k1_prime = BigInt3( | ||
77371252455336262886226991, 77371252455336267181195263, 19342813113834066795298815 | ||
); | ||
|
||
let (res: felt) = is_zero_pack(secp256k1_prime); | ||
assert res = 1; | ||
|
||
return (); | ||
} | ||
|
||
func main{range_check_ptr}() -> () { | ||
test_is_zero_pack(); | ||
|
||
return (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a199589
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.30
.build runner
15618118
ns/iter (± 492265
)11401960
ns/iter (± 164968
)1.37
This comment was automatically generated by workflow using github-action-benchmark.
CC: @unbalancedparentheses