Skip to content

Implement Relation trait for the IVC circuit #3428

Description

@jpraynaud

Why

StmCertificateCircuit implements the Relation trait of the Midnight standard library, while IvcCircuitData implements the lower level Circuit trait with a hand written configuration. The two circuits therefore produce verifying keys in different formats and the IVC configuration duplicates what ZkStdLibArch already provides.

What

Move the IVC circuit onto Relation, so that both circuits share the same configuration mechanism and the same verifying key format.

How

  • Move the IVC circuit body from synthesize to the circuit method of Relation (circuits/halo2_ivc/circuit.rs)
  • Declare the chips through ZkStdLibArch and drop the hand written column pool computation (circuits/halo2_ivc/config.rs)
  • Use VerifierGadget from midnight-zk-stdlib for the in-circuit certificate proof verification
  • Check that the IVC and the certificate verifying keys share the same format
  • Check the impact on the circuit degree and on the golden test vectors

Jia's explanation

Simplify configuration of the IVC circuit for Midnight-SK setup:

fn used_chips(&self) -> ZkStdLibArch {
        ZkStdLibArch {
            jubjub: true,
            poseidon: true,
            sha2_256: true,
            sha2_512: false,
            keccak_256: false,
            sha3_256: false,
            secp256k1: false,
            bls12_381: true,
            base64: false,
            nr_pow2range_cols: 4,
            automaton: false,
            blake2b: false,
        }
    }

Then move the ivc circuit code in fn synthesize  to fn circuit from Relation .
If we do this, both ivc_vk and cert_vk will have the same format MidnightVK
VerifierGadget is available here https://github.com/midnightntwrk/midnight-zk/blob/main/zk_stdlib/src/lib.rs#L847
it is also available in midnight-zk-stdlib = { version = "2.3.0" }
Then move the ivc circuit code in fn synthesize  to fn circuit from Relation .
If we do this, both ivc_vk and cert_vk will have the same format MidnightVK
VerifierGadget is available here https://github.com/midnightntwrk/midnight-zk/blob/main/zk_stdlib/src/lib.rs#L847
it is also available in midnight-zk-stdlib = { version = "2.3.0" }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions