Skip to content

Commit fe5ad3a

Browse files
authored
fix: bound _mint correctly in depositTransaction test function (#619)
1 parent 0caa582 commit fe5ad3a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/contracts-bedrock/test/L1/OptimismPortal2.t.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,11 +2565,13 @@ contract OptimismPortal2_DepositTransaction_Test is OptimismPortal2_TestInit {
25652565
external
25662566
{
25672567
// Prevent overflow on an upgrade context
2568-
if (isUsingLockbox()) {
2568+
// Since the value always goes through the portal
2569+
_mint = bound(_mint, 0, type(uint256).max - address(optimismPortal2).balance);
2570+
2571+
if (isUsingLockbox() && address(optimismPortal2).balance > address(ethLockbox).balance) {
25692572
_mint = bound(_mint, 0, type(uint256).max - address(ethLockbox).balance);
2570-
} else {
2571-
_mint = bound(_mint, 0, type(uint256).max - address(optimismPortal2).balance);
25722573
}
2574+
25732575
if (isUsingCustomGasToken()) {
25742576
_mint = 0;
25752577
}
@@ -2585,7 +2587,6 @@ contract OptimismPortal2_DepositTransaction_Test is OptimismPortal2_TestInit {
25852587

25862588
uint256 balanceBefore = address(optimismPortal2).balance;
25872589
uint256 lockboxBalanceBefore = address(ethLockbox).balance;
2588-
_mint = bound(_mint, 0, type(uint256).max - balanceBefore);
25892590

25902591
// EOA emulation
25912592
vm.expectEmit(address(optimismPortal2));

0 commit comments

Comments
 (0)