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(plonk): support multiple phase halo2 circuit #315

Open
chaosma opened this issue Jul 25, 2024 · 5 comments
Open

feat(plonk): support multiple phase halo2 circuit #315

chaosma opened this issue Jul 25, 2024 · 5 comments
Assignees
Milestone

Comments

@chaosma
Copy link
Collaborator

chaosma commented Jul 25, 2024

Currently, we only support one phase in halo2 circuit synthesize. Need add support for for multiple phases circuit (e.g. zkEVM circuit)

@chaosma chaosma changed the title feat(sps): support multiple phase halo2 circuit feat(plonk): support multiple phase halo2 circuit Jul 25, 2024
@cyphersnake cyphersnake added this to the zk-evm milestone Jul 30, 2024
@cyphersnake
Copy link
Collaborator

cyphersnake commented Jul 30, 2024

  • Investigation

@chaosma
Copy link
Collaborator Author

chaosma commented Jul 31, 2024

A multi-phase halo2 synthesize works as follows:
(1) generate the witness for columns of first phase, i.e. [W00, W01,..]; [C00, C01,...] =[comm(W00), comm(W01),...];
(2) generate challenges for phase 2 (if any): ro.absorb(C00); ro.absorb(C01);...; ro.squeeze(W0).
(3) continue as step (1) and (2) for other phases.

If we follow the same process as halo2, we have to use the same ro as halo2 and split the witness into columns and produce many commitments. We can simplify this part by not split into columns but as a whole. However, we still have to separate the single commitment of witness into multiple commitments (one for each phase).

After modify the witness collection according to each phase, the next task is to modify evaluation method to include the challenges for each phase. To do so, we need append these newly challenges into the challenges vector from sps.

With this change, the number of commitments in RelaxedPlonkInstance will increased by num_phase - 1....

@cyphersnake
Copy link
Collaborator

cyphersnake commented Aug 1, 2024

We have two types of challenges:

  • plonk-instance (generated in circuit-runner between phases)
  • sps (generated after circuit-runner::collect)

WitnessCollector

Add support of phases in WitnessCollector; Just adapt from halo2 implementation

Estimation: 2 sp

CircuitRunner

Have phases-run loop

  • Run synth for 1,2,3 phase
  • Fill on-step-circuit challenges between phases

Estimation: 5 sp

SPS

Now

We have <= 3 challenges at sps level, they generated with witness+lookup

After

On-Step-Circuit

We will have N1,N2 challenges, they generated from witness of 1,2 phases of circuit

sps

We should not using all witness for generate, but split it into phases-witness-data

Estimation: 2 sp

Verify

Impl verify logic with new PlonkInstace

Estimation: 2 sp


11 sp * 1.5 = 17 sp

@cyphersnake
Copy link
Collaborator

This task is left to track the context of the entire functionality if any details were missed during planning

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

No branches or pull requests

2 participants