Skip to content

Commit

Permalink
Adds zero address checks for ScrollSequencerUptimeFeed
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-de-leon-cll authored and mohamed-mehany committed Jan 24, 2024
1 parent c0f26a1 commit 7ede863
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/gas-snapshots/l2ep.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (ga
ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 18035)
ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 18253)
ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17959)
ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 21085)
ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 185840)
ScrollSequencerUptimeFeed_GasCosts:test_GasCosts() (gas: 64888)
ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597491)
ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573807)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ 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));
new ScrollSequencerUptimeFeed(s_l1OwnerAddr, address(0), false);

// Sets msg.sender and tx.origin to a valid address
vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr);

Expand Down

0 comments on commit 7ede863

Please sign in to comment.