From 0167dd273371a178b2d8be8cd2b5d2e10f1eb990 Mon Sep 17 00:00:00 2001 From: c4-bot-7 <144724379+c4-bot-7@users.noreply.github.com> Date: Sun, 17 Mar 2024 18:49:11 -0700 Subject: [PATCH] t4sk data for issue #49 --- data/t4sk-Q.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 data/t4sk-Q.md diff --git a/data/t4sk-Q.md b/data/t4sk-Q.md new file mode 100644 index 0000000..785463c --- /dev/null +++ b/data/t4sk-Q.md @@ -0,0 +1,19 @@ +# Transient storage in EssentialContract should target base chain instead of chain id = 1 + +https://github.com/code-423n4/2024-03-taiko/blob/b6885955903c4ec6a0d72ebb79b124c6d0a1002b/packages/protocol/contracts/common/EssentialContract.sol#L120-L123 + +https://github.com/code-423n4/2024-03-taiko/blob/b6885955903c4ec6a0d72ebb79b124c6d0a1002b/packages/protocol/contracts/common/EssentialContract.sol#L131-L134 + +`TaikoL1` can be deployed on L2 as a base contract for L3. Hence when the reentrancy lock is loaded using transient storage, it should compare chain id of base chain, instead of chain id = 1. + +For example +```solidity + if (block.chainid == BASE_CHAIN_ID) { + assembly { + tstore(_REENTRY_SLOT, _reentry) + } + } +``` + +This `BASE_CHAIN_ID` can be initialized as an immutable variable. +