Commit 0a002e1e authored by clabby's avatar clabby

devnet: Set the implementation of the `FaultDisputeGame` in the DGF upon initialization

parent 15660862
...@@ -17,6 +17,7 @@ services: ...@@ -17,6 +17,7 @@ services:
dockerfile: Dockerfile.l1 dockerfile: Dockerfile.l1
ports: ports:
- "8545:8545" - "8545:8545"
- "8546:8546"
- "7060:6060" - "7060:6060"
volumes: volumes:
- "l1_data:/db" - "l1_data:/db"
......
...@@ -43,5 +43,7 @@ ...@@ -43,5 +43,7 @@
"eip1559Elasticity": 2, "eip1559Elasticity": 2,
"l1GenesisBlockTimestamp": "0x64935846", "l1GenesisBlockTimestamp": "0x64935846",
"l1StartingBlockTag": "earliest", "l1StartingBlockTag": "earliest",
"l2GenesisRegolithTimeOffset": "0x0" "l2GenesisRegolithTimeOffset": "0x0",
} "faultGameAbsolutePrestate": 15,
\ No newline at end of file "faultGameMaxDepth": 4
}
...@@ -23,9 +23,14 @@ import { SystemConfig } from "../contracts/L1/SystemConfig.sol"; ...@@ -23,9 +23,14 @@ import { SystemConfig } from "../contracts/L1/SystemConfig.sol";
import { ResourceMetering } from "../contracts/L1/ResourceMetering.sol"; import { ResourceMetering } from "../contracts/L1/ResourceMetering.sol";
import { Constants } from "../contracts/libraries/Constants.sol"; import { Constants } from "../contracts/libraries/Constants.sol";
import { DisputeGameFactory } from "../contracts/dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "../contracts/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../contracts/dispute/FaultDisputeGame.sol";
import { L1ERC721Bridge } from "../contracts/L1/L1ERC721Bridge.sol"; import { L1ERC721Bridge } from "../contracts/L1/L1ERC721Bridge.sol";
import { Predeploys } from "../contracts/libraries/Predeploys.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 /// @title Deploy
/// @notice Script used to deploy a bedrock system. The entire system is deployed within the `run` function. /// @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. /// 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 { ...@@ -86,7 +91,10 @@ contract Deploy is Deployer {
initializeL2OutputOracle(); initializeL2OutputOracle();
initializeOptimismPortal(); initializeOptimismPortal();
setFaultGameImplementation();
transferProxyAdminOwnership(); transferProxyAdminOwnership();
transferDisputeGameFactoryOwnership();
} }
/// @notice Modifier that wraps a function in broadcasting. /// @notice Modifier that wraps a function in broadcasting.
...@@ -444,7 +452,7 @@ contract Deploy is Deployer { ...@@ -444,7 +452,7 @@ contract Deploy is Deployer {
_implementation: disputeGameFactory, _implementation: disputeGameFactory,
_data: abi.encodeCall( _data: abi.encodeCall(
DisputeGameFactory.initialize, DisputeGameFactory.initialize,
(cfg.finalSystemOwner()) (msg.sender)
) )
}); });
...@@ -665,5 +673,33 @@ contract Deploy is Deployer { ...@@ -665,5 +673,33 @@ contract Deploy is Deployer {
console.log("ProxyAdmin ownership transferred to: %s", finalSystemOwner); 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));
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 { ...@@ -45,6 +45,8 @@ contract DeployConfig is Script {
uint256 public eip1559Denominator; uint256 public eip1559Denominator;
uint256 public eip1559Elasticity; uint256 public eip1559Elasticity;
uint256 public l2GenesisRegolithTimeOffset; uint256 public l2GenesisRegolithTimeOffset;
uint256 public faultGameAbsolutePrestate;
uint256 public faultGameMaxDepth;
constructor(string memory _path) { constructor(string memory _path) {
console.log("DeployConfig: reading file %s", _path); console.log("DeployConfig: reading file %s", _path);
...@@ -82,6 +84,8 @@ contract DeployConfig is Script { ...@@ -82,6 +84,8 @@ contract DeployConfig is Script {
eip1559Denominator = stdJson.readUint(_json, "$.eip1559Denominator"); eip1559Denominator = stdJson.readUint(_json, "$.eip1559Denominator");
eip1559Elasticity = stdJson.readUint(_json, "$.eip1559Elasticity"); eip1559Elasticity = stdJson.readUint(_json, "$.eip1559Elasticity");
l2GenesisRegolithTimeOffset = stdJson.readUint(_json, "$.l2GenesisRegolithTimeOffset"); l2GenesisRegolithTimeOffset = stdJson.readUint(_json, "$.l2GenesisRegolithTimeOffset");
faultGameAbsolutePrestate = stdJson.readUint(_json, "$.faultGameAbsolutePrestate");
faultGameMaxDepth = stdJson.readUint(_json, "$.faultGameMaxDepth");
} }
function l1StartingBlockTag() public returns (bytes32) { function l1StartingBlockTag() public returns (bytes32) {
......
...@@ -201,6 +201,8 @@ interface OptionalL1DeployConfig { ...@@ -201,6 +201,8 @@ interface OptionalL1DeployConfig {
l1GenesisBlockGasUsed: string l1GenesisBlockGasUsed: string
l1GenesisBlockParentHash: string l1GenesisBlockParentHash: string
l1GenesisBlockBaseFeePerGas: 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