Skip to content

Commit

Permalink
Move new code to CircuitChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton committed Mar 6, 2024
1 parent d83be4b commit 1bba00e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "../../constants.hpp"
#include "../inner_proof_data/inner_proof_data.hpp"
#include "../notes/native/index.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/common/streams.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/crypto/merkle_tree/index.hpp"
Expand Down Expand Up @@ -266,7 +267,7 @@ class join_split_tests : public ::testing::Test {
bool sign_and_check_circuit(join_split_tx& tx, key_pair const& signing_key)
{
circuit = sign_and_create_circuit(tx, signing_key);
return circuit.check_circuit();
return CircuitChecker::check(circuit);
}

struct verify_result {
Expand Down Expand Up @@ -2198,7 +2199,7 @@ TEST_F(join_split_tests, test_deposit)
*/

CircuitBuilder circuit = sign_and_create_circuit(tx, user.owner);
EXPECT_TRUE(circuit.check_circuit());
EXPECT_TRUE(CircuitChecker::check(circuit));
}

TEST_F(join_split_tests, test_withdraw)
Expand All @@ -2219,7 +2220,7 @@ TEST_F(join_split_tests, test_withdraw)
*/

CircuitBuilder circuit = sign_and_create_circuit(tx, user.owner);
EXPECT_TRUE(circuit.check_circuit());
EXPECT_TRUE(CircuitChecker::check(circuit));
}

TEST_F(join_split_tests, test_private_send)
Expand All @@ -2237,7 +2238,7 @@ TEST_F(join_split_tests, test_private_send)

CircuitBuilder circuit = sign_and_create_circuit(tx, user.owner);

EXPECT_TRUE(circuit.check_circuit());
EXPECT_TRUE(CircuitChecker::check(circuit));
}

TEST_F(join_split_tests, test_defi_deposit)
Expand Down Expand Up @@ -2266,7 +2267,7 @@ TEST_F(join_split_tests, test_defi_deposit)
*/

CircuitBuilder circuit = sign_and_create_circuit(tx, user.owner);
EXPECT_TRUE(circuit.check_circuit());
EXPECT_TRUE(CircuitChecker::check(circuit));
}

TEST_F(join_split_tests, test_repayment)
Expand Down Expand Up @@ -2297,7 +2298,7 @@ TEST_F(join_split_tests, test_repayment)
tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier;

CircuitBuilder circuit = sign_and_create_circuit(tx, user.owner);
EXPECT_TRUE(circuit.check_circuit());
EXPECT_TRUE(CircuitChecker::check(circuit));
}

} // namespace bb::join_split_example::proofs::join_split
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "../../native/value/value_note.hpp"
#include "../../../../fixtures/user_context.hpp"
#include "../../constants.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/join_split_example/types.hpp"
#include "value_note.hpp"
#include <gtest/gtest.h>
Expand Down Expand Up @@ -38,7 +39,7 @@ TEST_F(ValueNote, Commits)
result.assert_equal(expected);

EXPECT_FALSE(builder.failed());
EXPECT_EQ(builder.check_circuit(), true);
EXPECT_EQ(CircuitChecker::check(builder), true);
}

TEST_F(ValueNote, CommitsWith0Value)
Expand All @@ -64,7 +65,7 @@ TEST_F(ValueNote, CommitsWith0Value)
auto result = circuit_note.commitment;
result.assert_equal(expected);

EXPECT_EQ(builder.check_circuit(), true);
EXPECT_EQ(CircuitChecker::check(builder), true);
}

TEST_F(ValueNote, CommitWithOversizedAssetIdFails)
Expand All @@ -88,6 +89,6 @@ TEST_F(ValueNote, CommitWithOversizedAssetIdFails)
result.assert_equal(expected);

EXPECT_TRUE(builder.failed());
EXPECT_EQ(builder.check_circuit(), false);
EXPECT_EQ(CircuitChecker::check(builder), false);
}
} // namespace bb::join_split_example

0 comments on commit 1bba00e

Please sign in to comment.