Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
cd73177a
Commit
cd73177a
authored
Nov 29, 2023
by
refcell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ctb): deploy output bisection game
parent
82b21d27
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1377 additions
and
11 deletions
+1377
-11
artifacts.json
op-bindings/artifacts.json
+1
-0
outputbisectiongame.go
op-bindings/bindings/outputbisectiongame.go
+1282
-0
outputbisectiongame_more.go
op-bindings/bindings/outputbisectiongame_more.go
+25
-0
config.go
op-chain-ops/genesis/config.go
+4
-0
devnetL1-template.json
...es/contracts-bedrock/deploy-config/devnetL1-template.json
+2
-0
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+59
-11
DeployConfig.s.sol
packages/contracts-bedrock/scripts/DeployConfig.s.sol
+4
-0
No files found.
op-bindings/artifacts.json
View file @
cd73177a
...
...
@@ -28,6 +28,7 @@
"L1BlockNumber"
,
"DisputeGameFactory"
,
"FaultDisputeGame"
,
"OutputBisectionGame"
,
"AlphabetVM"
,
"StandardBridge"
,
"CrossDomainMessenger"
,
...
...
op-bindings/bindings/outputbisectiongame.go
0 → 100644
View file @
cd73177a
This diff is collapsed.
Click to expand it.
op-bindings/bindings/outputbisectiongame_more.go
0 → 100644
View file @
cd73177a
This diff is collapsed.
Click to expand it.
op-chain-ops/genesis/config.go
View file @
cd73177a
...
...
@@ -203,6 +203,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"`
...
...
packages/contracts-bedrock/deploy-config/devnetL1-template.json
View file @
cd73177a
...
...
@@ -49,6 +49,8 @@
"faultGameAbsolutePrestate"
:
"0x03c7ae758795765c6664a5d39bf63841c71ff191e9189522bad8ebff5d4eca98"
,
"faultGameMaxDepth"
:
30
,
"faultGameMaxDuration"
:
1200
,
"outputBisectionGameGenesisBlock"
:
0
,
"outputBisectionGameSplitDepth"
:
15
,
"systemConfigStartBlock"
:
0
,
"requiredProtocolVersion"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
,
"recommendedProtocolVersion"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
...
...
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
cd73177a
...
...
@@ -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)
);
string memory gameTypeString;
if (rawGameType == 0) {
gameTypeString = "Cannon";
} else if (rawGameType == 254) {
gameTypeString = "OutputBisectionAlphabet";
} else if (rawGameType == 255) {
gameTypeString = "Alphabet";
} else {
gameTypeString = "Unknown";
}
console.log(
"[WARN] DisputeGameFactoryProxy: `FaultDisputeGame` implementation already set for game type: %s",
vm.toString(GameType.unwrap(_gameType))
"DisputeGameFactoryProxy: set `%s` implementation (Backend: %s | GameType: %s)",
deployed,
gameTypeString,
vm.toString(rawGameType)
);
}
}
}
packages/contracts-bedrock/scripts/DeployConfig.s.sol
View file @
cd73177a
...
...
@@ -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");
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment