Procházet zdrojové kódy

Remove unused MPCIO parameters from some heap methods

The MPCTIO (threaded IO) parameters are needed, but not the master
MPCIO.
Ian Goldberg před 6 měsíci
rodič
revize
e77f5ccd64
2 změnil soubory, kde provedl 7 přidání a 8 odebrání
  1. 5 6
      heap.cpp
  2. 2 2
      heap.hpp

+ 5 - 6
heap.cpp

@@ -321,7 +321,7 @@ The total cost of the protocol includes:
 - 2 flag-word multiplications (performed in parallel).
 - 3 DORAM updates (performed in parallel).
 */
-RegXS MinHeap::restore_heap_property(MPCIO & mpcio, MPCTIO &tio, yield_t & yield, RegXS index) {
+RegXS MinHeap::restore_heap_property(MPCTIO &tio, yield_t & yield, RegXS index) {
     RegAS smallest;
     auto HeapArray = oram.flat(tio, yield);
     RegXS leftchildindex = index;
@@ -510,7 +510,6 @@ void MinHeap::init(MPCTIO &tio, yield_t & yield, size_t n) {
     });
 }
 
-
 // Note: This function is intended for debugging purposes only.
 // The purpose of this function is to reconstruct the heap and print its contents.
 // The function performs the necessary operations to reconstruct the heap, ensuring that the heap property is satisfied. It then prints the contents of the reconstructed heap.
@@ -653,7 +652,7 @@ std::pair<RegXS, RegBS> MinHeap::restore_heap_property_at_explicit_index(MPCTIO
 // The choice of whether to use restore_heap_property or restore_heap_property_optimized
 // depends on whether it is a basic or optimized extraction of the minimum element.
 // These functions ensure that the heap property is maintained throughout the tree.
-RegAS MinHeap::extract_min(MPCIO & mpcio, MPCTIO &tio, yield_t & yield, int is_optimized) {
+RegAS MinHeap::extract_min(MPCTIO &tio, yield_t & yield, int is_optimized) {
 
     size_t height = std::log2(num_items);
     RegAS minval;
@@ -680,7 +679,7 @@ RegAS MinHeap::extract_min(MPCIO & mpcio, MPCTIO &tio, yield_t & yield, int is_o
 
     if(is_optimized == 0) {
         for (size_t i = 0; i < height - 1; ++i) {
-            smaller = restore_heap_property(mpcio, tio, yield, smaller);
+            smaller = restore_heap_property(tio, yield, smaller);
         }
     }
 
@@ -771,7 +770,7 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args) {
         for (size_t j = 0; j < n_extracts; ++j) {
 
             if(run_sanity == 1) {
-                RegAS minval = tree.extract_min(mpcio, tio, yield, is_optimized);
+                RegAS minval = tree.extract_min(tio, yield, is_optimized);
                 uint64_t minval_reconstruction = mpc_reconstruct(tio, yield, minval);
                 std::cout << "minval_reconstruction = " << minval_reconstruction << std::endl;
                 if (have_lastextract) {
@@ -780,7 +779,7 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args) {
                 lastextract = minval_reconstruction;
                 have_lastextract = true;
             } else {
-                tree.extract_min(mpcio, tio, yield, is_optimized);
+                tree.extract_min(tio, yield, is_optimized);
             }
 
             if (run_sanity == 1) {

+ 2 - 2
heap.hpp

@@ -18,7 +18,7 @@ private:
     // Takes in as an input the XOR shares of the index at which
     // the heap property has to be restored
     // Returns the XOR shares of the index of the smaller child
-    RegXS restore_heap_property(MPCIO &mpcio, MPCTIO &tio, yield_t & yield, RegXS index);
+    RegXS restore_heap_property(MPCTIO &tio, yield_t & yield, RegXS index);
 
     // Optimized restore heap property at a secret shared index
     // Takes in as an input the XOR shares of the index at which
@@ -41,7 +41,7 @@ public:
     // and restores the heap property
     // and takes in a boolean parameter to decide if the basic or the optimized version needs to be run
     // return value is the share of the minimum value (the root)
-    RegAS extract_min(MPCIO &mpcio, MPCTIO &tio, yield_t & yield, int is_optimized);
+    RegAS extract_min(MPCTIO &tio, yield_t & yield, int is_optimized = 1);
 
     // Intializes the heap array with 0x7fffffffffffff
     void init(MPCTIO &tio, yield_t & yield);