-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starknet Keccak #57
base: main
Are you sure you want to change the base?
Starknet Keccak #57
Conversation
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.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @marioiordanov)
src/hash.rs
line 58 at r1 (raw file):
let mut res_bytes: [u8; 32] = [0; 32]; masked_number.to_big_endian(&mut res_bytes); StarkFelt::new(res_bytes).expect("error when converting to StarkFelt")
Return a Result instead of expecting
src/hash_test.rs
line 75 at r1 (raw file):
#[test] fn starknet_keccak_mask() { let mask: U256 = U256::pow(U256::from(2), U256::from(250)) - U256::from(1);
Is it possible to calculate this in the const itself? (not blocking)
Code quote:
let mask: U256 = U256::pow(U256::from(2), U256::from(250)) - U256::from(1);
src/hash_test.rs
line 86 at r1 (raw file):
let expected_keccak_felt = stark_felt!("0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320"); let increase_balance_keccak_felt = crate::hash::starknet_keccak("increase_balance".as_bytes());
Replace the full path by importing the function
Code quote:
crate::
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.
Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @yair-starkware)
src/hash.rs
line 58 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Return a Result instead of expecting
Done.
src/hash_test.rs
line 75 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Is it possible to calculate this in the const itself? (not blocking)
No, because it gives a compilation error: he trait Sub<_>
is implemented for U256
, but that implementation is not const
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.
Reviewed 1 of 2 files at r2.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @marioiordanov)
src/hash.rs
line 24 at r2 (raw file):
const CHOOSER_FULL: u8 = 15; const CHOOSER_HALF: u8 = 14; /// the MASK equals to U256::pow(U256::from(2), U256::from(250)) - U256::from(1)
The
Code quote:
the
The PR includes:
Implementation of starknet_keccak hash function
This change is