Skip to content

Commit

Permalink
refactor: Remove unnecessary computation (AztecProtocol#4133)
Browse files Browse the repository at this point in the history
The merkle tree computations were done a bit hastily so seems like it was forgotten to reduce how much was computed. Not producing unexpected results, just computing unused hashes, so this pr is removing those unneeded computations.
  • Loading branch information
LHerskind authored Jan 18, 2024
1 parent e6ef4a9 commit 64c1ca8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions l1-contracts/src/core/libraries/decoders/Decoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ library Decoder {
for (uint256 j = 0; j < treeSize; j += 2) {
_leafs[j / 2] = sha256(bytes.concat(_leafs[j], _leafs[j + 1]));
}
treeSize /= 2;
}

return _leafs[0];
Expand Down
1 change: 1 addition & 0 deletions l1-contracts/src/core/libraries/decoders/TxsDecoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ library TxsDecoder {
for (uint256 j = 0; j < treeSize; j += 2) {
_leafs[j / 2] = sha256(bytes.concat(_leafs[j], _leafs[j + 1]));
}
treeSize /= 2;
}

return _leafs[0];
Expand Down

0 comments on commit 64c1ca8

Please sign in to comment.