Commit 24123795 authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix(ct): deploy MIPS2 properly (#12365)

Adds a new configuration to DeployImplementations so that it
knows which MIPS version to deploy.
parent c938fdfc
......@@ -1422,7 +1422,7 @@ workflows:
- semgrep-scan
- semgrep-scan:
name: semgrep-scan-local
scan_command: semgrep scan --timeout=100 --config=./.semgrep --strict --error .
scan_command: semgrep scan --timeout=100 --config=./.semgrep --error .
- go-lint:
requires:
- go-mod-download
......
......@@ -16,6 +16,7 @@ type DeployImplementationsInput struct {
ChallengePeriodSeconds *big.Int
ProofMaturityDelaySeconds *big.Int
DisputeGameFinalityDelaySeconds *big.Int
MipsVersion *big.Int
// Release version to set OPCM implementations for, of the format `op-contracts/vX.Y.Z`.
Release string
SuperchainConfigProxy common.Address
......
......@@ -55,6 +55,7 @@ func DeployImplementations(ctx context.Context, env *Env, artifactsFS foundry.St
ChallengePeriodSeconds: big.NewInt(86400),
ProofMaturityDelaySeconds: big.NewInt(604800),
DisputeGameFinalityDelaySeconds: big.NewInt(302400),
MipsVersion: big.NewInt(1),
Release: intent.ContractsRelease,
SuperchainConfigProxy: st.SuperchainDeployment.SuperchainConfigProxyAddress,
ProtocolVersionsProxy: st.SuperchainDeployment.ProtocolVersionsProxyAddress,
......
......@@ -31,6 +31,7 @@ type SuperFaultProofConfig struct {
ChallengePeriodSeconds *big.Int
ProofMaturityDelaySeconds *big.Int
DisputeGameFinalityDelaySeconds *big.Int
MipsVersion *big.Int
}
type OPCMImplementationsConfig struct {
......
......@@ -166,6 +166,7 @@ func DeploySuperchainToL1(l1Host *script.Host, superCfg *SuperchainConfig) (*Sup
ChallengePeriodSeconds: superCfg.Implementations.FaultProof.ChallengePeriodSeconds,
ProofMaturityDelaySeconds: superCfg.Implementations.FaultProof.ProofMaturityDelaySeconds,
DisputeGameFinalityDelaySeconds: superCfg.Implementations.FaultProof.DisputeGameFinalityDelaySeconds,
MipsVersion: superCfg.Implementations.FaultProof.MipsVersion,
Release: superCfg.Implementations.Release,
SuperchainConfigProxy: superDeployment.SuperchainConfigProxy,
ProtocolVersionsProxy: superDeployment.ProtocolVersionsProxy,
......
......@@ -75,6 +75,7 @@ func (r *InteropDevRecipe) Build(addrs devkeys.Addresses) (*WorldConfig, error)
ChallengePeriodSeconds: big.NewInt(120),
ProofMaturityDelaySeconds: big.NewInt(12),
DisputeGameFinalityDelaySeconds: big.NewInt(6),
MipsVersion: big.NewInt(1),
},
UseInterop: true,
StandardVersionsToml: opcm.StandardVersionsMainnetData,
......
......@@ -49,6 +49,7 @@ contract DeployImplementationsInput is BaseDeployIO {
uint256 internal _challengePeriodSeconds;
uint256 internal _proofMaturityDelaySeconds;
uint256 internal _disputeGameFinalityDelaySeconds;
uint256 internal _mipsVersion;
// The release version to set OPCM implementations for, of the format `op-contracts/vX.Y.Z`.
string internal _release;
......@@ -75,6 +76,8 @@ contract DeployImplementationsInput is BaseDeployIO {
_proofMaturityDelaySeconds = _value;
} else if (_sel == this.disputeGameFinalityDelaySeconds.selector) {
_disputeGameFinalityDelaySeconds = _value;
} else if (_sel == this.mipsVersion.selector) {
_mipsVersion = _value;
} else {
revert("DeployImplementationsInput: unknown selector");
}
......@@ -133,6 +136,11 @@ contract DeployImplementationsInput is BaseDeployIO {
return _disputeGameFinalityDelaySeconds;
}
function mipsVersion() public view returns (uint256) {
require(_mipsVersion != 0, "DeployImplementationsInput: not set");
return _mipsVersion;
}
function release() public view returns (string memory) {
require(!LibString.eq(_release, ""), "DeployImplementationsInput: not set");
return _release;
......@@ -959,11 +967,12 @@ contract DeployImplementations is Script {
if (existingImplementation != address(0)) {
singleton = IMIPS(payable(existingImplementation));
} else if (isDevelopRelease(release)) {
uint256 mipsVersion = _dii.mipsVersion();
IPreimageOracle preimageOracle = IPreimageOracle(address(_dio.preimageOracleSingleton()));
vm.broadcast(msg.sender);
singleton = IMIPS(
DeployUtils.create1({
_name: "MIPS",
_name: mipsVersion == 1 ? "MIPS" : "MIPS2",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IMIPS.__constructor__, (preimageOracle)))
})
);
......
......@@ -354,6 +354,7 @@ contract Deploy is Deployer {
dii.set(dii.challengePeriodSeconds.selector, cfg.preimageOracleChallengePeriod());
dii.set(dii.proofMaturityDelaySeconds.selector, cfg.proofMaturityDelaySeconds());
dii.set(dii.disputeGameFinalityDelaySeconds.selector, cfg.disputeGameFinalityDelaySeconds());
dii.set(dii.mipsVersion.selector, Config.useMultithreadedCannon() ? 2 : 1);
string memory release = "dev";
dii.set(dii.release.selector, release);
dii.set(
......
......@@ -438,6 +438,7 @@ contract DeployImplementations_Test is Test {
dii.set(dii.challengePeriodSeconds.selector, challengePeriodSeconds);
dii.set(dii.proofMaturityDelaySeconds.selector, proofMaturityDelaySeconds);
dii.set(dii.disputeGameFinalityDelaySeconds.selector, disputeGameFinalityDelaySeconds);
dii.set(dii.mipsVersion.selector, 1);
dii.set(dii.release.selector, release);
dii.set(dii.superchainConfigProxy.selector, address(superchainConfigProxy));
dii.set(dii.protocolVersionsProxy.selector, address(protocolVersionsProxy));
......@@ -451,6 +452,7 @@ contract DeployImplementations_Test is Test {
assertEq(challengePeriodSeconds, dii.challengePeriodSeconds(), "300");
assertEq(proofMaturityDelaySeconds, dii.proofMaturityDelaySeconds(), "400");
assertEq(disputeGameFinalityDelaySeconds, dii.disputeGameFinalityDelaySeconds(), "500");
assertEq(1, dii.mipsVersion(), "512");
assertEq(release, dii.release(), "525");
assertEq(address(superchainConfigProxy), address(dii.superchainConfigProxy()), "550");
assertEq(address(protocolVersionsProxy), address(dii.protocolVersionsProxy()), "575");
......@@ -471,6 +473,7 @@ contract DeployImplementations_Test is Test {
dii.set(dii.challengePeriodSeconds.selector, challengePeriodSeconds);
dii.set(dii.proofMaturityDelaySeconds.selector, proofMaturityDelaySeconds);
dii.set(dii.disputeGameFinalityDelaySeconds.selector, disputeGameFinalityDelaySeconds);
dii.set(dii.mipsVersion.selector, 1);
string memory release = "dev-release";
dii.set(dii.release.selector, release);
dii.set(dii.superchainConfigProxy.selector, address(superchainConfigProxy));
......
......@@ -424,6 +424,7 @@ contract DeployOPChain_TestBase is Test {
dii.set(dii.challengePeriodSeconds.selector, challengePeriodSeconds);
dii.set(dii.proofMaturityDelaySeconds.selector, proofMaturityDelaySeconds);
dii.set(dii.disputeGameFinalityDelaySeconds.selector, disputeGameFinalityDelaySeconds);
dii.set(dii.mipsVersion.selector, 1);
dii.set(dii.release.selector, release);
dii.set(dii.superchainConfigProxy.selector, address(superchainConfigProxy));
dii.set(dii.protocolVersionsProxy.selector, address(protocolVersionsProxy));
......
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