powdr-labs / powdr

A modular stack for zkVMs, with a focus on productivity, security and performance.
Apache License 2.0
416 stars 82 forks source link

Delay provision of degree ranges #2150

Open Schaeff opened 5 days ago

Schaeff commented 5 days ago

Context

When generating a proof, the prover must have access to a commitment to the fixed columns in the size of the execution trace. These commitments are generated during a setup phase by providing static sizes. This requires the user to know how long the execution trace is going to be ahead of time.

In ASM, these sizes must currently be provided either in the declaration of the machines, or in the instantiation of submachines. In PIL, they are defined in each namespace statement.

The issue with this is that we end up with a lot of code in the machines to deal with the sizes. This code could be made more ergonomic, but this issue describes another proposal.

Idea

The current flow is:

asm -> pil -> fixgen -> witgen -> setup -> prove

fixgen requires the static sizes which the trace is expected to have.

The idea is to delay fixgen as late as possible and split the flow into two stages

[ asm -> pil -> witgen ] -> [ fixgen -> setup -> prove ]
        run                        deploy(degrees)

This way, we only need to specify the degrees in the deploy phase. An idea for this would be something like a configuration file, similar to choosing an architecture to run a program on.

Impact