@inco/lightning 0.7.10 → 0.8.0-devnet
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.
- package/manifest.yaml +22 -0
- package/package.json +1 -1
- package/src/Lib.devnet.sol +1 -1
- package/src/Lib.sol +1 -1
- package/src/libs/incoLightning_devnet_v3_976859633.sol +478 -0
- package/src/lightning-parts/Fee.sol +1 -1
- package/src/lightning-parts/TEELifecycle.sol +11 -12
- package/src/lightning-parts/TEELifecycle.types.sol +1 -4
- package/src/test/FakeIncoInfra/MockRemoteAttestation.sol +2 -3
- package/src/test/IncoTest.sol +2 -2
- package/src/test/TEELifecycle/TEELifecycleMockTest.t.sol +1 -1
- package/src/version/IncoLightningConfig.sol +2 -2
package/manifest.yaml
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
incoLightning_devnet_v3_976859633:
|
|
2
|
+
executor:
|
|
3
|
+
name: incoLightning_devnet_v3_976859633
|
|
4
|
+
majorVersion: 3
|
|
5
|
+
deployer: "0x8202D2D747784Cb7D48868E44C42C4bf162a70BC"
|
|
6
|
+
pepper: devnet
|
|
7
|
+
executorAddress: "0x4732520194584a04Cac0224e067658619F4086bD"
|
|
8
|
+
salt: "0x8202d2d747784cb7d48868e44c42c4bf162a70bc00ef1fab551c72a93b0637f1"
|
|
9
|
+
deployments:
|
|
10
|
+
- name: incoLightningPreview_3_0_0__976859633
|
|
11
|
+
chainId: "84532"
|
|
12
|
+
chainName: Base Sepolia
|
|
13
|
+
version:
|
|
14
|
+
major: 3
|
|
15
|
+
minor: 0
|
|
16
|
+
patch: 0
|
|
17
|
+
shortSalt: "976859633"
|
|
18
|
+
blockNumber: "36099996"
|
|
19
|
+
deployDate: 2026-01-09T14:18:04.212Z
|
|
20
|
+
commit: v0.7.9-7-g63b3d823-dirty
|
|
21
|
+
active: true
|
|
22
|
+
includesPreviewFeatures: true
|
|
1
23
|
incoLightning_testnet_v2_889158349:
|
|
2
24
|
executor:
|
|
3
25
|
name: incoLightning_testnet_v2_889158349
|
package/package.json
CHANGED
package/src/Lib.devnet.sol
CHANGED
|
@@ -8,7 +8,7 @@ pragma solidity ^0.8;
|
|
|
8
8
|
import { IncoLightning } from "./IncoLightning.sol";
|
|
9
9
|
import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
|
|
10
10
|
|
|
11
|
-
IncoLightning constant inco = IncoLightning(
|
|
11
|
+
IncoLightning constant inco = IncoLightning(0x4732520194584a04Cac0224e067658619F4086bD);
|
|
12
12
|
address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
|
|
13
13
|
|
|
14
14
|
function typeOf(bytes32 handle) pure returns (ETypes) {
|
package/src/Lib.sol
CHANGED
|
@@ -8,7 +8,7 @@ pragma solidity ^0.8;
|
|
|
8
8
|
import { IncoLightning } from "./IncoLightning.sol";
|
|
9
9
|
import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
|
|
10
10
|
|
|
11
|
-
IncoLightning constant inco = IncoLightning(
|
|
11
|
+
IncoLightning constant inco = IncoLightning(0x4732520194584a04Cac0224e067658619F4086bD);
|
|
12
12
|
address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
|
|
13
13
|
|
|
14
14
|
function typeOf(bytes32 handle) pure returns (ETypes) {
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
// AUTOGENERATED FILE. DO NOT EDIT.
|
|
2
|
+
// This file was generated by the IncoLightning library generator.
|
|
3
|
+
// The original template is located at Lib.template.sol
|
|
4
|
+
|
|
5
|
+
/// SPDX-License-Identifier: No License
|
|
6
|
+
pragma solidity ^0.8;
|
|
7
|
+
|
|
8
|
+
import { IncoLightning } from "../IncoLightning.sol";
|
|
9
|
+
import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
|
|
10
|
+
|
|
11
|
+
IncoLightning constant inco = IncoLightning(0x4732520194584a04Cac0224e067658619F4086bD);
|
|
12
|
+
address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
|
|
13
|
+
|
|
14
|
+
function typeOf(bytes32 handle) pure returns (ETypes) {
|
|
15
|
+
return ETypes(uint8(uint256(handle) >> 8));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
library e {
|
|
19
|
+
function sanitize(euint256 a) internal returns (euint256) {
|
|
20
|
+
if (euint256.unwrap(a) == bytes32(0)) {
|
|
21
|
+
return asEuint256(0);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function sanitize(ebool a) internal returns (ebool) {
|
|
27
|
+
if (ebool.unwrap(a) == bytes32(0)) {
|
|
28
|
+
return asEbool(false);
|
|
29
|
+
}
|
|
30
|
+
return a;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function sanitize(eaddress a) internal returns (eaddress) {
|
|
34
|
+
if (eaddress.unwrap(a) == bytes32(0)) {
|
|
35
|
+
return asEaddress(address(0));
|
|
36
|
+
}
|
|
37
|
+
return a;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function s(euint256 a) internal returns (euint256) {
|
|
41
|
+
return sanitize(a);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function s(ebool a) internal returns (ebool) {
|
|
45
|
+
return sanitize(a);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function s(eaddress a) internal returns (eaddress) {
|
|
49
|
+
return sanitize(a);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function add(euint256 a, euint256 b) internal returns (euint256) {
|
|
53
|
+
return inco.eAdd(s(a), s(b));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function add(euint256 a, uint256 b) internal returns (euint256) {
|
|
57
|
+
return inco.eAdd(s(a), asEuint256(b));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function add(uint256 a, euint256 b) internal returns (euint256) {
|
|
61
|
+
return inco.eAdd(asEuint256(a), s(b));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function sub(euint256 a, euint256 b) internal returns (euint256) {
|
|
65
|
+
return inco.eSub(s(a), s(b));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function sub(euint256 a, uint256 b) internal returns (euint256) {
|
|
69
|
+
return inco.eSub(s(a), asEuint256(b));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function sub(uint256 a, euint256 b) internal returns (euint256) {
|
|
73
|
+
return inco.eSub(asEuint256(a), s(b));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function mul(euint256 a, euint256 b) internal returns (euint256) {
|
|
77
|
+
return inco.eMul(s(a), s(b));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function mul(euint256 a, uint256 b) internal returns (euint256) {
|
|
81
|
+
return inco.eMul(s(a), asEuint256(b));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function mul(uint256 a, euint256 b) internal returns (euint256) {
|
|
85
|
+
return inco.eMul(asEuint256(a), s(b));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function div(euint256 a, euint256 b) internal returns (euint256) {
|
|
89
|
+
return inco.eDiv(s(a), s(b));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function div(euint256 a, uint256 b) internal returns (euint256) {
|
|
93
|
+
return inco.eDiv(s(a), asEuint256(b));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function div(uint256 a, euint256 b) internal returns (euint256) {
|
|
97
|
+
return inco.eDiv(asEuint256(a), s(b));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function rem(euint256 a, euint256 b) internal returns (euint256) {
|
|
101
|
+
return inco.eRem(s(a), s(b));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function rem(euint256 a, uint256 b) internal returns (euint256) {
|
|
105
|
+
return inco.eRem(s(a), asEuint256(b));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function rem(uint256 a, euint256 b) internal returns (euint256) {
|
|
109
|
+
return inco.eRem(asEuint256(a), s(b));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function and(euint256 a, euint256 b) internal returns (euint256) {
|
|
113
|
+
return euint256.wrap(inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function and(euint256 a, uint256 b) internal returns (euint256) {
|
|
117
|
+
return euint256.wrap(inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function and(uint256 a, euint256 b) internal returns (euint256) {
|
|
121
|
+
return euint256.wrap(inco.eBitAnd(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function and(ebool a, ebool b) internal returns (ebool) {
|
|
125
|
+
return ebool.wrap(inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function and(ebool a, bool b) internal returns (ebool) {
|
|
129
|
+
return ebool.wrap(inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function and(bool a, ebool b) internal returns (ebool) {
|
|
133
|
+
return ebool.wrap(inco.eBitAnd(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function or(euint256 a, euint256 b) internal returns (euint256) {
|
|
137
|
+
return euint256.wrap(inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function or(euint256 a, uint256 b) internal returns (euint256) {
|
|
141
|
+
return euint256.wrap(inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function or(uint256 a, euint256 b) internal returns (euint256) {
|
|
145
|
+
return euint256.wrap(inco.eBitOr(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function or(ebool a, ebool b) internal returns (ebool) {
|
|
149
|
+
return ebool.wrap(inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function or(ebool a, bool b) internal returns (ebool) {
|
|
153
|
+
return ebool.wrap(inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function or(bool a, ebool b) internal returns (ebool) {
|
|
157
|
+
return ebool.wrap(inco.eBitOr(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function xor(euint256 a, euint256 b) internal returns (euint256) {
|
|
161
|
+
return euint256.wrap(inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function xor(euint256 a, uint256 b) internal returns (euint256) {
|
|
165
|
+
return euint256.wrap(inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function xor(uint256 a, euint256 b) internal returns (euint256) {
|
|
169
|
+
return euint256.wrap(inco.eBitXor(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function xor(ebool a, ebool b) internal returns (ebool) {
|
|
173
|
+
return ebool.wrap(inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function xor(ebool a, bool b) internal returns (ebool) {
|
|
177
|
+
return ebool.wrap(inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function xor(bool a, ebool b) internal returns (ebool) {
|
|
181
|
+
return ebool.wrap(inco.eBitXor(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function shl(euint256 a, euint256 b) internal returns (euint256) {
|
|
185
|
+
return inco.eShl(s(a), s(b));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function shl(euint256 a, uint256 b) internal returns (euint256) {
|
|
189
|
+
return inco.eShl(s(a), asEuint256(b));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function shl(uint256 a, euint256 b) internal returns (euint256) {
|
|
193
|
+
return inco.eShl(asEuint256(a), s(b));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function shr(euint256 a, euint256 b) internal returns (euint256) {
|
|
197
|
+
return inco.eShr(s(a), s(b));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function shr(euint256 a, uint256 b) internal returns (euint256) {
|
|
201
|
+
return inco.eShr(s(a), asEuint256(b));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function shr(uint256 a, euint256 b) internal returns (euint256) {
|
|
205
|
+
return inco.eShr(asEuint256(a), s(b));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function rotl(euint256 a, euint256 b) internal returns (euint256) {
|
|
209
|
+
return inco.eRotl(s(a), s(b));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function rotl(euint256 a, uint256 b) internal returns (euint256) {
|
|
213
|
+
return inco.eRotl(s(a), asEuint256(b));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function rotl(uint256 a, euint256 b) internal returns (euint256) {
|
|
217
|
+
return inco.eRotl(asEuint256(a), s(b));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function rotr(euint256 a, euint256 b) internal returns (euint256) {
|
|
221
|
+
return inco.eRotr(s(a), s(b));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function rotr(euint256 a, uint256 b) internal returns (euint256) {
|
|
225
|
+
return inco.eRotr(s(a), asEuint256(b));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function rotr(uint256 a, euint256 b) internal returns (euint256) {
|
|
229
|
+
return inco.eRotr(asEuint256(a), s(b));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function eq(euint256 a, euint256 b) internal returns (ebool) {
|
|
233
|
+
return inco.eEq(euint256.unwrap(s(a)), euint256.unwrap(s(b)));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function eq(euint256 a, uint256 b) internal returns (ebool) {
|
|
237
|
+
return inco.eEq(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b)));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function eq(uint256 a, euint256 b) internal returns (ebool) {
|
|
241
|
+
return inco.eEq(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b)));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function eq(eaddress a, address b) internal returns (ebool) {
|
|
245
|
+
return inco.eEq(eaddress.unwrap(s(a)), eaddress.unwrap(asEaddress(b)));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function eq(eaddress a, eaddress b) internal returns (ebool) {
|
|
249
|
+
return inco.eEq(eaddress.unwrap(s(a)), eaddress.unwrap(s(b)));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function eq(address a, eaddress b) internal returns (ebool) {
|
|
253
|
+
return inco.eEq(eaddress.unwrap(asEaddress(a)), eaddress.unwrap(s(b)));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function ne(euint256 a, euint256 b) internal returns (ebool) {
|
|
257
|
+
return inco.eNe(euint256.unwrap(s(a)), euint256.unwrap(s(b)));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function ne(euint256 a, uint256 b) internal returns (ebool) {
|
|
261
|
+
return inco.eNe(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b)));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function ne(uint256 a, euint256 b) internal returns (ebool) {
|
|
265
|
+
return inco.eNe(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b)));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function ne(eaddress a, eaddress b) internal returns (ebool) {
|
|
269
|
+
return inco.eNe(eaddress.unwrap(s(a)), eaddress.unwrap(s(b)));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function ne(eaddress a, address b) internal returns (ebool) {
|
|
273
|
+
return inco.eNe(eaddress.unwrap(s(a)), eaddress.unwrap(asEaddress(b)));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function ne(address a, eaddress b) internal returns (ebool) {
|
|
277
|
+
return inco.eNe(eaddress.unwrap(asEaddress(a)), eaddress.unwrap(s(b)));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function ge(euint256 a, euint256 b) internal returns (ebool) {
|
|
281
|
+
return inco.eGe(s(a), s(b));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function ge(euint256 a, uint256 b) internal returns (ebool) {
|
|
285
|
+
return inco.eGe(s(a), asEuint256(b));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function ge(uint256 a, euint256 b) internal returns (ebool) {
|
|
289
|
+
return inco.eGe(asEuint256(a), s(b));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function gt(euint256 a, euint256 b) internal returns (ebool) {
|
|
293
|
+
return inco.eGt(s(a), s(b));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function gt(euint256 a, uint256 b) internal returns (ebool) {
|
|
297
|
+
return inco.eGt(s(a), asEuint256(b));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function gt(uint256 a, euint256 b) internal returns (ebool) {
|
|
301
|
+
return inco.eGt(asEuint256(a), s(b));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function le(euint256 a, euint256 b) internal returns (ebool) {
|
|
305
|
+
return inco.eLe(s(a), s(b));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function le(euint256 a, uint256 b) internal returns (ebool) {
|
|
309
|
+
return inco.eLe(s(a), asEuint256(b));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function le(uint256 a, euint256 b) internal returns (ebool) {
|
|
313
|
+
return inco.eLe(asEuint256(a), s(b));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function lt(euint256 a, euint256 b) internal returns (ebool) {
|
|
317
|
+
return inco.eLt(s(a), s(b));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function lt(euint256 a, uint256 b) internal returns (ebool) {
|
|
321
|
+
return inco.eLt(s(a), asEuint256(b));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function lt(uint256 a, euint256 b) internal returns (ebool) {
|
|
325
|
+
return inco.eLt(asEuint256(a), s(b));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function min(euint256 a, euint256 b) internal returns (euint256) {
|
|
329
|
+
return inco.eMin(s(a), s(b));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function min(euint256 a, uint256 b) internal returns (euint256) {
|
|
333
|
+
return inco.eMin(s(a), asEuint256(b));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function min(uint256 a, euint256 b) internal returns (euint256) {
|
|
337
|
+
return inco.eMin(asEuint256(a), s(b));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function max(euint256 a, euint256 b) internal returns (euint256) {
|
|
341
|
+
return inco.eMax(s(a), s(b));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function max(euint256 a, uint256 b) internal returns (euint256) {
|
|
345
|
+
return inco.eMax(s(a), asEuint256(b));
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function max(uint256 a, euint256 b) internal returns (euint256) {
|
|
349
|
+
return inco.eMax(asEuint256(a), s(b));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function not(ebool a) internal returns (ebool) {
|
|
353
|
+
return inco.eNot(s(a));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/// @dev costs the inco fee
|
|
357
|
+
function rand() internal returns (euint256) {
|
|
358
|
+
return euint256.wrap(inco.eRand{value: inco.getFee()}(ETypes.Uint256));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/// @dev costs the inco fee
|
|
362
|
+
function randBounded(uint256 upperBound) internal returns (euint256) {
|
|
363
|
+
return euint256.wrap(inco.eRandBounded{value: inco.getFee()}(euint256.unwrap(asEuint256(upperBound)), ETypes.Uint256));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/// @dev costs the inco fee
|
|
367
|
+
function randBounded(euint256 upperBound) internal returns (euint256) {
|
|
368
|
+
return euint256.wrap(inco.eRandBounded{value: inco.getFee()}(euint256.unwrap(s(upperBound)), ETypes.Uint256));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function asEuint256(uint256 a) internal returns (euint256) {
|
|
372
|
+
return inco.asEuint256(a);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function asEbool(bool a) internal returns (ebool) {
|
|
376
|
+
return inco.asEbool(a);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function asEaddress(address a) internal returns (eaddress) {
|
|
380
|
+
return inco.asEaddress(a);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function asEbool(euint256 a) internal returns (ebool) {
|
|
384
|
+
return ebool.wrap(inco.eCast(euint256.unwrap(a), ETypes.Bool));
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function asEuint256(ebool a) internal returns (euint256) {
|
|
388
|
+
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/// @notice Creates a new encrypted uint256 assuming msg.sender is the user
|
|
392
|
+
/// @dev costs the inco fee
|
|
393
|
+
function newEuint256(bytes memory ciphertext) internal returns (euint256) {
|
|
394
|
+
return newEuint256(ciphertext, msg.sender);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/// @notice Creates a new encrypted uint256 for the given user.
|
|
398
|
+
/// @dev costs the inco fee
|
|
399
|
+
function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
|
|
400
|
+
return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/// @notice Creates a new encrypted bool assuming msg.sender is the user
|
|
404
|
+
/// @dev costs the inco fee
|
|
405
|
+
function newEbool(bytes memory ciphertext) internal returns (ebool) {
|
|
406
|
+
return newEbool(ciphertext, msg.sender);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/// @notice Creates a new encrypted bool for the given user.
|
|
410
|
+
/// @dev costs the inco fee
|
|
411
|
+
function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
|
|
412
|
+
return inco.newEbool{value: inco.getFee()}(ciphertext, user);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/// @notice Creates a new encrypted address assuming msg.sender is the user
|
|
416
|
+
/// @dev costs the inco fee
|
|
417
|
+
function newEaddress(bytes memory ciphertext) internal returns (eaddress) {
|
|
418
|
+
return newEaddress(ciphertext, msg.sender);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/// @notice Creates a new encrypted address for the given user.
|
|
422
|
+
/// @dev costs the inco fee
|
|
423
|
+
function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
|
|
424
|
+
return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function allow(euint256 a, address to) internal {
|
|
428
|
+
inco.allow(euint256.unwrap(a), to);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function allow(ebool a, address to) internal {
|
|
432
|
+
inco.allow(ebool.unwrap(a), to);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function allow(eaddress a, address to) internal {
|
|
436
|
+
inco.allow(eaddress.unwrap(a), to);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function reveal(euint256 a) internal {
|
|
440
|
+
inco.reveal(euint256.unwrap(a));
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function reveal(ebool a) internal {
|
|
444
|
+
inco.reveal(ebool.unwrap(a));
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function reveal(eaddress a) internal {
|
|
448
|
+
inco.reveal(eaddress.unwrap(a));
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function allowThis(euint256 a) internal {
|
|
452
|
+
allow(a, address(this));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function allowThis(ebool a) internal {
|
|
456
|
+
allow(a, address(this));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function allowThis(eaddress a) internal {
|
|
460
|
+
allow(a, address(this));
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function isAllowed(address user, euint256 a) internal view returns (bool) {
|
|
464
|
+
return inco.isAllowed(euint256.unwrap(a), user);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function select(ebool control, euint256 ifTrue, euint256 ifFalse) internal returns (euint256) {
|
|
468
|
+
return euint256.wrap(inco.eIfThenElse(s(control), euint256.unwrap(s(ifTrue)), euint256.unwrap(s(ifFalse))));
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function select(ebool control, ebool ifTrue, ebool ifFalse) internal returns (ebool) {
|
|
472
|
+
return ebool.wrap(inco.eIfThenElse(s(control), ebool.unwrap(s(ifTrue)), ebool.unwrap(s(ifFalse))));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function select(ebool control, eaddress ifTrue, eaddress ifFalse) internal returns (eaddress) {
|
|
476
|
+
return eaddress.wrap(inco.eIfThenElse(s(control), eaddress.unwrap(s(ifTrue)), eaddress.unwrap(s(ifFalse))));
|
|
477
|
+
}
|
|
478
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8;
|
|
3
3
|
|
|
4
4
|
// the fee should be modified through upgrades to limit gas cost
|
|
5
|
-
uint256 constant FEE = 0.
|
|
5
|
+
uint256 constant FEE = 0.000001 ether;
|
|
6
6
|
|
|
7
7
|
/// @notice Fee utils for lightning functions that require a fee
|
|
8
8
|
/// @dev the fee may be changed through upgrades, develop your apps accordingly!
|
|
@@ -29,8 +29,7 @@ contract TEELifecycleStorage {
|
|
|
29
29
|
// @dev The index of the TEE version is the version number
|
|
30
30
|
bytes32[] approvedTeeVersions;
|
|
31
31
|
// @notice The Network key
|
|
32
|
-
|
|
33
|
-
bytes eciesPubkey;
|
|
32
|
+
bytes networkPubkey;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
bytes32 private constant TEE_LIFECYCLE_STORAGE_LOCATION = keccak256("inco.storage.TEELifecycle");
|
|
@@ -80,9 +79,9 @@ abstract contract TEELifecycle is
|
|
|
80
79
|
event SignerHasUpdatedTDX(address indexed eoaSigner, bytes32 indexed mrAggregated);
|
|
81
80
|
|
|
82
81
|
// Constants
|
|
83
|
-
bytes32 public constant BOOTSTRAP_RESULT_STRUCT_HASH = keccak256(bytes("BootstrapResult(bytes
|
|
84
|
-
bytes32 public constant UPGRADE_RESULT_STRUCT_HASH = keccak256(bytes("UpgradeResult(bytes
|
|
85
|
-
bytes32 public constant ADD_NODE_RESULT_STRUCT_HASH = keccak256(bytes("AddNodeResult(bytes
|
|
82
|
+
bytes32 public constant BOOTSTRAP_RESULT_STRUCT_HASH = keccak256(bytes("BootstrapResult(bytes networkPubkey)"));
|
|
83
|
+
bytes32 public constant UPGRADE_RESULT_STRUCT_HASH = keccak256(bytes("UpgradeResult(bytes networkPubkey)"));
|
|
84
|
+
bytes32 public constant ADD_NODE_RESULT_STRUCT_HASH = keccak256(bytes("AddNodeResult(bytes networkPubkey)"));
|
|
86
85
|
|
|
87
86
|
uint16 public constant QUOTE_VERIFIER_VERSION = 4;
|
|
88
87
|
|
|
@@ -141,7 +140,7 @@ abstract contract TEELifecycle is
|
|
|
141
140
|
|
|
142
141
|
// Update contract publicly viewable state
|
|
143
142
|
addSigner(reportDataSigner);
|
|
144
|
-
$.
|
|
143
|
+
$.networkPubkey = bootstrapResult.networkPubkey;
|
|
145
144
|
|
|
146
145
|
emit BootstrapStageComplete(reportDataSigner, bootstrapResult);
|
|
147
146
|
}
|
|
@@ -163,7 +162,7 @@ abstract contract TEELifecycle is
|
|
|
163
162
|
|
|
164
163
|
require(isBootstrapComplete(), BootstrapNotComplete());
|
|
165
164
|
// Make sure the quote's network pubkey is the same as the one in the bootstrap result
|
|
166
|
-
require(keccak256($.
|
|
165
|
+
require(keccak256($.networkPubkey) == keccak256(upgradeResult.networkPubkey), InvalidNetworkPubkey());
|
|
167
166
|
// Make sure the new MR_AGGREGATED has been pre-approved.
|
|
168
167
|
bool isApproved = _isApprovedTeeVersion(newMrAggregated);
|
|
169
168
|
require(isApproved, TEEVersionNotFound());
|
|
@@ -188,7 +187,7 @@ abstract contract TEELifecycle is
|
|
|
188
187
|
|
|
189
188
|
require(isBootstrapComplete(), BootstrapNotComplete());
|
|
190
189
|
// Make sure the quote's network pubkey is the same as the one in the bootstrap result
|
|
191
|
-
require(keccak256($.
|
|
190
|
+
require(keccak256($.networkPubkey) == keccak256(addNodeResult.networkPubkey), InvalidNetworkPubkey());
|
|
192
191
|
// Make sure the new MR_AGGREGATED has been pre-approved.
|
|
193
192
|
bool isApproved = _isApprovedTeeVersion(newMrAggregated);
|
|
194
193
|
require(isApproved, TEEVersionNotFound());
|
|
@@ -257,7 +256,7 @@ abstract contract TEELifecycle is
|
|
|
257
256
|
function isBootstrapComplete() public view returns (bool) {
|
|
258
257
|
// The network pubkey is set once and once only, during the bootstrap process
|
|
259
258
|
// So we can use the length of the network pubkey to check if the bootstrap is complete
|
|
260
|
-
return getTeeLifecycleStorage().
|
|
259
|
+
return getTeeLifecycleStorage().networkPubkey.length > 0;
|
|
261
260
|
}
|
|
262
261
|
|
|
263
262
|
/**
|
|
@@ -384,14 +383,14 @@ abstract contract TEELifecycle is
|
|
|
384
383
|
return $.approvedTeeVersions[index];
|
|
385
384
|
}
|
|
386
385
|
|
|
387
|
-
function
|
|
388
|
-
return getTeeLifecycleStorage().
|
|
386
|
+
function networkPubkey() external view returns (bytes memory) {
|
|
387
|
+
return getTeeLifecycleStorage().networkPubkey;
|
|
389
388
|
}
|
|
390
389
|
|
|
391
390
|
function bootstrapResultDigest(BootstrapResult memory bootstrapResult) public view returns (bytes32) {
|
|
392
391
|
return
|
|
393
392
|
_hashTypedDataV4(
|
|
394
|
-
keccak256(abi.encode(BOOTSTRAP_RESULT_STRUCT_HASH, keccak256(bootstrapResult.
|
|
393
|
+
keccak256(abi.encode(BOOTSTRAP_RESULT_STRUCT_HASH, keccak256(bootstrapResult.networkPubkey)))
|
|
395
394
|
);
|
|
396
395
|
}
|
|
397
396
|
|
|
@@ -5,10 +5,7 @@ pragma solidity ^0.8.19;
|
|
|
5
5
|
* @notice A struct representing what the TDX EOA signs during the bootstrap process.
|
|
6
6
|
*/
|
|
7
7
|
struct BootstrapResult {
|
|
8
|
-
|
|
9
|
-
// https://github.com/Inco-fhevm/inco-monorepo/issues/983
|
|
10
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
11
|
-
bytes ecies_pubkey;
|
|
8
|
+
bytes networkPubkey;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -43,7 +43,7 @@ contract MockRemoteAttestation is TestUtils {
|
|
|
43
43
|
// Helper function to create a successful bootstrap result
|
|
44
44
|
function successfulBootstrapResult(
|
|
45
45
|
ITEELifecycle teeLifecycle,
|
|
46
|
-
bytes memory
|
|
46
|
+
bytes memory networkPubkey,
|
|
47
47
|
address signer,
|
|
48
48
|
uint256 signerPrivKey
|
|
49
49
|
)
|
|
@@ -55,14 +55,13 @@ contract MockRemoteAttestation is TestUtils {
|
|
|
55
55
|
bytes32 mrAggregated
|
|
56
56
|
)
|
|
57
57
|
{
|
|
58
|
-
bytes memory eciesPubkey = eciesPublicKey;
|
|
59
58
|
// See DEFAULT_MRTD in attestation/src/remote_attestation.rs
|
|
60
59
|
bytes memory mrtd =
|
|
61
60
|
hex"010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101";
|
|
62
61
|
// See DEFAULT_MR_AGGREGATED in attestation/src/remote_attestation.rs to
|
|
63
62
|
// see the calculation of the default value.
|
|
64
63
|
mrAggregated = hex"c3a67bac251d4946d7b17481d39631676042fe3afab06e70c22105ad8383c19f";
|
|
65
|
-
bootstrapResult = BootstrapResult({
|
|
64
|
+
bootstrapResult = BootstrapResult({networkPubkey: networkPubkey});
|
|
66
65
|
|
|
67
66
|
quote = createQuote(mrtd, signer);
|
|
68
67
|
signature = signBootstrapResult(bootstrapResult, signerPrivKey, teeLifecycle);
|
package/src/test/IncoTest.sol
CHANGED
|
@@ -39,12 +39,12 @@ contract IncoTest is MockOpHandler, DeployUtils, FakeDecryptionAttester, MockRem
|
|
|
39
39
|
function setUp() public virtual {
|
|
40
40
|
deployCreateX();
|
|
41
41
|
vm.startPrank(testDeployer);
|
|
42
|
-
vm.setEnv("
|
|
42
|
+
vm.setEnv("SHOULD_SETUP_TEE_SIGNER", "true"); // results in a network pubkey and decrypt signer being populated in the TEE Lifecycle
|
|
43
43
|
(IIncoLightning proxy,) = deployIncoLightningUsingConfig({
|
|
44
44
|
deployer: testDeployer,
|
|
45
45
|
// The highest precedent deployment
|
|
46
46
|
// We select the pepper that will be used that will be generated in the lib.sol (usually "testnet"), but currently "alphanet" has higher major version
|
|
47
|
-
pepper: "
|
|
47
|
+
pepper: "devnet",
|
|
48
48
|
quoteVerifier: new FakeQuoteVerifier()
|
|
49
49
|
});
|
|
50
50
|
IOwnable(address(proxy)).transferOwnership(owner);
|
|
@@ -138,7 +138,7 @@ contract TEELifecycleMockTest is MockRemoteAttestation, TEELifecycle {
|
|
|
138
138
|
{
|
|
139
139
|
(bootstrapPartyPrivkey, bootstrapPartyAddress) = getLabeledKeyPair("bootstrapParty");
|
|
140
140
|
mrAggregated = testMrAggregated;
|
|
141
|
-
bootstrapResult = BootstrapResult({
|
|
141
|
+
bootstrapResult = BootstrapResult({networkPubkey: testNetworkPubkey});
|
|
142
142
|
|
|
143
143
|
quote = createQuote(testMrtd, bootstrapPartyAddress);
|
|
144
144
|
signature = signBootstrapResult(bootstrapResult, bootstrapPartyPrivkey);
|
|
@@ -7,12 +7,12 @@ pragma solidity ^0.8;
|
|
|
7
7
|
// UPDATE the CHANGELOG on new versions
|
|
8
8
|
|
|
9
9
|
string constant CONTRACT_NAME = "incoLightning";
|
|
10
|
-
uint8 constant MAJOR_VERSION =
|
|
10
|
+
uint8 constant MAJOR_VERSION = 3;
|
|
11
11
|
uint8 constant MINOR_VERSION = 0;
|
|
12
12
|
// whenever a new version is deployed, we need to pump this up
|
|
13
13
|
// otherwise make test_upgrade will fail
|
|
14
14
|
// consequently, when we do a patch release, we don't need to pump it as it's already pumped
|
|
15
15
|
// when the previous release was done
|
|
16
|
-
uint8 constant PATCH_VERSION =
|
|
16
|
+
uint8 constant PATCH_VERSION = 2;
|
|
17
17
|
|
|
18
18
|
string constant VERIFIER_NAME = "incoVerifier";
|