Commit 11b679f1 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: fix nits

parent b17a3a43
This diff is collapsed.
......@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
const OptimismPortalStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1001,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1002,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"params\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_struct(ResourceParams)1014_storage\"},{\"astId\":1003,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_array(t_uint256)48_storage\"},{\"astId\":1004,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"l2Sender\",\"offset\":0,\"slot\":\"50\",\"type\":\"t_address\"},{\"astId\":1005,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"finalizedWithdrawals\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1006,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"provenWithdrawals\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_mapping(t_bytes32,t_struct(ProvenWithdrawal)1013_storage)\"},{\"astId\":1007,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"paused\",\"offset\":0,\"slot\":\"53\",\"type\":\"t_bool\"},{\"astId\":1008,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_L2_ORACLE\",\"offset\":1,\"slot\":\"53\",\"type\":\"t_contract(L2OutputOracle)1011\"},{\"astId\":1009,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_SYSTEM_CONFIG\",\"offset\":0,\"slot\":\"54\",\"type\":\"t_contract(SystemConfig)1012\"},{\"astId\":1010,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_GUARDIAN\",\"offset\":0,\"slot\":\"55\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)48_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[48]\",\"numberOfBytes\":\"1536\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_contract(L2OutputOracle)1011\":{\"encoding\":\"inplace\",\"label\":\"contract L2OutputOracle\",\"numberOfBytes\":\"20\"},\"t_contract(SystemConfig)1012\":{\"encoding\":\"inplace\",\"label\":\"contract SystemConfig\",\"numberOfBytes\":\"20\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_mapping(t_bytes32,t_struct(ProvenWithdrawal)1013_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e struct OptimismPortal.ProvenWithdrawal)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_struct(ProvenWithdrawal)1013_storage\"},\"t_struct(ProvenWithdrawal)1013_storage\":{\"encoding\":\"inplace\",\"label\":\"struct OptimismPortal.ProvenWithdrawal\",\"numberOfBytes\":\"64\"},\"t_struct(ResourceParams)1014_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ResourceMetering.ResourceParams\",\"numberOfBytes\":\"32\"},\"t_uint128\":{\"encoding\":\"inplace\",\"label\":\"uint128\",\"numberOfBytes\":\"16\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
const OptimismPortalStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1001,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1002,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"params\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_struct(ResourceParams)1014_storage\"},{\"astId\":1003,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_array(t_uint256)48_storage\"},{\"astId\":1004,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"l2Sender\",\"offset\":0,\"slot\":\"50\",\"type\":\"t_address\"},{\"astId\":1005,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"finalizedWithdrawals\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1006,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"provenWithdrawals\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_mapping(t_bytes32,t_struct(ProvenWithdrawal)1013_storage)\"},{\"astId\":1007,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"paused\",\"offset\":0,\"slot\":\"53\",\"type\":\"t_bool\"},{\"astId\":1008,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"$l2Oracle\",\"offset\":1,\"slot\":\"53\",\"type\":\"t_contract(L2OutputOracle)1011\"},{\"astId\":1009,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"$systemConfig\",\"offset\":0,\"slot\":\"54\",\"type\":\"t_contract(SystemConfig)1012\"},{\"astId\":1010,\"contract\":\"src/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"$guardian\",\"offset\":0,\"slot\":\"55\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)48_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[48]\",\"numberOfBytes\":\"1536\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_contract(L2OutputOracle)1011\":{\"encoding\":\"inplace\",\"label\":\"contract L2OutputOracle\",\"numberOfBytes\":\"20\"},\"t_contract(SystemConfig)1012\":{\"encoding\":\"inplace\",\"label\":\"contract SystemConfig\",\"numberOfBytes\":\"20\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_mapping(t_bytes32,t_struct(ProvenWithdrawal)1013_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e struct OptimismPortal.ProvenWithdrawal)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_struct(ProvenWithdrawal)1013_storage\"},\"t_struct(ProvenWithdrawal)1013_storage\":{\"encoding\":\"inplace\",\"label\":\"struct OptimismPortal.ProvenWithdrawal\",\"numberOfBytes\":\"64\"},\"t_struct(ResourceParams)1014_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ResourceMetering.ResourceParams\",\"numberOfBytes\":\"32\"},\"t_uint128\":{\"encoding\":\"inplace\",\"label\":\"uint128\",\"numberOfBytes\":\"16\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var OptimismPortalStorageLayout = new(solc.StorageLayout)
......
......@@ -63,9 +63,9 @@
| finalizedWithdrawals | mapping(bytes32 => bool) | 51 | 0 | 32 | src/L1/OptimismPortal.sol:OptimismPortal |
| provenWithdrawals | mapping(bytes32 => struct OptimismPortal.ProvenWithdrawal) | 52 | 0 | 32 | src/L1/OptimismPortal.sol:OptimismPortal |
| paused | bool | 53 | 0 | 1 | src/L1/OptimismPortal.sol:OptimismPortal |
| _L2_ORACLE | contract L2OutputOracle | 53 | 1 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
| _SYSTEM_CONFIG | contract SystemConfig | 54 | 0 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
| _GUARDIAN | address | 55 | 0 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
| $l2Oracle | contract L2OutputOracle | 53 | 1 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
| $systemConfig | contract SystemConfig | 54 | 0 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
| $guardian | address | 55 | 0 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
=======================
➡ src/L1/SystemConfig.sol:SystemConfig
......
......@@ -3,7 +3,7 @@
"src/L1/L1ERC721Bridge.sol": "0xac9d8e236a1b35c358f9800834f65375cf4270155e817cf3d0f2bac1968f9107",
"src/L1/L1StandardBridge.sol": "0x26fd79e041c403f4bc68758c410fcc801975e7648c0b51a2c4a6e8c44fabcbfd",
"src/L1/L2OutputOracle.sol": "0xd6c5eb38732077c4705f46a61be68a7beccc069a99ed1d07b8e1fc6e1de8ffa6",
"src/L1/OptimismPortal.sol": "0xc72b51200ad87d5be0d1232a04931f2143b282e1c38ab3bfc05a59ac2cee7d58",
"src/L1/OptimismPortal.sol": "0xaec3d476e2b892a56a7214aa1cceb33584457fd5f68c66730bb7cf27ddc7b57b",
"src/L1/SystemConfig.sol": "0x8e2b5103d2eb93b74af2e2f96a4505e637cdc3c44d80cf5ec2eca70060e1deff",
"src/L2/BaseFeeVault.sol": "0xa596e60762f16192cfa86459fcb9f4da9d8f756106eedac643a1ffeafbbfcc5f",
"src/L2/GasPriceOracle.sol": "0xc735a8bf01ad8bca194345748537bfd9924909c0342bc133c4a31e2fb8cb9882",
......
......@@ -53,15 +53,15 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
/// @notice Address of the L2OutputOracle contract.
/// @custom:network-specific
L2OutputOracle internal _L2_ORACLE;
L2OutputOracle internal $l2Oracle;
/// @notice Address of the SystemConfig contract.
/// @custom:network-specific
SystemConfig internal _SYSTEM_CONFIG;
SystemConfig internal $systemConfig;
/// @notice Address that has the ability to pause and unpause withdrawals.
/// @custom:network-specific
address internal _GUARDIAN;
address internal $guardian;
/// @notice Emitted when a transaction is deposited from L1 to L2.
/// The parameters of this event are read by the rollup node and used to derive deposit
......@@ -106,9 +106,9 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
_;
}
/// @custom:semver 1.7.2
/// @custom:semver 1.8.0
/// @notice Constructs the OptimismPortal contract.
constructor() Semver(1, 7, 2) {
constructor() Semver(1, 8, 0) {
initialize({
_l2Oracle: L2OutputOracle(address(0)),
_guardian: address(0),
......@@ -129,9 +129,9 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
bool _paused
) public reinitializer(2) {
l2Sender = Constants.DEFAULT_L2_SENDER;
_L2_ORACLE = _l2Oracle;
_SYSTEM_CONFIG = _systemConfig;
_GUARDIAN = _guardian;
$l2Oracle = _l2Oracle;
$systemConfig = _systemConfig;
$guardian = _guardian;
paused = _paused;
__ResourceMetering_init();
}
......@@ -139,46 +139,46 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
/// @notice Getter for the L2OutputOracle
/// @custom:legacy
function L2_ORACLE() external view returns (L2OutputOracle) {
return _L2_ORACLE;
return $l2Oracle;
}
/// @notice Getter for the L2OutputOracle
function l2Oracle() external view returns (L2OutputOracle) {
return _L2_ORACLE;
return $l2Oracle;
}
/// @notice Getter for the SystemConfig
/// @custom:legacy
function SYSTEM_CONFIG() external view returns (SystemConfig) {
return _SYSTEM_CONFIG;
return $systemConfig;
}
/// @notice Getter for the SystemConfig
function systemConfig() external view returns (SystemConfig) {
return _SYSTEM_CONFIG;
return $systemConfig;
}
/// @notice Getter for the Guardian
/// @custom:legacy
function GUARDIAN() external view returns (address) {
return _GUARDIAN;
return $guardian;
}
/// @notice Getter for the Guardian
function guardian() external view returns (address) {
return _GUARDIAN;
return $guardian;
}
/// @notice Pauses withdrawals.
function pause() external {
require(msg.sender == _GUARDIAN, "OptimismPortal: only guardian can pause");
require(msg.sender == $guardian, "OptimismPortal: only guardian can pause");
paused = true;
emit Paused(msg.sender);
}
/// @notice Unpauses withdrawals.
function unpause() external {
require(msg.sender == _GUARDIAN, "OptimismPortal: only guardian can unpause");
require(msg.sender == $guardian, "OptimismPortal: only guardian can unpause");
paused = false;
emit Unpaused(msg.sender);
}
......@@ -220,7 +220,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
override
returns (ResourceMetering.ResourceConfig memory)
{
return _SYSTEM_CONFIG.resourceConfig();
return $systemConfig.resourceConfig();
}
/// @notice Proves a withdrawal transaction.
......@@ -244,7 +244,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// Get the output root and load onto the stack to prevent multiple mloads. This will
// revert if there is no output root for the given block number.
bytes32 outputRoot = _L2_ORACLE.getL2Output(_l2OutputIndex).outputRoot;
bytes32 outputRoot = $l2Oracle.getL2Output(_l2OutputIndex).outputRoot;
// Verify that the output root can be generated with the elements in the proof.
require(
......@@ -264,7 +264,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// output index has been updated.
require(
provenWithdrawal.timestamp == 0 ||
_L2_ORACLE.getL2Output(provenWithdrawal.l2OutputIndex).outputRoot !=
$l2Oracle.getL2Output(provenWithdrawal.l2OutputIndex).outputRoot !=
provenWithdrawal.outputRoot,
"OptimismPortal: withdrawal hash has already been proven"
);
......@@ -336,7 +336,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// starting timestamp inside the L2OutputOracle. Not strictly necessary but extra layer of
// safety against weird bugs in the proving step.
require(
provenWithdrawal.timestamp >= _L2_ORACLE.startingTimestamp(),
provenWithdrawal.timestamp >= $l2Oracle.startingTimestamp(),
"OptimismPortal: withdrawal timestamp less than L2 Oracle starting timestamp"
);
......@@ -351,7 +351,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// Grab the OutputProposal from the L2OutputOracle, will revert if the output that
// corresponds to the given index has not been proposed yet.
Types.OutputProposal memory proposal = _L2_ORACLE.getL2Output(
Types.OutputProposal memory proposal = $l2Oracle.getL2Output(
provenWithdrawal.l2OutputIndex
);
......@@ -471,7 +471,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
/// @param _l2OutputIndex Index of the L2 output to check.
/// @return Whether or not the output is finalized.
function isOutputFinalized(uint256 _l2OutputIndex) external view returns (bool) {
return _isFinalizationPeriodElapsed(_L2_ORACLE.getL2Output(_l2OutputIndex).timestamp);
return _isFinalizationPeriodElapsed($l2Oracle.getL2Output(_l2OutputIndex).timestamp);
}
/// @notice Determines whether the finalization period has elapsed with respect to
......@@ -479,6 +479,6 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
/// @param _timestamp Timestamp to check.
/// @return Whether or not the finalization period has elapsed.
function _isFinalizationPeriodElapsed(uint256 _timestamp) internal view returns (bool) {
return block.timestamp > _timestamp + _L2_ORACLE.FINALIZATION_PERIOD_SECONDS();
return block.timestamp > _timestamp + $l2Oracle.FINALIZATION_PERIOD_SECONDS();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment