Skip to content

Commit

Permalink
removes L1 zero address check and removes unnecessary encodeWithSelec…
Browse files Browse the repository at this point in the history
…tor calls
  • Loading branch information
chris-de-leon-cll authored and mohamed-mehany committed Jan 24, 2024
1 parent 7ede863 commit a881c6e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ contract ScrollSequencerUptimeFeed is

/// @notice internal method that stores the L1 sender
function _setL1Sender(address to) private {
if (to == address(0)) {
revert ZeroAddress();
}

address from = s_l1Sender;
if (from != to) {
s_l1Sender = to;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ contract ArbitrumSequencerUptimeFeed_UpdateStatus is ArbitrumSequencerUptimeFeed
vm.startPrank(s_strangerAddr, s_strangerAddr);

// Tries to update the status from an unauthorized account
vm.expectRevert(abi.encodeWithSelector(ArbitrumSequencerUptimeFeed.InvalidSender.selector));
vm.expectRevert(ArbitrumSequencerUptimeFeed.InvalidSender.selector);
s_arbitrumSequencerUptimeFeed.updateStatus(true, uint64(1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract OptimismSequencerUptimeFeed_UpdateStatus is OptimismSequencerUptimeFeed
vm.startPrank(s_strangerAddr, s_strangerAddr);

// Tries to update the status from an unauthorized account
vm.expectRevert(abi.encodeWithSelector(OptimismSequencerUptimeFeed.InvalidSender.selector));
vm.expectRevert(OptimismSequencerUptimeFeed.InvalidSender.selector);
s_optimismSequencerUptimeFeed.updateStatus(true, uint64(1));
}

Expand All @@ -74,7 +74,7 @@ contract OptimismSequencerUptimeFeed_UpdateStatus is OptimismSequencerUptimeFeed
s_mockOptimismL2CrossDomainMessenger.setSender(s_strangerAddr);

// Tries to update the status from an unauthorized account
vm.expectRevert(abi.encodeWithSelector(OptimismSequencerUptimeFeed.InvalidSender.selector));
vm.expectRevert(OptimismSequencerUptimeFeed.InvalidSender.selector);
s_optimismSequencerUptimeFeed.updateStatus(true, uint64(1));
}

Expand Down Expand Up @@ -257,7 +257,7 @@ contract OptimismSequencerUptimeFeed_AggregatorV3Interface is OptimismSequencerU
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

// Gets data from a round that has not happened yet
vm.expectRevert(abi.encodeWithSelector(OptimismSequencerUptimeFeed.NoDataPresent.selector));
vm.expectRevert(OptimismSequencerUptimeFeed.NoDataPresent.selector);
s_optimismSequencerUptimeFeed.getRoundData(2);
}

Expand All @@ -267,7 +267,7 @@ contract OptimismSequencerUptimeFeed_AggregatorV3Interface is OptimismSequencerU
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

// Gets data from a round that has not happened yet
vm.expectRevert(abi.encodeWithSelector(OptimismSequencerUptimeFeed.NoDataPresent.selector));
vm.expectRevert(OptimismSequencerUptimeFeed.NoDataPresent.selector);
s_optimismSequencerUptimeFeed.getAnswer(2);
}

Expand All @@ -277,7 +277,7 @@ contract OptimismSequencerUptimeFeed_AggregatorV3Interface is OptimismSequencerU
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

// Gets data from a round that has not happened yet
vm.expectRevert(abi.encodeWithSelector(OptimismSequencerUptimeFeed.NoDataPresent.selector));
vm.expectRevert(OptimismSequencerUptimeFeed.NoDataPresent.selector);
s_optimismSequencerUptimeFeed.getTimestamp(2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ contract ScrollSequencerUptimeFeedTest is L2EPTest {
contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeedTest {
/// @notice it should have been deployed with the correct initial state
function test_InitialState() public {
// L1 sender address must not be the zero address
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.ZeroAddress.selector));
new ScrollSequencerUptimeFeed(address(0), address(s_mockScrollL2CrossDomainMessenger), false);

// L2 cross domain messenger address must not be the zero address
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.ZeroAddress.selector));
vm.expectRevert(ScrollSequencerUptimeFeed.ZeroAddress.selector);
new ScrollSequencerUptimeFeed(s_l1OwnerAddr, address(0), false);

// Sets msg.sender and tx.origin to a valid address
Expand All @@ -69,7 +65,7 @@ contract ScrollSequencerUptimeFeed_UpdateStatus is ScrollSequencerUptimeFeedTest
vm.startPrank(s_strangerAddr, s_strangerAddr);

// Tries to update the status from an unauthorized account
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.InvalidSender.selector));
vm.expectRevert(ScrollSequencerUptimeFeed.InvalidSender.selector);
s_scrollSequencerUptimeFeed.updateStatus(true, uint64(1));
}

Expand All @@ -82,7 +78,7 @@ contract ScrollSequencerUptimeFeed_UpdateStatus is ScrollSequencerUptimeFeedTest
s_mockScrollL2CrossDomainMessenger.setSender(s_strangerAddr);

// Tries to update the status from an unauthorized account
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.InvalidSender.selector));
vm.expectRevert(ScrollSequencerUptimeFeed.InvalidSender.selector);
s_scrollSequencerUptimeFeed.updateStatus(true, uint64(1));
}

Expand Down Expand Up @@ -265,7 +261,7 @@ contract ScrollSequencerUptimeFeed_AggregatorV3Interface is ScrollSequencerUptim
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

// Gets data from a round that has not happened yet
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.NoDataPresent.selector));
vm.expectRevert(ScrollSequencerUptimeFeed.NoDataPresent.selector);
s_scrollSequencerUptimeFeed.getRoundData(2);
}

Expand All @@ -275,7 +271,7 @@ contract ScrollSequencerUptimeFeed_AggregatorV3Interface is ScrollSequencerUptim
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

// Gets data from a round that has not happened yet
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.NoDataPresent.selector));
vm.expectRevert(ScrollSequencerUptimeFeed.NoDataPresent.selector);
s_scrollSequencerUptimeFeed.getAnswer(2);
}

Expand All @@ -285,7 +281,7 @@ contract ScrollSequencerUptimeFeed_AggregatorV3Interface is ScrollSequencerUptim
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

// Gets data from a round that has not happened yet
vm.expectRevert(abi.encodeWithSelector(ScrollSequencerUptimeFeed.NoDataPresent.selector));
vm.expectRevert(ScrollSequencerUptimeFeed.NoDataPresent.selector);
s_scrollSequencerUptimeFeed.getTimestamp(2);
}
}
Expand Down

0 comments on commit a881c6e

Please sign in to comment.