Skip to content

Commit

Permalink
Merge pull request #9 from FhenixProtocol/gas-usage
Browse files Browse the repository at this point in the history
add gas params
  • Loading branch information
Cashmaney authored Feb 5, 2024
2 parents 3e6c9d8 + f1bd704 commit 57e7a95
Show file tree
Hide file tree
Showing 3 changed files with 409 additions and 11 deletions.
359 changes: 359 additions & 0 deletions docs/devdocs/Writing Smart Contracts/Gas-and-Banchmarks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,359 @@
# 🔥 Gas and Banchmarks

This section will list the gas costs for every operation based on it's inputs.
The gas prices are a subject to change based on usage and performance.

:::tip
The current gas limit for a tranasaction is set to be 50 million
:::

<table>
<thead>
<tr>
<th>FHE.sol function</th>
<th>Input</th>
<th>Time in Query (ms)</th>
<th>Gas Units </th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">add</td>
<td>euint8</td>
<td>35</td>
<td>7,315</td>
</tr>
<tr>
<td>euint16</td>
<td>73</td>
<td>15,275</td>
</tr>
<tr>
<td>euint32</td>
<td>163</td>
<td>34,067</td>
</tr>
<tr>
<td rowspan="3">asEuint</td>
<td>inEuint</td>
<td>44</td>
<td>9,196</td>
</tr>
<tr>
<td>euint</td>
<td>5</td>
<td>1,045</td>
</tr>
<tr>
<td>uint</td>
<td>5</td>
<td>1,045</td>
</tr>
<tr>
<td>sealOutput</td>
<td>*</td>
<td>23</td>
<td>2,507</td>
</tr>
<tr>
<td>decrypt</td>
<td>*</td>
<td>18</td>
<td>3,762</td>
</tr>
<tr>
<td rowspan="3">lte</td>
<td>euint8</td>
<td>18</td>
<td>3,762</td>
</tr>
<tr>
<td>euint16</td>
<td>29</td>
<td>6,061</td>
</tr>
<tr>
<td>euint32</td>
<td>43</td>
<td>8,987</td>
</tr>
<tr>
<td rowspan="3">sbb</td>
<td>euint8</td>
<td>35</td>
<td>7,315</td>
</tr>
<tr>
<td>euint16</td>
<td>73</td>
<td>15,275</td>
</tr>
<tr>
<td>euint32</td>
<td>163</td>
<td>34,067</td>
</tr>
<tr>
<td rowspan="3">mul</td>
<td>euint8</td>
<td>94</td>
<td>19,646</td>
</tr>
<tr>
<td>euint16</td>
<td>311</td>
<td>64,999</td>
</tr>
<tr>
<td>euint32</td>
<td>1127</td>
<td>235,543</td>
</tr>
<tr>
<td rowspan="3">lt</td>
<td>euint8</td>
<td>22</td>
<td>4,598</td>
</tr>
<tr>
<td>euint16</td>
<td>36</td>
<td>7,524</td>
</tr>
<tr>
<td>euint32</td>
<td>60</td>
<td>12,540</td>
</tr>
<tr>
<td rowspan="3">select</td>
<td>euint8</td>
<td>214</td>
<td>44,726</td>
</tr>
<tr>
<td>euint16</td>
<td>316</td>
<td>66,044</td>
</tr>
<tr>
<td>euint32</td>
<td>549</td>
<td>114,741</td>
</tr>
<tr>
<td>require</td>
<td>*</td>
<td>65</td>
<td>13,585</td>
</tr>
<tr>
<td rowspan="3">div</td>
<td>euint8</td>
<td>447</td>
<td>93,423</td>
</tr>
<tr>
<td>euint16</td>
<td>1310</td>
<td>273,790</td>
</tr>
<tr>
<td>euint32</td>
<td>4800</td>
<td>1,003,200</td>
</tr>
<tr>
<td rowspan="3">gt</td>
<td>euint8</td>
<td>21</td>
<td>4,389</td>
</tr>
<tr>
<td>euint16</td>
<td>29</td>
<td>6,061</td>
</tr>
<tr>
<td>euint32</td>
<td>45</td>
<td>9,405</td>
</tr>
<tr>
<td rowspan="3">gte</td>
<td>euint8</td>
<td>21</td>
<td>4,389</td>
</tr>
<tr>
<td>euint16</td>
<td>29</td>
<td>6,061</td>
</tr>
<tr>
<td>euint32</td>
<td>45</td>
<td>9,405</td>
</tr>
<tr>
<td rowspan="3">rem</td>
<td>euint8</td>
<td>447</td>
<td>93,423</td>
</tr>
<tr>
<td>euint16</td>
<td>1310</td>
<td>273,790</td>
</tr>
<tr>
<td>euint32</td>
<td>4800</td>
<td>1,003,200</td>
</tr>
<tr>
<td rowspan="3">or</td>
<td>euint8</td>
<td>13</td>
<td>2,717</td>
</tr>
<tr>
<td>euint16</td>
<td>21</td>
<td>4,389</td>
</tr>
<tr>
<td>euint32</td>
<td>38</td>
<td>7,942</td>
</tr>
<tr>
<td rowspan="3">xor</td>
<td>euint8</td>
<td>13</td>
<td>2,717</td>
</tr>
<tr>
<td>euint16</td>
<td>21</td>
<td>4,389</td>
</tr>
<tr>
<td>euint32</td>
<td>38</td>
<td>7,942</td>
</tr>
<tr>
<td rowspan="3">eq</td>
<td>euint8</td>
<td>18</td>
<td>3,762</td>
</tr>
<tr>
<td>euint16</td>
<td>25</td>
<td>5,225</td>
</tr>
<tr>
<td>euint32</td>
<td>50</td>
<td>10,450</td>
</tr>
<tr>
<td rowspan="3">ne</td>
<td>euint8</td>
<td>18</td>
<td>3,762</td>
</tr>
<tr>
<td>euint16</td>
<td>25</td>
<td>5,225</td>
</tr>
<tr>
<td>euint32</td>
<td>50</td>
<td>10,450</td>
</tr>
<tr>
<td rowspan="3">min</td>
<td>euint8</td>
<td>41</td>
<td>8,569</td>
</tr>
<tr>
<td>euint16</td>
<td>75</td>
<td>15,675</td>
</tr>
<tr>
<td>euint32</td>
<td>135</td>
<td>28,215</td>
</tr>
<tr>
<td rowspan="3">max</td>
<td>euint8</td>
<td>41</td>
<td>8,569</td>
</tr>
<tr>
<td>euint16</td>
<td>75</td>
<td>15,675</td>
</tr>
<tr>
<td>euint32</td>
<td>135</td>
<td>28,215</td>
</tr>
<tr>
<td rowspan="3">shl</td>
<td>euint8</td>
<td>82</td>
<td>17,138</td>
</tr>
<tr>
<td>euint16</td>
<td>190</td>
<td>39,710</td>
</tr>
<tr>
<td>euint32</td>
<td>422</td>
<td>88,198</td>
</tr>
<tr>
<td rowspan="3">shr</td>
<td>euint8</td>
<td>82</td>
<td>17,138</td>
</tr>
<tr>
<td>euint16</td>
<td>190</td>
<td>39,710</td>
</tr>
<tr>
<td>euint32</td>
<td>422</td>
<td>88,198</td>
</tr>
<tr>
<td rowspan="3">not</td>
<td>euint8</td>
<td>12</td>
<td>2,508</td>
</tr>
<tr>
<td>euint16</td>
<td>22</td>
<td>4,598</td>
</tr>
<tr>
<td>euint32</td>
<td>36</td>
<td>7,524</td>
</tr>
</tbody>
</table>
Loading

0 comments on commit 57e7a95

Please sign in to comment.