@inco/lightning 0.8.0-devnet-6 → 0.8.0-devnet-8

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 (31) hide show
  1. package/package.json +4 -3
  2. package/src/IncoLightning.sol +13 -0
  3. package/src/Lib.alphanet.sol +21 -0
  4. package/src/Lib.demonet.sol +21 -0
  5. package/src/Lib.devnet.sol +21 -0
  6. package/src/Lib.sol +21 -0
  7. package/src/Lib.template.sol +23 -0
  8. package/src/Lib.testnet.sol +21 -0
  9. package/src/interfaces/IIncoLightning.sol +4 -0
  10. package/src/libs/incoLightning_alphanet_v0_297966649.sol +21 -0
  11. package/src/libs/incoLightning_alphanet_v1_725458969.sol +21 -0
  12. package/src/libs/incoLightning_alphanet_v2_976644394.sol +21 -0
  13. package/src/libs/incoLightning_demonet_v0_863421733.sol +21 -0
  14. package/src/libs/incoLightning_demonet_v2_467437523.sol +21 -0
  15. package/src/libs/incoLightning_devnet_v0_340846814.sol +21 -0
  16. package/src/libs/incoLightning_devnet_v1_904635675.sol +21 -0
  17. package/src/libs/incoLightning_devnet_v2_295237520.sol +21 -0
  18. package/src/libs/incoLightning_devnet_v3_976859633.sol +21 -0
  19. package/src/libs/incoLightning_devnet_v4_409204766.sol +21 -0
  20. package/src/libs/incoLightning_testnet_v0_183408998.sol +21 -0
  21. package/src/libs/incoLightning_testnet_v2_889158349.sol +21 -0
  22. package/src/lightning-parts/EncryptedInput.sol +60 -5
  23. package/src/lightning-parts/TEELifecycle.sol +36 -28
  24. package/src/lightning-parts/interfaces/IEncryptedInput.sol +6 -0
  25. package/src/lightning-parts/primitives/HandleGeneration.sol +2 -2
  26. package/src/lightning-parts/primitives/test/SignatureVerifier.t.sol +1 -1
  27. package/src/lightning-parts/test/HandleMetadata.t.sol +59 -9
  28. package/src/test/FakeIncoInfra/FakeIncoInfraBase.sol +3 -3
  29. package/src/test/FakeIncoInfra/MockRemoteAttestation.sol +2 -1
  30. package/src/test/TEELifecycle/TEELifecycleMockTest.t.sol +81 -56
  31. package/src/test/TestDeploy.t.sol +28 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inco/lightning",
3
- "version": "0.8.0-devnet-6",
3
+ "version": "0.8.0-devnet-8",
4
4
  "repository": "https://github.com/Inco-fhevm/inco-monorepo",
5
5
  "files": [
6
6
  "src/",
@@ -14,7 +14,7 @@
14
14
  "generate": "bun run generate:libraries",
15
15
  "generate:libraries": "bun run ../pega/lib/deployment/cmd/generate-libraries.ts",
16
16
  "publish:github": "bun publish --registry=https://npm.pkg.github.com",
17
- "publish:npm": "bun publish --access public"
17
+ "publish:npm": "npm publish --tag ${NPM_DIST_TAG:-alpha} --access public"
18
18
  },
19
19
  "dependencies": {
20
20
  "@inco/shared": "^0.1.0",
@@ -30,6 +30,7 @@
30
30
  "lcov-badge2": "^1.1.2"
31
31
  },
32
32
  "publishConfig": {
33
- "registry": "https://npm.pkg.github.com"
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.org/"
34
35
  }
35
36
  }
@@ -54,6 +54,7 @@ contract IncoLightning is
54
54
  /// @param owner The address that will own this contract and can authorize upgrades
55
55
  function initialize(address owner) public initializer {
56
56
  __Ownable_init(owner);
57
+ _setAcceptedVersion(2, true);
57
58
  }
58
59
 
59
60
  /// @notice Withdraws accumulated protocol fees to the owner
@@ -63,6 +64,18 @@ contract IncoLightning is
63
64
  _withdrawFeesTo(owner());
64
65
  }
65
66
 
67
+ /// @notice Adds a version to the accepted input versions whitelist.
68
+ /// @param version The version number to accept (must be non-negative).
69
+ function addAcceptedVersion(uint16 version) external onlyOwner {
70
+ _setAcceptedVersion(version, true);
71
+ }
72
+
73
+ /// @notice Removes a version from the accepted input versions whitelist.
74
+ /// @param version The version number to remove.
75
+ function removeAcceptedVersion(uint16 version) external onlyOwner {
76
+ _setAcceptedVersion(version, false);
77
+ }
78
+
66
79
  /// @notice Required for CreateX deterministic deployment
67
80
  /// @dev Empty fallback allows the contract to be deployed via CreateX's create2 mechanism
68
81
  fallback() external {}
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "./IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
10
+ import { DecryptionAttestation } from "./lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0xc0d693DeEF0A91CE39208676b6da09B822abd199);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "./IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
10
+ import { DecryptionAttestation } from "./lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0xA95EAbCE575f5f1e52605358Ee893F6536166378);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "./IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
10
+ import { DecryptionAttestation } from "./lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x4046b737B454b0430FBF29cea070e3337AdE95aD);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
package/src/Lib.sol CHANGED
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "./IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
10
+ import { DecryptionAttestation } from "./lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x4046b737B454b0430FBF29cea070e3337AdE95aD);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -4,6 +4,7 @@ pragma solidity ^0.8;
4
4
 
5
5
  import {IncoLightning} from "./IncoLightning.sol";
6
6
  import {ebool, euint256, eaddress, ETypes} from "./Types.sol";
7
+ import {DecryptionAttestation} from "./lightning-parts/DecryptionAttester.types.sol";
7
8
 
8
9
  // forge-lint: disable-next-line(screaming-snake-case-const)
9
10
  IncoLightning constant inco = IncoLightning(0x000000000000000000000000000000000000baBe);
@@ -822,6 +823,28 @@ library e {
822
823
  inco.reveal(eaddress.unwrap(a));
823
824
  }
824
825
 
826
+ /// @notice Verifies a decryption attestation for a euint256
827
+ /// @param handle The encrypted handle
828
+ /// @param value The claimed decrypted value
829
+ /// @param signatures The covalidator signatures
830
+ /// @return True if the attestation is valid
831
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
832
+ DecryptionAttestation memory attestation =
833
+ DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation =
844
+ DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
845
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
846
+ }
847
+
825
848
  /// @notice Allows this contract to access an encrypted uint256
826
849
  /// @param a The encrypted uint256
827
850
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "./IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "./Types.sol";
10
+ import { DecryptionAttestation } from "./lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x168FDc3Ae19A5d5b03614578C58974FF30FCBe92);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -21,4 +21,8 @@ interface IIncoLightning is
21
21
 
22
22
  function withdrawFees() external;
23
23
 
24
+ function addAcceptedVersion(uint16 version) external;
25
+
26
+ function removeAcceptedVersion(uint16 version) external;
27
+
24
28
  }
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x4651DfD7729aE5568092E7351fAaD872266d4CBd);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x28676Cd3b10b03b2FDF105Ba280425b45a674F2A);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0xc0d693DeEF0A91CE39208676b6da09B822abd199);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0xeBAFF6D578733E4603b99CBdbb221482F29a78E1);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0xA95EAbCE575f5f1e52605358Ee893F6536166378);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x3B22be60Ae699933959CA3cE147C96caa88Ccd3D);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x3473820DcAa71Af8157b93C7f2bf1c676A2A39A6);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0xC64BB070D6F5aa796e79fA19c1008647ffF736ED);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x4732520194584a04Cac0224e067658619F4086bD);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {
@@ -7,6 +7,7 @@ pragma solidity ^0.8;
7
7
 
8
8
  import { IncoLightning } from "../IncoLightning.sol";
9
9
  import { ebool, euint256, eaddress, ETypes } from "../Types.sol";
10
+ import { DecryptionAttestation } from "../lightning-parts/DecryptionAttester.types.sol";
10
11
 
11
12
  IncoLightning constant inco = IncoLightning(0x4046b737B454b0430FBF29cea070e3337AdE95aD);
12
13
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
@@ -823,6 +824,26 @@ library e {
823
824
  inco.reveal(eaddress.unwrap(a));
824
825
  }
825
826
 
827
+ /// @notice Verifies a decryption attestation for a euint256
828
+ /// @param handle The encrypted handle
829
+ /// @param value The claimed decrypted value
830
+ /// @param signatures The covalidator signatures
831
+ /// @return True if the attestation is valid
832
+ function verifyDecryption(euint256 handle, uint256 value, bytes[] memory signatures) internal view returns (bool) {
833
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: euint256.unwrap(handle), value: bytes32(value)});
834
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
835
+ }
836
+
837
+ /// @notice Verifies a decryption attestation for an ebool
838
+ /// @param handle The encrypted handle
839
+ /// @param value The claimed decrypted value
840
+ /// @param signatures The covalidator signatures
841
+ /// @return True if the attestation is valid
842
+ function verifyDecryption(ebool handle, bool value, bytes[] memory signatures) internal view returns (bool) {
843
+ DecryptionAttestation memory attestation = DecryptionAttestation({handle: ebool.unwrap(handle), value: value ? bytes32(uint256(1)) : bytes32(0)});
844
+ return inco.incoVerifier().isValidDecryptionAttestation(attestation, signatures);
845
+ }
846
+
826
847
  /// @notice Allows this contract to access an encrypted uint256
827
848
  /// @param a The encrypted uint256
828
849
  function allowThis(euint256 a) internal {