maidsafe / sn_dbc

Safe Network DBCs
BSD 3-Clause "New" or "Revised" License
15 stars 16 forks source link

test: improve reissue_auto in mint-repl #172

Closed dan-da closed 2 years ago

dan-da commented 2 years ago
  1. configurable reissue_auto We prompt the user for min and max number of inputs, max outputs, and preferred number of decoys when performing the reissue_auto algo to generate DBCs automatically.

  2. timings Displays some timing information for spentbook operations, wallet operations, and total time -- for each reissue.

Together, this enables us to easily simulate various sizes of reissues and observe how long they take for both (mock) spentbook and wallet.

Here is some example usage/output:

>> reissue_auto

How many reissues to perform [10]: 10

Min (if available) number of inputs [1]: 

Max number of inputs [2]: 1

Max number of outputs [2]: 20

Max number of decoys [10]: 

inputs to outputs.  value                  wallet     sb::random_decoys  sb::log_spent  total
     1 -> 13        18446744073709551615   2.515      0.0                0.474          2.990     
     1 -> 5         1920390358851236       1.39       0.0                0.219          1.258     
     1 -> 20        8692884789514          3.915      0.0                0.762          4.678     
     1 -> 2         159847808              0.469      0.0                0.105          0.575     
     1 -> 20        1101087722338122979    3.908      0.0                0.772          4.681     
     1 -> 3         98462780               0.659      0.0                0.141          0.801     
     1 -> 15        11774431375002         3.12       0.0                0.577          3.590     
     1 -> 8         152674910372358752     1.611      0.1                0.323          1.935     
     1 -> 4         64366554864543048      0.844      0.1                0.176          1.22      
     1 -> 20        61385028               3.969      0.1                0.751          4.722     
>> 
>> reissue_auto

How many reissues to perform [10]: 

Min (if available) number of inputs [1]: 

Max number of inputs [2]: 

Max number of outputs [2]: 

Max number of decoys [10]: 

inputs to outputs.  value                  wallet     sb::random_decoys  sb::log_spent  total
     1 -> 2         556263800493608        0.477      0.6                0.106          0.590     
     2 -> 2         103426498612           0.543      0.1                0.265          0.810     
     2 -> 2         55243759791597504      0.536      0.1                0.260          0.798     
     1 -> 2         30749250278512         0.469      0.1                0.106          0.578     
     1 -> 2         103996                 0.469      0.1                0.108          0.579     
     1 -> 2         439487434              0.477      0.1                0.105          0.584     
     2 -> 2         14065828637576759      0.620      0.1                0.258          0.881     
     1 -> 2         18923482590            0.477      0.1                0.110          0.590     
     2 -> 2         274397016              0.653      0.1                0.260          0.916     
     2 -> 1         14714531759805077      0.341      0.2                0.179          0.522