Commit 9544dc78 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6139 from ethereum-optimism/clabby/op-challenger-devnet-hack

feat(devnet): Set implementation of `FaultDisputeGame` in the factory
parents 29c1f395 f56c2040
......@@ -17,6 +17,7 @@ services:
dockerfile: Dockerfile.l1
ports:
- "8545:8545"
- "8546:8546"
- "7060:6060"
volumes:
- "l1_data:/db"
......
......@@ -43,5 +43,7 @@
"eip1559Elasticity": 2,
"l1GenesisBlockTimestamp": "0x64935846",
"l1StartingBlockTag": "earliest",
"l2GenesisRegolithTimeOffset": "0x0"
}
\ No newline at end of file
"l2GenesisRegolithTimeOffset": "0x0",
"faultGameAbsolutePrestate": 15,
"faultGameMaxDepth": 4
}
......@@ -23,9 +23,14 @@ import { SystemConfig } from "../contracts/L1/SystemConfig.sol";
import { ResourceMetering } from "../contracts/L1/ResourceMetering.sol";
import { Constants } from "../contracts/libraries/Constants.sol";
import { DisputeGameFactory } from "../contracts/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../contracts/dispute/FaultDisputeGame.sol";
import { L1ERC721Bridge } from "../contracts/L1/L1ERC721Bridge.sol";
import { Predeploys } from "../contracts/libraries/Predeploys.sol";
import { IBigStepper } from "../contracts/dispute/interfaces/IBigStepper.sol";
import { AlphabetVM } from "../contracts/test/FaultDisputeGame.t.sol";
import "../contracts/libraries/DisputeTypes.sol";
/// @title Deploy
/// @notice Script used to deploy a bedrock system. The entire system is deployed within the `run` function.
/// To add a new contract to the system, add a public function that deploys that individual contract.
......@@ -86,7 +91,10 @@ contract Deploy is Deployer {
initializeL2OutputOracle();
initializeOptimismPortal();
setFaultGameImplementation();
transferProxyAdminOwnership();
transferDisputeGameFactoryOwnership();
}
/// @notice Modifier that wraps a function in broadcasting.
......@@ -444,7 +452,7 @@ contract Deploy is Deployer {
_implementation: disputeGameFactory,
_data: abi.encodeCall(
DisputeGameFactory.initialize,
(cfg.finalSystemOwner())
(msg.sender)
)
});
......@@ -665,5 +673,35 @@ contract Deploy is Deployer {
console.log("ProxyAdmin ownership transferred to: %s", finalSystemOwner);
}
}
/// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner
function transferDisputeGameFactoryOwnership() broadcast() public {
if (block.chainid == 900) {
DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
address owner = disputeGameFactory.owner();
address finalSystemOwner = cfg.finalSystemOwner();
if (owner != finalSystemOwner) {
disputeGameFactory.transferOwnership(finalSystemOwner);
console.log("DisputeGameFactory ownership transferred to: %s", finalSystemOwner);
}
}
}
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() broadcast() public {
if (block.chainid == 900) {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate));
if (address(factory.gameImpls(GameTypes.FAULT)) == address(0)) {
factory.setImplementation(GameTypes.FAULT, new FaultDisputeGame({
_absolutePrestate: absolutePrestate,
_maxGameDepth: cfg.faultGameMaxDepth(),
_vm: faultVm
}));
console.log("DisputeGameFactory: set `FaultDisputeGame` implementation");
}
}
}
}
......@@ -45,6 +45,8 @@ contract DeployConfig is Script {
uint256 public eip1559Denominator;
uint256 public eip1559Elasticity;
uint256 public l2GenesisRegolithTimeOffset;
uint256 public faultGameAbsolutePrestate;
uint256 public faultGameMaxDepth;
constructor(string memory _path) {
console.log("DeployConfig: reading file %s", _path);
......@@ -82,6 +84,8 @@ contract DeployConfig is Script {
eip1559Denominator = stdJson.readUint(_json, "$.eip1559Denominator");
eip1559Elasticity = stdJson.readUint(_json, "$.eip1559Elasticity");
l2GenesisRegolithTimeOffset = stdJson.readUint(_json, "$.l2GenesisRegolithTimeOffset");
faultGameAbsolutePrestate = stdJson.readUint(_json, "$.faultGameAbsolutePrestate");
faultGameMaxDepth = stdJson.readUint(_json, "$.faultGameMaxDepth");
}
function l1StartingBlockTag() public returns (bytes32) {
......
......@@ -201,6 +201,8 @@ interface OptionalL1DeployConfig {
l1GenesisBlockGasUsed: string
l1GenesisBlockParentHash: string
l1GenesisBlockBaseFeePerGas: string
faultGameAbsolutePrestate: number
faultGameMaxDepth: number
}
/**
......
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