@inco/lightning 0.6.0 → 0.6.4

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/manifest.yaml +23 -0
  3. package/package.json +1 -1
  4. package/src/DeployUtils.sol +1 -1
  5. package/src/Errors.sol +1 -1
  6. package/src/Lib.alphanet.sol +25 -4
  7. package/src/Lib.demonet.sol +24 -3
  8. package/src/Lib.devnet.sol +24 -3
  9. package/src/Lib.sol +25 -4
  10. package/src/Lib.template.sol +97 -20
  11. package/src/Lib.testnet.sol +24 -3
  12. package/src/libs/incoLightning_alphanet_v0_297966649.sol +24 -3
  13. package/src/libs/incoLightning_alphanet_v1_725458969.sol +478 -0
  14. package/src/libs/incoLightning_demonet_v0_863421733.sol +24 -3
  15. package/src/libs/incoLightning_devnet_v0_340846814.sol +24 -3
  16. package/src/libs/incoLightning_devnet_v1_904635675.sol +24 -3
  17. package/src/libs/incoLightning_testnet_v0_183408998.sol +24 -3
  18. package/src/lightning-parts/AccessControl/test/TestAdvancedAccessControl.t.sol +1 -1
  19. package/src/lightning-parts/EncryptedInput.sol +52 -16
  20. package/src/lightning-parts/EncryptedOperations.sol +86 -90
  21. package/src/lightning-parts/TEELifecycle.sol +153 -66
  22. package/src/lightning-parts/TEELifecycle.types.sol +7 -0
  23. package/src/lightning-parts/interfaces/ITEELifecycle.sol +13 -2
  24. package/src/lightning-parts/primitives/HandleGeneration.sol +23 -57
  25. package/src/lightning-parts/primitives/interfaces/IHandleGeneration.sol +3 -34
  26. package/src/lightning-parts/test/HandleMetadata.t.sol +41 -4
  27. package/src/lightning-parts/test/InputsFee.t.sol +14 -21
  28. package/src/lightning-parts/test/TestDecryptionAttestationInSynchronousFlow.t.sol +6 -2
  29. package/src/shared/IOwnable.sol +10 -0
  30. package/src/shared/IUUPSUpgradable.sol +10 -0
  31. package/src/shared/JsonUtils.sol +16 -0
  32. package/src/shared/TestUtils.sol +50 -0
  33. package/src/shared/TypeUtils.sol +12 -0
  34. package/src/test/FakeIncoInfra/FakeComputeServer.sol +1 -1
  35. package/src/test/FakeIncoInfra/FakeDecryptionAttester.sol +36 -34
  36. package/src/test/FakeIncoInfra/FakeIncoInfraBase.sol +33 -18
  37. package/src/test/FakeIncoInfra/KVStore.sol +1 -1
  38. package/src/test/FakeIncoInfra/MockOpHandler.sol +5 -5
  39. package/src/test/FakeIncoInfra/MockRemoteAttestation.sol +1 -1
  40. package/src/test/IncoTest.sol +3 -3
  41. package/src/test/TEELifecycle/TEELifecycleMockTest.t.sol +73 -20
  42. package/src/test/TestAddTwo.t.sol +1 -1
  43. package/src/test/TestFakeInfra.t.sol +13 -3
  44. package/src/version/IncoLightningConfig.sol +4 -2
  45. package/src/version/Version.sol +4 -0
  46. package/src/version/interfaces/IVersion.sol +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2
4
+
5
+ - Inco Fees on:
6
+ - rand()
7
+ - randBounded()
8
+ - newEuint256()
9
+ - newEbool()
10
+ - newEaddress()
11
+
3
12
  ## 1.0.0
4
13
 
5
14
  - **State breaking change** - Contract Split between Executor and Verifier
package/manifest.yaml CHANGED
@@ -1,3 +1,26 @@
1
+ incoLightning_alphanet_v1_725458969:
2
+ executor:
3
+ name: incoLightning_alphanet_v1_725458969
4
+ majorVersion: 1
5
+ deployer: "0x8202D2D747784Cb7D48868E44C42C4bf162a70BC"
6
+ pepper: alphanet
7
+ executorAddress: "0x28676Cd3b10b03b2FDF105Ba280425b45a674F2A"
8
+ salt: "0x8202d2d747784cb7d48868e44c42c4bf162a70bc004dfbe338c6966a22bcca19"
9
+ deployments:
10
+ - name: incoLightningPreview_1_0_2__725458969
11
+ chainId: "84532"
12
+ chainName: Base Sepolia
13
+ version:
14
+ major: 1
15
+ minor: 0
16
+ patch: 2
17
+ shortSalt: "725458969"
18
+ decryptSigner: "0x4736F8CE685760017eEc130AC3FFc6187f5A1F95"
19
+ eciesPublicKey: "0x038a582d29083c2f3fefe024bf4dd9ab913ab8973716977da5f01106e0b84095b1"
20
+ blockNumber: "32124925"
21
+ deployDate: 2025-10-09T13:55:42.997Z
22
+ commit: v0.5.3-10-ga4f2312d
23
+ active: true
1
24
  incoLightning_devnet_v1_904635675:
2
25
  executor:
3
26
  name: incoLightning_devnet_v1_904635675
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inco/lightning",
3
- "version": "0.6.0",
3
+ "version": "0.6.4",
4
4
  "repository": "https://github.com/Inco-fhevm/inco-monorepo",
5
5
  "files": [
6
6
  "src/",
@@ -159,7 +159,7 @@ contract DeployUtils is Script {
159
159
  IIncoVerifier.initialize.selector,
160
160
  deployer, // owner
161
161
  VERIFIER_NAME,
162
- lightning.getVersion(),
162
+ lightning.getMajorVersion(),
163
163
  quoteVerifier
164
164
  )
165
165
  })
package/src/Errors.sol CHANGED
@@ -1,4 +1,4 @@
1
1
  // SPDX-License-Identifier: No License
2
2
  pragma solidity ^0.8;
3
3
 
4
- error HandleAlreadyExists();
4
+ error HandleAlreadyExists(bytes32 handle);
@@ -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(0x4651DfD7729aE5568092E7351fAaD872266d4CBd);
11
+ IncoLightning constant inco = IncoLightning(0x28676Cd3b10b03b2FDF105Ba280425b45a674F2A);
12
12
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
13
13
 
14
14
  function typeOf(bytes32 handle) pure returns (ETypes) {
@@ -388,17 +388,38 @@ library e {
388
388
  return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
389
389
  }
390
390
 
391
- /// @dev costs the inco fee
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
392
399
  function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
393
400
  return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
394
401
  }
395
402
 
396
- /// @dev costs the inco fee
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
397
411
  function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
398
412
  return inco.newEbool{value: inco.getFee()}(ciphertext, user);
399
413
  }
400
414
 
401
- /// @dev costs the inco fee
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
402
423
  function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
403
424
  return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
404
425
  }
@@ -388,17 +388,38 @@ library e {
388
388
  return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
389
389
  }
390
390
 
391
- /// @dev costs the inco fee
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
392
399
  function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
393
400
  return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
394
401
  }
395
402
 
396
- /// @dev costs the inco fee
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
397
411
  function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
398
412
  return inco.newEbool{value: inco.getFee()}(ciphertext, user);
399
413
  }
400
414
 
401
- /// @dev costs the inco fee
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
402
423
  function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
403
424
  return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
404
425
  }
@@ -388,17 +388,38 @@ library e {
388
388
  return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
389
389
  }
390
390
 
391
- /// @dev costs the inco fee
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
392
399
  function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
393
400
  return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
394
401
  }
395
402
 
396
- /// @dev costs the inco fee
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
397
411
  function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
398
412
  return inco.newEbool{value: inco.getFee()}(ciphertext, user);
399
413
  }
400
414
 
401
- /// @dev costs the inco fee
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
402
423
  function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
403
424
  return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
404
425
  }
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(0x3473820DcAa71Af8157b93C7f2bf1c676A2A39A6);
11
+ IncoLightning constant inco = IncoLightning(0x28676Cd3b10b03b2FDF105Ba280425b45a674F2A);
12
12
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
13
13
 
14
14
  function typeOf(bytes32 handle) pure returns (ETypes) {
@@ -388,17 +388,38 @@ library e {
388
388
  return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
389
389
  }
390
390
 
391
- /// @dev costs the inco fee
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
392
399
  function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
393
400
  return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
394
401
  }
395
402
 
396
- /// @dev costs the inco fee
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
397
411
  function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
398
412
  return inco.newEbool{value: inco.getFee()}(ciphertext, user);
399
413
  }
400
414
 
401
- /// @dev costs the inco fee
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
402
423
  function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
403
424
  return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
404
425
  }