pub trait CondSwapInstructions<F: Field>: UtilitiesInstructions<F> {
    // Required method
    fn swap(
        &self,
        layouter: impl Layouter<F>,
        pair: (Self::Var, Value<F>),
        swap: Value<bool>
    ) -> Result<(Self::Var, Self::Var), Error>;
}
Expand description

Instructions for a conditional swap gadget.

Required Methods§

source

fn swap( &self, layouter: impl Layouter<F>, pair: (Self::Var, Value<F>), swap: Value<bool> ) -> Result<(Self::Var, Self::Var), Error>

Given an input pair (a,b) and a swap boolean flag, returns (b,a) if swap is set, else (a,b) if swap is not set.

The second element of the pair is required to be a witnessed value, not a variable that already exists in the circuit.

Implementors§

source§

impl<F: PrimeField> CondSwapInstructions<F> for CondSwapChip<F>

source§

impl<Hash, Commit, F> CondSwapInstructions<Fp> for MerkleChip<Hash, Commit, F>where Hash: HashDomains<Affine>, F: FixedPoints<Affine>, Commit: CommitDomains<Affine, F, Hash>,