Commit 690d650f authored by clabby's avatar clabby Committed by GitHub

feat(ctb): Update FPACOPS scripts (#9495)

* Update FPACOPS

* updates; live network deployment config

* fmt

* Update sepolia deploy config
parent cbb7c3b2
...@@ -41,5 +41,19 @@ ...@@ -41,5 +41,19 @@
"eip1559Elasticity": 10, "eip1559Elasticity": 10,
"systemConfigStartBlock": 8300214, "systemConfigStartBlock": 8300214,
"requiredProtocolVersion": "0x0000000000000000000000000000000000000003000000010000000000000000", "requiredProtocolVersion": "0x0000000000000000000000000000000000000003000000010000000000000000",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000003000000010000000000000000" "recommendedProtocolVersion": "0x0000000000000000000000000000000000000003000000010000000000000000",
"fundDevAccounts": false,
"faultGameAbsolutePrestate": "0x03e1255457128b9afd9acf93239c1d477bdff88624901f9ca8fe0783b756dbe0",
"faultGameMaxDepth": 73,
"faultGameMaxDuration": 604800,
"faultGameGenesisBlock": 4061224,
"faultGameGenesisOutputRoot": "0xd08055c58b2c5149565c636b44fad2c25b5ccddef1385a2cb721529d7480b242",
"faultGameSplitDepth": 32,
"preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400,
"preimageOracleCancunActivationTimestamp": 1705473120,
"proofMaturityDelaySeconds": 604800,
"disputeGameFinalityDelaySeconds": 302400,
"respectedGameType": 0,
"useFaultProofs": true
} }
...@@ -42,17 +42,18 @@ ...@@ -42,17 +42,18 @@
"systemConfigStartBlock": 4071248, "systemConfigStartBlock": 4071248,
"requiredProtocolVersion": "0x0000000000000000000000000000000000000004000000000000000000000001", "requiredProtocolVersion": "0x0000000000000000000000000000000000000004000000000000000000000001",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000004000000000000000000000001", "recommendedProtocolVersion": "0x0000000000000000000000000000000000000004000000000000000000000001",
"fundDevAccounts": false,
"faultGameAbsolutePrestate": "0x03e1255457128b9afd9acf93239c1d477bdff88624901f9ca8fe0783b756dbe0", "faultGameAbsolutePrestate": "0x03e1255457128b9afd9acf93239c1d477bdff88624901f9ca8fe0783b756dbe0",
"faultGameMaxDepth": 73, "faultGameMaxDepth": 73,
"faultGameMaxDuration": 86400, "faultGameMaxDuration": 604800,
"faultGameGenesisBlock": 0, "faultGameGenesisBlock": 4061224,
"faultGameGenesisOutputRoot": "0x6a2fb9128c8bc82eed49ee590fba3e975bd67fede20535d0d20b3000ea6d99b1", "faultGameGenesisOutputRoot": "0xd08055c58b2c5149565c636b44fad2c25b5ccddef1385a2cb721529d7480b242",
"faultGameSplitDepth": 32, "faultGameSplitDepth": 32,
"preimageOracleMinProposalSize": 1800000, "preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400, "preimageOracleChallengePeriod": 86400,
"preimageOracleCancunActivationTimestamp": 1706655072, "preimageOracleCancunActivationTimestamp": 1706655072,
"proofMaturityDelaySeconds": 12, "proofMaturityDelaySeconds": 604800,
"disputeGameFinalityDelaySeconds": 6, "disputeGameFinalityDelaySeconds": 302400,
"respectedGameType": 0, "respectedGameType": 0,
"useFaultProofs": false "useFaultProofs": true
} }
...@@ -172,6 +172,9 @@ library ChainAssertions { ...@@ -172,6 +172,9 @@ library ChainAssertions {
console.log("Running chain assertions on the DisputeGameFactory"); console.log("Running chain assertions on the DisputeGameFactory");
DisputeGameFactory factory = DisputeGameFactory(_contracts.DisputeGameFactory); DisputeGameFactory factory = DisputeGameFactory(_contracts.DisputeGameFactory);
// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(factory), _slot: 0, _offset: 0 });
require(factory.owner() == _expectedOwner); require(factory.owner() == _expectedOwner);
} }
......
...@@ -125,7 +125,7 @@ contract Deploy is Deployer { ...@@ -125,7 +125,7 @@ contract Deploy is Deployer {
} }
/// @notice Returns the proxy addresses. If a proxy is not found, it will have address(0). /// @notice Returns the proxy addresses. If a proxy is not found, it will have address(0).
function _proxies() private view returns (Types.ContractSet memory proxies_) { function _proxies() internal view returns (Types.ContractSet memory proxies_) {
proxies_ = Types.ContractSet({ proxies_ = Types.ContractSet({
L1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"), L1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"),
L1StandardBridge: mustGetAddress("L1StandardBridgeProxy"), L1StandardBridge: mustGetAddress("L1StandardBridgeProxy"),
...@@ -142,7 +142,7 @@ contract Deploy is Deployer { ...@@ -142,7 +142,7 @@ contract Deploy is Deployer {
} }
/// @notice Returns the proxy addresses, not reverting if any are unset. /// @notice Returns the proxy addresses, not reverting if any are unset.
function _proxiesUnstrict() private view returns (Types.ContractSet memory proxies_) { function _proxiesUnstrict() internal view returns (Types.ContractSet memory proxies_) {
proxies_ = Types.ContractSet({ proxies_ = Types.ContractSet({
L1CrossDomainMessenger: getAddress("L1CrossDomainMessengerProxy"), L1CrossDomainMessenger: getAddress("L1CrossDomainMessengerProxy"),
L1StandardBridge: getAddress("L1StandardBridgeProxy"), L1StandardBridge: getAddress("L1StandardBridgeProxy"),
......
...@@ -6,18 +6,15 @@ import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; ...@@ -6,18 +6,15 @@ import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { StdAssertions } from "forge-std/StdAssertions.sol"; import { StdAssertions } from "forge-std/StdAssertions.sol";
import "scripts/Deploy.s.sol"; import "scripts/Deploy.s.sol";
/// @notice Deploys the Fault Proof Alpha Chad contracts. These contracts are currently in-development, and the system /// @notice Deploys the Fault Proof Alpha Chad contracts.
/// is independent of the live protocol. Once the contracts are integrated with the live protocol, this script
/// should be deleted.
contract FPACOPS is Deploy, StdAssertions { contract FPACOPS is Deploy, StdAssertions {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// ENTRYPOINTS // // ENTRYPOINTS //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
function deployFPAC() public { function deployFPAC(address _proxyAdmin, address _systemOwnerSafe) public {
console.log("Deploying a fresh FPAC system"); console.log("Deploying a fresh FPAC system and OptimismPortal2 implementation.");
// Mock the proxy admin & system owner safe so that the DisputeGameFactory & proxy are governed by the deployer.
prankDeployment("ProxyAdmin", msg.sender); prankDeployment("ProxyAdmin", msg.sender);
prankDeployment("SystemOwnerSafe", msg.sender); prankDeployment("SystemOwnerSafe", msg.sender);
...@@ -29,55 +26,80 @@ contract FPACOPS is Deploy, StdAssertions { ...@@ -29,55 +26,80 @@ contract FPACOPS is Deploy, StdAssertions {
deployPreimageOracle(); deployPreimageOracle();
deployMips(); deployMips();
// Deploy the new `OptimismPortal` implementation.
deployOptimismPortal2();
// Initialize the DisputeGameFactoryProxy. // Initialize the DisputeGameFactoryProxy.
initializeDisputeGameFactoryProxy(); initializeDisputeGameFactoryProxy();
// Deploy the Cannon Fault game implementation and set it as game ID = 0. // Deploy the Cannon Fault game implementation and set it as game ID = 0.
setCannonFaultGameImplementation({ _allowUpgrade: false }); setCannonFaultGameImplementation({ _allowUpgrade: false });
// Deploy the Permissioned Cannon Fault game implementation and set it as game ID = 1.
setPermissionedCannonFaultGameImplementation({ _allowUpgrade: false });
// Transfer ownership of the DisputeGameFactory to the SystemOwnerSafe, and transfer the administrative rights
// of the DisputeGameFactoryProxy to the ProxyAdmin.
transferDGFOwnershipFinal({ _proxyAdmin: _proxyAdmin, _systemOwnerSafe: _systemOwnerSafe });
// Ensure `msg.sender` owns the system. // Run post-deployment assertions.
postDeployAssertions(); postDeployAssertions({ _proxyAdmin: _proxyAdmin, _systemOwnerSafe: _systemOwnerSafe });
// Print overview // Print overview
printConfigReview(); printConfigReview();
} }
function upgradeGameImpl(address _dgf, address _mips) public {
prankDeployment("DisputeGameFactoryProxy", _dgf);
prankDeployment("Mips", _mips);
setCannonFaultGameImplementation({ _allowUpgrade: true });
}
function updateInitBond(address _dgf, GameType _gameType, uint256 _newBond) public {
vm.startBroadcast(msg.sender);
DisputeGameFactory dgfProxy = DisputeGameFactory(_dgf);
dgfProxy.setInitBond(_gameType, _newBond);
vm.stopBroadcast();
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// HELPERS // // HELPERS //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
/// @notice Initializes the DisputeGameFactoryProxy with the DisputeGameFactory. /// @notice Initializes the DisputeGameFactoryProxy with the DisputeGameFactory.
function initializeDisputeGameFactoryProxy() internal onlyTestnetOrDevnet broadcast { function initializeDisputeGameFactoryProxy() internal broadcast {
console.log("Initializing DisputeGameFactoryProxy with DisputeGameFactory.");
address dgfProxy = mustGetAddress("DisputeGameFactoryProxy"); address dgfProxy = mustGetAddress("DisputeGameFactoryProxy");
Proxy(payable(dgfProxy)).upgradeToAndCall( Proxy(payable(dgfProxy)).upgradeToAndCall(
mustGetAddress("DisputeGameFactory"), abi.encodeWithSignature("initialize(address)", msg.sender) mustGetAddress("DisputeGameFactory"), abi.encodeWithSignature("initialize(address)", msg.sender)
); );
} }
/// @notice Transfers admin rights of the `DisputeGameFactoryProxy` to the `ProxyAdmin` and sets the
/// `DisputeGameFactory` owner to the `SystemOwnerSafe`.
function transferDGFOwnershipFinal(address _proxyAdmin, address _systemOwnerSafe) internal broadcast {
DisputeGameFactory dgf = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
// Transfer the ownership of the DisputeGameFactory to the SystemOwnerSafe.
dgf.transferOwnership(_systemOwnerSafe);
// Transfer the admin rights of the DisputeGameFactoryProxy to the ProxyAdmin.
Proxy prox = Proxy(payable(address(dgf)));
prox.changeAdmin(_proxyAdmin);
}
/// @notice Checks that the deployed system is configured correctly. /// @notice Checks that the deployed system is configured correctly.
function postDeployAssertions() internal { function postDeployAssertions(address _proxyAdmin, address _systemOwnerSafe) internal {
// Ensure `msg.sender` owns the deployed system. Types.ContractSet memory contracts = _proxiesUnstrict();
address proxyAdmin = mustGetAddress("ProxyAdmin"); contracts.OptimismPortal2 = mustGetAddress("OptimismPortal2");
// Ensure that `useFaultProofs` is set to `true`.
assertTrue(cfg.useFaultProofs());
// Ensure the contracts are owned by the correct entities.
address dgfProxyAddr = mustGetAddress("DisputeGameFactoryProxy"); address dgfProxyAddr = mustGetAddress("DisputeGameFactoryProxy");
DisputeGameFactory dgfProxy = DisputeGameFactory(dgfProxyAddr); DisputeGameFactory dgfProxy = DisputeGameFactory(dgfProxyAddr);
assertEq(dgfProxy.owner(), proxyAdmin); assertEq(address(uint160(uint256(vm.load(dgfProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), _proxyAdmin);
assertEq(address(uint160(uint256(vm.load(dgfProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), proxyAdmin); ChainAssertions.checkDisputeGameFactory(contracts, _systemOwnerSafe);
// Check the config elements in the deployed contracts.
ChainAssertions.checkOptimismPortal2(contracts, cfg, false);
// Check the config elements. PreimageOracle oracle = PreimageOracle(mustGetAddress("PreimageOracle"));
assertEq(oracle.minProposalSize(), cfg.preimageOracleMinProposalSize());
assertEq(oracle.challengePeriod(), cfg.preimageOracleChallengePeriod());
MIPS mips = MIPS(mustGetAddress("Mips"));
assertEq(address(mips.oracle()), address(oracle));
// Check the FaultDisputeGame configuration.
FaultDisputeGame gameImpl = FaultDisputeGame(address(dgfProxy.gameImpls(GameTypes.CANNON))); FaultDisputeGame gameImpl = FaultDisputeGame(address(dgfProxy.gameImpls(GameTypes.CANNON)));
assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth()); assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth());
assertEq(gameImpl.splitDepth(), cfg.faultGameSplitDepth()); assertEq(gameImpl.splitDepth(), cfg.faultGameSplitDepth());
...@@ -85,16 +107,35 @@ contract FPACOPS is Deploy, StdAssertions { ...@@ -85,16 +107,35 @@ contract FPACOPS is Deploy, StdAssertions {
assertEq(gameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); assertEq(gameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate()));
assertEq(gameImpl.genesisBlockNumber(), cfg.faultGameGenesisBlock()); assertEq(gameImpl.genesisBlockNumber(), cfg.faultGameGenesisBlock());
assertEq(gameImpl.genesisOutputRoot().raw(), cfg.faultGameGenesisOutputRoot()); assertEq(gameImpl.genesisOutputRoot().raw(), cfg.faultGameGenesisOutputRoot());
// Check the security override yoke configuration.
PermissionedDisputeGame soyGameImpl =
PermissionedDisputeGame(address(dgfProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)));
assertEq(soyGameImpl.maxGameDepth(), cfg.faultGameMaxDepth());
assertEq(soyGameImpl.splitDepth(), cfg.faultGameSplitDepth());
assertEq(soyGameImpl.gameDuration().raw(), cfg.faultGameMaxDuration());
assertEq(soyGameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate()));
assertEq(soyGameImpl.genesisBlockNumber(), cfg.faultGameGenesisBlock());
assertEq(soyGameImpl.genesisOutputRoot().raw(), cfg.faultGameGenesisOutputRoot());
} }
/// @notice Prints a review of the fault proof configuration section of the deploy config. /// @notice Prints a review of the fault proof configuration section of the deploy config.
function printConfigReview() internal view { function printConfigReview() internal view {
console.log(unicode"📖 FaultDisputeGame Config Overview (chainid: %d)", block.chainid); console.log(unicode"📖 FaultDisputeGame Config Overview (chainid: %d)", block.chainid);
console.log(" 0. Use Fault Proofs: %s", cfg.useFaultProofs() ? "true" : "false");
console.log(" 1. Absolute Prestate: %x", cfg.faultGameAbsolutePrestate()); console.log(" 1. Absolute Prestate: %x", cfg.faultGameAbsolutePrestate());
console.log(" 2. Max Depth: %d", cfg.faultGameMaxDepth()); console.log(" 2. Max Depth: %d", cfg.faultGameMaxDepth());
console.log(" 3. Output / Execution split Depth: %d", cfg.faultGameSplitDepth()); console.log(" 3. Output / Execution split Depth: %d", cfg.faultGameSplitDepth());
console.log(" 4. Game Duration (seconds): %d", cfg.faultGameMaxDuration()); console.log(" 4. Game Duration (seconds): %d", cfg.faultGameMaxDuration());
console.log(" 5. L2 Genesis block number: %d", cfg.faultGameGenesisBlock()); console.log(" 5. L2 Genesis block number: %d", cfg.faultGameGenesisBlock());
console.log(" 6. L2 Genesis output root: %x", uint256(cfg.faultGameGenesisOutputRoot())); console.log(" 6. L2 Genesis output root: %x", uint256(cfg.faultGameGenesisOutputRoot()));
console.log(" 7. Proof Maturity Delay (seconds): ", cfg.proofMaturityDelaySeconds());
console.log(" 8. Dispute Game Finality Delay (seconds): ", cfg.disputeGameFinalityDelaySeconds());
console.log(" 9. Respected Game Type: ", cfg.respectedGameType());
console.log(" 10. Preimage Oracle Min Proposal Size (bytes): ", cfg.preimageOracleMinProposalSize());
console.log(" 11. Preimage Oracle Challenge Period (seconds): ", cfg.preimageOracleChallengePeriod());
console.log(
" 12. Preimage Oracle Cancun Activation Timestamp: ", cfg.preimageOracleCancunActivationTimestamp()
);
} }
} }
...@@ -22,13 +22,5 @@ cannon-prestate: # Generate the cannon prestate, and tar the `op-program` + `can ...@@ -22,13 +22,5 @@ cannon-prestate: # Generate the cannon prestate, and tar the `op-program` + `can
@rm -rf prestate-artifacts @rm -rf prestate-artifacts
.PHONY: deploy-fresh .PHONY: deploy-fresh
deploy-fresh: # Deploy a fresh version of the FPAC contracts. Pass `--broadcast` to send to the network. deploy-fresh: cannon-prestate # Deploy a fresh version of the FPAC contracts. Pass `--broadcast` to send to the network.
forge script FPACOPS.sol --sig "deployFPAC()" --chain $(chain) -vvv $(args) forge script FPACOPS.sol --sig "deployFPAC(address,address)" $(proxy-admin) $(system-owner-safe) --chain $(chain) -vvv $(args)
.PHONY: upgrade-game-impl
upgrade-game-impl: # Upgrades a dispute game implementation in the deployed `DisputeGameFactory` contract for the configured chain. Pass `--broadcast` to send to the network.
forge script FPACOPS.sol --sig "upgradeGameImpl(address,address)" --chain $(chain) -vvv $(dgf) $(vm) $(args)
.PHONY: update-init-bond
update-init-bond: # Upgrades a dispute game's init bond in the deployed `DisputeGameFactory` contract for the configured chain. Pass `--broadcast` to send to the network.
forge script FPACOPS.sol --sig "updateInitBond(address,uint8,uint256)" --chain $(chain) -vvv $(dgf) $(game-type) $(new-init-bond) $(args)
...@@ -6,7 +6,7 @@ Chain-ops scripts for the Fault Proof Alpha Chad contracts. ...@@ -6,7 +6,7 @@ Chain-ops scripts for the Fault Proof Alpha Chad contracts.
### Generating the Cannon prestate and artifacts ### Generating the Cannon prestate and artifacts
*Description*: Generates the cannon prestate, tars the relavent artifacts, and sets the absolute prestate field in the network's deploy config. _Description_: Generates the cannon prestate, tars the relavent artifacts, and sets the absolute prestate field in the network's deploy config.
```sh ```sh
make cannon-prestate chain=<chain-name> make cannon-prestate chain=<chain-name>
...@@ -14,24 +14,8 @@ make cannon-prestate chain=<chain-name> ...@@ -14,24 +14,8 @@ make cannon-prestate chain=<chain-name>
### Deploying a fresh system ### Deploying a fresh system
*Description*: Deploys a fully fresh FPAC system to the passed chain. All args after the `chain-name` are forwarded to `forge script`. _Description_: Deploys a fully fresh FPAC system to the passed chain. All args after the `args=` are forwarded to `forge script`.
```sh ```sh
make deploy-fresh chain=<chain-name> [args=<forge-script-args>] make deploy-fresh chain=<chain-name> proxy-admin=<chain-proxy-admin-addr> system-owner-safe=<chain-safe-addr> [args=<forge-script-args>]
```
### Upgrading the Game Implementation
*Description*: Upgrades the `CANNON` game type's implementation in the `DisputeGameFactory` that was deployed for the passed `chain-name`. All args after the `chain-name` are forwarded to `forge script`.
```sh
make upgrade-game-impl chain=<chain-name> dgf=<dgf-proxy-address> vm=<vm-address> [args=<forge-script-args>]
```
### Updating Init Bonds
*Description*: Updates the initialization bond for a given game type in the `DisputeGameFactory` that was deployed for the passed `chain-name`. All args after the `chain-name` are forwarded to `forge script`.
```sh
make update-init-bond chain=<chain-name> dgf=<dgf-proxy-address> game-type=<game-type> new-init-bond=<new-init-bond> [args=<forge-script-args>]
``` ```
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