Commit 747876d0 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6593 from ethereum-optimism/clabby/ctb/deploy-mips-fault-game

feat(ctb): Deploy `FaultDisputeGame` with `MIPS` backend on devnet
parents bc190b15 eec5478e
...@@ -760,7 +760,7 @@ jobs: ...@@ -760,7 +760,7 @@ jobs:
description: Go Module Name description: Go Module Name
type: string type: string
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
steps: steps:
- checkout - checkout
- run: - run:
...@@ -818,6 +818,12 @@ jobs: ...@@ -818,6 +818,12 @@ jobs:
- run: - run:
name: git submodules name: git submodules
command: git submodule update --init --recursive command: git submodule update --init --recursive
- run:
name: print go's available MIPS targets
command: go tool dist list | grep mips
- run:
name: generate cannon prestate
command: make cannon-prestate
- run: - run:
name: generate L1 state name: generate L1 state
command: make devnet-allocs command: make devnet-allocs
...@@ -895,6 +901,9 @@ jobs: ...@@ -895,6 +901,9 @@ jobs:
- run: - run:
name: git submodules name: git submodules
command: git submodule update --init --recursive command: git submodule update --init --recursive
- run:
name: generate cannon prestate
command: make cannon-prestate
- run: - run:
name: generate L1 state name: generate L1 state
command: make devnet-allocs command: make devnet-allocs
...@@ -962,6 +971,9 @@ jobs: ...@@ -962,6 +971,9 @@ jobs:
name: Install and build name: Install and build
command: | command: |
pnpm install && pnpm build pnpm install && pnpm build
- run:
name: generate cannon prestate
command: make cannon-prestate
- run: - run:
name: Bring up the stack name: Bring up the stack
command: make devnet-up command: make devnet-up
...@@ -1118,14 +1130,14 @@ jobs: ...@@ -1118,14 +1130,14 @@ jobs:
bedrock-go-tests: bedrock-go-tests:
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
resource_class: medium resource_class: medium
steps: steps:
- run: echo Done - run: echo Done
fpp-verify: fpp-verify:
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
steps: steps:
- checkout - checkout
- run: - run:
......
This diff is collapsed.
...@@ -36,6 +36,7 @@ func setupFaultDisputeGame() (common.Address, *bind.TransactOpts, *backends.Simu ...@@ -36,6 +36,7 @@ func setupFaultDisputeGame() (common.Address, *bind.TransactOpts, *backends.Simu
_, _, contract, err := bindings.DeployFaultDisputeGame( _, _, contract, err := bindings.DeployFaultDisputeGame(
opts, opts,
backend, backend,
uint8(0), // Game Type ID
[32]byte{0x01}, // Absolute Prestate Claim [32]byte{0x01}, // Absolute Prestate Claim
big.NewInt(15), // Max Game Depth big.NewInt(15), // Max Game Depth
uint64(604800), // 7 days uint64(604800), // 7 days
......
...@@ -69,6 +69,7 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context ...@@ -69,6 +69,7 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
_, tx, _, err = bindings.DeployFaultDisputeGame( _, tx, _, err = bindings.DeployFaultDisputeGame(
opts, opts,
client, client,
uint8(0),
alphabetVMAbsolutePrestateClaim, alphabetVMAbsolutePrestateClaim,
big.NewInt(alphabetGameDepth), big.NewInt(alphabetGameDepth),
gameDuration, gameDuration,
......
...@@ -100,7 +100,7 @@ FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeed ...@@ -100,7 +100,7 @@ FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeed
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32354) FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32354)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32806) FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32806)
FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10388) FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10388)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8266) FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8272)
FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57716) FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57716)
FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 210532) FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 210532)
FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228402) FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228402)
......
...@@ -721,19 +721,37 @@ contract Deploy is Deployer { ...@@ -721,19 +721,37 @@ contract Deploy is Deployer {
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory` /// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() onlyDevnet broadcast() public { function setFaultGameImplementation() onlyDevnet broadcast() public {
// Create the absolute prestate dump
string memory filePath = string.concat(vm.projectRoot(), "/../../op-program/bin/prestate-proof.json");
bytes32 mipsAbsolutePrestate;
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[1] = "-c";
commands[2] = string.concat("[[ -f ", filePath, " ]] && echo \"present\"");
if (vm.ffi(commands).length == 0) {
revert("Cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root.");
}
commands[2] = string.concat("cat ", filePath, " | jq -r .pre");
mipsAbsolutePrestate = abi.decode(vm.ffi(commands), (bytes32));
console.log("Absolute prestate: %s", vm.toString(mipsAbsolutePrestate));
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy")); DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())); for (uint8 i; i < 2; i++) {
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate)); Claim absolutePrestate = Claim.wrap(i == 0 ? bytes32(cfg.faultGameAbsolutePrestate()) : mipsAbsolutePrestate);
if (address(factory.gameImpls(GameTypes.FAULT)) == address(0)) { IBigStepper faultVm = IBigStepper(i == 0 ? address(new AlphabetVM(absolutePrestate)) : mustGetAddress("Mips"));
factory.setImplementation(GameTypes.FAULT, new FaultDisputeGame({ GameType gameType = GameType.wrap(i);
_absolutePrestate: absolutePrestate, if (address(factory.gameImpls(gameType)) == address(0)) {
_maxGameDepth: cfg.faultGameMaxDepth(), factory.setImplementation(gameType, new FaultDisputeGame({
_gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())), _gameType: gameType,
_vm: faultVm, _absolutePrestate: absolutePrestate,
_l2oo: L2OutputOracle(mustGetAddress("L2OutputOracleProxy")), _maxGameDepth: i == 0 ? 4 : cfg.faultGameMaxDepth(), // The max depth of the alphabet game is always 4
_blockOracle: BlockOracle(mustGetAddress("BlockOracle")) _gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())),
})); _vm: faultVm,
console.log("DisputeGameFactory: set `FaultDisputeGame` implementation"); _l2oo: L2OutputOracle(mustGetAddress("L2OutputOracleProxy")),
_blockOracle: BlockOracle(mustGetAddress("BlockOracle"))
}));
console.log("DisputeGameFactoryProxy: set `FaultDisputeGame` implementation (Backend: %s | GameType: %s)", i == 0 ? "AlphabetVM" : "MIPS", vm.toString(i));
}
} }
} }
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"src/L2/L2StandardBridge.sol": "0x73a4fea3dca8ac7d7ba32e38aadeb69bd344042666a40a75e8c28849f01999e5", "src/L2/L2StandardBridge.sol": "0x73a4fea3dca8ac7d7ba32e38aadeb69bd344042666a40a75e8c28849f01999e5",
"src/L2/L2ToL1MessagePasser.sol": "0xed800b600cb3f67e18a1ab10750e3934a8b3e42178f422bcacfde770a6e8e8bd", "src/L2/L2ToL1MessagePasser.sol": "0xed800b600cb3f67e18a1ab10750e3934a8b3e42178f422bcacfde770a6e8e8bd",
"src/L2/SequencerFeeVault.sol": "0xd57c143b1f042400430b991b806bf971628e6980406c751e82d19ae80eeb4e8d", "src/L2/SequencerFeeVault.sol": "0xd57c143b1f042400430b991b806bf971628e6980406c751e82d19ae80eeb4e8d",
"src/dispute/FaultDisputeGame.sol": "0x53ef150202f3e22dd0bd92a520c4eaa95752f5fd9d6b22f56d27958b71bb23ec", "src/dispute/FaultDisputeGame.sol": "0x01b3770e4d056550e71b4b9e9ada5401de98668d0a1e0ff336ed8f73a0127e99",
"src/legacy/DeployerWhitelist.sol": "0x5e80f7b13ef73f06c63bd9b118a49da1ff06a5c0fcf8067b5a3365d731c23765", "src/legacy/DeployerWhitelist.sol": "0x5e80f7b13ef73f06c63bd9b118a49da1ff06a5c0fcf8067b5a3365d731c23765",
"src/legacy/L1BlockNumber.sol": "0x84cc587148de5920dfcd19da44d28e769f0e4d08ca2bcc93f18aa78c6cc2ebe6", "src/legacy/L1BlockNumber.sol": "0x84cc587148de5920dfcd19da44d28e769f0e4d08ca2bcc93f18aa78c6cc2ebe6",
"src/legacy/LegacyMessagePasser.sol": "0x2692b50b227e5f75a53439c0cf303498edfd4fc087555b3fc9bc4bceb518229b", "src/legacy/LegacyMessagePasser.sol": "0x2692b50b227e5f75a53439c0cf303498edfd4fc087555b3fc9bc4bceb518229b",
......
...@@ -46,6 +46,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -46,6 +46,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// than the `BLOCKHASH` opcode allows as well as their estimated timestamps. /// than the `BLOCKHASH` opcode allows as well as their estimated timestamps.
BlockOracle public immutable BLOCK_ORACLE; BlockOracle public immutable BLOCK_ORACLE;
/// @notice The game type ID
GameType internal immutable GAME_TYPE;
/// @notice The root claim's position is always at gindex 1. /// @notice The root claim's position is always at gindex 1.
Position internal constant ROOT_POSITION = Position.wrap(1); Position internal constant ROOT_POSITION = Position.wrap(1);
...@@ -72,6 +75,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -72,6 +75,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// @notice An internal mapping to allow for constant-time lookups of existing claims. /// @notice An internal mapping to allow for constant-time lookups of existing claims.
mapping(ClaimHash => bool) internal claims; mapping(ClaimHash => bool) internal claims;
/// @param _gameType The type ID of the game.
/// @param _absolutePrestate The absolute prestate of the instruction trace. /// @param _absolutePrestate The absolute prestate of the instruction trace.
/// @param _maxGameDepth The maximum depth of bisection. /// @param _maxGameDepth The maximum depth of bisection.
/// @param _gameDuration The duration of the game. /// @param _gameDuration The duration of the game.
...@@ -83,6 +87,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -83,6 +87,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// timestamps. /// timestamps.
/// @custom:semver 0.0.6 /// @custom:semver 0.0.6
constructor( constructor(
GameType _gameType,
Claim _absolutePrestate, Claim _absolutePrestate,
uint256 _maxGameDepth, uint256 _maxGameDepth,
Duration _gameDuration, Duration _gameDuration,
...@@ -90,6 +95,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -90,6 +95,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
L2OutputOracle _l2oo, L2OutputOracle _l2oo,
BlockOracle _blockOracle BlockOracle _blockOracle
) Semver(0, 0, 6) { ) Semver(0, 0, 6) {
GAME_TYPE = _gameType;
ABSOLUTE_PRESTATE = _absolutePrestate; ABSOLUTE_PRESTATE = _absolutePrestate;
MAX_GAME_DEPTH = _maxGameDepth; MAX_GAME_DEPTH = _maxGameDepth;
GAME_DURATION = _gameDuration; GAME_DURATION = _gameDuration;
...@@ -332,8 +338,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -332,8 +338,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
function gameType() public pure override returns (GameType gameType_) { function gameType() public view override returns (GameType gameType_) {
gameType_ = GameTypes.FAULT; gameType_ = GAME_TYPE;
} }
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
...@@ -425,7 +431,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -425,7 +431,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
function gameData() function gameData()
external external
pure view
returns ( returns (
GameType gameType_, GameType gameType_,
Claim rootClaim_, Claim rootClaim_,
......
...@@ -25,7 +25,7 @@ interface IDisputeGame is IInitializable { ...@@ -25,7 +25,7 @@ interface IDisputeGame is IInitializable {
/// @dev The reference impl should be entirely different depending on the type (fault, validity) /// @dev The reference impl should be entirely different depending on the type (fault, validity)
/// i.e. The game type should indicate the security model. /// i.e. The game type should indicate the security model.
/// @return gameType_ The type of proof system being used. /// @return gameType_ The type of proof system being used.
function gameType() external pure returns (GameType gameType_); function gameType() external view returns (GameType gameType_);
/// @notice Getter for the root claim. /// @notice Getter for the root claim.
/// @dev `clones-with-immutable-args` argument #1 /// @dev `clones-with-immutable-args` argument #1
...@@ -58,7 +58,7 @@ interface IDisputeGame is IInitializable { ...@@ -58,7 +58,7 @@ interface IDisputeGame is IInitializable {
/// @return extraData_ Any extra data supplied to the dispute game contract by the creator. /// @return extraData_ Any extra data supplied to the dispute game contract by the creator.
function gameData() function gameData()
external external
pure view
returns ( returns (
GameType gameType_, GameType gameType_,
Claim rootClaim_, Claim rootClaim_,
......
...@@ -60,6 +60,7 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init { ...@@ -60,6 +60,7 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
// Deploy an implementation of the fault game // Deploy an implementation of the fault game
gameImpl = new FaultDisputeGame( gameImpl = new FaultDisputeGame(
GAME_TYPE,
absolutePrestate, absolutePrestate,
4, 4,
Duration.wrap(7 days), Duration.wrap(7 days),
......
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