privacy-scaling-explorations / chiquito

DSL for Halo2 circuits
https://docs.pecadorplonkish.xyz/
186 stars 39 forks source link

Refactoring: Compiler to return new structure for several machines #280

Closed leolara closed 1 month ago

leolara commented 2 months ago

We need to start the path that allows multiple machines. This is a complex refactoring, and from the SBPIR on we will build new compiler to the plonkish IR. But this is not in this task.

We should allow the main compiler src -> SBPIR to return several machines.

For that I would:

  1. rename the current compiler::compile function to compiler::compile_legacy and compiler::CompilerResult to compiler::CompilerResultLegacy. We need this so the previous examples and tests keep working. It should be easy with a refactoring tool like in vscode.
    1. Rename sbpir::SBPIR to sbpir::SBPIRMachine.
    2. Create a new sbpir::SBPIR that contains a hashmap of uuid -> SBPIRMachine and another hashmap from identifier -> uuid.
    3. Create a new compiler::compile that can take a source code with several machines and returns a new compiler::CompilerResult that contains the new sbpir::SBPIR
leolara commented 2 months ago

Even, better SBPIR renamed to SBPIRLegacy and a copy of SBPIR becomes SBPIRMachine that we will be able to modify SBPIRMachine a lot, and create a new plonkish compiler.

Eventually this will end up removing the SuperCircuits that are not that good design, but we inherited from zkEVM.

alxkzmn commented 1 month ago

Implemented in #284