@@ -70,12 +70,19 @@ library ChallengesUtil {
70
70
for (uint256 i = 0 ; i < transaction.proof.length ; i++ ) {
71
71
if (transaction.proof[i] == 0 ) nZeroProof++ ;
72
72
}
73
+ uint256 nZeroCompressedSecrets;
74
+ for (uint256 i = 0 ; i < transaction.compressedSecrets.length ; i++ ) {
75
+ if (transaction.compressedSecrets[i] == 0 ) nZeroCompressedSecrets++ ;
76
+ }
73
77
require (
74
78
(transaction.tokenId == ZERO && transaction.value == 0 ) ||
75
79
transaction.ercAddress == ZERO ||
76
80
transaction.recipientAddress != ZERO ||
77
81
transaction.commitments[0 ] == ZERO ||
78
82
transaction.commitments[1 ] != ZERO ||
83
+ transaction.nullifiers[0 ] != ZERO ||
84
+ transaction.nullifiers[1 ] != ZERO ||
85
+ transaction.compressedSecrets.length != nZeroCompressedSecrets ||
79
86
nZeroProof == 4 || // We assume that 3 out of the 4 proof elements can be a valid ZERO. Deals with exception cases
80
87
transaction.historicRootBlockNumberL2[0 ] != 0 ||
81
88
transaction.historicRootBlockNumberL2[1 ] != 0 ,
@@ -149,12 +156,19 @@ library ChallengesUtil {
149
156
for (uint256 i = 0 ; i < transaction.proof.length ; i++ ) {
150
157
if (transaction.proof[i] == 0 ) nZeroProof++ ;
151
158
}
159
+ uint256 nZeroCompressedSecrets;
160
+ for (uint256 i = 0 ; i < transaction.compressedSecrets.length ; i++ ) {
161
+ if (transaction.compressedSecrets[i] == 0 ) nZeroCompressedSecrets++ ;
162
+ }
152
163
require (
153
164
(transaction.tokenId == ZERO && transaction.value == 0 ) ||
154
165
transaction.ercAddress == ZERO ||
155
166
transaction.recipientAddress == ZERO ||
167
+ transaction.commitments[0 ] != ZERO ||
168
+ transaction.commitments[1 ] != ZERO ||
156
169
transaction.nullifiers[0 ] == ZERO ||
157
170
transaction.nullifiers[1 ] != ZERO ||
171
+ transaction.compressedSecrets.length != nZeroCompressedSecrets ||
158
172
nZeroProof == 4 || // We assume that 3 out of the 4 proof elements can be a valid ZERO. Deals with exception cases
159
173
transaction.historicRootBlockNumberL2[1 ] != 0 , // A withdraw has a similar constraint as a single transfer
160
174
'This withdraw transaction type is valid '
0 commit comments