-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new keccak hints + update import paths (#883)
* Add cache to keccak builtin * Temporaryly unhide recursive layout for debugging * Use same keccak method as the one used in keccak_utils * Make keccak builtin work * Fix visisbility * Small refactor * Refactor * Refactor * Add tests * Fix address management * Add test program * Clippy + Update tests * Remove unused import * Remove uneeded Rc * Make error less specific * Add integration test * Add proposed changes * Add new hints * Add test program * Move constants * Add keccak hints; * Fix overflowing operation * Add more hints * Add unit tests * Add integration test * Update import paths in cairo programs used for testing * Update hints with new import paths * Add newline at end of file * Clippy * Clean imports * Re-hide recursive layout * Update src/hint_processor/builtin_hint_processor/keccak_utils.rs Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com> * Add suggested change + fix conflicts * Update src/hint_processor/builtin_hint_processor/keccak_utils.rs Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com> * Fix * Use u64 in split_n_bytes hints * Use starknet_with_keccak layout when running cairo-lang * Fix relative path in compare_vm_state script --------- Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com>
- Loading branch information
Showing
15 changed files
with
432 additions
and
118 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
%builtins range_check bitwise keccak | ||
from starkware.cairo.common.cairo_builtins import KeccakBuiltin, BitwiseBuiltin | ||
from starkware.cairo.common.builtin_keccak.keccak import keccak_uint256s | ||
from starkware.cairo.common.alloc import alloc | ||
from starkware.cairo.common.uint256 import Uint256 | ||
|
||
func main{range_check_ptr, bitwise_ptr: BitwiseBuiltin*, keccak_ptr: KeccakBuiltin*}() { | ||
let elements: Uint256* = alloc(); | ||
assert elements[0] = Uint256(713458135386519, 18359173571); | ||
assert elements[1] = Uint256(1536741637546373185, 84357893467438914); | ||
assert elements[2] = Uint256(2842949328439284983294, 39248298942938492384); | ||
assert elements[3] = Uint256(27518568234293478923754395731931, 981587843715983274); | ||
assert elements[4] = Uint256(326848123647324823482, 93453458349589345); | ||
let (res) = keccak_uint256s(5, elements); | ||
assert res.high = 23012215180764429403047187376747988760; | ||
assert res.low = 13431206634823648732212765105043225161; | ||
|
||
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
Oops, something went wrong.