From ff2167249fd014c8cadc3843aa67f19fd904f99e Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:57:44 +0000 Subject: [PATCH] fix: calc constants rather than hardcoding where possible --- l1-contracts/src/core/libraries/Decoder.sol | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/l1-contracts/src/core/libraries/Decoder.sol b/l1-contracts/src/core/libraries/Decoder.sol index f5a1dec38ef..2ebfdb770ff 100644 --- a/l1-contracts/src/core/libraries/Decoder.sol +++ b/l1-contracts/src/core/libraries/Decoder.sol @@ -115,13 +115,14 @@ library Decoder { // Where the start of trees metadata begins in the block uint256 private constant START_TREES_BLOCK_HEADER_OFFSET = 0x80; - // Where the end of trees metadata begns in the block - uint256 private constant END_TREES_BLOCK_HEADER_OFFSET = 0x01c0; - // The size of the block header elements uint256 private constant TREES_BLOCK_HEADER_SIZE = 0x140; + // Where the end of trees metadata begns in the block + uint256 private constant END_TREES_BLOCK_HEADER_OFFSET = START_TREES_BLOCK_HEADER_OFFSET + TREES_BLOCK_HEADER_SIZE; + // Where the metadata ends and the block data begins. + // This is really (START_TREES_BLOCK_HEADER_OFFSET + 2 * TREES_BLOCK_HEADER_SIZE) but assembly doesnt allow comptime constant use uint256 private constant BLOCK_HEADER_OFFSET = 0x0300; /**