@inco/lightning 0.10.0-devnet-3 → 0.11.0-demonet-2
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 +46 -0
- package/package.json +1 -1
- package/src/IncoLightning.sol +1 -3
- package/src/IncoVerifier.sol +1 -3
- package/src/Lib.alphanet.sol +19 -0
- package/src/Lib.demonet.sol +20 -1
- package/src/Lib.devnet.sol +19 -0
- package/src/Lib.sol +20 -1
- package/src/Lib.template.sol +19 -0
- package/src/Lib.testnet.sol +20 -1
- package/src/Types.sol +0 -1
- package/src/interfaces/automata-interfaces/IPCCSRouterExtended.sol +2 -0
- package/src/libs/incoLightning_alphanet_v0_297966649.sol +19 -0
- package/src/libs/incoLightning_alphanet_v1_725458969.sol +19 -0
- package/src/libs/incoLightning_alphanet_v2_976644394.sol +19 -0
- package/src/libs/incoLightning_demonet_v0_863421733.sol +19 -0
- package/src/libs/incoLightning_demonet_v11_473256067.sol +1242 -0
- package/src/libs/incoLightning_demonet_v2_467437523.sol +19 -0
- package/src/libs/incoLightning_devnet_v0_340846814.sol +19 -0
- package/src/libs/incoLightning_devnet_v10_266391127.sol +19 -0
- package/src/libs/incoLightning_devnet_v1_904635675.sol +19 -0
- package/src/libs/incoLightning_devnet_v2_295237520.sol +19 -0
- package/src/libs/incoLightning_devnet_v3_976859633.sol +19 -0
- package/src/libs/incoLightning_devnet_v4_409204766.sol +19 -0
- package/src/libs/incoLightning_devnet_v5_203964628.sol +19 -0
- package/src/libs/incoLightning_devnet_v6_281949651.sol +19 -0
- package/src/libs/incoLightning_devnet_v7_24560427.sol +19 -0
- package/src/libs/incoLightning_devnet_v8_985328058.sol +19 -0
- package/src/libs/incoLightning_devnet_v9_269218568.sol +19 -0
- package/src/libs/incoLightning_testnet_v0_183408998.sol +19 -0
- package/src/libs/incoLightning_testnet_v11_340321378.sol +1242 -0
- package/src/libs/incoLightning_testnet_v2_889158349.sol +19 -0
- package/src/lightning-parts/AccessControl/AdvancedAccessControl.sol +13 -2
- package/src/lightning-parts/AccessControl/AdvancedAccessControl.types.sol +12 -0
- package/src/lightning-parts/AccessControl/test/TestAdvancedAccessControl.t.sol +36 -9
- package/src/lightning-parts/EncryptedOperations.sol +2 -9
- package/src/lightning-parts/primitives/EListHandleMetadata.sol +6 -6
- package/src/lightning-parts/primitives/HandleGeneration.sol +3 -10
- package/src/lightning-parts/primitives/HandleMetadata.sol +10 -10
- package/src/lightning-parts/test/HandleMetadata.t.sol +22 -40
- package/src/periphery/SessionVerifier.sol +16 -14
- package/src/test/IncoTest.sol +19 -3
- package/src/test/TestLib.t.sol +65 -13
- package/src/test/TestUpgrade.t.sol +1 -1
- package/src/version/IncoLightningConfig.sol +2 -2
package/src/test/IncoTest.sol
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|
package/src/test/TestLib.t.sol
CHANGED
|
@@ -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
|
+
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 =
|
|
16
|
+
uint8 constant PATCH_VERSION = 2;
|
|
17
17
|
|
|
18
18
|
string constant VERIFIER_NAME = "incoVerifier";
|