Skip to content

Commit

Permalink
feat: Move DEFAULT_STARTING_ANCHOR_ROOTS to Constants library
Browse files Browse the repository at this point in the history
  • Loading branch information
maurelian committed Oct 4, 2024
1 parent 99ca905 commit f6b1436
Showing 1 changed file with 58 additions and 18 deletions.
76 changes: 58 additions & 18 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ import {
DeployImplementationsInterop,
DeployImplementationsOutput
} from "scripts/DeployImplementations.s.sol";
import { DeployOPChainInput, DeployOPChain, DeployOPChainOutput } from "scripts/DeployOPChain.s.sol";

// Contracts
import { AddressManager } from "src/legacy/AddressManager.sol";
import { StorageSetter } from "src/universal/StorageSetter.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol";

// Libraries
import { Constants } from "src/libraries/Constants.sol";
Expand Down Expand Up @@ -430,33 +432,71 @@ contract Deploy is Deployer {
/// @notice Deploy all of the OP Chain specific contracts
function deployOpChain() public {
console.log("Deploying OP Chain");
deployAddressManager();
deployProxyAdmin();
transferAddressManagerOwnership(); // to the ProxyAdmin

// Ensure that the requisite contracts are deployed
mustGetAddress("SuperchainConfigProxy");
mustGetAddress("AddressManager");
mustGetAddress("ProxyAdmin");
OPContractsManager opcm = OPContractsManager(mustGetAddress("OPContractsManagerProxy"));

IAnchorStateRegistry.StartingAnchorRoot[] memory defaultStartingAnchorRoots =
new IAnchorStateRegistry.StartingAnchorRoot[](1);
defaultStartingAnchorRoots[0] = IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.PERMISSIONED_CANNON,
outputRoot: OutputRoot({ root: Hash.wrap(bytes32(hex"dead")), l2BlockNumber: 0 })
});
string memory saltMixer = "salt mixer";

OPContractsManager.DeployInput memory deployInput = OPContractsManager.DeployInput({
roles: OPContractsManager.Roles({
opChainProxyAdminOwner: cfg.finalSystemOwner(),
systemConfigOwner: cfg.finalSystemOwner(),
batcher: cfg.batchSenderAddress(),
unsafeBlockSigner: cfg.p2pSequencerAddress(),
proposer: cfg.l2OutputOracleProposer(),
challenger: cfg.l2OutputOracleChallenger()
}),
basefeeScalar: cfg.basefeeScalar(),
blobBasefeeScalar: cfg.blobbasefeeScalar(),
l2ChainId: cfg.l2ChainID(),
startingAnchorRoots: abi.encode(defaultStartingAnchorRoots),
saltMixer: saltMixer,
gasLimit: uint64(cfg.l2GenesisBlockGasLimit()),
disputeGameType: GameTypes.PERMISSIONED_CANNON,
disputeAbsolutePrestate: Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())),
disputeMaxGameDepth: cfg.faultGameMaxDepth(),
disputeSplitDepth: cfg.faultGameSplitDepth(),
disputeClockExtension: Duration.wrap(uint64(cfg.faultGameClockExtension())),
disputeMaxClockDuration: Duration.wrap(uint64(cfg.faultGameMaxClockDuration()))
});

deployERC1967Proxy("OptimismPortalProxy");
deployERC1967Proxy("SystemConfigProxy");
deployL1StandardBridgeProxy();
deployL1CrossDomainMessengerProxy();
deployERC1967Proxy("OptimismMintableERC20FactoryProxy");
deployERC1967Proxy("L1ERC721BridgeProxy");
OPContractsManager.DeployOutput memory deployOutput = opcm.deploy(deployInput);

// deployAddressManager();
save("AddressManager", address(deployOutput.addressManager));
// deployProxyAdmin();
save("ProxyAdmin", address(deployOutput.opChainProxyAdmin));
// transferAddressManagerOwnership(); // to the ProxyAdmin

save("OptimismPortalProxy", address(deployOutput.optimismPortalProxy));
save("SystemConfigProxy", address(deployOutput.systemConfigProxy));
save("L1StandardBridgeProxy", address(deployOutput.l1StandardBridgeProxy));
save("L1CrossDomainMessengerProxy", address(deployOutput.l1CrossDomainMessengerProxy));
save("OptimismMintableERC20FactoryProxy", address(deployOutput.optimismMintableERC20FactoryProxy));
save("L1ERC721BridgeProxy", address(deployOutput.l1ERC721BridgeProxy));

// Both the DisputeGameFactory and L2OutputOracle proxies are deployed regardless of whether fault proofs is
// enabled to prevent a nastier refactor to the deploy scripts. In the future, the L2OutputOracle will be
// removed. If fault proofs are not enabled, the DisputeGameFactory proxy will be unused.
deployERC1967Proxy("DisputeGameFactoryProxy");
save("DisputeGameFactoryProxy", address(deployOutput.disputeGameFactoryProxy));
save("PermissionedDelayedWETHProxy", address(deployOutput.delayedWETHPermissionedGameProxy));
deployERC1967Proxy("DelayedWETHProxy");
deployERC1967Proxy("PermissionedDelayedWETHProxy");
deployERC1967Proxy("AnchorStateRegistryProxy");

deployAnchorStateRegistry();
vm.prankStart(deployInput.roles.opChainProxyAdminOwner)
initializeDelayedWETH();
save("DelayedWETHProxy", address(deployOutput.delayedWETHPermissionlessGameProxy));
vm.prankStop();
// deployAnchorStateRegistry();
save("AnchorStateRegistryProxy", address(deployOutput.anchorStateRegistryProxy));
save("AnchorStateRegistry", address(deployOutput.anchorStateRegistryImpl));

initializeOpChain();
// initializeOpChain();

setAlphabetFaultGameImplementation({ _allowUpgrade: false });
setFastFaultGameImplementation({ _allowUpgrade: false });
Expand Down

0 comments on commit f6b1436

Please sign in to comment.