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: hello-world namespace support for ADVZ VID scheme #389

Merged
merged 56 commits into from
Nov 7, 2023

Conversation

ggutoski
Copy link
Contributor

@ggutoski ggutoski commented Oct 30, 2023

closes: #388

Revised 2023-11-06

Force-pushed update incorporating comments from previous reviews and offline discussion.

  • Add PayloadProver subtrait for VidScheme. It's a generic trait with two implementations for ADVZ. See rustdoc:
    //! Two implementations:
    //! 1. `PROOF = `[`Proof`]: KZG batch proof for the data. Useful for small
    //! sub-slices of `payload` such as an individual transaction within a block.
    //! Not snark-friendly because it requires a pairing.
    //! 2. `PROOF = `[`CommitRecovery`]: Rebuild the KZG commitment. Useful for
    //! larger sub-slices of `payload` such as a complete namespace.
    //! Snark-friendly because it does not require a pairing.
  • Change VidScheme to use &[u8] for payload type as per offline discussion.
  • move bytes_to_field from conversion.rs to a new bytes_to_field.rs file owned by advz.

Excerpts from original description

  • change the bytes-to-field conversion in conversion.rs. It's much simpler now because I decided we don't need to add metadata into the output field elements. Instead, it's the responsibility of the caller to know where exactly their bytes begin/end in the encoded field elements.
  • advz.rs has a large diff but it's mostly just moving code around.
  • fix a bug in encoding payload bytes to polynomials wherein FFT and inverse-FFT were accidentally swapped.
  • fix some nix stuff

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (main)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

primitives/src/vid/namespace.rs Outdated Show resolved Hide resolved
primitives/src/vid/namespace.rs Outdated Show resolved Hide resolved
primitives/src/vid/namespace.rs Outdated Show resolved Hide resolved
primitives/src/vid.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz/namespace.rs Outdated Show resolved Hide resolved
primitives/src/vid/payload_prover.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz/payload_prover.rs Show resolved Hide resolved
primitives/src/vid/advz/payload_prover.rs Outdated Show resolved Hide resolved
primitives/src/pcs/univariate_kzg/mod.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz.rs Outdated Show resolved Hide resolved
primitives/src/vid/advz/payload_prover.rs Show resolved Hide resolved
Copy link
Contributor

@chancharles92 chancharles92 left a comment

Choose a reason for hiding this comment

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

LGTM, can approve after addressing Jeb's concern about APIs.

Copy link
Member

@jbearer jbearer left a comment

Choose a reason for hiding this comment

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

Looks good. I think we might be missing some important traits on the proof types, particularly serdes. But if you want we can get this merged and add those later. Or add them now. Either way

primitives/src/vid/advz/payload_prover.rs Show resolved Hide resolved
/// KZG batch proofs and accompanying metadata.
///
/// TODO use batch proof instead of `Vec<P>` <https://github.com/EspressoSystems/jellyfish/issues/387>
pub struct SmallRangeProof<P> {
Copy link
Member

Choose a reason for hiding this comment

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

The proof types should at least derive Clone, Debug, and serde traits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely true. I'm going to merge now anyway because (i) this PR is already too big, (ii) don't want to initiate another round of approval, (iii) there will certainly be back-and-forth over issues like this as we integrate into the sequencer.

primitives/src/vid/payload_prover.rs Show resolved Hide resolved
@ggutoski ggutoski merged commit 11c7829 into main Nov 7, 2023
3 checks passed
@ggutoski ggutoski deleted the gg/vid-namespace branch November 7, 2023 16:58
ggutoski added a commit that referenced this pull request Nov 9, 2023
ggutoski added a commit that referenced this pull request Nov 10, 2023
* update comments as per #389 (comment)

* add commit_only_timer test

* tidy: idiomatic construction of polys

* remove P: PolynomialCommitmentScheme from GenericAdvz

* remove V: MerkleTreeScheme from GenericAdvz

* remove type alias Advz, rename GenericAdvz -> Advz

* remove some unneeded trait bounds

* enforce only H: HasherDigest bound

* remove old comments, tidy derivations

* fmt

* type aliases for kzg

* type aliases for MerkleTreeScheme

* more use of type aliases

* fix rustdoc
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.

T2: VID hello-world namespace support
3 participants