@solarity/zkit 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,7 @@ contract <%=verifier_id%> {
67
67
  mstore(add(pointer_, 32), y_)
68
68
  mstore(add(pointer_, 64), s_)
69
69
 
70
- res_ := staticcall(sub(gas(), 2000), 7, pointer_, 96, pointer_, 64) // ecMul
70
+ res_ := staticcall(6000, 7, pointer_, 96, pointer_, 64) // ecMul
71
71
  res_ := and(res_, gt(returndatasize(), 0)) // check that multiplication succeeded
72
72
 
73
73
  if iszero(res_) {
@@ -77,7 +77,7 @@ contract <%=verifier_id%> {
77
77
  mstore(add(pointer_, 64), mload(pR_))
78
78
  mstore(add(pointer_, 96), mload(add(pR_, 32)))
79
79
 
80
- res_ := staticcall(sub(gas(), 2000), 6, pointer_, 128, pR_, 64) // ecAdd
80
+ res_ := staticcall(150, 6, pointer_, 128, pR_, 64) // ecAdd
81
81
  res_ := and(res_, gt(returndatasize(), 0)) // check that addition succeeded
82
82
  }
83
83
 
@@ -136,7 +136,7 @@ contract <%=verifier_id%> {
136
136
  mstore(add(pPairing_, 704), DELTA_Y1)
137
137
  mstore(add(pPairing_, 736), DELTA_Y2)
138
138
 
139
- res_ := staticcall(sub(gas(), 2000), 8, pPairing_, 768, pPairing_, 32) // ecPairing
139
+ res_ := staticcall(181000, 8, pPairing_, 768, pPairing_, 32) // ecPairing
140
140
  res_ := and(res_, mload(pPairing_)) // check that pairing succeeded
141
141
  }
142
142
 
@@ -53,6 +53,7 @@ def _g1MulAdd(pR: uint256[2], pP: uint256[2], s: uint256) -> (bool, uint256[2]):
53
53
  success, response = raw_call(
54
54
  EC_MUL_PRECOMPILED_ADDRESS,
55
55
  abi_encode(pP, s),
56
+ gas=6000,
56
57
  max_outsize=64,
57
58
  is_static_call=True,
58
59
  revert_on_failure=False
@@ -68,6 +69,7 @@ def _g1MulAdd(pR: uint256[2], pP: uint256[2], s: uint256) -> (bool, uint256[2]):
68
69
  success, response = raw_call(
69
70
  EC_ADD_PRECOMPILED_ADDRESS,
70
71
  abi_encode(pR, pS),
72
+ gas=150,
71
73
  max_outsize=64,
72
74
  is_static_call=True,
73
75
  revert_on_failure=False
@@ -107,6 +109,7 @@ def _checkPairing(pA: uint256[2], pB: uint256[2][2], pC: uint256[2], pubSignals:
107
109
  pC,
108
110
  DELTA_X1, DELTA_X2, DELTA_Y1, DELTA_Y2
109
111
  ),
112
+ gas=181000,
110
113
  max_outsize=32,
111
114
  is_static_call=True,
112
115
  revert_on_failure=False
@@ -415,7 +415,7 @@ contract <%=verifier_id%> {
415
415
  mstore(add(mIn,64), mload(pP_))
416
416
  mstore(add(mIn,96), mload(add(pP_, 32)))
417
417
 
418
- res_ := staticcall(sub(gas(), 2000), 6, mIn, 128, pR_, 64)
418
+ res_ := staticcall(150, 6, mIn, 128, pR_, 64)
419
419
  }
420
420
 
421
421
  function g1_mulAccC(pR_, x_, y_, s_) -> res_ {
@@ -424,7 +424,7 @@ contract <%=verifier_id%> {
424
424
  mstore(add(mIn,32), y_)
425
425
  mstore(add(mIn,64), s_)
426
426
 
427
- res_ := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
427
+ res_ := staticcall(6000, 7, mIn, 96, mIn, 64)
428
428
 
429
429
  if iszero(res_) {
430
430
  leave
@@ -433,7 +433,7 @@ contract <%=verifier_id%> {
433
433
  mstore(add(mIn,64), mload(pR_))
434
434
  mstore(add(mIn,96), mload(add(pR_, 32)))
435
435
 
436
- res_ := staticcall(sub(gas(), 2000), 6, mIn, 128, pR_, 64)
436
+ res_ := staticcall(150, 6, mIn, 128, pR_, 64)
437
437
  }
438
438
 
439
439
  function g1_mulSetC(pR_, x_, y_, s_) -> res_ {
@@ -442,7 +442,7 @@ contract <%=verifier_id%> {
442
442
  mstore(add(mIn,32), y_)
443
443
  mstore(add(mIn,64), s_)
444
444
 
445
- res_ := staticcall(sub(gas(), 2000), 7, mIn, 96, pR_, 64)
445
+ res_ := staticcall(6000, 7, mIn, 96, pR_, 64)
446
446
  }
447
447
 
448
448
  function g1_mulSet(pR_, pP_, s_) -> res_ {
@@ -748,7 +748,7 @@ contract <%=verifier_id%> {
748
748
  mstore(add(mIn,320), G2_Y2)
749
749
  mstore(add(mIn,352), G2_Y1)
750
750
 
751
- if iszero(staticcall(sub(gas(), 2000), 8, mIn, 384, mIn, 0x20)) {
751
+ if iszero(staticcall(113000, 8, mIn, 384, mIn, 0x20)) {
752
752
  leave
753
753
  }
754
754
 
@@ -149,6 +149,7 @@ def _ecadd(a: uint256[2], b: uint256[2]) -> (bool, uint256[2]):
149
149
  success, response = raw_call(
150
150
  EC_ADD_PRECOMPILED_ADDRESS,
151
151
  abi_encode(a, b),
152
+ gas=150,
152
153
  max_outsize=64,
153
154
  is_static_call=True,
154
155
  revert_on_failure=False
@@ -171,6 +172,7 @@ def _ecmul(p: uint256[2], s: uint256) -> (bool, uint256[2]):
171
172
  success, response = raw_call(
172
173
  EC_MUL_PRECOMPILED_ADDRESS,
173
174
  abi_encode(p, s),
175
+ gas=6000,
174
176
  max_outsize=64,
175
177
  is_static_call=True,
176
178
  revert_on_failure=False
@@ -639,6 +641,7 @@ def _checkPairing(p: uint256[P_TOTAL_SIZE], proof: uint256[24]) -> bool:
639
641
  success, response = raw_call(
640
642
  EC_PAIRING_PRECOMPILED_ADDRESS,
641
643
  abi_encode(mIn),
644
+ gas=113000,
642
645
  max_outsize=32,
643
646
  is_static_call=True,
644
647
  revert_on_failure=False
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solarity/zkit",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "license": "MIT",
5
5
  "author": "Distributed Lab",
6
6
  "readme": "README.md",
@@ -67,7 +67,7 @@ contract <%=verifier_id%> {
67
67
  mstore(add(pointer_, 32), y_)
68
68
  mstore(add(pointer_, 64), s_)
69
69
 
70
- res_ := staticcall(sub(gas(), 2000), 7, pointer_, 96, pointer_, 64) // ecMul
70
+ res_ := staticcall(6000, 7, pointer_, 96, pointer_, 64) // ecMul
71
71
  res_ := and(res_, gt(returndatasize(), 0)) // check that multiplication succeeded
72
72
 
73
73
  if iszero(res_) {
@@ -77,7 +77,7 @@ contract <%=verifier_id%> {
77
77
  mstore(add(pointer_, 64), mload(pR_))
78
78
  mstore(add(pointer_, 96), mload(add(pR_, 32)))
79
79
 
80
- res_ := staticcall(sub(gas(), 2000), 6, pointer_, 128, pR_, 64) // ecAdd
80
+ res_ := staticcall(150, 6, pointer_, 128, pR_, 64) // ecAdd
81
81
  res_ := and(res_, gt(returndatasize(), 0)) // check that addition succeeded
82
82
  }
83
83
 
@@ -136,7 +136,7 @@ contract <%=verifier_id%> {
136
136
  mstore(add(pPairing_, 704), DELTA_Y1)
137
137
  mstore(add(pPairing_, 736), DELTA_Y2)
138
138
 
139
- res_ := staticcall(sub(gas(), 2000), 8, pPairing_, 768, pPairing_, 32) // ecPairing
139
+ res_ := staticcall(181000, 8, pPairing_, 768, pPairing_, 32) // ecPairing
140
140
  res_ := and(res_, mload(pPairing_)) // check that pairing succeeded
141
141
  }
142
142
 
@@ -53,6 +53,7 @@ def _g1MulAdd(pR: uint256[2], pP: uint256[2], s: uint256) -> (bool, uint256[2]):
53
53
  success, response = raw_call(
54
54
  EC_MUL_PRECOMPILED_ADDRESS,
55
55
  abi_encode(pP, s),
56
+ gas=6000,
56
57
  max_outsize=64,
57
58
  is_static_call=True,
58
59
  revert_on_failure=False
@@ -68,6 +69,7 @@ def _g1MulAdd(pR: uint256[2], pP: uint256[2], s: uint256) -> (bool, uint256[2]):
68
69
  success, response = raw_call(
69
70
  EC_ADD_PRECOMPILED_ADDRESS,
70
71
  abi_encode(pR, pS),
72
+ gas=150,
71
73
  max_outsize=64,
72
74
  is_static_call=True,
73
75
  revert_on_failure=False
@@ -107,6 +109,7 @@ def _checkPairing(pA: uint256[2], pB: uint256[2][2], pC: uint256[2], pubSignals:
107
109
  pC,
108
110
  DELTA_X1, DELTA_X2, DELTA_Y1, DELTA_Y2
109
111
  ),
112
+ gas=181000,
110
113
  max_outsize=32,
111
114
  is_static_call=True,
112
115
  revert_on_failure=False
@@ -415,7 +415,7 @@ contract <%=verifier_id%> {
415
415
  mstore(add(mIn,64), mload(pP_))
416
416
  mstore(add(mIn,96), mload(add(pP_, 32)))
417
417
 
418
- res_ := staticcall(sub(gas(), 2000), 6, mIn, 128, pR_, 64)
418
+ res_ := staticcall(150, 6, mIn, 128, pR_, 64)
419
419
  }
420
420
 
421
421
  function g1_mulAccC(pR_, x_, y_, s_) -> res_ {
@@ -424,7 +424,7 @@ contract <%=verifier_id%> {
424
424
  mstore(add(mIn,32), y_)
425
425
  mstore(add(mIn,64), s_)
426
426
 
427
- res_ := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
427
+ res_ := staticcall(6000, 7, mIn, 96, mIn, 64)
428
428
 
429
429
  if iszero(res_) {
430
430
  leave
@@ -433,7 +433,7 @@ contract <%=verifier_id%> {
433
433
  mstore(add(mIn,64), mload(pR_))
434
434
  mstore(add(mIn,96), mload(add(pR_, 32)))
435
435
 
436
- res_ := staticcall(sub(gas(), 2000), 6, mIn, 128, pR_, 64)
436
+ res_ := staticcall(150, 6, mIn, 128, pR_, 64)
437
437
  }
438
438
 
439
439
  function g1_mulSetC(pR_, x_, y_, s_) -> res_ {
@@ -442,7 +442,7 @@ contract <%=verifier_id%> {
442
442
  mstore(add(mIn,32), y_)
443
443
  mstore(add(mIn,64), s_)
444
444
 
445
- res_ := staticcall(sub(gas(), 2000), 7, mIn, 96, pR_, 64)
445
+ res_ := staticcall(6000, 7, mIn, 96, pR_, 64)
446
446
  }
447
447
 
448
448
  function g1_mulSet(pR_, pP_, s_) -> res_ {
@@ -748,7 +748,7 @@ contract <%=verifier_id%> {
748
748
  mstore(add(mIn,320), G2_Y2)
749
749
  mstore(add(mIn,352), G2_Y1)
750
750
 
751
- if iszero(staticcall(sub(gas(), 2000), 8, mIn, 384, mIn, 0x20)) {
751
+ if iszero(staticcall(113000, 8, mIn, 384, mIn, 0x20)) {
752
752
  leave
753
753
  }
754
754
 
@@ -149,6 +149,7 @@ def _ecadd(a: uint256[2], b: uint256[2]) -> (bool, uint256[2]):
149
149
  success, response = raw_call(
150
150
  EC_ADD_PRECOMPILED_ADDRESS,
151
151
  abi_encode(a, b),
152
+ gas=150,
152
153
  max_outsize=64,
153
154
  is_static_call=True,
154
155
  revert_on_failure=False
@@ -171,6 +172,7 @@ def _ecmul(p: uint256[2], s: uint256) -> (bool, uint256[2]):
171
172
  success, response = raw_call(
172
173
  EC_MUL_PRECOMPILED_ADDRESS,
173
174
  abi_encode(p, s),
175
+ gas=6000,
174
176
  max_outsize=64,
175
177
  is_static_call=True,
176
178
  revert_on_failure=False
@@ -639,6 +641,7 @@ def _checkPairing(p: uint256[P_TOTAL_SIZE], proof: uint256[24]) -> bool:
639
641
  success, response = raw_call(
640
642
  EC_PAIRING_PRECOMPILED_ADDRESS,
641
643
  abi_encode(mIn),
644
+ gas=113000,
642
645
  max_outsize=32,
643
646
  is_static_call=True,
644
647
  revert_on_failure=False