Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ct): deploy MIPS2 properly #12365

Merged
merged 1 commit into from
Oct 8, 2024
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/deployer/opcm/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/deployer/pipeline/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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 @@ -31,6 +31,7 @@ type SuperFaultProofConfig struct {
ChallengePeriodSeconds *big.Int
ProofMaturityDelaySeconds *big.Int
DisputeGameFinalityDelaySeconds *big.Int
MipsVersion *big.Int
}

type OPCMImplementationsConfig struct {
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 @@ -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,
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/interopgen/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 10 additions & 1 deletion packages/contracts-bedrock/scripts/DeployImplementations.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)))
})
);
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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");
Expand All @@ -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));
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down