Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
395d36fb
Unverified
Commit
395d36fb
authored
Dec 06, 2022
by
mergify[bot]
Committed by
GitHub
Dec 06, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4249 from ethereum-optimism/jm/ctb-test-cleanup/7
Rename L2xDM and Output Oracle tests
parents
a37d8623
c5dc366b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
133 deletions
+133
-133
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+61
-61
L2CrossDomainMessenger.t.sol
...racts-bedrock/contracts/test/L2CrossDomainMessenger.t.sol
+13
-13
L2OutputOracle.t.sol
...ges/contracts-bedrock/contracts/test/L2OutputOracle.t.sol
+36
-36
LegacyERC20ETH.t.sol
...ges/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
+9
-9
OptimismMintableERC20.t.sol
...tracts-bedrock/contracts/test/OptimismMintableERC20.t.sol
+10
-10
OptimismMintableERC20Factory.t.sol
...bedrock/contracts/test/OptimismMintableERC20Factory.t.sol
+4
-4
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
395d36fb
...
...
@@ -69,46 +69,46 @@ L1StandardBridge_FinalizeETHWithdrawal_Test:test_finalizeETHWithdrawal_succeeds(
L1StandardBridge_Getter_Test:test_getters_succeeds() (gas: 31449)
L1StandardBridge_Initialize_Test:test_initialize_succeeds() (gas: 22005)
L1StandardBridge_Receive_Test:test_receive_succeeds() (gas: 514475)
L2CrossDomainMessenger_Test:testCannot_L2MessengerPause() (gas: 10860)
L2CrossDomainMessenger_Test:test_L1MessengerRelayMessageRevertsOnReentrancy() (gas: 167775)
L2CrossDomainMessenger_Test:test_L2MessengerMessageVersion() (gas: 8389)
L2CrossDomainMessenger_Test:test_L2MessengerPause() (gas: 31802)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageFirstStuckSecondSucceeds() (gas: 168269)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageSucceeds() (gas: 53204)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageToSystemContract() (gas: 36172)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageV0Fails() (gas: 18870)
L2CrossDomainMessenger_Test:test_L2MessengerRelayShouldRevertIfPaused() (gas: 41596)
L2CrossDomainMessenger_Test:test_L2MessengerSendMessage() (gas: 122533)
L2CrossDomainMessenger_Test:test_L2MessengerTwiceSendMessage() (gas: 134716)
L2CrossDomainMessenger_Test:test_L2MessengerXDomainSenderReverts() (gas: 10568)
L2CrossDomainMessenger_Test:test_L2MessengerxDomainMessageSenderResets() (gas: 52615)
L2OutputOracleTest:testCannot_ProposeWithUnmatchedBlockhash() (gas: 29434)
L2OutputOracleTest:testCannot_constructWithBadTimestamp() (gas: 70674)
L2OutputOracleTest:testCannot_deleteL2Outputs_afterLatest() (gas: 200324)
L2OutputOracleTest:testCannot_deleteL2Outputs_ifNotChallenger() (gas: 18915)
L2OutputOracleTest:testCannot_deleteL2Outputs_nonExistent() (gas: 103509)
L2OutputOracleTest:testCannot_proposeEmptyOutput() (gas: 26721)
L2OutputOracleTest:testCannot_proposeFutureTimetamp() (gas: 28678)
L2OutputOracleTest:testCannot_proposeL2Output_ifNotProposer() (gas: 25782)
L2OutputOracleTest:testCannot_proposeOnWrongFork() (gas: 28941)
L2OutputOracleTest:testCannot_proposeUnexpectedBlockNumber() (gas: 28382)
L2OutputOracleTest:test_computeL2Timestamp() (gas: 37185)
L2OutputOracleTest:test_constructor() (gas: 33715)
L2OutputOracleTest:test_deleteOutputs_multipleOutputs() (gas: 286718)
L2OutputOracleTest:test_deleteOutputs_singleOutput() (gas: 173018)
L2OutputOracleTest:test_getL2Output() (gas: 101700)
L2OutputOracleTest:test_getL2OutputIndexAfter_multipleOutputsExist() (gas: 267181)
L2OutputOracleTest:test_getL2OutputIndexAfter_noOutputsExist() (gas: 17938)
L2CrossDomainMessenger_Test:test_messageVersion_succeeds() (gas: 8367)
L2CrossDomainMessenger_Test:test_pause_notOwner_reverts() (gas: 10859)
L2CrossDomainMessenger_Test:test_pause_succeeds() (gas: 31846)
L2CrossDomainMessenger_Test:test_relayMessage_paused_reverts() (gas: 41596)
L2CrossDomainMessenger_Test:test_relayMessage_reentrancy_reverts() (gas: 167766)
L2CrossDomainMessenger_Test:test_relayMessage_retry_succeeds() (gas: 168292)
L2CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 53183)
L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 36194)
L2CrossDomainMessenger_Test:test_relayMessage_v0_reverts() (gas: 18870)
L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 122533)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 134671)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 52594)
L2CrossDomainMessenger_Test:test_xDomainSender_senderNotSet_reverts() (gas: 10524)
L2OutputOracleTest:test_computeL2Timestamp_succeeds() (gas: 37184)
L2OutputOracleTest:test_constructor_badTimestamp_reverts() (gas: 70717)
L2OutputOracleTest:test_constructor_succeeds() (gas: 33760)
L2OutputOracleTest:test_deleteL2Outputs_afterLatest_reverts() (gas: 200230)
L2OutputOracleTest:test_deleteL2Outputs_ifNotChallenger_reverts() (gas: 18883)
L2OutputOracleTest:test_deleteL2Outputs_nonExistent_reverts() (gas: 103402)
L2OutputOracleTest:test_deleteOutputs_multipleOutputs_succeeds() (gas: 286560)
L2OutputOracleTest:test_deleteOutputs_singleOutput_succeeds() (gas: 172876)
L2OutputOracleTest:test_getL2OutputIndexAfter_multipleOutputsExist_succeeds() (gas: 267182)
L2OutputOracleTest:test_getL2OutputIndexAfter_noOutputsExis_reverts() (gas: 17914)
L2OutputOracleTest:test_getL2OutputIndexAfter_previousBlock_succeeds() (gas: 96086)
L2OutputOracleTest:test_getL2OutputIndexAfter_sameBlock_succeeds() (gas: 95994)
L2OutputOracleTest:test_latestBlockNumber() (gas: 96937)
L2OutputOracleTest:test_nextBlockNumber() (gas: 17468)
L2OutputOracleTest:test_proposeWithBlockhashAndHeight() (gas: 95251)
L2OutputOracleTest:test_proposingAnotherOutput() (gas: 97175)
L2OutputOracleUpgradeable_Test:test_cannotInitImpl() (gas: 15171)
L2OutputOracleUpgradeable_Test:test_cannotInitProxy() (gas: 20152)
L2OutputOracleUpgradeable_Test:test_initValuesOnProxy() (gas: 26052)
L2OutputOracleUpgradeable_Test:test_upgrading() (gas: 180457)
L2OutputOracleTest:test_getL2Output_succeeds() (gas: 101699)
L2OutputOracleTest:test_latestBlockNumber_succeeds() (gas: 96983)
L2OutputOracleTest:test_nextBlockNumber_succeeds() (gas: 17468)
L2OutputOracleTest:test_proposeL2Output_emptyOutput_reverts() (gas: 26688)
L2OutputOracleTest:test_proposeL2Output_futureTimetamp_reverts() (gas: 28646)
L2OutputOracleTest:test_proposeL2Output_notProposer_reverts() (gas: 25782)
L2OutputOracleTest:test_proposeL2Output_proposeAnotherOutput_succeeds() (gas: 97137)
L2OutputOracleTest:test_proposeL2Output_unexpectedBlockNumber_reverts() (gas: 28402)
L2OutputOracleTest:test_proposeL2Output_unmatchedBlockhash_reverts() (gas: 29446)
L2OutputOracleTest:test_proposeL2Output_wrongFork_reverts() (gas: 29005)
L2OutputOracleTest:test_proposeWithBlockhashAndHeight_succeeds() (gas: 95296)
L2OutputOracleUpgradeable_Test:test_initValuesOnProxy_succeeds() (gas: 26096)
L2OutputOracleUpgradeable_Test:test_initializeImpl_alreadyInitialized_reverts() (gas: 15149)
L2OutputOracleUpgradeable_Test:test_initializeProxy_alreadyInitialized_reverts() (gas: 20131)
L2OutputOracleUpgradeable_Test:test_upgrading_succeeds() (gas: 180413)
L2StandardBridge_Test:test_finalizeBridgeETH_incorrectValue_reverts() (gas: 23788)
L2StandardBridge_Test:test_finalizeBridgeETH_sendToMessenger_reverts() (gas: 23927)
L2StandardBridge_Test:test_finalizeBridgeETH_sendToSelf_reverts() (gas: 23838)
...
...
@@ -122,30 +122,30 @@ L2StandardBridge_Test:test_withdraw_succeeds() (gas: 343975)
L2ToL1MessagePasserTest:test_burn_succeeds() (gas: 112572)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromContract_succeeds() (gas: 70423)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromEOA_succeeds() (gas: 75874)
LegacyERC20ETH_Test:test_approve
() (gas: 10723
)
LegacyERC20ETH_Test:test_burn() (gas: 10615)
LegacyERC20ETH_Test:test_crossDomain
() (gas: 6339
)
LegacyERC20ETH_Test:test_decreaseAllowance
() (gas: 10657
)
LegacyERC20ETH_Test:test_increaseAllowance
() (gas: 10667
)
LegacyERC20ETH_Test:test_metadata() (gas: 15414)
LegacyERC20ETH_Test:test_mint() (gas: 10649)
LegacyERC20ETH_Test:test_transfer
() (gas: 10711
)
LegacyERC20ETH_Test:test_transfer
From() (gas: 12887
)
LegacyERC20ETH_Test:test_approve
_doesNotExist_reverts() (gas: 10701
)
LegacyERC20ETH_Test:test_burn
_doesNotExist_reverts
() (gas: 10615)
LegacyERC20ETH_Test:test_crossDomain
_succeeds() (gas: 6362
)
LegacyERC20ETH_Test:test_decreaseAllowance
_doesNotExist_reverts() (gas: 10679
)
LegacyERC20ETH_Test:test_increaseAllowance
_doesNotExist_reverts() (gas: 10689
)
LegacyERC20ETH_Test:test_metadata
_succeeds
() (gas: 15414)
LegacyERC20ETH_Test:test_mint
_doesNotExist_reverts
() (gas: 10649)
LegacyERC20ETH_Test:test_transfer
From_doesNotExist_reverts() (gas: 12887
)
LegacyERC20ETH_Test:test_transfer
_doesNotExist_reverts() (gas: 10733
)
LegacyMessagePasser_Test:test_LegacyMessagePasser_passMessageToL1_Succeeds() (gas: 34519)
OptimismMintableERC20_Test:test_bridge
() (gas: 7599
)
OptimismMintableERC20_Test:test_burn
() (gas: 51031
)
OptimismMintableERC20_Test:test_burn
RevertsFromNotBridge() (gas: 11164
)
OptimismMintableERC20_Test:test_erc165_supportsInterface
() (gas: 7765
)
OptimismMintableERC20_Test:test_l1Token
() (gas: 7622
)
OptimismMintableERC20_Test:test_l2Bridge
() (gas: 7688
)
OptimismMintableERC20_Test:test_legacy
() (gas: 14300
)
OptimismMintableERC20_Test:test_mint
() (gas: 63609
)
OptimismMintableERC20_Test:test_mint
RevertsFromNotBridge() (gas: 11098
)
OptimismMintableERC20_Test:test_remoteToken
() (gas: 7644
)
OptimismMintableTokenFactory_Test:test_bridge() (gas: 7577)
OptimismMintableTokenFactory_Test:test_createStandardL2Token
() (gas: 1095274
)
OptimismMintableTokenFactory_Test:test_createStandardL2Token
SameTwice() (gas: 2176691
)
OptimismMintableTokenFactory_Test:test_createStandardL2Token
ShouldRevertIfRemoteIsZero() (gas: 9413
)
OptimismMintableERC20_Test:test_bridge
_succeeds() (gas: 7643
)
OptimismMintableERC20_Test:test_burn
_notBridge_reverts() (gas: 11165
)
OptimismMintableERC20_Test:test_burn
_succeeds() (gas: 51013
)
OptimismMintableERC20_Test:test_erc165_supportsInterface
_succeeds() (gas: 7742
)
OptimismMintableERC20_Test:test_l1Token
_succeeds() (gas: 7599
)
OptimismMintableERC20_Test:test_l2Bridge
_succeeds() (gas: 7665
)
OptimismMintableERC20_Test:test_legacy
_succeeds() (gas: 14344
)
OptimismMintableERC20_Test:test_mint
_notBridge_reverts() (gas: 11121
)
OptimismMintableERC20_Test:test_mint
_succeeds() (gas: 63609
)
OptimismMintableERC20_Test:test_remoteToken
_succeeds() (gas: 7622
)
OptimismMintableTokenFactory_Test:test_bridge
_succeeds
() (gas: 7577)
OptimismMintableTokenFactory_Test:test_createStandardL2Token
_remoteIsZero_succeeds() (gas: 9413
)
OptimismMintableTokenFactory_Test:test_createStandardL2Token
_sameTwice_succeeds() (gas: 2176713
)
OptimismMintableTokenFactory_Test:test_createStandardL2Token
_succeeds() (gas: 1095296
)
OptimismPortalUpgradeable_Test:test_initialize_cannotInitImpl_reverts() (gas: 10791)
OptimismPortalUpgradeable_Test:test_initialize_cannotInitProxy_reverts() (gas: 15833)
OptimismPortalUpgradeable_Test:test_params_initValuesOnProxy_succeeds() (gas: 16011)
...
...
packages/contracts-bedrock/contracts/test/L2CrossDomainMessenger.t.sol
View file @
395d36fb
...
...
@@ -20,23 +20,23 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
super.setUp();
}
function test_
L2MessengerPause
() external {
function test_
pause_succeeds
() external {
L2Messenger.pause();
assert(L2Messenger.paused());
}
function test
Cannot_L2MessengerPause
() external {
function test
_pause_notOwner_reverts
() external {
vm.expectRevert("Ownable: caller is not the owner");
vm.prank(address(0xABBA));
L2Messenger.pause();
}
function test_
L2MessengerMessageVersion
() external {
function test_
messageVersion_succeeds
() external {
(, uint16 version) = Encoding.decodeVersionedNonce(L2Messenger.messageNonce());
assertEq(version, L2Messenger.MESSAGE_VERSION());
}
function test_
L2MessengerSendMessage
() external {
function test_
sendMessage_succeeds
() external {
bytes memory xDomainCallData = Encoding.encodeCrossDomainMessage(
L2Messenger.messageNonce(),
alice,
...
...
@@ -80,7 +80,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
L2Messenger.sendMessage(recipient, hex"ff", uint32(100));
}
function test_
L2MessengerTwiceSendMessage
() external {
function test_
sendMessage_twice_succeeds
() external {
uint256 nonce = L2Messenger.messageNonce();
L2Messenger.sendMessage(recipient, hex"aa", uint32(500_000));
L2Messenger.sendMessage(recipient, hex"aa", uint32(500_000));
...
...
@@ -88,12 +88,12 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
assertEq(nonce + 2, L2Messenger.messageNonce());
}
function test_
L2MessengerXDomainSenderR
everts() external {
function test_
xDomainSender_senderNotSet_r
everts() external {
vm.expectRevert("CrossDomainMessenger: xDomainMessageSender is not set");
L2Messenger.xDomainMessageSender();
}
function test_
L2MessengerRelayMessageV0Fail
s() external {
function test_
relayMessage_v0_revert
s() external {
address target = address(0xabcd);
address sender = address(L1Messenger);
address caller = AddressAliasHelper.applyL1ToL2Alias(address(L1Messenger));
...
...
@@ -113,7 +113,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
);
}
function test_
L2MessengerRelayMessageS
ucceeds() external {
function test_
relayMessage_s
ucceeds() external {
address target = address(0xabcd);
address sender = address(L1Messenger);
address caller = AddressAliasHelper.applyL1ToL2Alias(address(L1Messenger));
...
...
@@ -151,7 +151,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
}
// relayMessage: should revert if attempting to relay a message sent to an L1 system contract
function test_
L2MessengerRelayMessageToSystemContract
() external {
function test_
relayMessage_toSystemContract_reverts
() external {
address target = address(messagePasser);
address sender = address(L1Messenger);
address caller = AddressAliasHelper.applyL1ToL2Alias(address(L1Messenger));
...
...
@@ -170,7 +170,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
}
// relayMessage: the xDomainMessageSender is reset to the original value
function test_
L2MessengerxDomainMessageSenderReset
s() external {
function test_
xDomainMessageSender_reset_succeed
s() external {
vm.expectRevert("CrossDomainMessenger: xDomainMessageSender is not set");
L2Messenger.xDomainMessageSender();
...
...
@@ -190,7 +190,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
}
// relayMessage: should revert if paused
function test_
L2MessengerRelayShouldRevertIfPaused
() external {
function test_
relayMessage_paused_reverts
() external {
vm.prank(L2Messenger.owner());
L2Messenger.pause();
...
...
@@ -200,7 +200,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
// relayMessage: should send a successful call to the target contract after the first message
// fails and ETH gets stuck, but the second message succeeds
function test_
L2MessengerRelayMessageFirstStuckSecondS
ucceeds() external {
function test_
relayMessage_retry_s
ucceeds() external {
address target = address(0xabcd);
address sender = address(L1Messenger);
address caller = AddressAliasHelper.applyL1ToL2Alias(address(L1Messenger));
...
...
@@ -254,7 +254,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
}
// relayMessage: should revert if recipient is trying to reenter
function test_
L1MessengerRelayMessageRevertsOnReentrancy
() external {
function test_
relayMessage_reentrancy_reverts
() external {
address target = address(0xabcd);
address sender = address(L1Messenger);
address caller = AddressAliasHelper.applyL1ToL2Alias(address(L1Messenger));
...
...
packages/contracts-bedrock/contracts/test/L2OutputOracle.t.sol
View file @
395d36fb
...
...
@@ -14,7 +14,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
super.setUp();
}
function test_constructor() external {
function test_constructor
_succeeds
() external {
assertEq(oracle.PROPOSER(), proposer);
assertEq(oracle.CHALLENGER(), owner);
assertEq(oracle.SUBMISSION_INTERVAL(), submissionInterval);
...
...
@@ -23,7 +23,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
assertEq(oracle.startingTimestamp(), startingTimestamp);
}
function test
Cannot_constructWithBadTimestamp
() external {
function test
_constructor_badTimestamp_reverts
() external {
vm.expectRevert("L2OutputOracle: starting L2 timestamp must be less than current time");
new L2OutputOracle(
...
...
@@ -42,7 +42,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
****************/
// Test: latestBlockNumber() should return the correct value
function test_latestBlockNumber() external {
function test_latestBlockNumber
_succeeds
() external {
uint256 proposedNumber = oracle.nextBlockNumber();
// Roll to after the block number we'll propose
...
...
@@ -53,7 +53,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
}
// Test: getL2Output() should return the correct value
function test_getL2Output() external {
function test_getL2Output
_succeeds
() external {
uint256 nextBlockNumber = oracle.nextBlockNumber();
uint256 nextOutputIndex = oracle.nextOutputIndex();
warpToProposeTime(nextBlockNumber);
...
...
@@ -96,7 +96,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
}
// Test: getL2OutputIndexAfter() returns correct value during binary search
function test_getL2OutputIndexAfter_multipleOutputsExist() external {
function test_getL2OutputIndexAfter_multipleOutputsExist
_succeeds
() external {
bytes32 output1 = keccak256(abi.encode(1));
uint256 nextBlockNumber1 = oracle.nextBlockNumber();
warpToProposeTime(nextBlockNumber1);
...
...
@@ -135,13 +135,13 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
}
// Test: getL2OutputIndexAfter() reverts when no output exists yet
function test_getL2OutputIndexAfter_noOutputsExis
t
() external {
function test_getL2OutputIndexAfter_noOutputsExis
_reverts
() external {
vm.expectRevert("L2OutputOracle: cannot get output as no outputs have been proposed yet");
oracle.getL2OutputIndexAfter(0);
}
// Test: nextBlockNumber() should return the correct value
function test_nextBlockNumber() external {
function test_nextBlockNumber
_succeeds
() external {
assertEq(
oracle.nextBlockNumber(),
// The return value should match this arithmetic
...
...
@@ -149,7 +149,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
);
}
function test_computeL2Timestamp() external {
function test_computeL2Timestamp
_succeeds
() external {
// reverts if timestamp is too low
vm.expectRevert(stdError.arithmeticError);
oracle.computeL2Timestamp(startingBlockNumber - 1);
...
...
@@ -177,8 +177,8 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
// Test: proposeL2Output succeeds when given valid input, and no block hash and number are
// specified.
function test_propos
ingAnotherOutput
() public {
bytes32 proposedOutput2 = keccak256(abi.encode(
2
));
function test_propos
eL2Output_proposeAnotherOutput_succeeds
() public {
bytes32 proposedOutput2 = keccak256(abi.encode());
uint256 nextBlockNumber = oracle.nextBlockNumber();
warpToProposeTime(nextBlockNumber);
uint256 proposedNumber = oracle.latestBlockNumber();
...
...
@@ -193,7 +193,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
// Test: proposeL2Output succeeds when given valid input, and when a block hash and number are
// specified for reorg protection.
function test_proposeWithBlockhashAndHeight() external {
function test_proposeWithBlockhashAndHeight
_succeeds
() external {
// Get the number and hash of a previous block in the chain
uint256 prevL1BlockNumber = block.number - 1;
bytes32 prevL1BlockHash = blockhash(prevL1BlockNumber);
...
...
@@ -209,7 +209,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
***************************/
// Test: proposeL2Output fails if called by a party that is not the proposer.
function test
Cannot_proposeL2Output_ifNotProposer
() external {
function test
_proposeL2Output_notProposer_reverts
() external {
uint256 nextBlockNumber = oracle.nextBlockNumber();
warpToProposeTime(nextBlockNumber);
...
...
@@ -219,7 +219,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
}
// Test: proposeL2Output fails given a zero blockhash.
function test
Cannot_proposeEmptyOutput
() external {
function test
_proposeL2Output_emptyOutput_reverts
() external {
bytes32 outputToPropose = bytes32(0);
uint256 nextBlockNumber = oracle.nextBlockNumber();
warpToProposeTime(nextBlockNumber);
...
...
@@ -229,7 +229,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
}
// Test: proposeL2Output fails if the block number doesn't match the next expected number.
function test
Cannot_proposeUnexpectedBlockNumber
() external {
function test
_proposeL2Output_unexpectedBlockNumber_reverts
() external {
uint256 nextBlockNumber = oracle.nextBlockNumber();
warpToProposeTime(nextBlockNumber);
vm.prank(proposer);
...
...
@@ -238,7 +238,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
}
// Test: proposeL2Output fails if it would have a timestamp in the future.
function test
Cannot_proposeFutureTimetamp
() external {
function test
_proposeL2Output_futureTimetamp_reverts
() external {
uint256 nextBlockNumber = oracle.nextBlockNumber();
uint256 nextTimestamp = oracle.computeL2Timestamp(nextBlockNumber);
vm.warp(nextTimestamp);
...
...
@@ -249,7 +249,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
// Test: proposeL2Output fails if a non-existent L1 block hash and number are provided for reorg
// protection.
function test
Cannot_proposeOnWrongFork
() external {
function test
_proposeL2Output_wrongFork_reverts
() external {
uint256 nextBlockNumber = oracle.nextBlockNumber();
warpToProposeTime(nextBlockNumber);
vm.prank(proposer);
...
...
@@ -266,7 +266,7 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
// Test: proposeL2Output fails when given valid input, but the block hash and number do not
// match.
function test
Cannot_ProposeWithUnmatchedBlockhash
() external {
function test
_proposeL2Output_unmatchedBlockhash_reverts
() external {
// Move ahead to block 100 so that we can reference historical blocks
vm.roll(100);
...
...
@@ -291,9 +291,9 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
event OutputsDeleted(uint256 indexed prevNextOutputIndex, uint256 indexed newNextOutputIndex);
function test_deleteOutputs_singleOutput() external {
test_propos
ingAnotherOutput
();
test_propos
ingAnotherOutput
();
function test_deleteOutputs_singleOutput
_succeeds
() external {
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestOutputIndex = oracle.latestOutputIndex();
...
...
@@ -315,11 +315,11 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
assertEq(newLatestOutput.timestamp, proposal.timestamp);
}
function test_deleteOutputs_multipleOutputs() external {
test_propos
ingAnotherOutput
();
test_propos
ingAnotherOutput
();
test_propos
ingAnotherOutput
();
test_propos
ingAnotherOutput
();
function test_deleteOutputs_multipleOutputs
_succeeds
() external {
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestOutputIndex = oracle.latestOutputIndex();
...
...
@@ -345,15 +345,15 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
* Delete Tests - Sad Path *
***************************/
function test
Cannot_deleteL2Outputs_ifNotChallenger
() external {
function test
_deleteL2Outputs_ifNotChallenger_reverts
() external {
uint256 latestBlockNumber = oracle.latestBlockNumber();
vm.expectRevert("L2OutputOracle: only the challenger address can delete outputs");
oracle.deleteL2Outputs(latestBlockNumber);
}
function test
Cannot_deleteL2Outputs_nonExistent
() external {
test_propos
ingAnotherOutput
();
function test
_deleteL2Outputs_nonExistent_reverts
() external {
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
uint256 latestBlockNumber = oracle.latestBlockNumber();
...
...
@@ -362,11 +362,11 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
oracle.deleteL2Outputs(latestBlockNumber + 1);
}
function test
Cannot_deleteL2Outputs_afterLatest
() external {
function test
_deleteL2Outputs_afterLatest_reverts
() external {
// Start by proposing three outputs
test_propos
ingAnotherOutput
();
test_propos
ingAnotherOutput
();
test_propos
ingAnotherOutput
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
test_propos
eL2Output_proposeAnotherOutput_succeeds
();
// Delete the latest two outputs
uint256 latestOutputIndex = oracle.latestOutputIndex();
...
...
@@ -388,7 +388,7 @@ contract L2OutputOracleUpgradeable_Test is L2OutputOracle_Initializer {
proxy = Proxy(payable(address(oracle)));
}
function test_initValuesOnProxy() external {
function test_initValuesOnProxy
_succeeds
() external {
assertEq(submissionInterval, oracleImpl.SUBMISSION_INTERVAL());
assertEq(l2BlockTime, oracleImpl.L2_BLOCK_TIME());
assertEq(startingBlockNumber, oracleImpl.startingBlockNumber());
...
...
@@ -398,17 +398,17 @@ contract L2OutputOracleUpgradeable_Test is L2OutputOracle_Initializer {
assertEq(owner, oracleImpl.CHALLENGER());
}
function test_
cannotInitProxy
() external {
function test_
initializeProxy_alreadyInitialized_reverts
() external {
vm.expectRevert("Initializable: contract is already initialized");
L2OutputOracle(payable(proxy)).initialize(startingBlockNumber, startingTimestamp);
}
function test_
cannotInitImpl
() external {
function test_
initializeImpl_alreadyInitialized_reverts
() external {
vm.expectRevert("Initializable: contract is already initialized");
L2OutputOracle(oracleImpl).initialize(startingBlockNumber, startingTimestamp);
}
function test_upgrading() external {
function test_upgrading
_succeeds
() external {
// Check an unused slot before upgrading.
bytes32 slot21Before = vm.load(address(oracle), bytes32(uint256(21)));
assertEq(bytes32(0), slot21Before);
...
...
packages/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
View file @
395d36fb
...
...
@@ -12,48 +12,48 @@ contract LegacyERC20ETH_Test is CommonTest {
eth = new LegacyERC20ETH();
}
function test_metadata() external {
function test_metadata
_succeeds
() external {
assertEq(eth.name(), "Ether");
assertEq(eth.symbol(), "ETH");
assertEq(eth.decimals(), 18);
}
function test_crossDomain() external {
function test_crossDomain
_succeeds
() external {
assertEq(eth.l2Bridge(), Predeploys.L2_STANDARD_BRIDGE);
assertEq(eth.l1Token(), address(0));
}
function test_transfer() external {
function test_transfer
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: transfer is disabled");
eth.transfer(alice, 100);
}
function test_approve() external {
function test_approve
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: approve is disabled");
eth.approve(alice, 100);
}
function test_transferFrom() external {
function test_transferFrom
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: transferFrom is disabled");
eth.transferFrom(bob, alice, 100);
}
function test_increaseAllowance() external {
function test_increaseAllowance
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: increaseAllowance is disabled");
eth.increaseAllowance(alice, 100);
}
function test_decreaseAllowance() external {
function test_decreaseAllowance
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: decreaseAllowance is disabled");
eth.decreaseAllowance(alice, 100);
}
function test_mint() external {
function test_mint
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: mint is disabled");
eth.mint(alice, 100);
}
function test_burn() external {
function test_burn
_doesNotExist_reverts
() external {
vm.expectRevert("LegacyERC20ETH: burn is disabled");
eth.burn(alice, 100);
}
...
...
packages/contracts-bedrock/contracts/test/OptimismMintableERC20.t.sol
View file @
395d36fb
...
...
@@ -13,23 +13,23 @@ contract OptimismMintableERC20_Test is Bridge_Initializer {
super.setUp();
}
function test_remoteToken() external {
function test_remoteToken
_succeeds
() external {
assertEq(L2Token.remoteToken(), address(L1Token));
}
function test_bridge() external {
function test_bridge
_succeeds
() external {
assertEq(L2Token.bridge(), address(L2Bridge));
}
function test_l1Token() external {
function test_l1Token
_succeeds
() external {
assertEq(L2Token.l1Token(), address(L1Token));
}
function test_l2Bridge() external {
function test_l2Bridge
_succeeds
() external {
assertEq(L2Token.l2Bridge(), address(L2Bridge));
}
function test_legacy() external {
function test_legacy
_succeeds
() external {
// Getters for the remote token
assertEq(L2Token.REMOTE_TOKEN(), address(L1Token));
assertEq(L2Token.remoteToken(), address(L1Token));
...
...
@@ -40,7 +40,7 @@ contract OptimismMintableERC20_Test is Bridge_Initializer {
assertEq(L2Token.l2Bridge(), address(L2Bridge));
}
function test_mint() external {
function test_mint
_succeeds
() external {
vm.expectEmit(true, true, true, true);
emit Mint(alice, 100);
...
...
@@ -50,14 +50,14 @@ contract OptimismMintableERC20_Test is Bridge_Initializer {
assertEq(L2Token.balanceOf(alice), 100);
}
function test_mint
RevertsFromNotBridge
() external {
function test_mint
_notBridge_reverts
() external {
// NOT the bridge
vm.expectRevert("OptimismMintableERC20: only bridge can mint and burn");
vm.prank(address(alice));
L2Token.mint(alice, 100);
}
function test_burn() external {
function test_burn
_succeeds
() external {
vm.prank(address(L2Bridge));
L2Token.mint(alice, 100);
...
...
@@ -70,14 +70,14 @@ contract OptimismMintableERC20_Test is Bridge_Initializer {
assertEq(L2Token.balanceOf(alice), 0);
}
function test_burn
RevertsFromNotBridge
() external {
function test_burn
_notBridge_reverts
() external {
// NOT the bridge
vm.expectRevert("OptimismMintableERC20: only bridge can mint and burn");
vm.prank(address(alice));
L2Token.burn(alice, 100);
}
function test_erc165_supportsInterface() external {
function test_erc165_supportsInterface
_succeeds
() external {
// The assertEq calls in this test are comparing the manual calculation of the iface,
// with what is returned by the solidity's type().interfaceId, just to be safe.
bytes4 iface1 = bytes4(keccak256("supportsInterface(bytes4)"));
...
...
packages/contracts-bedrock/contracts/test/OptimismMintableERC20Factory.t.sol
View file @
395d36fb
...
...
@@ -16,11 +16,11 @@ contract OptimismMintableTokenFactory_Test is Bridge_Initializer {
super.setUp();
}
function test_bridge() external {
function test_bridge
_succeeds
() external {
assertEq(address(L2TokenFactory.bridge()), address(L2Bridge));
}
function test_createStandardL2Token() external {
function test_createStandardL2Token
_succeeds
() external {
address remote = address(4);
address local = LibRLP.computeAddress(address(L2TokenFactory), 2);
...
...
@@ -34,7 +34,7 @@ contract OptimismMintableTokenFactory_Test is Bridge_Initializer {
L2TokenFactory.createStandardL2Token(remote, "Beep", "BOOP");
}
function test_createStandardL2Token
SameTwice
() external {
function test_createStandardL2Token
_sameTwice_succeeds
() external {
address remote = address(4);
vm.prank(alice);
...
...
@@ -52,7 +52,7 @@ contract OptimismMintableTokenFactory_Test is Bridge_Initializer {
L2TokenFactory.createStandardL2Token(remote, "Beep", "BOOP");
}
function test_createStandardL2Token
ShouldRevertIfRemoteIsZero
() external {
function test_createStandardL2Token
_remoteIsZero_succeeds
() external {
address remote = address(0);
vm.expectRevert("OptimismMintableERC20Factory: must provide remote token address");
L2TokenFactory.createStandardL2Token(remote, "Beep", "BOOP");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment