Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions op-chain-ops/deployer/opcm/opchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type DeployOPChainInput struct {
L2ChainId *big.Int
OpcmProxy common.Address
SaltMixer string
GasLimit uint64
}

func (input *DeployOPChainInput) InputSet() bool {
Expand Down Expand Up @@ -124,6 +125,7 @@ type opcmDeployInput struct {
L2ChainId *big.Int
StartingAnchorRoots []byte
SaltMixer string
GasLimit uint64
}

// decodeOutputABIJSON defines an ABI for a fake method called "decodeOutput" that returns the
Expand Down Expand Up @@ -243,6 +245,7 @@ func DeployOPChainRaw(
L2ChainId: input.L2ChainId,
StartingAnchorRoots: input.StartingAnchorRoots(),
SaltMixer: input.SaltMixer,
GasLimit: input.GasLimit,
})
if err != nil {
return out, fmt.Errorf("failed to pack deploy input: %w", err)
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/deployer/pipeline/opchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func DeployOPChain(ctx context.Context, env *Env, artifactsFS foundry.StatDirFs,
L2ChainId: chainID.Big(),
OpcmProxy: st.ImplementationsDeployment.OpcmProxyAddress,
SaltMixer: st.Create2Salt.String(), // passing through salt generated at state initialization
GasLimit: 30_000_000, // TODO: make this configurable
}

var dco opcm.DeployOPChainOutput
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/interopgen/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type L2Config struct {
genesis.L2InitializationConfig
Prefund map[common.Address]*big.Int
SaltMixer string
GasLimit uint64
}

func (c *L2Config) Check(log log.Logger) error {
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/interopgen/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func DeployL2ToL1(l1Host *script.Host, superCfg *SuperchainConfig, superDeployme
L2ChainId: new(big.Int).SetUint64(cfg.L2ChainID),
OpcmProxy: superDeployment.OpcmProxy,
SaltMixer: cfg.SaltMixer,
GasLimit: cfg.GasLimit,
})
if err != nil {
return nil, fmt.Errorf("failed to deploy L2 OP chain: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion op-chain-ops/interopgen/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.Addresses) (*
UseAltDA: false,
},
},
Prefund: make(map[common.Address]*big.Int),
Prefund: make(map[common.Address]*big.Int),
SaltMixer: "",
GasLimit: 30_000_000,
}

// TODO(#11887): consider making the number of prefunded keys configurable.
Expand Down
12 changes: 10 additions & 2 deletions packages/contracts-bedrock/scripts/DeployOPChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ contract DeployOPChainInput is BaseDeployIO {
uint256 internal _l2ChainId;
OPContractsManager internal _opcmProxy;
string internal _saltMixer;
uint64 internal _gasLimit;

function set(bytes4 _sel, address _addr) public {
require(_addr != address(0), "DeployOPChainInput: cannot set zero address");
Expand All @@ -69,6 +70,8 @@ contract DeployOPChainInput is BaseDeployIO {
} else if (_sel == this.l2ChainId.selector) {
require(_value != 0 && _value != block.chainid, "DeployOPChainInput: invalid l2ChainId");
_l2ChainId = _value;
} else if (_sel == this.gasLimit.selector) {
_gasLimit = SafeCast.toUint64(_value);
} else {
revert("DeployOPChainInput: unknown selector");
}
Expand Down Expand Up @@ -156,6 +159,10 @@ contract DeployOPChainInput is BaseDeployIO {
function saltMixer() public view returns (string memory) {
return _saltMixer;
}

function gasLimit() public view returns (uint64) {
return _gasLimit;
}
}

contract DeployOPChainOutput is BaseDeployIO {
Expand Down Expand Up @@ -374,7 +381,7 @@ contract DeployOPChainOutput is BaseDeployIO {
require(systemConfig.basefeeScalar() == _doi.basefeeScalar(), "SYSCON-20");
require(systemConfig.blobbasefeeScalar() == _doi.blobBaseFeeScalar(), "SYSCON-30");
require(systemConfig.batcherHash() == bytes32(uint256(uint160(_doi.batcher()))), "SYSCON-40");
require(systemConfig.gasLimit() == uint64(30000000), "SYSCON-50"); // TODO allow other gas limits?
require(systemConfig.gasLimit() == uint64(30_000_000), "SYSCON-50");
require(systemConfig.unsafeBlockSigner() == _doi.unsafeBlockSigner(), "SYSCON-60");
require(systemConfig.scalar() >> 248 == 1, "SYSCON-70");

Expand Down Expand Up @@ -514,7 +521,8 @@ contract DeployOPChain is Script {
blobBasefeeScalar: _doi.blobBaseFeeScalar(),
l2ChainId: _doi.l2ChainId(),
startingAnchorRoots: _doi.startingAnchorRoots(),
saltMixer: _doi.saltMixer()
saltMixer: _doi.saltMixer(),
gasLimit: _doi.gasLimit()
});

vm.broadcast(msg.sender);
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"sourceCodeHash": "0xde4df0f9633dc0cdb1c9f634003ea5b0f7c5c1aebc407bc1b2f44c0ecf938649"
},
"src/L1/OPContractsManager.sol": {
"initCodeHash": "0xa0c1139a01cef2445266c71175eff2d36e4b3a7584b198835ed8cba4f7143704",
"sourceCodeHash": "0x67f9846a215d0817a75b4beee50925861d14da2cab1b699bb4e8ae89fa12d01b"
"initCodeHash": "0xfaab186a660764265a837fac689a6d8602454c6ca9f39b5244282768b8d86b3a",
"sourceCodeHash": "0x831b7268e1beb93050dbaae1e83e17635385bd101779146a95150084f69d2835"
},
"src/L1/OptimismPortal.sol": {
"initCodeHash": "0xbe2c0c81b3459014f287d8c89cdc0d27dde5d1f44e5d024fa1e4773ddc47c190",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
"internalType": "string",
"name": "saltMixer",
"type": "string"
},
{
"internalType": "uint64",
"name": "gasLimit",
"type": "uint64"
}
],
"internalType": "struct OPContractsManager.DeployInput",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
"internalType": "string",
"name": "saltMixer",
"type": "string"
},
{
"internalType": "uint64",
"name": "gasLimit",
"type": "uint64"
}
],
"internalType": "struct OPContractsManager.DeployInput",
Expand Down
9 changes: 5 additions & 4 deletions packages/contracts-bedrock/src/L1/OPContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ contract OPContractsManager is ISemver, Initializable {
bytes startingAnchorRoots;
// The salt mixer is used as part of making the resulting salt unique.
string saltMixer;
uint64 gasLimit;
}

/// @notice The full set of outputs from deploying a new OP Stack chain.
Expand Down Expand Up @@ -124,8 +125,8 @@ contract OPContractsManager is ISemver, Initializable {

// -------- Constants and Variables --------

/// @custom:semver 1.0.0-beta.17
string public constant version = "1.0.0-beta.17";
/// @custom:semver 1.0.0-beta.18
string public constant version = "1.0.0-beta.18";

/// @notice Represents the interface version so consumers know how to decode the DeployOutput struct
/// that's emitted in the `Deployed` event. Whenever that struct changes, a new version should be used.
Expand Down Expand Up @@ -467,7 +468,7 @@ contract OPContractsManager is ISemver, Initializable {
_input.basefeeScalar,
_input.blobBasefeeScalar,
bytes32(uint256(uint160(_input.roles.batcher))), // batcherHash
30_000_000,
_input.gasLimit,
_input.roles.unsafeBlockSigner,
referenceResourceConfig,
chainIdToBatchInboxAddress(_input.l2ChainId),
Expand All @@ -486,7 +487,7 @@ contract OPContractsManager is ISemver, Initializable {
_input.basefeeScalar,
_input.blobBasefeeScalar,
bytes32(uint256(uint160(_input.roles.batcher))), // batcherHash
30_000_000,
_input.gasLimit,
_input.roles.unsafeBlockSigner,
referenceResourceConfig,
chainIdToBatchInboxAddress(_input.l2ChainId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract OPContractsManagerInterop is OPContractsManager {
_input.basefeeScalar,
_input.blobBasefeeScalar,
bytes32(uint256(uint160(_input.roles.batcher))), // batcherHash
30_000_000, // gasLimit TODO make this configurable?
_input.gasLimit,
_input.roles.unsafeBlockSigner,
referenceResourceConfig,
chainIdToBatchInboxAddress(_input.l2ChainId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ contract OPContractsManager_Deploy_Test is DeployOPChain_TestBase {
doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar);
doi.set(doi.l2ChainId.selector, l2ChainId);
doi.set(doi.opcmProxy.selector, address(opcm));
doi.set(doi.gasLimit.selector, gasLimit);
}

// This helper function is used to convert the input struct type defined in DeployOPChain.s.sol
Expand All @@ -71,7 +72,8 @@ contract OPContractsManager_Deploy_Test is DeployOPChain_TestBase {
blobBasefeeScalar: _doi.blobBaseFeeScalar(),
l2ChainId: _doi.l2ChainId(),
startingAnchorRoots: _doi.startingAnchorRoots(),
saltMixer: _doi.saltMixer()
saltMixer: _doi.saltMixer(),
gasLimit: _doi.gasLimit()
});
}

Expand Down
3 changes: 3 additions & 0 deletions packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ contract DeployOPChain_TestBase is Test {
AnchorStateRegistry.StartingAnchorRoot[] startingAnchorRoots;
OPContractsManager opcm = OPContractsManager(address(0));
string saltMixer = "defaultSaltMixer";
uint64 gasLimit = 30_000_000;

function setUp() public virtual {
// Set defaults for reference types
Expand Down Expand Up @@ -481,6 +482,7 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
doi.set(doi.l2ChainId.selector, l2ChainId);
doi.set(doi.opcmProxy.selector, address(opcm)); // Not fuzzed since it must be an actual instance.
doi.set(doi.saltMixer.selector, saltMixer);
doi.set(doi.gasLimit.selector, gasLimit);

deployOPChain.run(doi, doo);

Expand All @@ -497,6 +499,7 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
assertEq(blobBaseFeeScalar, doi.blobBaseFeeScalar(), "800");
assertEq(l2ChainId, doi.l2ChainId(), "900");
assertEq(saltMixer, doi.saltMixer(), "1000");
assertEq(gasLimit, doi.gasLimit(), "1100");

// Assert inputs were properly passed through to the contract initializers.
assertEq(address(doo.opChainProxyAdmin().owner()), opChainProxyAdminOwner, "2100");
Expand Down