Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6b1b845
Initial copy
ControlCplusControlV Feb 11, 2025
ccc4cf9
Make tests work
ControlCplusControlV Feb 11, 2025
4a3ac87
snapshots
ControlCplusControlV Feb 18, 2025
eab51b9
semantic version for pre-release
ControlCplusControlV Feb 18, 2025
3f98a88
my size was not size
ControlCplusControlV Feb 18, 2025
75c5405
semver lock fixed oops
ControlCplusControlV Feb 18, 2025
29e44d2
added spec tests
ControlCplusControlV Feb 18, 2025
b1f6819
fix initialization test
ControlCplusControlV Feb 18, 2025
94641d4
allow modifying super fdg
ControlCplusControlV Feb 18, 2025
a951dde
Update packages/contracts-bedrock/src/dispute/SuperPermissionedDisput…
ControlCplusControlV Feb 18, 2025
5ad85e8
introduced the deploy scripts
ControlCplusControlV Feb 18, 2025
0fc2682
added in new tests
ControlCplusControlV Feb 18, 2025
dc6aa96
Merge remote-tracking branch 'origin/controlc/super-dispute-game-mvp'…
ControlCplusControlV Feb 18, 2025
94dbcfb
Update packages/contracts-bedrock/src/dispute/SuperPermissionedDisput…
ControlCplusControlV Feb 18, 2025
f10fdb6
Update packages/contracts-bedrock/src/dispute/SuperFaultDisputeGame.sol
ControlCplusControlV Feb 18, 2025
94ce39c
Merge remote-tracking branch 'origin/controlc/super-dispute-game-mvp'…
ControlCplusControlV Feb 18, 2025
d3cd0db
Merge branch 'develop' into controlc/super-dispute-game
ControlCplusControlV Feb 19, 2025
ad01a7b
Patches
ControlCplusControlV Feb 19, 2025
3f082b3
fix tests
ControlCplusControlV Feb 19, 2025
a9e9f0d
remove unused errors
ControlCplusControlV Feb 19, 2025
a75369a
new snapshots
ControlCplusControlV Feb 19, 2025
a7d106a
semver bump
ControlCplusControlV Feb 19, 2025
00b2615
more snapshots
ControlCplusControlV Feb 19, 2025
0defd2b
vm()
ControlCplusControlV Feb 19, 2025
d696b15
fixed spec tests
ControlCplusControlV Feb 20, 2025
632cb99
snapshot + fix tests
ControlCplusControlV Feb 20, 2025
a24181d
fix tests
ControlCplusControlV Feb 20, 2025
b413dce
delete actors tests
ControlCplusControlV Feb 20, 2025
7405573
unused imports
ControlCplusControlV Feb 20, 2025
2f87c87
fix fork tests
ControlCplusControlV Feb 20, 2025
ab0f1c3
fix tests
AmadiMichael Feb 21, 2025
669a1fe
new test case
ControlCplusControlV Feb 21, 2025
41eadb6
use new prestate for deployment
ControlCplusControlV Feb 25, 2025
c48d955
Remove Unused l2ChainId
ControlCplusControlV Feb 26, 2025
f0c774a
fix tests
ControlCplusControlV Feb 26, 2025
e4c86c7
fix tests + snapshot
ControlCplusControlV Feb 27, 2025
c32bec4
missed one
ControlCplusControlV Feb 27, 2025
43f0a56
Merge remote-tracking branch 'origin/develop' into controlc/super-dis…
ControlCplusControlV Feb 27, 2025
b694934
correct snapshot
ControlCplusControlV Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 115 additions & 16 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { IFaultDisputeGame } from "interfaces/dispute/IFaultDisputeGame.sol";
import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol";
import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol";
import { IMIPS } from "interfaces/cannon/IMIPS.sol";
import { IPermissionedDisputeGame } from "interfaces/dispute/IPermissionedDisputeGame.sol";
import { IPreimageOracle } from "interfaces/cannon/IPreimageOracle.sol";

/// @title Deploy
Expand Down Expand Up @@ -399,6 +400,8 @@ contract Deploy is Deployer {
});

setAlphabetFaultGameImplementation();
setSuperFaultGameImplementation();
setSuperPermissionedGameImplementation();
setFastFaultGameImplementation();
setCannonFaultGameImplementation();

Expand Down Expand Up @@ -670,6 +673,21 @@ contract Deploy is Deployer {
}
}

function loadInteropDevnetAbsolutePrestate() internal returns (Claim interopDevnetAbsolutePrestate_) {
string memory filePath = string.concat(vm.projectRoot(), "/../../op-program/bin/prestate-proof-interop.json");
if (bytes(Process.bash(string.concat("[[ -f ", filePath, " ]] && echo \"present\""))).length == 0) {
revert(
"Deploy: cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root"
);
}
interopDevnetAbsolutePrestate_ =
Claim.wrap(abi.decode(bytes(Process.bash(string.concat("cat ", filePath, " | jq -r .pre"))), (bytes32)));
console.log(
"[Cannon Dispute Game] Using devnet Interop Devnet Absolute Prestate: %s",
vm.toString(Claim.unwrap(interopDevnetAbsolutePrestate_))
);
}

/// @notice Loads the singlethreaded mips absolute prestate from the prestate-proof for devnets otherwise
/// from the config.
function _loadDevnetStMipsAbsolutePrestate() internal returns (Claim mipsAbsolutePrestate_) {
Expand Down Expand Up @@ -747,16 +765,60 @@ contract Deploy is Deployer {
splitDepth: cfg.faultGameSplitDepth(),
clockExtension: Duration.wrap(uint64(cfg.faultGameClockExtension())),
maxClockDuration: Duration.wrap(uint64(cfg.faultGameMaxClockDuration())),
vm: IBigStepper(
new AlphabetVM(outputAbsolutePrestate, IPreimageOracle(artifacts.mustGetAddress("PreimageOracle")))
),
vm: IBigStepper(artifacts.mustGetAddress("MipsSingleton")),
weth: weth,
anchorStateRegistry: IAnchorStateRegistry(artifacts.mustGetAddress("AnchorStateRegistryProxy")),
l2ChainId: cfg.l2ChainID()
})
});
}

/// @notice Sets the implementation for the `PERMISSIONED_SUPER_CANNON` game type in the `DisputeGameFactory`
function setSuperPermissionedGameImplementation() public onlyDevnet broadcast {
console.log("Setting SuperPermissionedDisputeGame implementation");
IDisputeGameFactory factory = IDisputeGameFactory(artifacts.mustGetAddress("DisputeGameFactoryProxy"));
IDelayedWETH weth = IDelayedWETH(artifacts.mustGetAddress("DelayedWETHProxy"));

_setFaultGameImplementation({
_factory: factory,
_params: IFaultDisputeGame.GameConstructorParams({
gameType: GameType.wrap(4),
absolutePrestate: loadInteropDevnetAbsolutePrestate(),
maxGameDepth: cfg.faultGameMaxDepth(),
splitDepth: cfg.faultGameSplitDepth(),
clockExtension: Duration.wrap(uint64(cfg.faultGameClockExtension())),
maxClockDuration: Duration.wrap(uint64(cfg.faultGameMaxClockDuration())),
vm: IBigStepper(artifacts.mustGetAddress("MipsSingleton")),
weth: weth,
anchorStateRegistry: IAnchorStateRegistry(artifacts.mustGetAddress("AnchorStateRegistryProxy")),
l2ChainId: 0 // Unused Param on SuperDisputeGame
})
});
}

/// @notice Sets the implementation for the `SUPER_CANNON` game type in the `DisputeGameFactory`
function setSuperFaultGameImplementation() public onlyDevnet broadcast {
console.log("Setting SuperFaultDisputeGame implementation");
IDisputeGameFactory factory = IDisputeGameFactory(artifacts.mustGetAddress("DisputeGameFactoryProxy"));
IDelayedWETH weth = IDelayedWETH(artifacts.mustGetAddress("DelayedWETHProxy"));

_setFaultGameImplementation({
_factory: factory,
_params: IFaultDisputeGame.GameConstructorParams({
gameType: GameType.wrap(4),
absolutePrestate: loadInteropDevnetAbsolutePrestate(),
maxGameDepth: cfg.faultGameMaxDepth(),
splitDepth: cfg.faultGameSplitDepth(),
clockExtension: Duration.wrap(uint64(cfg.faultGameClockExtension())),
maxClockDuration: Duration.wrap(uint64(cfg.faultGameMaxClockDuration())),
vm: IBigStepper(artifacts.mustGetAddress("MipsSingleton")),
weth: weth,
anchorStateRegistry: IAnchorStateRegistry(artifacts.mustGetAddress("AnchorStateRegistryProxy")),
l2ChainId: 0 // Unused Param on SuperDisputeGame
})
});
}

/// @notice Sets the implementation for the `ALPHABET` game type in the `DisputeGameFactory`
function setFastFaultGameImplementation() public onlyDevnet broadcast {
console.log("Setting Fast FaultDisputeGame implementation");
Expand Down Expand Up @@ -813,18 +875,51 @@ contract Deploy is Deployer {
rawGameType != GameTypes.PERMISSIONED_CANNON.raw(), "Deploy: Permissioned Game should be deployed by OPCM"
);

_factory.setImplementation(
_params.gameType,
IDisputeGame(
DeployUtils.create2AndSave({
_save: artifacts,
_salt: _implSalt(),
_name: "FaultDisputeGame",
_nick: string.concat("FaultDisputeGame_", vm.toString(rawGameType)),
_args: DeployUtils.encodeConstructor(abi.encodeCall(IFaultDisputeGame.__constructor__, (_params)))
})
)
);
if (rawGameType == 4) {
_factory.setImplementation(
_params.gameType,
IDisputeGame(
DeployUtils.create2AndSave({
_save: artifacts,
_salt: _implSalt(),
_name: "SuperFaultDisputeGame",
_nick: string.concat("SuperFaultDisputeGame_", vm.toString(rawGameType)),
_args: DeployUtils.encodeConstructor(abi.encodeCall(IFaultDisputeGame.__constructor__, (_params)))
})
)
);
} else if (rawGameType == 5) {
_factory.setImplementation(
_params.gameType,
IDisputeGame(
DeployUtils.create2AndSave({
_save: artifacts,
_salt: _implSalt(),
_name: "SuperPermissionedDisputeGame",
_nick: string.concat("SuperFaultDisputeGame_", vm.toString(rawGameType)),
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IPermissionedDisputeGame.__constructor__,
(_params, cfg.l2OutputOracleProposer(), cfg.l2OutputOracleChallenger())
)
)
})
)
);
} else {
_factory.setImplementation(
_params.gameType,
IDisputeGame(
DeployUtils.create2AndSave({
_save: artifacts,
_salt: _implSalt(),
_name: "FaultDisputeGame",
_nick: string.concat("FaultDisputeGame_", vm.toString(rawGameType)),
_args: DeployUtils.encodeConstructor(abi.encodeCall(IFaultDisputeGame.__constructor__, (_params)))
})
)
);
}

string memory gameTypeString;
if (rawGameType == GameTypes.CANNON.raw()) {
Expand All @@ -835,6 +930,10 @@ contract Deploy is Deployer {
gameTypeString = "OP Succinct";
} else if (rawGameType == GameTypes.KAILUA.raw()) {
gameTypeString = "Kailua";
} else if (rawGameType == 4) {
gameTypeString = "Super Cannon";
} else if (rawGameType == 5) {
gameTypeString = "Permissioned Super Cannon";
} else {
gameTypeString = "Unknown";
}
Expand Down Expand Up @@ -866,7 +965,7 @@ contract Deploy is Deployer {
),
saltMixer: saltMixer,
gasLimit: uint64(cfg.l2GenesisBlockGasLimit()),
disputeGameType: GameTypes.PERMISSIONED_CANNON,
disputeGameType: GameType.wrap(4),
disputeAbsolutePrestate: Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())),
disputeMaxGameDepth: cfg.faultGameMaxDepth(),
disputeSplitDepth: cfg.faultGameSplitDepth(),
Expand Down
125 changes: 3 additions & 122 deletions packages/contracts-bedrock/snapshots/abi/SuperFaultDisputeGame.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,46 +147,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "version",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "stateRoot",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "messagePasserStorageRoot",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "latestBlockhash",
"type": "bytes32"
}
],
"internalType": "struct Types.OutputRootProof",
"name": "_outputRootProof",
"type": "tuple"
},
{
"internalType": "bytes",
"name": "_headerRLP",
"type": "bytes"
}
],
"name": "challengeRootL2Block",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -527,45 +487,6 @@
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "l2BlockNumberChallenged",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "l2BlockNumberChallenger",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "l2ChainId",
"outputs": [
{
"internalType": "uint256",
"name": "l2ChainId_",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "maxClockDuration",
Expand Down Expand Up @@ -1003,11 +924,6 @@
"name": "AnchorRootNotFound",
"type": "error"
},
{
"inputs": [],
"name": "BlockNumberMatches",
"type": "error"
},
{
"inputs": [],
"name": "BondTransferFailed",
Expand Down Expand Up @@ -1043,21 +959,11 @@
"name": "ClockTimeExceeded",
"type": "error"
},
{
"inputs": [],
"name": "ContentLengthMismatch",
"type": "error"
},
{
"inputs": [],
"name": "DuplicateStep",
"type": "error"
},
{
"inputs": [],
"name": "EmptyItem",
"type": "error"
},
{
"inputs": [],
"name": "GameDepthExceeded",
Expand Down Expand Up @@ -1098,36 +1004,16 @@
"name": "InvalidClockExtension",
"type": "error"
},
{
"inputs": [],
"name": "InvalidDataRemainder",
"type": "error"
},
{
"inputs": [],
"name": "InvalidDisputedClaimIndex",
"type": "error"
},
{
"inputs": [],
"name": "InvalidHeader",
"type": "error"
},
{
"inputs": [],
"name": "InvalidHeaderRLP",
"type": "error"
},
{
"inputs": [],
"name": "InvalidLocalIdent",
"type": "error"
},
{
"inputs": [],
"name": "InvalidOutputRootProof",
"type": "error"
},
{
"inputs": [],
"name": "InvalidParent",
Expand All @@ -1145,12 +1031,12 @@
},
{
"inputs": [],
"name": "L2BlockNumberChallenged",
"name": "MaxDepthTooLarge",
"type": "error"
},
{
"inputs": [],
"name": "MaxDepthTooLarge",
"name": "NoChainIdNeeded",
"type": "error"
},
{
Expand All @@ -1170,7 +1056,7 @@
},
{
"inputs": [],
"name": "UnexpectedList",
"name": "SuperFaultDisputeGameInvalidRootClaim",
"type": "error"
},
{
Expand All @@ -1184,11 +1070,6 @@
"name": "UnexpectedRootClaim",
"type": "error"
},
{
"inputs": [],
"name": "UnexpectedString",
"type": "error"
},
{
"inputs": [],
"name": "ValidStep",
Expand Down
Loading