Skip to content

Commit

Permalink
test(zk): implement MultiLookupCircuit
Browse files Browse the repository at this point in the history
  • Loading branch information
Insun35 committed Jun 13, 2024
1 parent a8ccfdc commit 8cb3ce2
Show file tree
Hide file tree
Showing 6 changed files with 1,321 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tachyon/zk/plonk/examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ tachyon_cc_library(
"//tachyon/zk/base/commitments:gwc_extension",
"//tachyon/zk/base/commitments:shplonk_extension",
"//tachyon/zk/lookup/halo2:scheme",
"//tachyon/zk/lookup/log_derivative_halo2:scheme",
"//tachyon/zk/plonk/examples/fibonacci:fibonacci1_circuit",
"//tachyon/zk/plonk/examples/fibonacci:fibonacci2_circuit",
"//tachyon/zk/plonk/examples/fibonacci:fibonacci3_circuit",
Expand All @@ -47,6 +48,8 @@ tachyon_cc_library(
testonly = True,
hdrs = ["circuit_test.h"],
deps = [
":multi_lookup_circuit",
":multi_lookup_circuit_test_data",
":point",
":shuffle_circuit",
":shuffle_circuit_test_data",
Expand Down Expand Up @@ -77,6 +80,19 @@ tachyon_cc_library(
hdrs = ["point.h"],
)

tachyon_cc_library(
name = "multi_lookup_circuit",
hdrs = ["multi_lookup_circuit.h"],
deps = ["//tachyon/zk/plonk/constraint_system:circuit"],
)

tachyon_cc_library(
name = "multi_lookup_circuit_test_data",
testonly = True,
hdrs = ["multi_lookup_circuit_test_data.h"],
deps = COMMON_TEST_DATA_DEPS,
)

tachyon_cc_library(
name = "shuffle_circuit",
hdrs = ["shuffle_circuit.h"],
Expand Down Expand Up @@ -119,6 +135,15 @@ tachyon_cc_library(
deps = COMMON_TEST_DATA_DEPS + ["//tachyon/base:range"],
)

tachyon_cc_unittest(
name = "multi_lookup_circuit_test",
srcs = ["multi_lookup_circuit_test.cc"],
deps = COMMON_TEST_DEPS + [
":multi_lookup_circuit",
":multi_lookup_circuit_test_data",
],
)

tachyon_cc_unittest(
name = "shuffle_circuit_test",
srcs = ["shuffle_circuit_test.cc"],
Expand Down
2 changes: 2 additions & 0 deletions tachyon/zk/plonk/examples/circuit_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "tachyon/zk/plonk/examples/fibonacci/fibonacci2_circuit_test_data.h"
#include "tachyon/zk/plonk/examples/fibonacci/fibonacci3_circuit.h"
#include "tachyon/zk/plonk/examples/fibonacci/fibonacci3_circuit_test_data.h"
#include "tachyon/zk/plonk/examples/multi_lookup_circuit.h"
#include "tachyon/zk/plonk/examples/multi_lookup_circuit_test_data.h"
#include "tachyon/zk/plonk/examples/point.h"
#include "tachyon/zk/plonk/examples/shuffle_circuit.h"
#include "tachyon/zk/plonk/examples/shuffle_circuit_test_data.h"
Expand Down
6 changes: 6 additions & 0 deletions tachyon/zk/plonk/examples/circuit_test_type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "tachyon/zk/base/commitments/gwc_extension.h"
#include "tachyon/zk/base/commitments/shplonk_extension.h"
#include "tachyon/zk/lookup/halo2/scheme.h"
#include "tachyon/zk/lookup/log_derivative_halo2/scheme.h"
#include "tachyon/zk/plonk/examples/fibonacci/fibonacci1_circuit.h"
#include "tachyon/zk/plonk/examples/fibonacci/fibonacci2_circuit.h"
#include "tachyon/zk/plonk/examples/fibonacci/fibonacci3_circuit.h"
Expand All @@ -26,6 +27,11 @@ using BN254Halo2LS = lookup::halo2::Scheme<typename BN254SHPlonk::Poly,
typename BN254SHPlonk::Evals,
typename BN254SHPlonk::Commitment>;

using BN254LogDerivativeHalo2LS =
lookup::log_derivative_halo2::Scheme<typename BN254SHPlonk::Poly,
typename BN254SHPlonk::Evals,
typename BN254SHPlonk::Commitment>;

template <typename Circuit>
constexpr bool IsSimpleFloorPlanner =
std::is_same_v<typename Circuit::FloorPlanner, SimpleFloorPlanner<Circuit>>;
Expand Down
Loading

0 comments on commit 8cb3ce2

Please sign in to comment.