fix CVF-7

This commit is contained in:
poma 2021-03-22 20:25:42 +03:00
parent 53e7a69556
commit 790f049719
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
2 changed files with 13 additions and 4 deletions

@ -235,10 +235,7 @@ contract TornadoTrees is Initializable {
string memory _type, string memory _type,
uint256 _from, // most likely array length after the proposal has passed uint256 _from, // most likely array length after the proposal has passed
uint256 _step // optimal step size to find first match, approximately equals dispersion uint256 _step // optimal step size to find first match, approximately equals dispersion
) internal view returns (uint256) { ) internal view virtual returns (uint256) {
if (_from == 0 && _step == 0) {
return 0; // for tests
}
// Find the segment with correct array length // Find the segment with correct array length
bool direction = elementExists(_tornadoTreesV1, _type, _from); bool direction = elementExists(_tornadoTreesV1, _type, _from);
do { do {

@ -113,4 +113,16 @@ contract TornadoTreesMock is TornadoTrees {
_withdrawals[i] = withdrawals[lastProcessedWithdrawalLeaf + i]; _withdrawals[i] = withdrawals[lastProcessedWithdrawalLeaf + i];
} }
} }
function findArrayLength(
ITornadoTreesV1 _tornadoTreesV1,
string memory _type,
uint256 _from, // most likely array length after the proposal has passed
uint256 _step // optimal step size to find first match, approximately equals dispersion
) internal view override returns (uint256) {
if (_from == 0 && _step == 0) {
return 0;
}
return super.findArrayLength(_tornadoTreesV1, _type, _from, _step);
}
} }