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

Add independent block proof aggregation pipeline #656

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

Nashtare
Copy link
Collaborator

@Nashtare Nashtare commented Sep 24, 2024

Adds an aggregator binary that can perform:

  • block proof wrapping (i.e. obfuscating a final block proof before sending it for aggregation with other (independent) chains' block proofs
  • 2-to-1 block proof aggregation

Also includes change in VerifierData to support all 3 upper layer proofs by the verifier binary.

Addresses the first part of 2-to-1 aggregation logic (i.e. these are still circuit dependent), next step is to make the aggregator support a set of distinct preprocessed circuits (i.e. type 1 Eth, type 1 PoS, type 2 CDK, etc...) and support arbitrary aggregation of such block proofs through N-to-1 conditional aggregation, see #622.

Only supports stdio mode for now, though we could add the others (http / rpc) should we want it, easily, but I'd rather wait for it to stabilize first (i.e. once #622 is dealt with) before proceeding to supporting these additional modes.

One thing that bothers me is the output to disk, which currently looks like so:

  • block proof: proofs/b7.zkproof
  • wrapped block proof: proofs/b7_wrapper.zkproof -> i.e. only height indicator, no chain ID
  • aggregated independent block proofs: proofs/block_aggreg.zkproof -> i.e. no indicator at all

Adding the chain ID for the middle layer is easy, but I worry about readability on the last layer, as we may aggregate an arbitrary number of proofs coming from an arbitrary number of distinct chains, hence aiming at adding this kind of information would just blow up the filename length. An alternative could be to mark the file with the hash used as public input (at least to have some unique identifier, though it doesn't carry much meaning on its own..)

closes #387

@Nashtare Nashtare self-assigned this Sep 24, 2024
@github-actions github-actions bot added crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: zero_bin Anything related to the zero-bin subcrates. ci labels Sep 24, 2024
scripts/prove_rpc.sh Show resolved Hide resolved
@@ -0,0 +1,36 @@
use clap::{Parser, Subcommand};
Copy link
Contributor

Choose a reason for hiding this comment

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

nonblocking: Adding a new file for a single struct seems a bit excessive - could we fold this in?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we want to support additional modes than just STDIO, then we'll keep the 2nd struct, which will make it similar in essence to the leader and verifier binaries cli modules. I find it a tad clearer than bloating a single file, but happy to refactor all binaries at once if preferred to go down this path

Copy link
Member

Choose a reason for hiding this comment

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

I find it a tad clearer than bloating a single file

Agreed

zero/src/bin/aggregator/stdio.rs Outdated Show resolved Hide resolved
AggregatableBlockProof::Block(proof)
}
Ok(Err(e)) => {
anyhow::bail!("Proving task finished with error: {e:?}");
Copy link
Contributor

Choose a reason for hiding this comment

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

String interpolation here is just a worse version of anyhow::Context::context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To be fair this is copy-pasta, but happy to change

scripts/prove_stdio.sh Show resolved Hide resolved
scripts/prove_stdio.sh Show resolved Hide resolved
zero/src/bin/aggregator/stdio.rs Outdated Show resolved Hide resolved
zero/src/bin/verifier.rs Outdated Show resolved Hide resolved
zero/src/proof_types.rs Outdated Show resolved Hide resolved
Co-Authored-By: Marko Atanasievski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: zero_bin Anything related to the zero-bin subcrates.
Projects
Status: Ready to Review
Development

Successfully merging this pull request may close these issues.

feat(zero-bin): add support for 2-to-1 independent block proofs aggregation
4 participants