Conversation
yair-starkware
left a comment
There was a problem hiding this comment.
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::
marioiordanov
left a comment
There was a problem hiding this comment.
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
yair-starkware
left a comment
There was a problem hiding this comment.
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