Recap the proving process in openVM:
start from the test in lib.rs

The new function create number of auto precompiles, and also set what type of the chip. this are all stored in config, that means, I need to check how the fields of config are used.
prove_mock-> compile and prove

-> compile guest, prove


-> compile_guest-> compile_openvm

in this compile_openvm, the chain of functions that linked to sdk_vm_config, it seems it enable specific instructions set.
question: when I separate plonk, there is no instructions opcode. what should I do, let’s first see clearly how powdr APC is added.
-> compile_guest-> compile_openvm-> compile_exe

and in this compile_exe, the function compile_exe_with_elf, is where powdr extension added, in this customised function

In this customised function, it does some counting on basic blocks to determine how to create APC


create powdrPrecompile, then at the end, get compiledProgram, attention to the specializedConfig:

it has powdrExtension, as the comment said, it wraps sdkVmConfig, adding powdr extension
and then go back to compile_exe_with_elf, after customize, the export pil function actually do a lot stuff

let’s check create chip complex

it creates a chip complex and extend it with powdr extension

it basically just use chip.extend function to extend the instruction chip one by one

in this extend function, it is where inventory.add happens


you see, it call config.build, so in create_chip_complex function, it has this code:
let chip = chip.extend(&self.powdr)?;
it will call powdrExtension build:

Adding new chip:
Now come to the question, when adding new chip, is the Periphery is only about buses?
and to add new chips, I would need to implement the trait VmExtension, what are functions in the trait?
Periphery
Figuring out Periphery:
start with checking the VmExtension trait

it only has one function, return types are VmInventory<Executor, Periphery>
go back to powdrExtention build function, all these code are used for periphery, need to check what exactly they are doing

To know that, I need to check what happens with periphery when they pass to create new precompile chip as input

when adding a new chip, a new extension needs to be added in inventory: in vm.rs file

The question is, how the opcode will be handled? when we separate the plonk chips, we separate them from the circuit constraints level, while the API still needs us to do something with the opcode level.
let’s see what inventory consists of?

what is periphery? is it chips that doesn’t need opcode?
I also need to figure out what this shared chip, periphery does


This is the trait that a VM extension one needs to implement

This create chip complex function is also important
