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

feat(zk): implement combined custom gate column builder #206

Merged
merged 13 commits into from
Dec 22, 2023

Conversation

dongchangYoo
Copy link
Contributor

@dongchangYoo dongchangYoo commented Dec 18, 2023

This PR mainly implements a function named BuildCombinedCustomGateColumn().
And it corresponds to evaluate_h() in Zcash implementations.

Additionally, some bugs in the VanishingArgument class have been fixed, and the process also includes assigning a VanishingArgument instance to the ProvingKey.

@chokobole
Copy link
Contributor

d19cf3f This should be test typed commit.

tachyon/zk/plonk/vanishing/vanishing_utils.h Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils_unittest.cc Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils_unittest.cc Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils_unittest.cc Outdated Show resolved Hide resolved
tachyon/zk/plonk/circuit/rotation.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument.h Outdated Show resolved Hide resolved
@dongchangYoo dongchangYoo force-pushed the feat/implement-circuit-poly-builder branch 5 times, most recently from cdd1ba8 to 21233b6 Compare December 20, 2023 06:22
tachyon/zk/plonk/circuit/examples/circuit_test.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/circuit/owned_table.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/calculation.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/circuit/rotation.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument_unittest.cc Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/graph_evaluator.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_utils.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/circuit_polynomial_builder.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/circuit_polynomial_builder.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/circuit_polynomial_builder.h Outdated Show resolved Hide resolved
tachyon/zk/plonk/vanishing/vanishing_argument_unittest.cc Outdated Show resolved Hide resolved
`VanishingArgument` actually only requires `Field` type as a template argument.
…y loop

An issue arises in the `VanishingArgument::Create()` where the
destructor of `ValueSource` is called infinitely during the process
of adding `Calculation::HornerData` to `custom_gates`.
This issue is suspected to stem from managing the members of
`Calculation` as a `Union`, hence each member was changed to `std::optional`.
We switched it to public for external logic that uses only this
feature, and changed it to `static` since this function does not
use any internal variables.
`Table` does not own the data of its members, so rename it to
`RefTable` to improve the user's intuitive understanding.
@dongchangYoo dongchangYoo force-pushed the feat/implement-circuit-poly-builder branch from dcf1a0c to 9837c2a Compare December 22, 2023 04:10
Copy link
Contributor

@TomTaehoonKim TomTaehoonKim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Insun35 Insun35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

In the next commit, `OwnedTable` will be implemented with an
interface same to `RefTable`, but it owns data of members.
Therefore the common methods of two child classes was implemented
in `TableBase`.
It owns `Fixed/Advice/Instance` columns and is a class that returns
a `Ref` to the respective column when given a `ColumnKey` as input.
It is similar to Table in `zk/plonk/circuit/table.h`.
It is a class that manages the arguments of `ValueSource::Get()`,
`Calculation::Evaluate()`, and `GraphEvaluator::Evaluate()` together.
It will replace `ValueSourceData` on the next commit.
It generates circuit polynomial: gate₀(X) + y * gate₁(X) + ... + yⁱ * gateᵢ(X) + ...
See [Halo2 book](https://zcash.github.io/halo2/design/proving-system/vanishing.html)
And To find reference of this log, see [evaluate_h()](See [evaluate_h()](https://github.com/kroma-network/halo2/blob/7d0a36990452c8e7ebd600de258420781a9b7917/halo2_proofs/src/plonk/evaluation.rs#L280-L583))

And this feature is provided by the
`VanishingArgument::BuildExtendedCircuitColumn()` function.
@dongchangYoo dongchangYoo force-pushed the feat/implement-circuit-poly-builder branch from 9837c2a to a9f048b Compare December 22, 2023 05:55
@dongchangYoo dongchangYoo merged commit d9ce974 into main Dec 22, 2023
3 checks passed
@dongchangYoo dongchangYoo deleted the feat/implement-circuit-poly-builder branch December 22, 2023 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants