Commit ab4da63b authored by refcell.eth's avatar refcell.eth Committed by GitHub

Merge pull request #8347 from ethereum-optimism/refcell/output-dg-deploy

feat(ctb): OutputBisectionGame Devnet Deployment
parents ca87b905 bc385a49
......@@ -28,6 +28,7 @@
"L1BlockNumber",
"DisputeGameFactory",
"FaultDisputeGame",
"OutputBisectionGame",
"AlphabetVM",
"StandardBridge",
"CrossDomainMessenger",
......
This diff is collapsed.
This diff is collapsed.
......@@ -206,6 +206,10 @@ type DeployConfig struct {
// game can run for before it is ready to be resolved. Each side receives half of this value
// on their chess clock at the inception of the dispute.
FaultGameMaxDuration uint64 `json:"faultGameMaxDuration"`
// OutputBisectionGameGenesisBlock is the block number for genesis.
OutputBisectionGameGenesisBlock uint64 `json:"outputBisectionGameGenesisBlock"`
// OutputBisectionGameSplitDepth is the depth at which the output bisection game splits.
OutputBisectionGameSplitDepth uint64 `json:"outputBisectionGameSplitDepth"`
// FundDevAccounts configures whether or not to fund the dev accounts. Should only be used
// during devnet deployments.
FundDevAccounts bool `json:"fundDevAccounts"`
......
......@@ -68,6 +68,8 @@
"faultGameAbsolutePrestate": "0x0000000000000000000000000000000000000000000000000000000000000000",
"faultGameMaxDepth": 63,
"faultGameMaxDuration": 604800,
"outputBisectionGameGenesisBlock": 0,
"outputBisectionGameSplitDepth": 0,
"systemConfigStartBlock": 0,
"requiredProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000"
......
......@@ -49,6 +49,8 @@
"faultGameAbsolutePrestate": "0x03c7ae758795765c6664a5d39bf63841c71ff191e9189522bad8ebff5d4eca98",
"faultGameMaxDepth": 30,
"faultGameMaxDuration": 1200,
"outputBisectionGameGenesisBlock": 0,
"outputBisectionGameSplitDepth": 15,
"systemConfigStartBlock": 0,
"requiredProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000"
......
......@@ -33,6 +33,7 @@ import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { OutputBisectionGame } from "src/dispute/OutputBisectionGame.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol";
import { BlockOracle } from "src/dispute/BlockOracle.sol";
......@@ -288,6 +289,7 @@ contract Deploy is Deployer {
deployImplementations();
initializeImplementations();
setOutputBisectionImplementation();
setAlphabetFaultGameImplementation();
setCannonFaultGameImplementation();
......@@ -1018,6 +1020,21 @@ contract Deploy is Deployer {
);
}
/// @notice Sets the implementation for the output bisection game type (254) in the `DisputeGameFactory`
function setOutputBisectionImplementation() public onlyDevnet broadcast {
console.log("Setting OutputBisectionGame implementation");
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim outputAbsolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
_setFaultGameImplementation({
_factory: factory,
_gameType: GameType.wrap(254),
_absolutePrestate: outputAbsolutePrestate,
_faultVm: IBigStepper(new AlphabetVM(outputAbsolutePrestate)),
_maxGameDepth: cfg.faultGameMaxDepth()
});
}
/// @notice Sets the implementation for the alphabet game type in the `DisputeGameFactory`
function setAlphabetFaultGameImplementation() public onlyDevnet broadcast {
console.log("Setting Alphabet FaultDisputeGame implementation");
......@@ -1044,7 +1061,31 @@ contract Deploy is Deployer {
)
internal
{
if (address(_factory.gameImpls(_gameType)) == address(0)) {
if (address(_factory.gameImpls(_gameType)) != address(0)) {
console.log(
"[WARN] DisputeGameFactoryProxy: `FaultDisputeGame` implementation already set for game type: %s",
vm.toString(GameType.unwrap(_gameType))
);
return;
}
string memory deployed;
if (GameType.unwrap(_gameType) == 254) {
deployed = "OutputBisectionGame";
_factory.setImplementation(
_gameType,
new OutputBisectionGame({
_gameType: _gameType,
_absolutePrestate: _absolutePrestate,
_genesisBlockNumber: cfg.outputBisectionGameGenesisBlock(),
_maxGameDepth: _maxGameDepth,
_splitDepth: cfg.outputBisectionGameSplitDepth(),
_gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())),
_vm: _faultVm
})
);
} else {
deployed = "FaultDisputeGame";
_factory.setImplementation(
_gameType,
new FaultDisputeGame({
......@@ -1057,18 +1098,25 @@ contract Deploy is Deployer {
_blockOracle: BlockOracle(mustGetAddress("BlockOracle"))
})
);
}
uint8 rawGameType = GameType.unwrap(_gameType);
console.log(
"DisputeGameFactoryProxy: set `FaultDisputeGame` implementation (Backend: %s | GameType: %s)",
rawGameType == 0 ? "Cannon" : "Alphabet",
vm.toString(rawGameType)
);
uint8 rawGameType = GameType.unwrap(_gameType);
string memory gameTypeString;
if (rawGameType == 0) {
gameTypeString = "Cannon";
} else if (rawGameType == 254) {
gameTypeString = "OutputBisectionAlphabet";
} else if (rawGameType == 255) {
gameTypeString = "Alphabet";
} else {
console.log(
"[WARN] DisputeGameFactoryProxy: `FaultDisputeGame` implementation already set for game type: %s",
vm.toString(GameType.unwrap(_gameType))
);
gameTypeString = "Unknown";
}
console.log(
"DisputeGameFactoryProxy: set `%s` implementation (Backend: %s | GameType: %s)",
deployed,
gameTypeString,
vm.toString(rawGameType)
);
}
}
......@@ -50,6 +50,8 @@ contract DeployConfig is Script {
uint256 public faultGameAbsolutePrestate;
uint256 public faultGameMaxDepth;
uint256 public faultGameMaxDuration;
uint256 public outputBisectionGameGenesisBlock;
uint256 public outputBisectionGameSplitDepth;
uint256 public systemConfigStartBlock;
uint256 public requiredProtocolVersion;
uint256 public recommendedProtocolVersion;
......@@ -104,6 +106,8 @@ contract DeployConfig is Script {
faultGameAbsolutePrestate = stdJson.readUint(_json, "$.faultGameAbsolutePrestate");
faultGameMaxDepth = stdJson.readUint(_json, "$.faultGameMaxDepth");
faultGameMaxDuration = stdJson.readUint(_json, "$.faultGameMaxDuration");
outputBisectionGameGenesisBlock = stdJson.readUint(_json, "$.outputBisectionGameGenesisBlock");
outputBisectionGameSplitDepth = stdJson.readUint(_json, "$.outputBisectionGameSplitDepth");
}
}
......
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