-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SHIP-3521] Add tests to L2EP contracts to improve test coverage (#14341
) * Add tests trying to improve test coverage * Increate testing and clean up * prettier * Update MockBaseSequencerUptimeFeed.sol * Create stale-cougars-approve.md * Update l2ep.gas-snapshot * [Bot] Update changeset file with jira issue * Revert "Update l2ep.gas-snapshot" This reverts commit 6e0d211. * Update l2ep.gas-snapshot * fix comments and clean up scroll tests * Update l2ep.gas-snapshot * Update ZKSyncSequencerUptimeFeed.t.sol * fix gas snapshot * Update ScrollSequencerUptimeFeed.t.sol * Update ScrollSequencerUptimeFeed.t.sol * Update l2ep.gas-snapshot * rename l2ep -> shared to l2ep -> base * cleanup * address feedback * Renames tests to follow Solidity convetions * [Bot] Update changeset file with jira issues --------- Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com> Co-authored-by: Mohamed Mehany <7327188+mohamed-mehany@users.noreply.github.com>
- Loading branch information
1 parent
8420829
commit 202e6b5
Showing
23 changed files
with
702 additions
and
937 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@chainlink/contracts': patch | ||
--- | ||
|
||
[L2EP] Refactor tests and fix file exclusion for coverage | ||
|
||
|
||
PR issue: SHIP-3521 | ||
|
||
Solidity Review issue: SHIP-4050 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
contracts/src/v0.8/l2ep/optimism/OptimismSequencerUptimeFeed.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import {BaseSequencerUptimeFeed} from "../../base/BaseSequencerUptimeFeed.sol"; | ||
|
||
contract MockBaseSequencerUptimeFeed is BaseSequencerUptimeFeed { | ||
string public constant override typeAndVersion = "MockSequencerUptimeFeed 1.1.0-dev"; | ||
|
||
/// @dev this will be used for internal testing | ||
bool private s_validateSenderShouldPass; | ||
|
||
constructor( | ||
address l1SenderAddress, | ||
bool initialStatus, | ||
bool validateSenderShouldPass | ||
) BaseSequencerUptimeFeed(l1SenderAddress, initialStatus) { | ||
s_validateSenderShouldPass = validateSenderShouldPass; | ||
} | ||
|
||
function _validateSender(address /* l1Sender */) internal view override { | ||
if (!s_validateSenderShouldPass) { | ||
revert InvalidSender(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import {BaseValidator} from "../../base/BaseValidator.sol"; | ||
|
||
contract MockBaseValidator is BaseValidator { | ||
string public constant override typeAndVersion = "MockValidator 1.1.0-dev"; | ||
|
||
constructor( | ||
address l1CrossDomainMessengerAddress, | ||
address l2UptimeFeedAddr, | ||
uint32 gasLimit | ||
) BaseValidator(l1CrossDomainMessengerAddress, l2UptimeFeedAddr, gasLimit) {} | ||
|
||
function validate( | ||
uint256 /* previousRoundId */, | ||
int256 /* previousAnswer */, | ||
uint256 /* currentRoundId */, | ||
int256 /* currentAnswer */ | ||
) external view override checkAccess returns (bool) { | ||
return true; | ||
} | ||
} |
Oops, something went wrong.