@coti-io/coti-contracts 0.1.0 → 1.0.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/.github/workflows/npm-publish.yml +2 -1
- package/CONTRIBUTING.md +2 -2
- package/LICENSE +1 -1
- package/README.md +18 -35
- package/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc.sol +3 -115
- package/contracts/mocks/README.md +1 -1
- package/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol +257 -280
- package/contracts/mocks/utils/mpc/BitwiseTestsContract.sol +93 -187
- package/contracts/mocks/utils/mpc/{Comparison1Tests.Contract.sol → Comparison1TestsContract.sol} +67 -115
- package/contracts/mocks/utils/mpc/Comparison2TestsContract.sol +76 -116
- package/contracts/mocks/utils/mpc/MinMaxTestsContract.sol +69 -164
- package/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.sol +103 -56
- package/contracts/mocks/utils/mpc/MiscellaneousTestsContract.sol +270 -0
- package/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract.sol +127 -0
- package/contracts/mocks/utils/mpc/README.md +12 -12
- package/contracts/mocks/utils/mpc/TransferScalarTestsContract.sol +54 -211
- package/contracts/mocks/utils/mpc/TransferTestsContract.sol +165 -640
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract.sol +222 -0
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract.sol +222 -0
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol +223 -0
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract.sol +222 -0
- package/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract.sol +265 -0
- package/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol +281 -0
- package/contracts/onboard/AccountOnboard.sol +3 -3
- package/contracts/token/PrivateERC20/PrivateERC20.sol +1 -1
- package/contracts/token/PrivateERC721/IERC721Errors.sol +57 -0
- package/contracts/token/PrivateERC721/PrivateERC721.sol +1 -1
- package/contracts/utils/mpc/MpcCore.sol +2835 -988
- package/contracts/utils/mpc/MpcInterface.sol +6 -4
- package/hardhat.config.ts +17 -6
- package/package.json +20 -4
- package/test/token/PrivateERC20/PrivateERC20.test.ts +2 -2
- package/test/utils/accounts.ts +1 -1
- package/test/utils/mpc/Precompile.test.ts +42 -39
- package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/ArithmeticTestsContract.ts +374 -0
- package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/PrecompilesArythmeticTestsContract.ts +374 -0
- package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/index.ts +5 -0
- package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.ts +96 -10
- package/typechain-types/contracts/mocks/utils/mpc/BitwiseTestsContract.ts +45 -5
- package/typechain-types/contracts/mocks/utils/mpc/Comparison1TestsContract.ts +374 -0
- package/typechain-types/contracts/mocks/utils/mpc/Comparison2TestsContract.ts +45 -5
- package/typechain-types/contracts/mocks/utils/mpc/MinMaxTestsContract.ts +25 -5
- package/typechain-types/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.ts +62 -0
- package/typechain-types/contracts/mocks/utils/mpc/MiscellaneousTestsContract.ts +396 -0
- package/typechain-types/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract.ts +251 -0
- package/typechain-types/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/OffboardToUserKeyTestContract.ts +11 -8
- package/typechain-types/contracts/mocks/utils/mpc/TransferScalarTestsContract.ts +15 -15
- package/typechain-types/contracts/mocks/utils/mpc/TransferTestsContract.ts +15 -15
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.sol/TransferWithAllowance64TestsContract.ts +251 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.sol/TransferWithAllowanceTestsContract.ts +250 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.sol/index.ts +5 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.ts +389 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract.ts +391 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract.ts +391 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol/TransferWithAllowance64_64TestsContract.ts +391 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol/TransferWithAllowance64_8TestsContract.ts +391 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol/index.ts +5 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.ts +391 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract.ts +391 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract.ts +306 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol/TransferTestsContract.ts +125 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol/TransferWithAllowanceTestsContract.ts +125 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol/index.ts +5 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.ts +296 -0
- package/typechain-types/contracts/mocks/utils/mpc/index.ts +9 -6
- package/typechain-types/contracts/onboard/AccountOnboard.ts +9 -4
- package/typechain-types/contracts/token/PrivateERC721/IERC721Errors.ts +69 -0
- package/typechain-types/contracts/token/PrivateERC721/index.ts +1 -0
- package/typechain-types/contracts/utils/mpc/MpcCore.ts +84 -0
- package/typechain-types/contracts/utils/mpc/MpcInterface.sol/ExtendedOperations.ts +81 -40
- package/typechain-types/contracts/utils/mpc/index.ts +1 -0
- package/typechain-types/factories/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20Mock__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/ArithmeticTestsContract__factory.ts +387 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/PrecompilesArythmeticTestsContract__factory.ts +388 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/index.ts +5 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract__factory.ts +92 -7
- package/typechain-types/factories/contracts/mocks/utils/mpc/BitwiseTestsContract__factory.ts +38 -2
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol/Comparison1TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1TestsContract__factory.ts +387 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison2TestsContract__factory.ts +38 -2
- package/typechain-types/factories/contracts/mocks/utils/mpc/MinMaxTestsContract__factory.ts +15 -2
- package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous1TestsContract__factory.ts +66 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous2TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MiscellaneousTestsContract__factory.ts +424 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract__factory.ts +285 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/OffboardToUserKeyTestContract__factory.ts +19 -3
- package/typechain-types/factories/contracts/mocks/utils/mpc/ShiftTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/StringTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferScalarTestsContract__factory.ts +4 -4
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferTestsContract__factory.ts +4 -4
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.sol/TransferWithAllowance64TestsContract__factory.ts +294 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.sol/TransferWithAllowanceTestsContract__factory.ts +292 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract.sol/index.ts +5 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64TestsContract__factory.ts +720 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract__factory.ts +724 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract__factory.ts +724 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol/TransferWithAllowance64_64TestsContract__factory.ts +724 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol/TransferWithAllowance64_8TestsContract__factory.ts +724 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol/index.ts +5 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract__factory.ts +724 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract__factory.ts +724 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract__factory.ts +507 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol/TransferTestsContract__factory.ts +150 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol/TransferWithAllowanceTestsContract__factory.ts +150 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol/index.ts +5 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract__factory.ts +434 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/index.ts +9 -4
- package/typechain-types/factories/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock__factory.ts +1 -1
- package/typechain-types/factories/contracts/onboard/AccountOnboard__factory.ts +8 -2
- package/typechain-types/factories/contracts/token/PrivateERC721/IERC721Errors__factory.ts +128 -0
- package/typechain-types/factories/contracts/token/PrivateERC721/index.ts +1 -0
- package/typechain-types/factories/contracts/utils/mpc/MpcCore__factory.ts +77 -0
- package/typechain-types/factories/contracts/utils/mpc/MpcInterface.sol/ExtendedOperations__factory.ts +124 -61
- package/typechain-types/factories/contracts/utils/mpc/index.ts +1 -0
- package/typechain-types/hardhat.d.ts +152 -26
- package/typechain-types/index.ts +20 -8
- package/contracts/access/DataPrivacyFramework/README.md +0 -68
- package/contracts/mocks/utils/mpc/Miscellaneous2TestsContract.sol +0 -448
- package/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol +0 -81
- package/contracts/mocks/utils/mpc/ShiftTestsContract.sol +0 -311
- package/contracts/token/PrivateERC20/README.md +0 -104
- package/contracts/token/PrivateERC721/README.md +0 -282
- package/contracts/utils/mpc/README.md +0 -82
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
2
|
pragma solidity ^0.8.19;
|
|
4
3
|
|
|
5
4
|
import "../../../utils/mpc/MpcCore.sol";
|
|
6
5
|
|
|
7
6
|
contract Comparison2TestsContract {
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
struct AllGTCastingValues {
|
|
9
|
+
gtBool aBool_s;
|
|
10
|
+
gtBool bBool_s;
|
|
10
11
|
gtUint8 a8_s;
|
|
11
12
|
gtUint8 b8_s;
|
|
12
13
|
gtUint16 a16_s;
|
|
@@ -41,74 +42,67 @@ contract Comparison2TestsContract {
|
|
|
41
42
|
gtBool res64_32;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
function setPublicValues(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
uint8 b
|
|
48
|
-
) public {
|
|
45
|
+
function setPublicValues(AllGTCastingValues memory castingValues, uint8 a, uint8 b) public{
|
|
46
|
+
castingValues.aBool_s = MpcCore.setPublic(a > b);
|
|
47
|
+
castingValues.bBool_s = MpcCore.setPublic(b > a);
|
|
49
48
|
castingValues.a8_s = MpcCore.setPublic8(a);
|
|
50
49
|
castingValues.b8_s = MpcCore.setPublic8(b);
|
|
51
|
-
castingValues.a16_s =
|
|
52
|
-
castingValues.b16_s =
|
|
53
|
-
castingValues.a32_s =
|
|
54
|
-
castingValues.b32_s =
|
|
55
|
-
castingValues.a64_s =
|
|
56
|
-
castingValues.b64_s =
|
|
50
|
+
castingValues.a16_s = MpcCore.setPublic16(a);
|
|
51
|
+
castingValues.b16_s = MpcCore.setPublic16(b);
|
|
52
|
+
castingValues.a32_s = MpcCore.setPublic32(a);
|
|
53
|
+
castingValues.b32_s = MpcCore.setPublic32(b);
|
|
54
|
+
castingValues.a64_s = MpcCore.setPublic64(a);
|
|
55
|
+
castingValues.b64_s = MpcCore.setPublic64(b);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
bool
|
|
58
|
+
bool eqResult;
|
|
59
|
+
bool neResult;
|
|
60
|
+
bool geResult;
|
|
60
61
|
|
|
61
|
-
function
|
|
62
|
-
return
|
|
62
|
+
function getEqResult() public view returns (bool) {
|
|
63
|
+
return eqResult;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getNeResult() public view returns (bool) {
|
|
67
|
+
return neResult;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getGeResult() public view returns (bool) {
|
|
71
|
+
return geResult;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
function decryptAndCompareResults16(
|
|
66
|
-
|
|
67
|
-
) public returns (bool) {
|
|
74
|
+
function decryptAndCompareResults16(Check16 memory check16) public returns (bool){
|
|
75
|
+
|
|
68
76
|
// Calculate the result
|
|
69
77
|
bool result = MpcCore.decrypt(check16.res16_16);
|
|
70
78
|
|
|
71
|
-
require(
|
|
72
|
-
|
|
73
|
-
result == MpcCore.decrypt(check16.res16_8),
|
|
74
|
-
"decryptAndCompareAllResults: Failed to decrypt and compare all results"
|
|
75
|
-
);
|
|
79
|
+
require(result == MpcCore.decrypt(check16.res8_16) && result == MpcCore.decrypt(check16.res16_8),
|
|
80
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
76
81
|
|
|
77
82
|
return result;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
function decryptAndCompareResults32(
|
|
81
|
-
|
|
82
|
-
) public returns (bool) {
|
|
85
|
+
function decryptAndCompareResults32(Check32 memory check32) public returns (bool){
|
|
86
|
+
|
|
83
87
|
// Calculate the result
|
|
84
88
|
bool result = MpcCore.decrypt(check32.res32_32);
|
|
85
89
|
|
|
86
|
-
require(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
result == MpcCore.decrypt(check32.res32_16) &&
|
|
90
|
-
result == MpcCore.decrypt(check32.res16_32),
|
|
91
|
-
"decryptAndCompareAllResults: Failed to decrypt and compare all results"
|
|
92
|
-
);
|
|
90
|
+
require(result == MpcCore.decrypt(check32.res8_32) && result == MpcCore.decrypt(check32.res32_8)
|
|
91
|
+
&& result == MpcCore.decrypt(check32.res32_16) && result == MpcCore.decrypt(check32.res16_32),
|
|
92
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
93
93
|
|
|
94
94
|
return result;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function decryptAndCompareResults64(
|
|
98
|
-
|
|
99
|
-
) public returns (bool) {
|
|
97
|
+
function decryptAndCompareResults64(Check64 memory check64) public returns (bool){
|
|
98
|
+
|
|
100
99
|
// Calculate the result
|
|
101
100
|
bool result = MpcCore.decrypt(check64.res64_64);
|
|
102
101
|
|
|
103
|
-
require(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
result == MpcCore.decrypt(check64.res16_64) &&
|
|
108
|
-
result == MpcCore.decrypt(check64.res64_32) &&
|
|
109
|
-
result == MpcCore.decrypt(check64.res32_64),
|
|
110
|
-
"decryptAndCompareAllResults: Failed to decrypt and compare all results"
|
|
111
|
-
);
|
|
102
|
+
require(result == MpcCore.decrypt(check64.res8_64) && result == MpcCore.decrypt(check64.res64_8)
|
|
103
|
+
&& result == MpcCore.decrypt(check64.res64_16) && result == MpcCore.decrypt(check64.res16_64)
|
|
104
|
+
&& result == MpcCore.decrypt(check64.res64_32) && result == MpcCore.decrypt(check64.res32_64),
|
|
105
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
112
106
|
|
|
113
107
|
return result;
|
|
114
108
|
}
|
|
@@ -120,10 +114,11 @@ contract Comparison2TestsContract {
|
|
|
120
114
|
Check64 memory check64;
|
|
121
115
|
setPublicValues(castingValues, a, b);
|
|
122
116
|
|
|
117
|
+
MpcCore.decrypt(MpcCore.eq(castingValues.aBool_s, castingValues.bBool_s));
|
|
118
|
+
|
|
123
119
|
// Calculate the expected result
|
|
124
|
-
result =
|
|
125
|
-
|
|
126
|
-
);
|
|
120
|
+
bool result = MpcCore.decrypt(MpcCore.eq(castingValues.a8_s, castingValues.b8_s));
|
|
121
|
+
eqResult = result;
|
|
127
122
|
|
|
128
123
|
// Calculate the results with casting to 16
|
|
129
124
|
check16.res16_16 = MpcCore.eq(castingValues.a16_s, castingValues.b16_s);
|
|
@@ -153,26 +148,14 @@ contract Comparison2TestsContract {
|
|
|
153
148
|
require(result == res64, "eqTest: cast 64 failed");
|
|
154
149
|
|
|
155
150
|
// Check the result with scalar
|
|
156
|
-
require(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"eqTest: test
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"eqTest: test 16 bits with scalar failed"
|
|
165
|
-
);
|
|
166
|
-
require(
|
|
167
|
-
result == MpcCore.decrypt(MpcCore.eq(a, castingValues.b32_s)) &&
|
|
168
|
-
result == MpcCore.decrypt(MpcCore.eq(castingValues.a32_s, b)),
|
|
169
|
-
"eqTest: test 32 bits with scalar failed"
|
|
170
|
-
);
|
|
171
|
-
require(
|
|
172
|
-
result == MpcCore.decrypt(MpcCore.eq(a, castingValues.b64_s)) &&
|
|
173
|
-
result == MpcCore.decrypt(MpcCore.eq(castingValues.a64_s, b)),
|
|
174
|
-
"eqTest: test 64 bits with scalar failed"
|
|
175
|
-
);
|
|
151
|
+
require(result == MpcCore.decrypt(MpcCore.eq(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.eq(castingValues.a8_s, b)),
|
|
152
|
+
"eqTest: test 8 bits with scalar failed");
|
|
153
|
+
require(result == MpcCore.decrypt(MpcCore.eq(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.eq(castingValues.a16_s, b)),
|
|
154
|
+
"eqTest: test 16 bits with scalar failed");
|
|
155
|
+
require(result == MpcCore.decrypt(MpcCore.eq(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.eq(castingValues.a32_s, b)),
|
|
156
|
+
"eqTest: test 32 bits with scalar failed");
|
|
157
|
+
require(result == MpcCore.decrypt(MpcCore.eq(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.eq(castingValues.a64_s, b)),
|
|
158
|
+
"eqTest: test 64 bits with scalar failed");
|
|
176
159
|
|
|
177
160
|
return result;
|
|
178
161
|
}
|
|
@@ -184,10 +167,11 @@ contract Comparison2TestsContract {
|
|
|
184
167
|
Check64 memory check64;
|
|
185
168
|
setPublicValues(castingValues, a, b);
|
|
186
169
|
|
|
170
|
+
MpcCore.decrypt(MpcCore.ne(castingValues.aBool_s, castingValues.bBool_s));
|
|
171
|
+
|
|
187
172
|
// Calculate the expected result
|
|
188
|
-
result =
|
|
189
|
-
|
|
190
|
-
);
|
|
173
|
+
bool result = MpcCore.decrypt(MpcCore.ne(castingValues.a8_s, castingValues.b8_s));
|
|
174
|
+
neResult = result;
|
|
191
175
|
|
|
192
176
|
// Calculate the results with casting to 16
|
|
193
177
|
check16.res16_16 = MpcCore.ne(castingValues.a16_s, castingValues.b16_s);
|
|
@@ -217,26 +201,14 @@ contract Comparison2TestsContract {
|
|
|
217
201
|
require(result == res64, "neTest: cast 64 failed");
|
|
218
202
|
|
|
219
203
|
// Check the result with scalar
|
|
220
|
-
require(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"neTest: test
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
"neTest: test 16 bits with scalar failed"
|
|
229
|
-
);
|
|
230
|
-
require(
|
|
231
|
-
result == MpcCore.decrypt(MpcCore.ne(a, castingValues.b32_s)) &&
|
|
232
|
-
result == MpcCore.decrypt(MpcCore.ne(castingValues.a32_s, b)),
|
|
233
|
-
"neTest: test 32 bits with scalar failed"
|
|
234
|
-
);
|
|
235
|
-
require(
|
|
236
|
-
result == MpcCore.decrypt(MpcCore.ne(a, castingValues.b64_s)) &&
|
|
237
|
-
result == MpcCore.decrypt(MpcCore.ne(castingValues.a64_s, b)),
|
|
238
|
-
"neTest: test 64 bits with scalar failed"
|
|
239
|
-
);
|
|
204
|
+
require(result == MpcCore.decrypt(MpcCore.ne(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.ne(castingValues.a8_s, b)),
|
|
205
|
+
"neTest: test 8 bits with scalar failed");
|
|
206
|
+
require(result == MpcCore.decrypt(MpcCore.ne(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.ne(castingValues.a16_s, b)),
|
|
207
|
+
"neTest: test 16 bits with scalar failed");
|
|
208
|
+
require(result == MpcCore.decrypt(MpcCore.ne(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.ne(castingValues.a32_s, b)),
|
|
209
|
+
"neTest: test 32 bits with scalar failed");
|
|
210
|
+
require(result == MpcCore.decrypt(MpcCore.ne(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.ne(castingValues.a64_s, b)),
|
|
211
|
+
"neTest: test 64 bits with scalar failed");
|
|
240
212
|
|
|
241
213
|
return result;
|
|
242
214
|
}
|
|
@@ -249,9 +221,8 @@ contract Comparison2TestsContract {
|
|
|
249
221
|
setPublicValues(castingValues, a, b);
|
|
250
222
|
|
|
251
223
|
// Calculate the expected result
|
|
252
|
-
result =
|
|
253
|
-
|
|
254
|
-
);
|
|
224
|
+
bool result = MpcCore.decrypt(MpcCore.ge(castingValues.a8_s, castingValues.b8_s));
|
|
225
|
+
geResult = result;
|
|
255
226
|
|
|
256
227
|
// Calculate the results with casting to 16
|
|
257
228
|
check16.res16_16 = MpcCore.ge(castingValues.a16_s, castingValues.b16_s);
|
|
@@ -281,27 +252,16 @@ contract Comparison2TestsContract {
|
|
|
281
252
|
require(result == res64, "geTest: cast 64 failed");
|
|
282
253
|
|
|
283
254
|
// Check the result with scalar
|
|
284
|
-
require(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
"geTest: test
|
|
288
|
-
)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
"geTest: test 16 bits with scalar failed"
|
|
293
|
-
);
|
|
294
|
-
require(
|
|
295
|
-
result == MpcCore.decrypt(MpcCore.ge(a, castingValues.b32_s)) &&
|
|
296
|
-
result == MpcCore.decrypt(MpcCore.ge(castingValues.a32_s, b)),
|
|
297
|
-
"geTest: test 32 bits with scalar failed"
|
|
298
|
-
);
|
|
299
|
-
require(
|
|
300
|
-
result == MpcCore.decrypt(MpcCore.ge(a, castingValues.b64_s)) &&
|
|
301
|
-
result == MpcCore.decrypt(MpcCore.ge(castingValues.a64_s, b)),
|
|
302
|
-
"geTest: test 64 bits with scalar failed"
|
|
303
|
-
);
|
|
255
|
+
require(result == MpcCore.decrypt(MpcCore.ge(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.ge(castingValues.a8_s, b)),
|
|
256
|
+
"geTest: test 8 bits with scalar failed");
|
|
257
|
+
require(result == MpcCore.decrypt(MpcCore.ge(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.ge(castingValues.a16_s, b)),
|
|
258
|
+
"geTest: test 16 bits with scalar failed");
|
|
259
|
+
require(result == MpcCore.decrypt(MpcCore.ge(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.ge(castingValues.a32_s, b)),
|
|
260
|
+
"geTest: test 32 bits with scalar failed");
|
|
261
|
+
require(result == MpcCore.decrypt(MpcCore.ge(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.ge(castingValues.a64_s, b)),
|
|
262
|
+
"geTest: test 64 bits with scalar failed");
|
|
304
263
|
|
|
305
264
|
return result;
|
|
306
265
|
}
|
|
307
|
-
|
|
266
|
+
|
|
267
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
2
|
pragma solidity ^0.8.19;
|
|
4
3
|
|
|
5
4
|
import "../../../utils/mpc/MpcCore.sol";
|
|
@@ -41,74 +40,59 @@ contract MinMaxTestsContract {
|
|
|
41
40
|
gtUint64 res64_32;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
function setPublicValues(
|
|
45
|
-
AllGTCastingValues memory castingValues,
|
|
46
|
-
uint8 a,
|
|
47
|
-
uint8 b
|
|
48
|
-
) public {
|
|
43
|
+
function setPublicValues(AllGTCastingValues memory castingValues, uint8 a, uint8 b) public{
|
|
49
44
|
castingValues.a8_s = MpcCore.setPublic8(a);
|
|
50
45
|
castingValues.b8_s = MpcCore.setPublic8(b);
|
|
51
|
-
castingValues.a16_s =
|
|
52
|
-
castingValues.b16_s =
|
|
53
|
-
castingValues.a32_s =
|
|
54
|
-
castingValues.b32_s =
|
|
55
|
-
castingValues.a64_s =
|
|
56
|
-
castingValues.b64_s =
|
|
46
|
+
castingValues.a16_s = MpcCore.setPublic16(a);
|
|
47
|
+
castingValues.b16_s = MpcCore.setPublic16(b);
|
|
48
|
+
castingValues.a32_s = MpcCore.setPublic32(a);
|
|
49
|
+
castingValues.b32_s = MpcCore.setPublic32(b);
|
|
50
|
+
castingValues.a64_s = MpcCore.setPublic64(a);
|
|
51
|
+
castingValues.b64_s = MpcCore.setPublic64(b);
|
|
57
52
|
}
|
|
58
53
|
|
|
59
|
-
uint8
|
|
54
|
+
uint8 minResult;
|
|
55
|
+
uint8 maxResult;
|
|
60
56
|
|
|
61
|
-
function
|
|
62
|
-
return
|
|
57
|
+
function getMinResult() public view returns (uint8) {
|
|
58
|
+
return minResult;
|
|
63
59
|
}
|
|
60
|
+
function getMaxResult() public view returns (uint8) {
|
|
61
|
+
return maxResult;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function decryptAndCompareResults16(Check16 memory check16) public returns (uint16){
|
|
64
65
|
|
|
65
|
-
function decryptAndCompareResults16(
|
|
66
|
-
Check16 memory check16
|
|
67
|
-
) public returns (uint16) {
|
|
68
66
|
// Calculate the result
|
|
69
67
|
uint16 result = MpcCore.decrypt(check16.res16_16);
|
|
70
68
|
|
|
71
|
-
require(
|
|
72
|
-
|
|
73
|
-
result == MpcCore.decrypt(check16.res16_8),
|
|
74
|
-
"decryptAndCompareAllResults: Failed to decrypt and compare all results"
|
|
75
|
-
);
|
|
69
|
+
require(result == MpcCore.decrypt(check16.res8_16) && result == MpcCore.decrypt(check16.res16_8),
|
|
70
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
76
71
|
|
|
77
72
|
return result;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
|
-
function decryptAndCompareResults32(
|
|
81
|
-
|
|
82
|
-
) public returns (uint32) {
|
|
75
|
+
function decryptAndCompareResults32(Check32 memory check32) public returns (uint32){
|
|
76
|
+
|
|
83
77
|
// Calculate the result
|
|
84
78
|
uint32 result = MpcCore.decrypt(check32.res32_32);
|
|
85
79
|
|
|
86
|
-
require(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
result == MpcCore.decrypt(check32.res32_16) &&
|
|
90
|
-
result == MpcCore.decrypt(check32.res16_32),
|
|
91
|
-
"decryptAndCompareAllResults: Failed to decrypt and compare all results"
|
|
92
|
-
);
|
|
80
|
+
require(result == MpcCore.decrypt(check32.res8_32) && result == MpcCore.decrypt(check32.res32_8)
|
|
81
|
+
&& result == MpcCore.decrypt(check32.res32_16) && result == MpcCore.decrypt(check32.res16_32),
|
|
82
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
93
83
|
|
|
94
84
|
return result;
|
|
95
85
|
}
|
|
96
86
|
|
|
97
|
-
function decryptAndCompareResults64(
|
|
98
|
-
|
|
99
|
-
) public returns (uint64) {
|
|
87
|
+
function decryptAndCompareResults64(Check64 memory check64) public returns (uint64){
|
|
88
|
+
|
|
100
89
|
// Calculate the result
|
|
101
90
|
uint64 result = MpcCore.decrypt(check64.res64_64);
|
|
102
91
|
|
|
103
|
-
require(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
result == MpcCore.decrypt(check64.res16_64) &&
|
|
108
|
-
result == MpcCore.decrypt(check64.res64_32) &&
|
|
109
|
-
result == MpcCore.decrypt(check64.res32_64),
|
|
110
|
-
"decryptAndCompareAllResults: Failed to decrypt and compare all results"
|
|
111
|
-
);
|
|
92
|
+
require(result == MpcCore.decrypt(check64.res8_64) && result == MpcCore.decrypt(check64.res64_8)
|
|
93
|
+
&& result == MpcCore.decrypt(check64.res64_16) && result == MpcCore.decrypt(check64.res16_64)
|
|
94
|
+
&& result == MpcCore.decrypt(check64.res64_32) && result == MpcCore.decrypt(check64.res32_64),
|
|
95
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
112
96
|
|
|
113
97
|
return result;
|
|
114
98
|
}
|
|
@@ -121,85 +105,45 @@ contract MinMaxTestsContract {
|
|
|
121
105
|
setPublicValues(castingValues, a, b);
|
|
122
106
|
|
|
123
107
|
// Calculate the expected result
|
|
124
|
-
result =
|
|
125
|
-
|
|
126
|
-
);
|
|
108
|
+
uint8 result = MpcCore.decrypt(MpcCore.min(castingValues.a8_s, castingValues.b8_s));
|
|
109
|
+
minResult = result;
|
|
127
110
|
|
|
128
111
|
// Calculate the results with casting to 16
|
|
129
|
-
check16.res16_16 = MpcCore.min(
|
|
130
|
-
castingValues.a16_s,
|
|
131
|
-
castingValues.b16_s
|
|
132
|
-
);
|
|
112
|
+
check16.res16_16 = MpcCore.min(castingValues.a16_s, castingValues.b16_s);
|
|
133
113
|
check16.res8_16 = MpcCore.min(castingValues.a8_s, castingValues.b16_s);
|
|
134
114
|
check16.res16_8 = MpcCore.min(castingValues.a16_s, castingValues.b8_s);
|
|
135
115
|
uint16 res16 = decryptAndCompareResults16(check16);
|
|
136
116
|
require(res16 == result, "minTest: cast 16 failed");
|
|
137
117
|
|
|
138
118
|
// Calculate the result with casting to 32
|
|
139
|
-
check32.res32_32 = MpcCore.min(
|
|
140
|
-
castingValues.a32_s,
|
|
141
|
-
castingValues.b32_s
|
|
142
|
-
);
|
|
119
|
+
check32.res32_32 = MpcCore.min(castingValues.a32_s, castingValues.b32_s);
|
|
143
120
|
check32.res8_32 = MpcCore.min(castingValues.a8_s, castingValues.b32_s);
|
|
144
121
|
check32.res32_8 = MpcCore.min(castingValues.a32_s, castingValues.b8_s);
|
|
145
|
-
check32.res16_32 = MpcCore.min(
|
|
146
|
-
|
|
147
|
-
castingValues.b32_s
|
|
148
|
-
);
|
|
149
|
-
check32.res32_16 = MpcCore.min(
|
|
150
|
-
castingValues.a32_s,
|
|
151
|
-
castingValues.b16_s
|
|
152
|
-
);
|
|
122
|
+
check32.res16_32 = MpcCore.min(castingValues.a16_s, castingValues.b32_s);
|
|
123
|
+
check32.res32_16 = MpcCore.min(castingValues.a32_s, castingValues.b16_s);
|
|
153
124
|
uint32 res32 = decryptAndCompareResults32(check32);
|
|
154
125
|
require(result == res32, "minTest: cast 32 failed");
|
|
155
126
|
|
|
156
127
|
// Calculate the result with casting to 64
|
|
157
|
-
check64.res64_64 = MpcCore.min(
|
|
158
|
-
castingValues.a64_s,
|
|
159
|
-
castingValues.b64_s
|
|
160
|
-
);
|
|
128
|
+
check64.res64_64 = MpcCore.min(castingValues.a64_s, castingValues.b64_s);
|
|
161
129
|
check64.res8_64 = MpcCore.min(castingValues.a8_s, castingValues.b64_s);
|
|
162
130
|
check64.res64_8 = MpcCore.min(castingValues.a64_s, castingValues.b8_s);
|
|
163
|
-
check64.res16_64 = MpcCore.min(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
);
|
|
167
|
-
check64.res64_16 = MpcCore.min(
|
|
168
|
-
castingValues.a64_s,
|
|
169
|
-
castingValues.b16_s
|
|
170
|
-
);
|
|
171
|
-
check64.res32_64 = MpcCore.min(
|
|
172
|
-
castingValues.a32_s,
|
|
173
|
-
castingValues.b64_s
|
|
174
|
-
);
|
|
175
|
-
check64.res64_32 = MpcCore.min(
|
|
176
|
-
castingValues.a64_s,
|
|
177
|
-
castingValues.b32_s
|
|
178
|
-
);
|
|
131
|
+
check64.res16_64 = MpcCore.min(castingValues.a16_s, castingValues.b64_s);
|
|
132
|
+
check64.res64_16 = MpcCore.min(castingValues.a64_s, castingValues.b16_s);
|
|
133
|
+
check64.res32_64 = MpcCore.min(castingValues.a32_s, castingValues.b64_s);
|
|
134
|
+
check64.res64_32 = MpcCore.min(castingValues.a64_s, castingValues.b32_s);
|
|
179
135
|
uint64 res64 = decryptAndCompareResults64(check64);
|
|
180
136
|
require(result == res64, "minTest: cast 64 failed");
|
|
181
137
|
|
|
182
138
|
// Check the result with scalar
|
|
183
|
-
require(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"minTest: test
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"minTest: test 16 bits with scalar failed"
|
|
192
|
-
);
|
|
193
|
-
require(
|
|
194
|
-
res32 == MpcCore.decrypt(MpcCore.min(a, castingValues.b32_s)) &&
|
|
195
|
-
res32 == MpcCore.decrypt(MpcCore.min(castingValues.a32_s, b)),
|
|
196
|
-
"minTest: test 32 bits with scalar failed"
|
|
197
|
-
);
|
|
198
|
-
require(
|
|
199
|
-
res64 == MpcCore.decrypt(MpcCore.min(a, castingValues.b64_s)) &&
|
|
200
|
-
res64 == MpcCore.decrypt(MpcCore.min(castingValues.a64_s, b)),
|
|
201
|
-
"minTest: test 64 bits with scalar failed"
|
|
202
|
-
);
|
|
139
|
+
require(result == MpcCore.decrypt(MpcCore.min(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.min(castingValues.a8_s, b)),
|
|
140
|
+
"minTest: test 8 bits with scalar failed");
|
|
141
|
+
require(res16 == MpcCore.decrypt(MpcCore.min(a, castingValues.b16_s)) && res16 == MpcCore.decrypt(MpcCore.min(castingValues.a16_s, b)),
|
|
142
|
+
"minTest: test 16 bits with scalar failed");
|
|
143
|
+
require(res32 == MpcCore.decrypt(MpcCore.min(a, castingValues.b32_s)) && res32 == MpcCore.decrypt(MpcCore.min(castingValues.a32_s, b)),
|
|
144
|
+
"minTest: test 32 bits with scalar failed");
|
|
145
|
+
require(res64 == MpcCore.decrypt(MpcCore.min(a, castingValues.b64_s)) && res64 == MpcCore.decrypt(MpcCore.min(castingValues.a64_s, b)),
|
|
146
|
+
"minTest: test 64 bits with scalar failed");
|
|
203
147
|
|
|
204
148
|
return result;
|
|
205
149
|
}
|
|
@@ -212,86 +156,47 @@ contract MinMaxTestsContract {
|
|
|
212
156
|
setPublicValues(castingValues, a, b);
|
|
213
157
|
|
|
214
158
|
// Calculate the expected result
|
|
215
|
-
result =
|
|
216
|
-
|
|
217
|
-
);
|
|
159
|
+
uint8 result = MpcCore.decrypt(MpcCore.max(castingValues.a8_s, castingValues.b8_s));
|
|
160
|
+
maxResult = result;
|
|
218
161
|
|
|
219
162
|
// Calculate the results with casting to 16
|
|
220
|
-
check16.res16_16 = MpcCore.max(
|
|
221
|
-
castingValues.a16_s,
|
|
222
|
-
castingValues.b16_s
|
|
223
|
-
);
|
|
163
|
+
check16.res16_16 = MpcCore.max(castingValues.a16_s, castingValues.b16_s);
|
|
224
164
|
check16.res8_16 = MpcCore.max(castingValues.a8_s, castingValues.b16_s);
|
|
225
165
|
check16.res16_8 = MpcCore.max(castingValues.a16_s, castingValues.b8_s);
|
|
226
166
|
uint16 res16 = decryptAndCompareResults16(check16);
|
|
227
167
|
require(res16 == result, "maxTest: cast 16 failed");
|
|
228
168
|
|
|
229
169
|
// Calculate the result with casting to 32
|
|
230
|
-
check32.res32_32 = MpcCore.max(
|
|
231
|
-
castingValues.a32_s,
|
|
232
|
-
castingValues.b32_s
|
|
233
|
-
);
|
|
170
|
+
check32.res32_32 = MpcCore.max(castingValues.a32_s, castingValues.b32_s);
|
|
234
171
|
check32.res8_32 = MpcCore.max(castingValues.a8_s, castingValues.b32_s);
|
|
235
172
|
check32.res32_8 = MpcCore.max(castingValues.a32_s, castingValues.b8_s);
|
|
236
|
-
check32.res16_32 = MpcCore.max(
|
|
237
|
-
|
|
238
|
-
castingValues.b32_s
|
|
239
|
-
);
|
|
240
|
-
check32.res32_16 = MpcCore.max(
|
|
241
|
-
castingValues.a32_s,
|
|
242
|
-
castingValues.b16_s
|
|
243
|
-
);
|
|
173
|
+
check32.res16_32 = MpcCore.max(castingValues.a16_s, castingValues.b32_s);
|
|
174
|
+
check32.res32_16 = MpcCore.max(castingValues.a32_s, castingValues.b16_s);
|
|
244
175
|
uint32 res32 = decryptAndCompareResults32(check32);
|
|
245
176
|
require(result == res32, "maxTest: cast 32 failed");
|
|
246
177
|
|
|
247
178
|
// Calculate the result with casting to 64
|
|
248
|
-
check64.res64_64 = MpcCore.max(
|
|
249
|
-
castingValues.a64_s,
|
|
250
|
-
castingValues.b64_s
|
|
251
|
-
);
|
|
179
|
+
check64.res64_64 = MpcCore.max(castingValues.a64_s, castingValues.b64_s);
|
|
252
180
|
check64.res8_64 = MpcCore.max(castingValues.a8_s, castingValues.b64_s);
|
|
253
181
|
check64.res64_8 = MpcCore.max(castingValues.a64_s, castingValues.b8_s);
|
|
254
|
-
check64.res16_64 = MpcCore.max(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
);
|
|
258
|
-
check64.res64_16 = MpcCore.max(
|
|
259
|
-
castingValues.a64_s,
|
|
260
|
-
castingValues.b16_s
|
|
261
|
-
);
|
|
262
|
-
check64.res32_64 = MpcCore.max(
|
|
263
|
-
castingValues.a32_s,
|
|
264
|
-
castingValues.b64_s
|
|
265
|
-
);
|
|
266
|
-
check64.res64_32 = MpcCore.max(
|
|
267
|
-
castingValues.a64_s,
|
|
268
|
-
castingValues.b32_s
|
|
269
|
-
);
|
|
182
|
+
check64.res16_64 = MpcCore.max(castingValues.a16_s, castingValues.b64_s);
|
|
183
|
+
check64.res64_16 = MpcCore.max(castingValues.a64_s, castingValues.b16_s);
|
|
184
|
+
check64.res32_64 = MpcCore.max(castingValues.a32_s, castingValues.b64_s);
|
|
185
|
+
check64.res64_32 = MpcCore.max(castingValues.a64_s, castingValues.b32_s);
|
|
270
186
|
uint64 res64 = decryptAndCompareResults64(check64);
|
|
271
187
|
require(result == res64, "maxTest: cast 64 failed");
|
|
272
188
|
|
|
273
189
|
// Check the result with scalar
|
|
274
|
-
require(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
"minTest: test
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
"minTest: test 16 bits with scalar failed"
|
|
283
|
-
);
|
|
284
|
-
require(
|
|
285
|
-
res32 == MpcCore.decrypt(MpcCore.max(a, castingValues.b32_s)) &&
|
|
286
|
-
res32 == MpcCore.decrypt(MpcCore.max(castingValues.a32_s, b)),
|
|
287
|
-
"minTest: test 32 bits with scalar failed"
|
|
288
|
-
);
|
|
289
|
-
require(
|
|
290
|
-
res64 == MpcCore.decrypt(MpcCore.max(a, castingValues.b64_s)) &&
|
|
291
|
-
res64 == MpcCore.decrypt(MpcCore.max(castingValues.a64_s, b)),
|
|
292
|
-
"minTest: test 64 bits with scalar failed"
|
|
293
|
-
);
|
|
190
|
+
require(result == MpcCore.decrypt(MpcCore.max(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.max(castingValues.a8_s, b)),
|
|
191
|
+
"minTest: test 8 bits with scalar failed");
|
|
192
|
+
require(res16 == MpcCore.decrypt(MpcCore.max(a, castingValues.b16_s)) && res16 == MpcCore.decrypt(MpcCore.max(castingValues.a16_s, b)),
|
|
193
|
+
"minTest: test 16 bits with scalar failed");
|
|
194
|
+
require(res32 == MpcCore.decrypt(MpcCore.max(a, castingValues.b32_s)) && res32 == MpcCore.decrypt(MpcCore.max(castingValues.a32_s, b)),
|
|
195
|
+
"minTest: test 32 bits with scalar failed");
|
|
196
|
+
require(res64 == MpcCore.decrypt(MpcCore.max(a, castingValues.b64_s)) && res64 == MpcCore.decrypt(MpcCore.max(castingValues.a64_s, b)),
|
|
197
|
+
"minTest: test 64 bits with scalar failed");
|
|
294
198
|
|
|
295
199
|
return result;
|
|
296
200
|
}
|
|
297
|
-
|
|
201
|
+
|
|
202
|
+
}
|