fix CVF-21

This commit is contained in:
poma 2021-03-22 20:16:14 +03:00
parent 8a82afba42
commit 53e7a69556
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657

View File

@ -149,9 +149,10 @@ contract TornadoTrees is Initializable {
bytes32 deposit = offset + i >= depositsV1Length ? deposits[offset + i] : tornadoTreesV1.deposits(offset + i); bytes32 deposit = offset + i >= depositsV1Length ? deposits[offset + i] : tornadoTreesV1.deposits(offset + i);
require(leafHash == deposit, "Incorrect deposit"); require(leafHash == deposit, "Incorrect deposit");
assembly { assembly {
mstore(add(add(data, mul(ITEM_SIZE, i)), 0x7c), blockNumber) let itemOffset := add(data, mul(ITEM_SIZE, i))
mstore(add(add(data, mul(ITEM_SIZE, i)), 0x78), instance) mstore(add(itemOffset, 0x7c), blockNumber)
mstore(add(add(data, mul(ITEM_SIZE, i)), 0x64), hash) mstore(add(itemOffset, 0x78), instance)
mstore(add(itemOffset, 0x64), hash)
} }
if (offset + i >= depositsV1Length) { if (offset + i >= depositsV1Length) {
delete deposits[offset + i]; delete deposits[offset + i];
@ -200,9 +201,10 @@ contract TornadoTrees is Initializable {
bytes32 withdrawal = offset + i >= withdrawalsV1Length ? withdrawals[offset + i] : tornadoTreesV1.withdrawals(offset + i); bytes32 withdrawal = offset + i >= withdrawalsV1Length ? withdrawals[offset + i] : tornadoTreesV1.withdrawals(offset + i);
require(leafHash == withdrawal, "Incorrect withdrawal"); require(leafHash == withdrawal, "Incorrect withdrawal");
assembly { assembly {
mstore(add(add(data, mul(ITEM_SIZE, i)), 0x7c), blockNumber) let itemOffset := add(data, mul(ITEM_SIZE, i))
mstore(add(add(data, mul(ITEM_SIZE, i)), 0x78), instance) mstore(add(itemOffset, 0x7c), blockNumber)
mstore(add(add(data, mul(ITEM_SIZE, i)), 0x64), hash) mstore(add(itemOffset, 0x78), instance)
mstore(add(itemOffset, 0x64), hash)
} }
if (offset + i >= withdrawalsV1Length) { if (offset + i >= withdrawalsV1Length) {
delete withdrawals[offset + i]; delete withdrawals[offset + i];