@inco/lightning 0.10.0-devnet-2 → 0.11.0-demonet-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.
Files changed (45) hide show
  1. package/manifest.yaml +46 -0
  2. package/package.json +1 -1
  3. package/src/IncoLightning.sol +1 -3
  4. package/src/IncoVerifier.sol +1 -3
  5. package/src/Lib.alphanet.sol +19 -0
  6. package/src/Lib.demonet.sol +20 -1
  7. package/src/Lib.devnet.sol +19 -0
  8. package/src/Lib.sol +20 -1
  9. package/src/Lib.template.sol +19 -0
  10. package/src/Lib.testnet.sol +20 -1
  11. package/src/Types.sol +0 -1
  12. package/src/interfaces/automata-interfaces/IPCCSRouterExtended.sol +2 -0
  13. package/src/libs/incoLightning_alphanet_v0_297966649.sol +19 -0
  14. package/src/libs/incoLightning_alphanet_v1_725458969.sol +19 -0
  15. package/src/libs/incoLightning_alphanet_v2_976644394.sol +19 -0
  16. package/src/libs/incoLightning_demonet_v0_863421733.sol +19 -0
  17. package/src/libs/incoLightning_demonet_v11_473256067.sol +1242 -0
  18. package/src/libs/incoLightning_demonet_v2_467437523.sol +19 -0
  19. package/src/libs/incoLightning_devnet_v0_340846814.sol +19 -0
  20. package/src/libs/incoLightning_devnet_v10_266391127.sol +19 -0
  21. package/src/libs/incoLightning_devnet_v1_904635675.sol +19 -0
  22. package/src/libs/incoLightning_devnet_v2_295237520.sol +19 -0
  23. package/src/libs/incoLightning_devnet_v3_976859633.sol +19 -0
  24. package/src/libs/incoLightning_devnet_v4_409204766.sol +19 -0
  25. package/src/libs/incoLightning_devnet_v5_203964628.sol +19 -0
  26. package/src/libs/incoLightning_devnet_v6_281949651.sol +19 -0
  27. package/src/libs/incoLightning_devnet_v7_24560427.sol +19 -0
  28. package/src/libs/incoLightning_devnet_v8_985328058.sol +19 -0
  29. package/src/libs/incoLightning_devnet_v9_269218568.sol +19 -0
  30. package/src/libs/incoLightning_testnet_v0_183408998.sol +19 -0
  31. package/src/libs/incoLightning_testnet_v11_340321378.sol +1242 -0
  32. package/src/libs/incoLightning_testnet_v2_889158349.sol +19 -0
  33. package/src/lightning-parts/AccessControl/AdvancedAccessControl.sol +13 -2
  34. package/src/lightning-parts/AccessControl/AdvancedAccessControl.types.sol +12 -0
  35. package/src/lightning-parts/AccessControl/test/TestAdvancedAccessControl.t.sol +36 -9
  36. package/src/lightning-parts/EncryptedOperations.sol +2 -9
  37. package/src/lightning-parts/primitives/EListHandleMetadata.sol +6 -6
  38. package/src/lightning-parts/primitives/HandleGeneration.sol +3 -10
  39. package/src/lightning-parts/primitives/HandleMetadata.sol +10 -10
  40. package/src/lightning-parts/test/HandleMetadata.t.sol +22 -40
  41. package/src/periphery/SessionVerifier.sol +16 -14
  42. package/src/test/IncoTest.sol +19 -3
  43. package/src/test/TestLib.t.sol +65 -13
  44. package/src/test/TestUpgrade.t.sol +1 -1
  45. package/src/version/IncoLightningConfig.sol +2 -2
@@ -12,6 +12,7 @@ import {FakeQuoteVerifier} from "./FakeIncoInfra/FakeQuoteVerifier.sol";
12
12
  import {IOwnable} from "../../src/shared/IOwnable.sol";
13
13
  import {MockRemoteAttestation} from "./FakeIncoInfra/MockRemoteAttestation.sol";
14
14
  import {BootstrapResult} from "../lightning-parts/TEELifecycle.types.sol";
15
+ import {AllowanceProof, AllowanceVoucher} from "../lightning-parts/AccessControl/AdvancedAccessControl.sol";
15
16
  import {Safe} from "safe-smart-account/Safe.sol";
16
17
  import {SafeProxyFactory} from "safe-smart-account/proxies/SafeProxyFactory.sol";
17
18
 
@@ -60,9 +61,8 @@ contract IncoTest is MockOpHandler, DeployUtils, FakeDecryptionAttester, MockRem
60
61
  (IIncoLightning proxy,) = deployIncoLightningUsingConfig({
61
62
  deployer: testDeployer,
62
63
  owner: owner,
63
- // The highest precedent deployment
64
- // 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
65
- pepper: "devnet",
64
+ // The highest precedent deployment pepper
65
+ pepper: "testnet",
66
66
  quoteVerifier: new FakeQuoteVerifier()
67
67
  });
68
68
  vm.stopPrank();
@@ -83,4 +83,20 @@ contract IncoTest is MockOpHandler, DeployUtils, FakeDecryptionAttester, MockRem
83
83
  vm.recordLogs();
84
84
  }
85
85
 
86
+ /// @dev Creates an empty AllowanceProof (no proof required when sharer is address(0))
87
+ function _emptyAllowanceProof() internal pure returns (AllowanceProof memory) {
88
+ return AllowanceProof({
89
+ sharer: address(0),
90
+ voucher: AllowanceVoucher({
91
+ sessionNonce: bytes32(0),
92
+ verifyingContract: address(0),
93
+ callFunction: bytes4(0),
94
+ sharerArgData: "",
95
+ warning: ""
96
+ }),
97
+ voucherSignature: "",
98
+ requesterArgData: ""
99
+ });
100
+ }
101
+
86
102
  }
@@ -18,7 +18,6 @@ import {
18
18
  } from "../Types.sol";
19
19
  import {EncryptedOperations} from "../lightning-parts/EncryptedOperations.sol";
20
20
  import {DecryptionAttestation, ElementAttestationWithProof} from "../lightning-parts/DecryptionAttester.types.sol";
21
- import {AllowanceProof, AllowanceVoucher} from "../lightning-parts/AccessControl/AdvancedAccessControl.sol";
22
21
 
23
22
  /// @notice Wrapper to expose internal requireEqual as an external call so vm.expectRevert works
24
23
  contract RequireEqualCaller {
@@ -644,6 +643,27 @@ contract TestLib is IncoTest {
644
643
  assertTrue(inco.persistAllowed(eaddress.unwrap(a), address(this)));
645
644
  }
646
645
 
646
+ function testAllowElist() public {
647
+ elist list = _listRange(0, 3, ETypes.Uint256);
648
+ assertFalse(inco.persistAllowed(elist.unwrap(list), alice));
649
+ e.allow(list, alice);
650
+ assertTrue(inco.persistAllowed(elist.unwrap(list), alice));
651
+ }
652
+
653
+ function testRevealElist() public {
654
+ elist list = _listRange(0, 3, ETypes.Uint256);
655
+ assertFalse(inco.isRevealed(elist.unwrap(list)));
656
+ e.reveal(list);
657
+ assertTrue(inco.isRevealed(elist.unwrap(list)));
658
+ }
659
+
660
+ function testAllowThisElist() public {
661
+ elist list = _listRange(0, 3, ETypes.Uint256);
662
+ assertFalse(inco.persistAllowed(elist.unwrap(list), address(this)));
663
+ e.allowThis(list);
664
+ assertTrue(inco.persistAllowed(elist.unwrap(list), address(this)));
665
+ }
666
+
647
667
  function testIsAllowed() public {
648
668
  euint256 a = e.asEuint256(42);
649
669
  processAllOperations();
@@ -937,18 +957,6 @@ contract TestLib is IncoTest {
937
957
  assertFalse(isValid, "Invalid bool value should return false");
938
958
  }
939
959
 
940
- /// @dev Creates an empty AllowanceProof (no proof required when sharer is address(0))
941
- function _emptyAllowanceProof() internal pure returns (AllowanceProof memory) {
942
- return AllowanceProof({
943
- sharer: address(0),
944
- voucher: AllowanceVoucher({
945
- sessionNonce: bytes32(0), verifyingContract: address(0), callFunction: bytes4(0), sharerArgData: ""
946
- }),
947
- voucherSignature: "",
948
- requesterArgData: ""
949
- });
950
- }
951
-
952
960
  // ============ REQUIRE EQUAL TESTS ============
953
961
 
954
962
  function testRequireEqual_Ebool_ValidAttestation_True() public {
@@ -1558,6 +1566,36 @@ contract TestLib is IncoTest {
1558
1566
  assertFalse(result, "Empty proof should fail verification");
1559
1567
  }
1560
1568
 
1569
+ // ============ ELIST ALLOW / REVEAL / ALLOWTHIS WRAPPER TESTS ============
1570
+
1571
+ function testEListWrapper_Allow() public {
1572
+ _setupEListHelper();
1573
+ elist list = elistHelper.callRange(0, 3);
1574
+
1575
+ assertFalse(inco.persistAllowed(elist.unwrap(list), alice));
1576
+ elistHelper.callAllowElist(list, alice);
1577
+ assertTrue(inco.persistAllowed(elist.unwrap(list), alice));
1578
+ }
1579
+
1580
+ function testEListWrapper_Reveal() public {
1581
+ _setupEListHelper();
1582
+ elist list = elistHelper.callRange(0, 3);
1583
+
1584
+ assertFalse(inco.isRevealed(elist.unwrap(list)));
1585
+ elistHelper.callRevealElist(list);
1586
+ assertTrue(inco.isRevealed(elist.unwrap(list)));
1587
+ }
1588
+
1589
+ function testEListWrapper_AllowThis() public {
1590
+ _setupEListHelper();
1591
+ // elistHelper must create the list so it has transient access, which is required to call allow
1592
+ elist list = elistHelper.callRange(0, 3);
1593
+
1594
+ assertFalse(inco.persistAllowed(elist.unwrap(list), address(elistHelper)));
1595
+ elistHelper.callAllowThisElist(list);
1596
+ assertTrue(inco.persistAllowed(elist.unwrap(list), address(elistHelper)));
1597
+ }
1598
+
1561
1599
  }
1562
1600
 
1563
1601
  /// @notice Helper contract for testing msg.sender variants
@@ -1758,4 +1796,18 @@ contract LibEListHelper {
1758
1796
  return e.verifyEListDecryption(elistHandle, proofElements, proof, signatures);
1759
1797
  }
1760
1798
 
1799
+ // ============ allow / reveal / allowThis wrappers ============
1800
+
1801
+ function callAllowElist(elist list, address to) external {
1802
+ e.allow(list, to);
1803
+ }
1804
+
1805
+ function callRevealElist(elist list) external {
1806
+ e.reveal(list);
1807
+ }
1808
+
1809
+ function callAllowThisElist(elist list) external {
1810
+ e.allowThis(list);
1811
+ }
1812
+
1761
1813
  }
@@ -277,7 +277,7 @@ contract TestUpgrade is IncoTest {
277
277
 
278
278
  // Helpers
279
279
  function _deploySessionVerifierProxy(address proxyOwner) private returns (SessionVerifier) {
280
- SessionVerifier impl = new SessionVerifier("");
280
+ SessionVerifier impl = new SessionVerifier(bytes32(0));
281
281
  ERC1967Proxy proxy = new ERC1967Proxy(address(impl), abi.encodeCall(SessionVerifier.initialize, (proxyOwner)));
282
282
  return SessionVerifier(address(proxy));
283
283
  }
@@ -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;
10
+ uint8 constant MAJOR_VERSION = 11;
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 = 1;
16
+ uint8 constant PATCH_VERSION = 2;
17
17
 
18
18
  string constant VERIFIER_NAME = "incoVerifier";