From 943fba6ed19e7a61467e238846db6484faadc8b2 Mon Sep 17 00:00:00 2001 From: LHerskind <lasse.herskind@gmail.com> Date: Thu, 18 Jan 2024 13:04:35 +0000 Subject: [PATCH] refactor: Remove unnecessary computation --- l1-contracts/src/core/libraries/decoders/Decoder.sol | 1 + l1-contracts/src/core/libraries/decoders/TxsDecoder.sol | 1 + 2 files changed, 2 insertions(+) diff --git a/l1-contracts/src/core/libraries/decoders/Decoder.sol b/l1-contracts/src/core/libraries/decoders/Decoder.sol index 178e91acda2..39efa07f04d 100644 --- a/l1-contracts/src/core/libraries/decoders/Decoder.sol +++ b/l1-contracts/src/core/libraries/decoders/Decoder.sol @@ -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]; diff --git a/l1-contracts/src/core/libraries/decoders/TxsDecoder.sol b/l1-contracts/src/core/libraries/decoders/TxsDecoder.sol index c58b10b377e..93bb8d922d4 100644 --- a/l1-contracts/src/core/libraries/decoders/TxsDecoder.sol +++ b/l1-contracts/src/core/libraries/decoders/TxsDecoder.sol @@ -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];