Skip to content

Commit

Permalink
Update circuit size and vkhash detection tests (#1750)
Browse files Browse the repository at this point in the history
Switched EXPECT_TRUE to EXPECT_EQ and EXPECT_LE. This will help quickly change values
  • Loading branch information
Rumata888 authored Nov 15, 2022
1 parent c8a99dc commit f991c64
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions src/aztec/rollup/proofs/account/account.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,18 +362,18 @@ TEST_F(account_tests, test_create_account_full_proof_and_detect_circuit_change)
// rollup/constants.hpp and see if atleast the next power of two limit is not exceeded. Please change the constant
// values accordingly and set is_circuit_change_expected to 0 in rollup/constants.hpp before merging.
if (!(circuit_gate_count::is_circuit_change_expected)) {
EXPECT_TRUE(number_of_gates_acc == circuit_gate_count::ACCOUNT)
EXPECT_EQ(number_of_gates_acc, circuit_gate_count::ACCOUNT)
<< "The gate count for the account circuit is changed.";
EXPECT_TRUE(from_buffer<uint256_t>(vk_hash_acc) == circuit_vk_hash::ACCOUNT)
EXPECT_EQ(from_buffer<uint256_t>(vk_hash_acc), circuit_vk_hash::ACCOUNT)
<< "The verification key hash for the account circuit is changed: " << from_buffer<uint256_t>(vk_hash_acc);
// For the next power of two limit, we need to consider that we reserve four gates for adding
// randomness/zero-knowledge
EXPECT_TRUE(number_of_gates_acc <=
circuit_gate_next_power_of_two::ACCOUNT - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_acc,
circuit_gate_next_power_of_two::ACCOUNT - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the account circuit.";
} else {
EXPECT_TRUE(number_of_gates_acc <=
circuit_gate_next_power_of_two::ACCOUNT - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_acc,
circuit_gate_next_power_of_two::ACCOUNT - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the account circuit.";
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/aztec/rollup/proofs/claim/claim.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ TEST_F(claim_tests, test_claim_and_detect_circuit_change)
// rollup/constants.hpp and see if atleast the next power of two limit is not exceeded. Please change the constant
// values accordingly and set is_circuit_change_expected to 0 in rollup/constants.hpp before merging.
if (!(circuit_gate_count::is_circuit_change_expected)) {
EXPECT_TRUE(number_of_gates_claim == circuit_gate_count::CLAIM)
EXPECT_EQ(number_of_gates_claim, circuit_gate_count::CLAIM)
<< "The gate count for the claim circuit is changed.";
EXPECT_TRUE(from_buffer<uint256_t>(vk_hash_claim) == circuit_vk_hash::CLAIM)
EXPECT_EQ(from_buffer<uint256_t>(vk_hash_claim), circuit_vk_hash::CLAIM)
<< "The verification key hash for the claim circuit is changed: " << from_buffer<uint256_t>(vk_hash_claim);
// For the next power of two limit, we need to consider that we reserve four gates for adding
// randomness/zero-knowledge
EXPECT_TRUE(number_of_gates_claim <=
circuit_gate_next_power_of_two::CLAIM - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_claim,
circuit_gate_next_power_of_two::CLAIM - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the claim circuit.";
} else {
EXPECT_TRUE(number_of_gates_claim <=
circuit_gate_next_power_of_two::CLAIM - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_claim,
circuit_gate_next_power_of_two::CLAIM - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the claim circuit.";
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/aztec/rollup/proofs/join_split/join_split.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,19 +695,19 @@ TEST_F(join_split_tests, test_0_input_notes_and_detect_circuit_change)
// rollup/constants.hpp and see if atleast the next power of two limit is not exceeded. Please change the constant
// values accordingly and set is_circuit_change_expected to 0 in rollup/constants.hpp before merging.
if (!(circuit_gate_count::is_circuit_change_expected)) {
EXPECT_TRUE(number_of_gates_js == circuit_gate_count::JOIN_SPLIT)
EXPECT_EQ(number_of_gates_js, circuit_gate_count::JOIN_SPLIT)
<< "The gate count for the join_split circuit is changed.";
EXPECT_TRUE(from_buffer<uint256_t>(vk_hash_js) == circuit_vk_hash::JOIN_SPLIT)
EXPECT_EQ(from_buffer<uint256_t>(vk_hash_js), circuit_vk_hash::JOIN_SPLIT)
<< "The verification key hash for the join_split circuit is changed: "
<< from_buffer<uint256_t>(vk_hash_js);
// For the next power of two limit, we need to consider that we reserve four gates for adding
// randomness/zero-knowledge
EXPECT_TRUE(number_of_gates_js <=
circuit_gate_next_power_of_two::JOIN_SPLIT - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_js,
circuit_gate_next_power_of_two::JOIN_SPLIT - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the join_split circuit.";
} else {
EXPECT_TRUE(number_of_gates_js <=
circuit_gate_next_power_of_two::JOIN_SPLIT - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_js,
circuit_gate_next_power_of_two::JOIN_SPLIT - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the join_split circuit.";
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/aztec/rollup/proofs/root_rollup/root_rollup_full.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,18 @@ HEAVY_TEST_F(root_rollup_full_tests, test_root_rollup_3x2_and_detect_circuit_cha
// rollup/constants.hpp and see if atleast the next power of two limit is not exceeded. Please change the constant
// values accordingly and set is_circuit_change_expected to 0 in rollup/constants.hpp before merging.
if (!(circuit_gate_count::is_circuit_change_expected)) {
EXPECT_TRUE(number_of_gates_root_rollup == circuit_gate_count::ROOT_ROLLUP)
EXPECT_EQ(number_of_gates_root_rollup, circuit_gate_count::ROOT_ROLLUP)
<< "The gate count for the root rollup circuit is changed.";
EXPECT_TRUE(from_buffer<uint256_t>(vk_hash_root_rollup) == circuit_vk_hash::ROOT_ROLLUP)
EXPECT_EQ(from_buffer<uint256_t>(vk_hash_root_rollup), circuit_vk_hash::ROOT_ROLLUP)
<< "The verification key hash for the root rollup circuit is changed.";
// For the next power of two limit, we need to consider that we reserve four gates for adding
// randomness/zero-knowledge
EXPECT_TRUE(number_of_gates_root_rollup <=
circuit_gate_next_power_of_two::ROOT_ROLLUP - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_root_rollup,
circuit_gate_next_power_of_two::ROOT_ROLLUP - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the root rollup circuit.";
} else {
EXPECT_TRUE(number_of_gates_root_rollup <=
circuit_gate_next_power_of_two::ROOT_ROLLUP - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_root_rollup,
circuit_gate_next_power_of_two::ROOT_ROLLUP - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the root rollup circuit.";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ HEAVY_TEST_F(root_verifier_full_tests, good_data_passes_and_detect_circuit_chang
// rollup/constants.hpp and see if atleast the next power of two limit is not exceeded. Please change the constant
// values accordingly and set is_circuit_change_expected to 0 in rollup/constants.hpp before merging.
if (!(circuit_gate_count::is_circuit_change_expected)) {
EXPECT_TRUE(number_of_gates_root_verifier == circuit_gate_count::ROOT_VERIFIER)
EXPECT_EQ(number_of_gates_root_verifier, circuit_gate_count::ROOT_VERIFIER)
<< "The gate count for the root verifier circuit is changed.";
EXPECT_TRUE(from_buffer<uint256_t>(vk_hash_root_verifier) == circuit_vk_hash::ROOT_VERIFIER)
EXPECT_EQ(from_buffer<uint256_t>(vk_hash_root_verifier), circuit_vk_hash::ROOT_VERIFIER)
<< "The verification key hash for the root verifier circuit is changed.";
// For the next power of two limit, we need to consider that we reserve four gates for adding
// randomness/zero-knowledge
EXPECT_TRUE(number_of_gates_root_verifier <=
circuit_gate_next_power_of_two::ROOT_VERIFIER - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_root_verifier,
circuit_gate_next_power_of_two::ROOT_VERIFIER - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the root verifier circuit.";
} else {
EXPECT_TRUE(number_of_gates_root_verifier <=
circuit_gate_next_power_of_two::ROOT_VERIFIER - waffle::ComposerBase::NUM_RESERVED_GATES)
EXPECT_LE(number_of_gates_root_verifier,
circuit_gate_next_power_of_two::ROOT_VERIFIER - waffle::ComposerBase::NUM_RESERVED_GATES)
<< "You have exceeded the next power of two limit for the root verifier circuit.";
}
}
Expand Down

0 comments on commit f991c64

Please sign in to comment.