Commit c38c669c authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: fix system config initialize

Every sentinel contract should have null values in their
storage to make them unusable. Sometimes there are constraints
on what these values can be in the initializer and they cannot
be exactly 0 but must be close enough to make the contract
useless. This commit updates the startBlock number so that
it is not 0 because if it is 0 then it will be set to `block.number`
which is not what we want.
parent 6cc232ea
...@@ -37,5 +37,6 @@ ...@@ -37,5 +37,6 @@
"l2GenesisBlockBaseFeePerGas": "0x3b9aca00", "l2GenesisBlockBaseFeePerGas": "0x3b9aca00",
"eip1559Denominator": 50, "eip1559Denominator": 50,
"eip1559Elasticity": 6, "eip1559Elasticity": 6,
"l2GenesisRegolithTimeOffset": "0x0" "l2GenesisRegolithTimeOffset": "0x0",
"systemConfigStartBlock": 0
} }
...@@ -395,7 +395,6 @@ contract Deploy is Deployer { ...@@ -395,7 +395,6 @@ contract Deploy is Deployer {
/// @notice Deploy the SystemConfig /// @notice Deploy the SystemConfig
function deploySystemConfig() public broadcast returns (address addr_) { function deploySystemConfig() public broadcast returns (address addr_) {
SystemConfig config = new SystemConfig(); SystemConfig config = new SystemConfig();
bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));
require(config.owner() == address(0xdEaD)); require(config.owner() == address(0xdEaD));
require(config.overhead() == 0); require(config.overhead() == 0);
...@@ -418,7 +417,7 @@ contract Deploy is Deployer { ...@@ -418,7 +417,7 @@ contract Deploy is Deployer {
require(config.optimismPortal() == address(0)); require(config.optimismPortal() == address(0));
require(config.l1CrossDomainMessenger() == address(0)); require(config.l1CrossDomainMessenger() == address(0));
require(config.optimismMintableERC20Factory() == address(0)); require(config.optimismMintableERC20Factory() == address(0));
require(config.startBlock() == 0); require(config.startBlock() == 1);
save("SystemConfig", address(config)); save("SystemConfig", address(config));
console.log("SystemConfig deployed at %s", address(config)); console.log("SystemConfig deployed at %s", address(config));
...@@ -490,6 +489,7 @@ contract Deploy is Deployer { ...@@ -490,6 +489,7 @@ contract Deploy is Deployer {
address systemConfig = mustGetAddress("SystemConfig"); address systemConfig = mustGetAddress("SystemConfig");
bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress()))); bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));
uint256 startBlock = cfg.systemConfigStartBlock();
proxyAdmin.upgradeAndCall({ proxyAdmin.upgradeAndCall({
_proxy: payable(systemConfigProxy), _proxy: payable(systemConfigProxy),
...@@ -504,7 +504,7 @@ contract Deploy is Deployer { ...@@ -504,7 +504,7 @@ contract Deploy is Deployer {
uint64(cfg.l2GenesisBlockGasLimit()), uint64(cfg.l2GenesisBlockGasLimit()),
cfg.p2pSequencerAddress(), cfg.p2pSequencerAddress(),
Constants.DEFAULT_RESOURCE_CONFIG(), Constants.DEFAULT_RESOURCE_CONFIG(),
cfg.systemConfigStartBlock(), startBlock,
cfg.batchInboxAddress(), cfg.batchInboxAddress(),
SystemConfig.Addresses({ SystemConfig.Addresses({
l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"), l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"),
...@@ -542,7 +542,13 @@ contract Deploy is Deployer { ...@@ -542,7 +542,13 @@ contract Deploy is Deployer {
require(config.l2OutputOracle() == mustGetAddress("L2OutputOracleProxy")); require(config.l2OutputOracle() == mustGetAddress("L2OutputOracleProxy"));
require(config.optimismPortal() == mustGetAddress("OptimismPortalProxy")); require(config.optimismPortal() == mustGetAddress("OptimismPortalProxy"));
require(config.l1CrossDomainMessenger() == mustGetAddress("L1CrossDomainMessengerProxy")); require(config.l1CrossDomainMessenger() == mustGetAddress("L1CrossDomainMessengerProxy"));
require(config.startBlock() == cfg.systemConfigStartBlock());
// A non zero start block is an override
if (startBlock != 0) {
require(config.startBlock() == startBlock);
} else {
require(config.startBlock() == block.number);
}
} }
/// @notice Initialize the L1StandardBridge /// @notice Initialize the L1StandardBridge
......
...@@ -118,7 +118,7 @@ contract SystemConfig is OwnableUpgradeable, Semver { ...@@ -118,7 +118,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
systemTxMaxGas: 0, systemTxMaxGas: 0,
maximumBaseFee: 0 maximumBaseFee: 0
}), }),
_startBlock: 0, _startBlock: 1,
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: SystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
......
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