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
f58973a9
Commit
f58973a9
authored
Aug 07, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
systemconfig: updates
parent
bc0e517b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
23 deletions
+66
-23
SystemConfig.sol
packages/contracts-bedrock/src/L1/SystemConfig.sol
+9
-8
SystemConfig.t.sol
packages/contracts-bedrock/test/SystemConfig.t.sol
+57
-15
No files found.
packages/contracts-bedrock/src/L1/SystemConfig.sol
View file @
f58973a9
...
...
@@ -25,6 +25,8 @@ contract SystemConfig is OwnableUpgradeable, Semver {
UNSAFE_BLOCK_SIGNER
}
/// @notice Struct representing the addresses of L1 system contracts. These should be the
/// proxies and will differ for each OP Stack chain.
struct Addresses {
address l1CrossDomainMessenger;
address l1ERC721Bridge;
...
...
@@ -42,22 +44,22 @@ contract SystemConfig is OwnableUpgradeable, Semver {
/// proof to fetch this value.
bytes32 public constant UNSAFE_BLOCK_SIGNER_SLOT = keccak256("systemconfig.unsafeblocksigner");
/// @notice
/// @notice
Storage slot that the L1CrossDomainMessenger address is stored at.
bytes32 public constant L1_CROSS_DOMAIN_MESSENGER_SLOT = keccak256("systemconfig.l1crossdomainmessenger");
/// @notice
/// @notice
Storage slot that the L1ERC721Bridge address is stored at.
bytes32 public constant L1_ERC_721_BRIDGE_SLOT = keccak256("systemconfig.l1erc721bridge");
/// @notice
/// @notice
Storage slot that the L1StandardBridge address is stored at.
bytes32 public constant L1_STANDARD_BRIDGE_SLOT = keccak256("systemconfig.l1standardbridge");
/// @notice
/// @notice
Storage slot that the L2OutputOracle address is stored at.
bytes32 public constant L2_OUTPUT_ORACLE_SLOT = keccak256("systemconfig.l2outputoracle");
/// @notice
/// @notice
Storage slot that the OptimismPortal address is stored at.
bytes32 public constant OPTIMISM_PORTAL_SLOT = keccak256("systemconfig.optimismportal");
/// @notice
/// @notice
Storage slot that the batch inbox address is stored at.
bytes32 public constant BATCH_INBOX_SLOT = keccak256("systemconfig.batchinbox");
/// @notice Fixed L2 gas overhead. Used as part of the L2 fee calculation.
...
...
@@ -85,8 +87,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
/// @param data Encoded update data.
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
/// @notice The block at which the op-node can start searching for
/// logs from.
/// @notice The block at which the op-node can start searching for logs from.
uint256 public startBlock;
/// @custom:semver 1.4.0
...
...
packages/contracts-bedrock/test/SystemConfig.t.sol
View file @
f58973a9
...
...
@@ -18,6 +18,19 @@ contract SystemConfig_Init is CommonTest {
SystemConfig sysConf;
SystemConfig systemConfigImpl;
// Dummy addresses used to test getters
address constant batchInbox = address(0x18);
address constant l1CrossDomainMessenger = address(0x20);
address constant l1ERC721Bridge = address(0x21);
address constant l1StandardBridge = address(0x22);
address constant l2OutputOracle = address(0x23);
address constant optimismPortal = address(0x24);
uint256 constant overhead = 2100;
uint256 constant scalar = 1000000;
bytes32 constant batcherHash = bytes32(hex"abcd");
uint64 constant gasLimit = 30_000_000;
address constant unsafeBlockSigner = address(1);
function setUp() public virtual override {
super.setUp();
...
...
@@ -30,21 +43,21 @@ contract SystemConfig_Init is CommonTest {
abi.encodeCall(
SystemConfig.initialize,
(
alice, //_owner,
2100,
//_overhead,
1000000,
//_scalar,
b
ytes32(hex"abcd"), //_batcherHash,
30_000_000,
//_gasLimit,
address(1),
//_unsafeBlockSigner,
Constants.DEFAULT_RESOURCE_CONFIG(), //_config,
0, //_startBlock
address(0),
// _batchInbox
SystemConfig.Addresses({ // _addresses
l1CrossDomainMessenger:
address(0)
,
l1ERC721Bridge:
address(0)
,
l1StandardBridge:
address(0)
,
l2OutputOracle:
address(0)
,
optimismPortal:
address(0)
alice,
//_owner,
overhead,
//_overhead,
scalar,
//_scalar,
b
atcherHash, // _batcherHash
gasLimit,
//_gasLimit,
unsafeBlockSigner,
//_unsafeBlockSigner,
Constants.DEFAULT_RESOURCE_CONFIG(),
//_config,
0,
//_startBlock
batchInbox,
// _batchInbox
SystemConfig.Addresses({
// _addresses
l1CrossDomainMessenger:
l1CrossDomainMessenger
,
l1ERC721Bridge:
l1ERC721Bridge
,
l1StandardBridge:
l1StandardBridge
,
l2OutputOracle:
l2OutputOracle
,
optimismPortal:
optimismPortal
})
)
)
...
...
@@ -54,6 +67,35 @@ contract SystemConfig_Init is CommonTest {
}
}
contract SystemConfig_Initialize_Test is SystemConfig_Init {
/// @dev Tests that initailization sets the correct values.
function test_initialize_values() external {
assertEq(sysConf.l1CrossDomainMessenger(), l1CrossDomainMessenger);
assertEq(sysConf.l1ERC721Bridge(), l1ERC721Bridge);
assertEq(sysConf.l1StandardBridge(), l1StandardBridge);
assertEq(sysConf.l2OutputOracle(), l2OutputOracle);
assertEq(sysConf.optimismPortal(), optimismPortal);
assertEq(sysConf.batchInbox(), batchInbox);
assertEq(sysConf.owner(), alice);
assertEq(sysConf.overhead(), overhead);
assertEq(sysConf.scalar(), scalar);
assertEq(sysConf.batcherHash(), batcherHash);
assertEq(sysConf.gasLimit(), gasLimit);
assertEq(sysConf.unsafeBlockSigner(), unsafeBlockSigner);
// Depends on start block being set to 0 in `initialize`
assertEq(sysConf.startBlock(), block.number);
// Depends on `initialize` being called with defaults
ResourceMetering.ResourceConfig memory cfg = Constants.DEFAULT_RESOURCE_CONFIG();
ResourceMetering.ResourceConfig memory actual = sysConf.resourceConfig();
assertEq(actual.maxResourceLimit, cfg.maxResourceLimit);
assertEq(actual.elasticityMultiplier, cfg.elasticityMultiplier);
assertEq(actual.baseFeeMaxChangeDenominator, cfg.baseFeeMaxChangeDenominator);
assertEq(actual.minimumBaseFee, cfg.minimumBaseFee);
assertEq(actual.systemTxMaxGas, cfg.systemTxMaxGas);
assertEq(actual.maximumBaseFee, cfg.maximumBaseFee);
}
}
contract SystemConfig_Initialize_TestFail is SystemConfig_Init {
/// @dev Tests that initialization reverts if the gas limit is too low.
function test_initialize_lowGasLimit_reverts() external {
...
...
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