Skip to content

Commit

Permalink
Merge pull request #261 from kroma-network/refac/organize-zk-directories
Browse files Browse the repository at this point in the history
refac: organize zk directories
  • Loading branch information
chokobole committed Jan 30, 2024
2 parents ac5f282 + 5023e99 commit c6c7f83
Show file tree
Hide file tree
Showing 128 changed files with 960 additions and 948 deletions.
18 changes: 0 additions & 18 deletions tachyon/zk/base/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ tachyon_cc_library(
deps = ["//tachyon/base:ref"],
)

tachyon_cc_library(
name = "field_stringifier",
hdrs = ["field_stringifier.h"],
deps = [
"//tachyon/base/strings:rust_stringifier",
"//tachyon/math/finite_fields:prime_field_base",
],
)

tachyon_cc_library(
name = "point_set",
hdrs = ["point_set.h"],
Expand All @@ -35,15 +26,6 @@ tachyon_cc_library(
],
)

tachyon_cc_library(
name = "point_stringifier",
hdrs = ["point_stringifier.h"],
deps = [
":field_stringifier",
"//tachyon/math/elliptic_curves:points",
],
)

tachyon_cc_library(
name = "random_field_generator_base",
hdrs = ["random_field_generator_base.h"],
Expand Down
31 changes: 5 additions & 26 deletions tachyon/zk/expressions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tachyon_cc_library(
hdrs = ["advice_expression.h"],
deps = [
":expression",
"//tachyon/zk/plonk/circuit:query",
"//tachyon/zk/plonk/constraint_system:query",
"@com_google_absl//absl/memory",
],
)
Expand All @@ -17,7 +17,7 @@ tachyon_cc_library(
hdrs = ["challenge_expression.h"],
deps = [
":expression",
"//tachyon/zk/plonk/circuit:challenge",
"//tachyon/zk/plonk/constraint_system:challenge",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
],
Expand Down Expand Up @@ -45,7 +45,7 @@ tachyon_cc_library(
deps = [
":expression_type",
"//tachyon/base:ref",
"//tachyon/zk/plonk/circuit:selector",
"//tachyon/zk/plonk/constraint_system:selector",
],
)

Expand All @@ -69,27 +69,6 @@ tachyon_cc_library(
],
)

tachyon_cc_library(
name = "expression_stringifier",
hdrs = ["expression_stringifier.h"],
deps = [
":advice_expression",
":challenge_expression",
":constant_expression",
":fixed_expression",
":instance_expression",
":negated_expression",
":product_expression",
":scaled_expression",
":selector_expression",
":sum_expression",
"//tachyon/zk/base:field_stringifier",
"//tachyon/zk/plonk/circuit:challenge_stringifier",
"//tachyon/zk/plonk/circuit:phase_stringifier",
"//tachyon/zk/plonk/circuit:rotation_stringifier",
],
)

tachyon_cc_library(
name = "expression_type",
srcs = ["expression_type.cc"],
Expand All @@ -102,7 +81,7 @@ tachyon_cc_library(
hdrs = ["fixed_expression.h"],
deps = [
":expression",
"//tachyon/zk/plonk/circuit:query",
"//tachyon/zk/plonk/constraint_system:query",
"@com_google_absl//absl/memory",
],
)
Expand All @@ -112,7 +91,7 @@ tachyon_cc_library(
hdrs = ["instance_expression.h"],
deps = [
":expression",
"//tachyon/zk/plonk/circuit:query",
"//tachyon/zk/plonk/constraint_system:query",
"@com_google_absl//absl/memory",
],
)
Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/advice_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "absl/memory/memory.h"

#include "tachyon/zk/expressions/expression.h"
#include "tachyon/zk/plonk/circuit/query.h"
#include "tachyon/zk/plonk/constraint_system/query.h"

namespace tachyon::zk {

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/challenge_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "absl/strings/substitute.h"

#include "tachyon/zk/expressions/expression.h"
#include "tachyon/zk/plonk/circuit/challenge.h"
#include "tachyon/zk/plonk/constraint_system/challenge.h"

namespace tachyon::zk {

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/evaluator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tachyon_cc_library(
"//tachyon/zk/expressions:scaled_expression",
"//tachyon/zk/expressions:selector_expression",
"//tachyon/zk/expressions:sum_expression",
"//tachyon/zk/plonk/circuit:ref_table",
"//tachyon/zk/plonk/base:ref_table",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/evaluator/simple_evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "tachyon/zk/expressions/scaled_expression.h"
#include "tachyon/zk/expressions/selector_expression.h"
#include "tachyon/zk/expressions/sum_expression.h"
#include "tachyon/zk/plonk/circuit/ref_table.h"
#include "tachyon/zk/plonk/base/ref_table.h"

namespace tachyon::zk {

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "tachyon/base/logging.h"
#include "tachyon/base/ref.h"
#include "tachyon/zk/expressions/expression_type.h"
#include "tachyon/zk/plonk/circuit/selector.h"
#include "tachyon/zk/plonk/constraint_system/selector.h"

namespace tachyon::zk {

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/fixed_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "absl/memory/memory.h"

#include "tachyon/zk/expressions/expression.h"
#include "tachyon/zk/plonk/circuit/query.h"
#include "tachyon/zk/plonk/constraint_system/query.h"

namespace tachyon::zk {

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/instance_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "absl/memory/memory.h"

#include "tachyon/zk/expressions/expression.h"
#include "tachyon/zk/plonk/circuit/query.h"
#include "tachyon/zk/plonk/constraint_system/query.h"

namespace tachyon::zk {

Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/expressions/selector_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "absl/strings/substitute.h"

#include "tachyon/zk/expressions/expression.h"
#include "tachyon/zk/plonk/circuit/selector.h"
#include "tachyon/zk/plonk/constraint_system/selector.h"

namespace tachyon::zk {

Expand Down
12 changes: 1 addition & 11 deletions tachyon/zk/lookup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,11 @@ tachyon_cc_library(
"//tachyon/zk/base/entities:prover_base",
"//tachyon/zk/expressions/evaluator:simple_evaluator",
"//tachyon/zk/lookup:permute_expression_pair",
"//tachyon/zk/plonk/circuit:rotation",
"//tachyon/zk/plonk/constraint_system:rotation",
"//tachyon/zk/plonk/permutation:grand_product_argument",
],
)

tachyon_cc_library(
name = "lookup_argument_stringifier",
hdrs = ["lookup_argument_stringifier.h"],
deps = [
":lookup_argument",
"//tachyon/base/strings:rust_stringifier",
"//tachyon/zk/expressions:expression_stringifier",
],
)

tachyon_cc_library(
name = "lookup_committed",
hdrs = ["lookup_committed.h"],
Expand Down
2 changes: 1 addition & 1 deletion tachyon/zk/lookup/lookup_argument_runner_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "tachyon/zk/lookup/compress_expression.h"
#include "tachyon/zk/lookup/lookup_argument_runner.h"
#include "tachyon/zk/lookup/permute_expression_pair.h"
#include "tachyon/zk/plonk/circuit/rotation.h"
#include "tachyon/zk/plonk/constraint_system/rotation.h"
#include "tachyon/zk/plonk/permutation/grand_product_argument.h"

namespace tachyon::zk {
Expand Down
34 changes: 0 additions & 34 deletions tachyon/zk/plonk/BUILD.bazel

This file was deleted.

72 changes: 72 additions & 0 deletions tachyon/zk/plonk/base/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
load("//bazel:tachyon_cc.bzl", "tachyon_cc_library", "tachyon_cc_unittest")

package(default_visibility = ["//visibility:public"])

tachyon_cc_library(
name = "column_key",
hdrs = ["column_key.h"],
deps = [
":column_type",
":phase",
"//tachyon/base:logging",
"@com_google_absl//absl/strings",
],
)

tachyon_cc_library(
name = "column_type",
srcs = ["column_type.cc"],
hdrs = ["column_type.h"],
deps = ["//tachyon/base:logging"],
)

tachyon_cc_library(
name = "owned_table",
hdrs = ["owned_table.h"],
deps = [":table_base"],
)

tachyon_cc_library(
name = "phase",
hdrs = ["phase.h"],
deps = [
"//tachyon/base/strings:string_number_conversions",
"@com_google_absl//absl/hash",
],
)

tachyon_cc_library(
name = "ref_table",
hdrs = ["ref_table.h"],
deps = [":table_base"],
)

tachyon_cc_library(
name = "table_base",
hdrs = ["table_base.h"],
deps = [
":column_key",
"//tachyon/base:logging",
"//tachyon/base:ref",
"//tachyon/base:template_util",
"//tachyon/base/containers:container_util",
"@com_google_absl//absl/types:span",
],
)

tachyon_cc_unittest(
name = "base_unittests",
srcs = [
"column_key_unittest.cc",
"phase_unittest.cc",
"ref_table_unittest.cc",
],
deps = [
":column_key",
":phase",
":ref_table",
"//tachyon/math/elliptic_curves/bn/bn254:g1",
"//tachyon/math/polynomials/univariate:univariate_evaluations",
"@com_google_absl//absl/hash:hash_testing",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// can be found in the LICENSE-MIT.halo2 and the LICENCE-APACHE.halo2
// file.

#ifndef TACHYON_ZK_PLONK_CIRCUIT_COLUMN_KEY_H_
#define TACHYON_ZK_PLONK_CIRCUIT_COLUMN_KEY_H_
#ifndef TACHYON_ZK_PLONK_BASE_COLUMN_KEY_H_
#define TACHYON_ZK_PLONK_BASE_COLUMN_KEY_H_

#include <stddef.h>

Expand All @@ -16,8 +16,8 @@
#include "absl/strings/substitute.h"

#include "tachyon/base/logging.h"
#include "tachyon/zk/plonk/circuit/column_type.h"
#include "tachyon/zk/plonk/circuit/phase.h"
#include "tachyon/zk/plonk/base/column_type.h"
#include "tachyon/zk/plonk/base/phase.h"

namespace tachyon::zk {

Expand Down Expand Up @@ -211,4 +211,4 @@ H AbslHashValue(H h, const ColumnKey<C>& column) {

} // namespace tachyon::zk

#endif // TACHYON_ZK_PLONK_CIRCUIT_COLUMN_KEY_H_
#endif // TACHYON_ZK_PLONK_BASE_COLUMN_KEY_H_
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "tachyon/zk/plonk/circuit/column_key.h"
#include "tachyon/zk/plonk/base/column_key.h"

#include "absl/hash/hash_testing.h"
#include "gtest/gtest.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// can be found in the LICENSE-MIT.halo2 and the LICENCE-APACHE.halo2
// file.

#include "tachyon/zk/plonk/circuit/column_type.h"
#include "tachyon/zk/plonk/base/column_type.h"

#include "tachyon/base/logging.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// can be found in the LICENSE-MIT.halo2 and the LICENCE-APACHE.halo2
// file.

#ifndef TACHYON_ZK_PLONK_CIRCUIT_COLUMN_TYPE_H_
#define TACHYON_ZK_PLONK_CIRCUIT_COLUMN_TYPE_H_
#ifndef TACHYON_ZK_PLONK_BASE_COLUMN_TYPE_H_
#define TACHYON_ZK_PLONK_BASE_COLUMN_TYPE_H_

#include <ostream>
#include <string_view>
Expand All @@ -29,4 +29,4 @@ TACHYON_EXPORT std::string_view ColumnTypeToString(ColumnType type);

} // namespace tachyon::zk

#endif // TACHYON_ZK_PLONK_CIRCUIT_COLUMN_TYPE_H_
#endif // TACHYON_ZK_PLONK_BASE_COLUMN_TYPE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
// can be found in the LICENSE-MIT.halo2 and the LICENCE-APACHE.halo2
// file.

#ifndef TACHYON_ZK_PLONK_CIRCUIT_OWNED_TABLE_H_
#define TACHYON_ZK_PLONK_CIRCUIT_OWNED_TABLE_H_
#ifndef TACHYON_ZK_PLONK_BASE_OWNED_TABLE_H_
#define TACHYON_ZK_PLONK_BASE_OWNED_TABLE_H_

#include <utility>
#include <vector>

#include "tachyon/zk/plonk/circuit/table_base.h"
#include "tachyon/zk/plonk/base/table_base.h"

namespace tachyon::zk {

Expand Down Expand Up @@ -44,4 +44,4 @@ class OwnedTable : public TableBase<PolyOrEvals> {

} // namespace tachyon::zk

#endif // TACHYON_ZK_PLONK_CIRCUIT_OWNED_TABLE_H_
#endif // TACHYON_ZK_PLONK_BASE_OWNED_TABLE_H_

0 comments on commit c6c7f83

Please sign in to comment.