🌍 Background
As detailed in Interactive/Non Interactive-PoRep Gas Cost Comparison , NI-PoRep is competitive wrt Interactive PoRep for the removal of precommit step and associated gas costs (the vast majority of PreCommit gas cost would be saved).
Moreover, the more sector one aggregates with SnarkPack, the less the single (amortized)
Proof verification gas cost decreases.
In what follows, we consider NI-PoRep with 128 bits of security.
📊 Motivation
Current single sector proof verification gas cost (Proof Submit Charge gas) is SingleSectorVerificationCost
~34721049 (see here for details).
While on one hand we want NI-PoRep sectors to be competitive with respect to Interactive PoRep ones, we also want gas usage per sector to remain somewhat constant in order to preserve the cryptoeconomic of the network.
🗺️ How to get there
With this in mind, this analysis aims to compare proof verification gas costs in the non interactive and interactive PoRep setting. More specifically, we will compare what follows:
- Single Interactive PoRep sector proof verification gas costs
- Per sector (amortized) proof verification gas costs for Non Interactive PoRep sectors.
We will consider different numbers of aggregated NI-PoRep sectors (from 1 to 64) highlighting the cost comparison of proof verification and the per sector gas balancer multiplier needed in order to have constant per sector proof verification gas cost, equal to 34’721’049.
📋 Proof Verification Gas cost Analysis
(Multiple) NI-PoRep Sectors Vs Single Interactive PoRep sector
Current (Interactive) PoRep proof verification gas cost (Proof Submit Charge gas) See here |
34721049 |
Gas costs associated with aggregation
10x Single Circuit Linear Gas Cost (Single Current PoRep Linear Gas Cost), 32Gi |
449900 |
Number of circuits aggregated | Number of Current PoRep aggregated | Gas Cost |
≤ 64 = 2^6 | 6 | 103994170 |
≤ 128 = 2^7 | 12 | 112356810 |
≤ 256 = 2^8 | 25 | 122912610 |
≤ 512 = 2^9 | 51 | 137559930 |
≤1024 = 2^10 | 102 | 162039100 |
≤ 2048 = 2^11 | 204 | 210960780 |
≤ 4096 = 2^12 | 409 | 318351180 |
≤ 8192 = 2^13 | 819 | 528274980 |
This means that if we have a number of circuits N which is not a power of two, the total gas cost will be the sum between the gas cost corresponding to and 449900*N/10
Example: aggregating 6 current PoRep (60 circuits) costs 103994170+ 6*449900, given that .
If we look at the details of the per sector (amortized) proof verification cost (considering 128 bits of security), we notice that the breakeven is 6 NI-PoRep sectors (see table and graph below for all the details).
From that point onwards, per sector proof verification gas costs for NI-PoRep is lower than for single Interactive PoRep sectors.
In order have a constant per sector gas verification cost we need to solve the simple equation
NI-AmortizedSectorVerificationCost
+ *NI-AmortizedSectorVerificationCost
= SingleSectorVerificationCost
⇒ = (34721049-NI-AmortizedSectorVerificationCost
)/NI-AmortizedSectorVerificationCost
We refer to as the per sector NI-PoRep gas balancer (last column in the table below).
Please to the table below for all the details:
Number of NI PoRep Sectors | Total number of circuits aggregated | Total proof verification gas cost (formula) | Total proof verification gas cost (value) | Per NI-PoRep sector proof verification gas cost (amortized) | NI-PoRep proof verification gas cost < Current (Interactive) PoRep proof verification gas cost? | Proof Verification gas cost difference (NI Vs Interactive) | Per Sector NI-PoRep Gas Balancer |
1 | 128 | 112356810 + 13*449900 | 118205510 | 118205510 | No | 83484461 | Not needed |
2 | 256 | 122912610+ 26*449900 | 134610010 | 67305005 | No | 32583956 | Not needed |
3 | 384 | 137559930+ 39*449900 | 155106030 | 51702010 | No | 16980961 | Not needed |
4 | 512 | 137559930+ 52*449900 | 160954730 | 40238682.5 | No | 5517633.5 | Not needed |
5 | 640 | 162039100 + 64*449900 | 190832700 | 38166540 | No | 3445491 | Not needed |
6 | 768 | 162039100 + 77*449900 | 196681400 | 32780233.33 | Yes | -1940815.667 | 0.05920688992 |
7 | 896 | 162039100 + 90*449900 | 202530100 | 28932871.43 | Yes | -5788177.571 | 0.200055414 |
8 | 1024 | 162039100 + 103*449900 | 208378800 | 26047350 | Yes | -8673699 | 0.3329973683 |
9 | 1152 | 210960780 + 116*449900 | 263149180 | 29238797.78 | Yes | -5482251.222 | 0.187499201 |
10 | 1280 | 210960780 + 128*449900 | 268547980 | 26854798 | Yes | -7866251 | 0.2929178987 |
11 | 1408 | 210960780 + 141*449900 | 274396680 | 24945152.73 | Yes | -9775896.273 | 0.3918956272 |
12 | 1536 | 210960780 + 154*449900 | 280245380 | 23353781.67 | Yes | -11367267.33 | 0.4867420401 |
13 | 1664 | 210960780 + 167*449900 | 286094080 | 22007236.92 | Yes | -12713812.08 | 0.5777105105 |
14 | 1792 | 210960780 + 180*449900 | 291942780 | 20853055.71 | Yes | -13867993.29 | 0.665034107 |
15 | 1920 | 210960780 + 192*449900 | 297341580 | 19822772 | Yes | -14898277 | 0.7515738465 |
16 | 2048 | 210960780 + 205*449900 | 303190280 | 18949392.5 | Yes | -15771656.5 | 0.8323040699 |
17 | 2176 | 318351180 + 218*449900 | 416429380 | 24495845.88 | Yes | -10225203.12 | 0.4174260063 |
18 | 2304 | 318351181 + 231*449900 | 422278081 | 23459893.39 | Yes | -11261155.61 | 0.4800173396 |
19 | 2432 | 318351182 + 244*449900 | 428126782 | 22532988.53 | Yes | -12188060.47 | 0.5408985346 |
20 | 2560 | 318351183 + 256*449900 | 433525583 | 21676279.15 | Yes | -13044769.85 | 0.6017993107 |
21 | 2688 | 318351184 + 269*449900 | 439374284 | 20922584.95 | Yes | -13798464.05 | 0.6595009211 |
22 | 2816 | 318351185 + 282*449900 | 445222985 | 20237408.41 | Yes | -14483640.59 | 0.7156865295 |
23 | 2944 | 318351186 + 295*449900 | 451071686 | 19611812.43 | Yes | -15109236.57 | 0.7704151065 |
24 | 3072 | 318351187 + 301*449900 | 453771087 | 18907128.63 | Yes | -15813920.38 | 0.8363998939 |
25 | 3200 | 318351188 + 320*449900 | 462319188 | 18492767.52 | Yes | -16228281.48 | 0.877547477 |
26 | 3328 | 318351189 + 333*449900 | 468167889 | 18006457.27 | Yes | -16714591.73 | 0.9282554298 |
27 | 3456 | 318351190 + 346*449900 | 474016590 | 17556170 | Yes | -17164879 | 0.9777120522 |
28 | 3584 | 318351191 + 359*449900 | 479865291 | 17138046.11 | Yes | -17583002.89 | 1.025963099 |
29 | 3712 | 318351192 + 372*449900 | 485713992 | 16748758.34 | Yes | -17972290.66 | 1.07305212 |
30 | 3840 | 318351193 + 384*449900 | 491112793 | 16370426.43 | Yes | -18350622.57 | 1.120961793 |
31 | 3968 | 318351194 + 397*449900 | 496961494 | 16031015.94 | Yes | -18690033.06 | 1.165867038 |
32 | 4096 | 318351195 + 410*449900 | 502810195 | 15712818.59 | Yes | -19008230.41 | 1.209727605 |
33 | 4224 | 528274980 + 423*449900 | 718582680 | 21775232.73 | Yes | -12945816.27 | 0.5945202256 |
34 | 4352 | 528274980 + 436*449900 | 724431380 | 21306805.29 | Yes | -13414243.71 | 0.6295755521 |
35 | 4480 | 528274980 + 448*449900 | 729830180 | 20852290.86 | Yes | -13868758.14 | 0.6650951801 |
36 | 4608 | 528274980 + 461*449900 | 735678880 | 20435524.44 | Yes | -14285524.56 | 0.6990534838 |
37 | 4736 | 528274980 + 474*449900 | 741527580 | 20041285.95 | Yes | -14679763.05 | 0.7324761043 |
38 | 4864 | 528274980 + 487*449900 | 747376280 | 19667796.84 | Yes | -15053252.16 | 0.7653756178 |
39 | 4992 | 528274980 + 500*449900 | 753224980 | 19313461.03 | Yes | -15407587.97 | 0.7977642098 |
40 | 5120 | 528274987 + 512*449900 | 758623787 | 18965594.68 | Yes | -15755454.33 | 0.8307387453 |
41 | 5248 | 528274980 + 525*449900 | 764472480 | 18645670.24 | Yes | -16075378.76 | 0.8621507592 |
42 | 5376 | 528274980 + 538*449900 | 770321180 | 18340980.48 | Yes | -16380068.52 | 0.893085762 |
43 | 5504 | 528274980 + 551*449900 | 776169880 | 18050462.33 | Yes | -16670586.67 | 0.9235545535 |
44 | 5632 | 528274980 + 564*449900 | 782018580 | 17773149.55 | Yes | -16947899.45 | 0.9535675943 |
45 | 5760 | 528274980 + 576*449900 | 787417380 | 17498164 | Yes | -17222885 | 0.9842681209 |
46 | 5888 | 528274980 + 589*449900 | 793266080 | 17244914.78 | Yes | -17476134.22 | 1.013407978 |
47 | 6016 | 528274980 + 602*449900 | 799114780 | 17002442.13 | Yes | -17718606.87 | 1.042121287 |
48 | 6144 | 528274987 + 615*449900 | 804963487 | 16770072.65 | Yes | -17950976.35 | 1.070417328 |
49 | 6272 | 528274980 + 628*449900 | 810812180 | 16547187.35 | Yes | -18173861.65 | 1.098305185 |
50 | 6400 | 528274980 + 640*449900 | 816210980 | 16324219.6 | Yes | -18396829.4 | 1.126965322 |
51 | 6528 | 528274980 + 653*449900 | 822059680 | 16118817.25 | Yes | -18602231.75 | 1.154069275 |
52 | 6656 | 528274980 + 666*449900 | 827908380 | 15921315 | Yes | -18799734 | 1.18079028 |
53 | 6784 | 528274980 + 679*449900 | 833757080 | 15731265.66 | Yes | -18989783.34 | 1.207136396 |
54 | 6912 | 528274980 + 692*449900 | 839605780 | 15548255.19 | Yes | -19172793.81 | 1.233115458 |
55 | 7040 | 528274980 + 704*449900 | 845004580 | 15363719.64 | Yes | -19357329.36 | 1.259937686 |
56 | 7168 | 528274987 + 717*449900 | 850853287 | 15193808.7 | Yes | -19527240.3 | 1.285210357 |
57 | 7296 | 528274980 + 730*449900 | 856701980 | 15029859.3 | Yes | -19691189.7 | 1.310137993 |
58 | 7424 | 528274980 + 743*449900 | 862550680 | 14871563.45 | Yes | -19849485.55 | 1.334727557 |
59 | 7552 | 528274980 + 756*449900 | 868399380 | 14718633.56 | Yes | -20002415.44 | 1.358985898 |
60 | 7680 | 528274980 + 768*449900 | 873798180 | 14563303 | Yes | -20157746 | 1.384146577 |
61 | 7808 | 528274980 + 781*449900 | 879646880 | 14420440.66 | Yes | -20300608.34 | 1.407766158 |
62 | 7936 | 528274980 + 794*449900 | 885495580 | 14282186.77 | Yes | -20438862.23 | 1.431073725 |
63 | 8064 | 528274980 + 807*449900 | 891344280 | 14148321.9 | Yes | -20572727.1 | 1.454075419 |
64 | 8192 | 528274987 + 820*449900 | 897192987 | 14018640.42 | Yes | -20702408.58 | 1.476777202 |
The table is summarized in the following graph: