Skip to content
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

Fix tests #15

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ resolver = "2"
# franklin-crypto = {path = "../franklin-crypto", features = ["plonk", "multicore"]}
franklin-crypto = {git = "https://github.com/matter-labs/franklin-crypto", branch = "dev", features = ["multicore"]}
sha2 = "0.10"
sha3 = "0.10"
# sha3 = "0.10"
sha3 = { git = "https://github.com/RustCrypto/hashes.git", rev = "7a187e934c1f6c68e4b4e5cf37541b7a0d64d303" }
hex = "*"
once_cell = "*"
derivative = "*"
Expand Down
6 changes: 3 additions & 3 deletions src/data_structures/alg_binary_tree/dense_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ mod tests {
>::new(&params);

let mut leaf_hashes = vec![Fr::zero(); 8];
let one = Fr::from_str("1").unwrap();
leaf_hashes[0] = one;
leaf_hashes[0] = Fr::one();
let new_tree = BinaryTree::<Bn256, _>::create_from_leaf_hashes(&leaf_hashes, hasher);

assert_eq!(
new_tree.get_commitment().to_string().as_str(),
"Fr(0x2a30c843f2912ccc50f7b5baab078e548dd5df3fdb07199d1413c437b0997dee)"
// "Fr(0x2a30c843f2912ccc50f7b5baab078e548dd5df3fdb07199d1413c437b0997dee)"
"Fr(0x113bf1fa2ddb05cf4659651dc6a6c602a8f29dfde19f288e066c97b020fdc9d8)"
);
}

Expand Down
12 changes: 9 additions & 3 deletions src/glue/code_unpacker_sha256/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,15 @@ mod test {
let mut code_hash_in_internal_format = [0u8; 32];
let length_in_words = (input_length / 32) as u16;
let length_in_words_le = length_in_words.to_be_bytes();
code_hash_in_internal_format[0] = length_in_words_le[0];
code_hash_in_internal_format[1] = length_in_words_le[1];
code_hash_in_internal_format[2..].copy_from_slice(&code_hash.as_slice()[2..]);

use zkevm_opcode_defs::versioned_hash::ContractCodeSha256;
use zkevm_opcode_defs::VersionedHashDef;

code_hash_in_internal_format[0] = ContractCodeSha256::VERSION_BYTE;
code_hash_in_internal_format[1] = 0;
code_hash_in_internal_format[2] = length_in_words_le[0];
code_hash_in_internal_format[3] = length_in_words_le[1];
code_hash_in_internal_format[4..].copy_from_slice(&code_hash.as_slice()[4..]);
let code_hash =
UInt256::constant_from_biguint(BigUint::from_bytes_be(&code_hash_in_internal_format));

Expand Down