Enum arrabbiata::interpreter::Instruction
source · pub enum Instruction {
PoseidonFullRound(usize),
PoseidonSpongeAbsorb,
EllipticCurveScaling(usize, u64),
EllipticCurveAddition(usize),
NoOp,
}
Expand description
A list of instruction/gadget implemented in the interpreter.
The control flow can be managed by implementing a function
fetch_next_instruction
and fetch_instruction
on a witness environnement.
See the Witness environment for more details.
Mostly, the instructions will be used to build the verifier circuit, but it can be generalized.
When the circuit is predefined, the instructions can be accompanied by a public selector. When implementing a virtual machine, where instructions are unknown at compile time, other methods can be used. We leave this for future work.
For the moment, the type is not parametrized, on purpose, to keep it simple (KISS method). However, IO could be encoded in the type, and encode a typed control-flow. We leave this for future work.
Variants§
PoseidonFullRound(usize)
This gadget implement the Poseidon hash instance described in the top-level documentation. In the current setup, with NUMBER_OF_COLUMNS columns, we can compute 5 full rounds per row.
We split the Poseidon gadget in 13 sub-gadgets, one for each set of 5 full rounds and one for the absorbtion. The parameter is the starting round of the permutation. It is expected to be a multiple of five.
Note that, for now, the gadget can only be used by the verifier circuit.
PoseidonSpongeAbsorb
Absorb [PlonkSpongeConstants::SPONGE_WIDTH - 1] elements into the sponge. The elements are absorbed into the last [PlonkSpongeConstants::SPONGE_WIDTH - 1] elements of the sponge state.
The values to be absorbed depend on the state of the environment while executing this instruction.
Note that, for now, the gadget can only be used by the verifier circuit.
EllipticCurveScaling(usize, u64)
EllipticCurveAddition(usize)
NoOp
Trait Implementations§
source§impl Clone for Instruction
impl Clone for Instruction
source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Instruction
impl Debug for Instruction
source§impl From<Instruction> for Gadget
impl From<Instruction> for Gadget
Convert an instruction into the corresponding gadget.