Skip to content

Commit

Permalink
t4sk data for issue #49
Browse files Browse the repository at this point in the history
  • Loading branch information
c4-bot-7 committed Mar 18, 2024
1 parent 90dfd16 commit 0167dd2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions data/t4sk-Q.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 0167dd2

Please sign in to comment.