From 1e1185de61aaf2961820cb2f9b4b08a6319037f6 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 4 Jun 2021 02:25:35 +0800 Subject: [PATCH] Implement UtilitiesInstructions, CondSwapInstructions for MerkleChip --- src/circuit/gadget/orchard_action/merkle.rs | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/circuit/gadget/orchard_action/merkle.rs b/src/circuit/gadget/orchard_action/merkle.rs index 3e141d5bb..4be60d49c 100644 --- a/src/circuit/gadget/orchard_action/merkle.rs +++ b/src/circuit/gadget/orchard_action/merkle.rs @@ -165,3 +165,37 @@ impl::extract(point) } } + +impl + UtilitiesInstructions for MerkleChip +{ + type Var = CellValue; +} + +impl + CondSwapInstructions for MerkleChip +{ + type Var = CellValue; + type Swap = Swap; + + #[allow(clippy::type_complexity)] + fn swap( + &self, + layouter: impl Layouter, + pair: ( + >::Var, + >::Var, + ), + swap: Self::Swap, + ) -> Result< + ( + >::Var, + >::Var, + ), + Error, + > { + let config = self.config().cond_swap_config.clone(); + let chip = CondSwapChip::::construct(config); + chip.swap(layouter, pair, swap) + } +}