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
bddc53d6
Commit
bddc53d6
authored
Jun 22, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More styling fixes
parent
01fbb00a
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
121 additions
and
131 deletions
+121
-131
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+89
-89
L1CrossDomainMessenger.sol
...contracts-bedrock/contracts/L1/L1CrossDomainMessenger.sol
+0
-1
L1ERC721Bridge.sol
packages/contracts-bedrock/contracts/L1/L1ERC721Bridge.sol
+0
-1
L1StandardBridge.sol
packages/contracts-bedrock/contracts/L1/L1StandardBridge.sol
+0
-1
L2OutputOracle.sol
packages/contracts-bedrock/contracts/L1/L2OutputOracle.sol
+0
-1
OptimismPortal.sol
packages/contracts-bedrock/contracts/L1/OptimismPortal.sol
+0
-1
ResourceMetering.sol
packages/contracts-bedrock/contracts/L1/ResourceMetering.sol
+0
-1
SystemConfig.sol
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
+0
-1
CommonTest.t.sol
packages/contracts-bedrock/contracts/test/CommonTest.t.sol
+20
-0
L1CrossDomainMessenger.t.sol
...racts-bedrock/contracts/test/L1CrossDomainMessenger.t.sol
+0
-1
L1StandardBridge.t.sol
...s/contracts-bedrock/contracts/test/L1StandardBridge.t.sol
+0
-1
L2OutputOracle.t.sol
...ges/contracts-bedrock/contracts/test/L2OutputOracle.t.sol
+12
-30
OptimismPortal.t.sol
...ges/contracts-bedrock/contracts/test/OptimismPortal.t.sol
+0
-1
SystemConfig.t.sol
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
+0
-2
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
bddc53d6
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/contracts/L1/L1CrossDomainMessenger.sol
View file @
bddc53d6
...
@@ -12,7 +12,6 @@ import { Semver } from "../universal/Semver.sol";
...
@@ -12,7 +12,6 @@ import { Semver } from "../universal/Semver.sol";
/// for sending and receiving data on the L1 side. Users are encouraged to use this
/// for sending and receiving data on the L1 side. Users are encouraged to use this
/// interface instead of interacting with lower-level contracts directly.
/// interface instead of interacting with lower-level contracts directly.
contract L1CrossDomainMessenger is CrossDomainMessenger, Semver {
contract L1CrossDomainMessenger is CrossDomainMessenger, Semver {
/// @notice Address of the OptimismPortal.
/// @notice Address of the OptimismPortal.
OptimismPortal public immutable PORTAL;
OptimismPortal public immutable PORTAL;
...
...
packages/contracts-bedrock/contracts/L1/L1ERC721Bridge.sol
View file @
bddc53d6
...
@@ -11,7 +11,6 @@ import { Semver } from "../universal/Semver.sol";
...
@@ -11,7 +11,6 @@ import { Semver } from "../universal/Semver.sol";
/// make it possible to transfer ERC721 tokens from Ethereum to Optimism. This contract
/// make it possible to transfer ERC721 tokens from Ethereum to Optimism. This contract
/// acts as an escrow for ERC721 tokens deposited into L2.
/// acts as an escrow for ERC721 tokens deposited into L2.
contract L1ERC721Bridge is ERC721Bridge, Semver {
contract L1ERC721Bridge is ERC721Bridge, Semver {
/// @notice Mapping of L1 token to L2 token to ID to boolean, indicating if the given L1 token
/// @notice Mapping of L1 token to L2 token to ID to boolean, indicating if the given L1 token
/// by ID was deposited for a given L2 token.
/// by ID was deposited for a given L2 token.
mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
...
...
packages/contracts-bedrock/contracts/L1/L1StandardBridge.sol
View file @
bddc53d6
...
@@ -16,7 +16,6 @@ import { Semver } from "../universal/Semver.sol";
...
@@ -16,7 +16,6 @@ import { Semver } from "../universal/Semver.sol";
/// of some token types that may not be properly supported by this contract include, but are
/// of some token types that may not be properly supported by this contract include, but are
/// not limited to: tokens with transfer fees, rebasing tokens, and tokens with blocklists.
/// not limited to: tokens with transfer fees, rebasing tokens, and tokens with blocklists.
contract L1StandardBridge is StandardBridge, Semver {
contract L1StandardBridge is StandardBridge, Semver {
/// @custom:legacy
/// @custom:legacy
/// @notice Emitted whenever a deposit of ETH from L1 into L2 is initiated.
/// @notice Emitted whenever a deposit of ETH from L1 into L2 is initiated.
/// @param from Address of the depositor.
/// @param from Address of the depositor.
...
...
packages/contracts-bedrock/contracts/L1/L2OutputOracle.sol
View file @
bddc53d6
...
@@ -11,7 +11,6 @@ import { Types } from "../libraries/Types.sol";
...
@@ -11,7 +11,6 @@ import { Types } from "../libraries/Types.sol";
/// commitment to the state of the L2 chain. Other contracts like the OptimismPortal use
/// commitment to the state of the L2 chain. Other contracts like the OptimismPortal use
/// these outputs to verify information about the state of L2.
/// these outputs to verify information about the state of L2.
contract L2OutputOracle is Initializable, Semver {
contract L2OutputOracle is Initializable, Semver {
/// @notice The interval in L2 blocks at which checkpoints must be submitted.
/// @notice The interval in L2 blocks at which checkpoints must be submitted.
/// Although this is immutable, it can safely be modified by upgrading the
/// Although this is immutable, it can safely be modified by upgrading the
/// implementation contract.
/// implementation contract.
...
...
packages/contracts-bedrock/contracts/L1/OptimismPortal.sol
View file @
bddc53d6
...
@@ -19,7 +19,6 @@ import { Semver } from "../universal/Semver.sol";
...
@@ -19,7 +19,6 @@ import { Semver } from "../universal/Semver.sol";
/// and L2. Messages sent directly to the OptimismPortal have no form of replayability.
/// and L2. Messages sent directly to the OptimismPortal have no form of replayability.
/// Users are encouraged to use the L1CrossDomainMessenger for a higher-level interface.
/// Users are encouraged to use the L1CrossDomainMessenger for a higher-level interface.
contract OptimismPortal is Initializable, ResourceMetering, Semver {
contract OptimismPortal is Initializable, ResourceMetering, Semver {
/// @notice Represents a proven withdrawal.
/// @notice Represents a proven withdrawal.
/// @custom:field outputRoot Root of the L2 output this was proven against.
/// @custom:field outputRoot Root of the L2 output this was proven against.
/// @custom:field timestamp Timestamp at whcih the withdrawal was proven.
/// @custom:field timestamp Timestamp at whcih the withdrawal was proven.
...
...
packages/contracts-bedrock/contracts/L1/ResourceMetering.sol
View file @
bddc53d6
...
@@ -11,7 +11,6 @@ import { Arithmetic } from "../libraries/Arithmetic.sol";
...
@@ -11,7 +11,6 @@ import { Arithmetic } from "../libraries/Arithmetic.sol";
/// @notice ResourceMetering implements an EIP-1559 style resource metering system where pricing
/// @notice ResourceMetering implements an EIP-1559 style resource metering system where pricing
/// updates automatically based on current demand.
/// updates automatically based on current demand.
abstract contract ResourceMetering is Initializable {
abstract contract ResourceMetering is Initializable {
/// @notice Represents the various parameters that control the way in which resources are
/// @notice Represents the various parameters that control the way in which resources are
/// metered. Corresponds to the EIP-1559 resource metering system.
/// metered. Corresponds to the EIP-1559 resource metering system.
/// @custom:field prevBaseFee Base fee from the previous block(s).
/// @custom:field prevBaseFee Base fee from the previous block(s).
...
...
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
View file @
bddc53d6
...
@@ -12,7 +12,6 @@ import { ResourceMetering } from "./ResourceMetering.sol";
...
@@ -12,7 +12,6 @@ import { ResourceMetering } from "./ResourceMetering.sol";
/// All configuration is stored on L1 and picked up by L2 as part of the derviation of
/// All configuration is stored on L1 and picked up by L2 as part of the derviation of
/// the L2 chain.
/// the L2 chain.
contract SystemConfig is OwnableUpgradeable, Semver {
contract SystemConfig is OwnableUpgradeable, Semver {
/// @notice Enum representing different types of updates.
/// @notice Enum representing different types of updates.
/// @custom:value BATCHER Represents an update to the batcher hash.
/// @custom:value BATCHER Represents an update to the batcher hash.
/// @custom:value GAS_CONFIG Represents an update to txn fee config on L2.
/// @custom:value GAS_CONFIG Represents an update to txn fee config on L2.
...
...
packages/contracts-bedrock/contracts/test/CommonTest.t.sol
View file @
bddc53d6
...
@@ -124,6 +124,26 @@ contract L2OutputOracle_Initializer is CommonTest {
...
@@ -124,6 +124,26 @@ contract L2OutputOracle_Initializer is CommonTest {
vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1);
vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1);
}
}
/// @dev Helper function to propose an output.
function proposeAnotherOutput() public {
bytes32 proposedOutput2 = keccak256(abi.encode());
uint256 nextBlockNumber = oracle.nextBlockNumber();
uint256 nextOutputIndex = oracle.nextOutputIndex();
warpToProposeTime(nextBlockNumber);
uint256 proposedNumber = oracle.latestBlockNumber();
// Ensure the submissionInterval is enforced
assertEq(nextBlockNumber, proposedNumber + submissionInterval);
vm.roll(nextBlockNumber + 1);
vm.expectEmit(true, true, true, true);
emit OutputProposed(proposedOutput2, nextOutputIndex, nextBlockNumber, block.timestamp);
vm.prank(proposer);
oracle.proposeL2Output(proposedOutput2, nextBlockNumber, 0, 0);
}
function setUp() public virtual override {
function setUp() public virtual override {
super.setUp();
super.setUp();
guardian = makeAddr("guardian");
guardian = makeAddr("guardian");
...
...
packages/contracts-bedrock/contracts/test/L1CrossDomainMessenger.t.sol
View file @
bddc53d6
...
@@ -19,7 +19,6 @@ import { OptimismPortal } from "../L1/OptimismPortal.sol";
...
@@ -19,7 +19,6 @@ import { OptimismPortal } from "../L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
contract L1CrossDomainMessenger_Test is Messenger_Initializer {
contract L1CrossDomainMessenger_Test is Messenger_Initializer {
/// @dev The receiver address
/// @dev The receiver address
address recipient = address(0xabbaacdc);
address recipient = address(0xabbaacdc);
...
...
packages/contracts-bedrock/contracts/test/L1StandardBridge.t.sol
View file @
bddc53d6
...
@@ -41,7 +41,6 @@ contract L1StandardBridge_Initialize_Test is Bridge_Initializer {
...
@@ -41,7 +41,6 @@ contract L1StandardBridge_Initialize_Test is Bridge_Initializer {
contract L1StandardBridge_Initialize_TestFail is Bridge_Initializer {}
contract L1StandardBridge_Initialize_TestFail is Bridge_Initializer {}
contract L1StandardBridge_Receive_Test is Bridge_Initializer {
contract L1StandardBridge_Receive_Test is Bridge_Initializer {
/// @dev Tests receive bridges ETH successfully.
/// @dev Tests receive bridges ETH successfully.
function test_receive_succeeds() external {
function test_receive_succeeds() external {
assertEq(address(op).balance, 0);
assertEq(address(op).balance, 0);
...
...
packages/contracts-bedrock/contracts/test/L2OutputOracle.t.sol
View file @
bddc53d6
...
@@ -207,26 +207,10 @@ contract L2OutputOracle_getter_Test is L2OutputOracle_Initializer {
...
@@ -207,26 +207,10 @@ contract L2OutputOracle_getter_Test is L2OutputOracle_Initializer {
}
}
contract L2OutputOracle_proposeL2Output_Test is L2OutputOracle_Initializer {
contract L2OutputOracle_proposeL2Output_Test is L2OutputOracle_Initializer {
/// @dev Test that `proposeL2Output` succeeds for a valid input
/// @dev Test that `proposeL2Output` succeeds for a valid input
/// and when a block hash and number are not specified.
/// and when a block hash and number are not specified.
function test_proposeL2Output_proposeAnotherOutput_succeeds() public {
function test_proposeL2Output_proposeAnotherOutput_succeeds() public {
bytes32 proposedOutput2 = keccak256(abi.encode());
proposeAnotherOutput();
uint256 nextBlockNumber = oracle.nextBlockNumber();
uint256 nextOutputIndex = oracle.nextOutputIndex();
warpToProposeTime(nextBlockNumber);
uint256 proposedNumber = oracle.latestBlockNumber();
// Ensure the submissionInterval is enforced
assertEq(nextBlockNumber, proposedNumber + submissionInterval);
vm.roll(nextBlockNumber + 1);
vm.expectEmit(true, true, true, true);
emit OutputProposed(proposedOutput2, nextOutputIndex, nextBlockNumber, block.timestamp);
vm.prank(proposer);
oracle.proposeL2Output(proposedOutput2, nextBlockNumber, 0, 0);
}
}
/// @dev Tests that `proposeL2Output` succeeds when given valid input and
/// @dev Tests that `proposeL2Output` succeeds when given valid input and
...
@@ -324,11 +308,10 @@ contract L2OutputOracle_proposeL2Output_Test is L2OutputOracle_Initializer {
...
@@ -324,11 +308,10 @@ contract L2OutputOracle_proposeL2Output_Test is L2OutputOracle_Initializer {
}
}
contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
/// @dev Tests that `deleteL2Outputs` succeeds for a single output.
/// @dev Tests that `deleteL2Outputs` succeeds for a single output.
function test_deleteOutputs_singleOutput_succeeds() external {
function test_deleteOutputs_singleOutput_succeeds() external {
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestOutputIndex = oracle.latestOutputIndex();
uint256 latestOutputIndex = oracle.latestOutputIndex();
...
@@ -352,10 +335,10 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
...
@@ -352,10 +335,10 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
/// @dev Tests that `deleteL2Outputs` succeeds for multiple outputs.
/// @dev Tests that `deleteL2Outputs` succeeds for multiple outputs.
function test_deleteOutputs_multipleOutputs_succeeds() external {
function test_deleteOutputs_multipleOutputs_succeeds() external {
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestOutputIndex = oracle.latestOutputIndex();
uint256 latestOutputIndex = oracle.latestOutputIndex();
...
@@ -387,7 +370,7 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
...
@@ -387,7 +370,7 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
/// @dev Tests that `deleteL2Outputs` reverts for a non-existant output index.
/// @dev Tests that `deleteL2Outputs` reverts for a non-existant output index.
function test_deleteL2Outputs_nonExistent_reverts() external {
function test_deleteL2Outputs_nonExistent_reverts() external {
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
uint256 latestBlockNumber = oracle.latestBlockNumber();
uint256 latestBlockNumber = oracle.latestBlockNumber();
...
@@ -399,10 +382,9 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
...
@@ -399,10 +382,9 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
/// @dev Tests that `deleteL2Outputs` reverts when trying to delete outputs
/// @dev Tests that `deleteL2Outputs` reverts when trying to delete outputs
/// after the latest output index.
/// after the latest output index.
function test_deleteL2Outputs_afterLatest_reverts() external {
function test_deleteL2Outputs_afterLatest_reverts() external {
// Start by proposing three outputs
proposeAnotherOutput();
test_proposeL2Output_proposeAnotherOutput_succeeds();
proposeAnotherOutput();
test_proposeL2Output_proposeAnotherOutput_succeeds();
proposeAnotherOutput();
test_proposeL2Output_proposeAnotherOutput_succeeds();
// Delete the latest two outputs
// Delete the latest two outputs
uint256 latestOutputIndex = oracle.latestOutputIndex();
uint256 latestOutputIndex = oracle.latestOutputIndex();
...
@@ -417,7 +399,7 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
...
@@ -417,7 +399,7 @@ contract L2OutputOracle_deleteOutputs_Test is L2OutputOracle_Initializer {
/// @dev Tests that `deleteL2Outputs` reverts for finalized outputs.
/// @dev Tests that `deleteL2Outputs` reverts for finalized outputs.
function test_deleteL2Outputs_finalized_reverts() external {
function test_deleteL2Outputs_finalized_reverts() external {
test_proposeL2Output_proposeAnotherOutput_succeeds
();
proposeAnotherOutput
();
// Warp past the finalization period + 1 second
// Warp past the finalization period + 1 second
vm.warp(block.timestamp + oracle.FINALIZATION_PERIOD_SECONDS() + 1);
vm.warp(block.timestamp + oracle.FINALIZATION_PERIOD_SECONDS() + 1);
...
...
packages/contracts-bedrock/contracts/test/OptimismPortal.t.sol
View file @
bddc53d6
...
@@ -1155,7 +1155,6 @@ contract OptimismPortalUpgradeable_Test is Portal_Initializer {
...
@@ -1155,7 +1155,6 @@ contract OptimismPortalUpgradeable_Test is Portal_Initializer {
/// @dev Test various values of the resource metering config to ensure that deposits cannot be
/// @dev Test various values of the resource metering config to ensure that deposits cannot be
/// broken by changing the config.
/// broken by changing the config.
contract OptimismPortalResourceFuzz_Test is Portal_Initializer {
contract OptimismPortalResourceFuzz_Test is Portal_Initializer {
/// @dev The max gas limit observed throughout this test. Setting this too high can cause
/// @dev The max gas limit observed throughout this test. Setting this too high can cause
/// the test to take too long to run.
/// the test to take too long to run.
uint256 constant MAX_GAS_LIMIT = 30_000_000;
uint256 constant MAX_GAS_LIMIT = 30_000_000;
...
...
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
View file @
bddc53d6
...
@@ -41,7 +41,6 @@ contract SystemConfig_Init is CommonTest {
...
@@ -41,7 +41,6 @@ contract SystemConfig_Init is CommonTest {
}
}
contract SystemConfig_Initialize_TestFail is SystemConfig_Init {
contract SystemConfig_Initialize_TestFail is SystemConfig_Init {
/// @dev Tests that initialization reverts if the gas limit is too low.
/// @dev Tests that initialization reverts if the gas limit is too low.
function test_initialize_lowGasLimit_reverts() external {
function test_initialize_lowGasLimit_reverts() external {
uint64 minimumGasLimit = sysConf.minimumGasLimit();
uint64 minimumGasLimit = sysConf.minimumGasLimit();
...
@@ -69,7 +68,6 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Init {
...
@@ -69,7 +68,6 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Init {
}
}
contract SystemConfig_Setters_TestFail is SystemConfig_Init {
contract SystemConfig_Setters_TestFail is SystemConfig_Init {
/// @dev Tests that `setBatcherHash` reverts if the caller is not the owner.
/// @dev Tests that `setBatcherHash` reverts if the caller is not the owner.
function test_setBatcherHash_notOwner_reverts() external {
function test_setBatcherHash_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert("Ownable: caller is not the owner");
...
...
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