From c067c5af6a8f7dcff06e01834d4abbcb2a33f058 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 6 Aug 2024 22:19:48 +0900 Subject: [PATCH 1/4] feat: UpgradeAndEnableFastConfirmAction action --- .../NovaUpgradeAndEnableFastConfirmAction.sol | 17 +++++ .../UpgradeAndEnableFastConfirmAction.sol | 76 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol create mode 100644 src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol diff --git a/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol b/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol new file mode 100644 index 000000000..23e4e5888 --- /dev/null +++ b/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.16; + +import "./UpgradeAndEnableFastConfirmAction.sol"; +import "../../address-registries/L1AddressRegistry.sol"; + +contract NovaUpgradeAndEnableFastConfirmAction is UpgradeAndEnableFastConfirmAction { + constructor() + UpgradeAndEnableFastConfirmAction( + L1AddressRegistry(0x2F06643fc2CC18585Ae790b546388F0DE4Ec6635), + 0x0000000000000000000000000000000000000000, // TODO: v2.1.0 RollupAdminLogic + 0x0000000000000000000000000000000000000000, // TODO: v2.1.0 RollupUserLogic + 0x0000000000000000000000000000000000000000, // TODO: anyTrustFastConfirmer + 1 // TODO: newMinimumAssertionPeriod in blocks + ) + {} +} diff --git a/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol b/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol new file mode 100644 index 000000000..e7d0f1cfa --- /dev/null +++ b/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.16; + +import "@arbitrum/nitro-contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol"; + +import "../../address-registries/interfaces.sol"; + +interface IRollupAdminFC { + function anyTrustFastConfirmer() external view returns (address); + function setAnyTrustFastConfirmer(address _anyTrustFastConfirmer) external; +} + +/// @notice Upgrades the rollup logic to v2.1 and enables fast confirmation +contract UpgradeAndEnableFastConfirmAction { + IRollupGetter public immutable addressRegistry; + address public immutable newPrimaryLogic; + address public immutable newSecondaryLogic; + address public immutable anyTrustFastConfirmer; + uint256 public immutable newMinimumAssertionPeriod; + + constructor( + IRollupGetter _addressRegistry, + address _newPrimaryLogic, + address _newSecondaryLogic, + address _anyTrustFastConfirmer, + uint256 _newMinimumAssertionPeriod + ) { + addressRegistry = _addressRegistry; + newPrimaryLogic = _newPrimaryLogic; + newSecondaryLogic = _newSecondaryLogic; + anyTrustFastConfirmer = _anyTrustFastConfirmer; + newMinimumAssertionPeriod = _newMinimumAssertionPeriod; + } + + function perform() external { + address rollupAddress = address(addressRegistry.rollup()); + + DoubleLogicUUPSUpgradeable(rollupAddress).upgradeTo(newPrimaryLogic); + DoubleLogicUUPSUpgradeable(rollupAddress).upgradeSecondaryTo(newSecondaryLogic); + + // Setup AnyTrustFastConfirmer + require( + IRollupAdminFC(address(addressRegistry.rollup())).anyTrustFastConfirmer() == address(0), + "UpgradeAndEnableFastConfirmAction: Fast confirm already enabled" + ); + IRollupAdminFC(address(addressRegistry.rollup())).setAnyTrustFastConfirmer( + anyTrustFastConfirmer + ); + require( + IRollupAdminFC(address(addressRegistry.rollup())).anyTrustFastConfirmer() + == anyTrustFastConfirmer, + "UpgradeAndEnableFastConfirmAction: Unexpected anyTrustFastConfirmer" + ); + + // Set AnyTrustFastConfirmer as validator + address[] memory validators = new address[](1); + validators[0] = anyTrustFastConfirmer; + bool[] memory values = new bool[](1); + values[0] = true; + IRollupAdmin(address(addressRegistry.rollup())).setValidator(validators, values); + require( + IRollupCore(address(addressRegistry.rollup())).isValidator(anyTrustFastConfirmer), + "UpgradeAndEnableFastConfirmAction: Failed to set validator" + ); + + // Set minimum assertion period + IRollupAdmin(address(addressRegistry.rollup())).setMinimumAssertionPeriod( + newMinimumAssertionPeriod + ); + require( + IRollupCore(address(addressRegistry.rollup())).minimumAssertionPeriod() + == newMinimumAssertionPeriod, + "UpgradeAndEnableFastConfirmAction: Failed to set minimum assertion period" + ); + } +} From 8d305ac76649bb7ebd2f791c37920c4ea00531c0 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 6 Aug 2024 22:23:13 +0900 Subject: [PATCH 2/4] docs: comment --- .../AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol b/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol index e7d0f1cfa..8731f5316 100644 --- a/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol +++ b/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol @@ -35,6 +35,7 @@ contract UpgradeAndEnableFastConfirmAction { function perform() external { address rollupAddress = address(addressRegistry.rollup()); + // Upgrade rollup logics DoubleLogicUUPSUpgradeable(rollupAddress).upgradeTo(newPrimaryLogic); DoubleLogicUUPSUpgradeable(rollupAddress).upgradeSecondaryTo(newSecondaryLogic); From 22f8d27455b1fee6fc8027556d5761a9888e3fdb Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:01:24 -0400 Subject: [PATCH 3/4] use rollupAddress var --- .../UpgradeAndEnableFastConfirmAction.sol | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol b/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol index 8731f5316..a7f8710e7 100644 --- a/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol +++ b/src/gov-action-contracts/AIPs/EnableFastConfirm/UpgradeAndEnableFastConfirmAction.sol @@ -41,14 +41,14 @@ contract UpgradeAndEnableFastConfirmAction { // Setup AnyTrustFastConfirmer require( - IRollupAdminFC(address(addressRegistry.rollup())).anyTrustFastConfirmer() == address(0), + IRollupAdminFC(rollupAddress).anyTrustFastConfirmer() == address(0), "UpgradeAndEnableFastConfirmAction: Fast confirm already enabled" ); - IRollupAdminFC(address(addressRegistry.rollup())).setAnyTrustFastConfirmer( + IRollupAdminFC(rollupAddress).setAnyTrustFastConfirmer( anyTrustFastConfirmer ); require( - IRollupAdminFC(address(addressRegistry.rollup())).anyTrustFastConfirmer() + IRollupAdminFC(rollupAddress).anyTrustFastConfirmer() == anyTrustFastConfirmer, "UpgradeAndEnableFastConfirmAction: Unexpected anyTrustFastConfirmer" ); @@ -58,18 +58,18 @@ contract UpgradeAndEnableFastConfirmAction { validators[0] = anyTrustFastConfirmer; bool[] memory values = new bool[](1); values[0] = true; - IRollupAdmin(address(addressRegistry.rollup())).setValidator(validators, values); + IRollupAdmin(rollupAddress).setValidator(validators, values); require( - IRollupCore(address(addressRegistry.rollup())).isValidator(anyTrustFastConfirmer), + IRollupCore(rollupAddress).isValidator(anyTrustFastConfirmer), "UpgradeAndEnableFastConfirmAction: Failed to set validator" ); // Set minimum assertion period - IRollupAdmin(address(addressRegistry.rollup())).setMinimumAssertionPeriod( + IRollupAdmin(rollupAddress).setMinimumAssertionPeriod( newMinimumAssertionPeriod ); require( - IRollupCore(address(addressRegistry.rollup())).minimumAssertionPeriod() + IRollupCore(rollupAddress).minimumAssertionPeriod() == newMinimumAssertionPeriod, "UpgradeAndEnableFastConfirmAction: Failed to set minimum assertion period" ); From e7ffee080a21a0f66b0992f33f3ab885c6b667f3 Mon Sep 17 00:00:00 2001 From: gzeon Date: Thu, 8 Aug 2024 14:58:58 +0800 Subject: [PATCH 4/4] feat: v2.1.0 rollup logics on mainnet --- .../NovaUpgradeAndEnableFastConfirmAction.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol b/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol index 23e4e5888..bbe4f1703 100644 --- a/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol +++ b/src/gov-action-contracts/AIPs/EnableFastConfirm/NovaUpgradeAndEnableFastConfirmAction.sol @@ -8,8 +8,8 @@ contract NovaUpgradeAndEnableFastConfirmAction is UpgradeAndEnableFastConfirmAct constructor() UpgradeAndEnableFastConfirmAction( L1AddressRegistry(0x2F06643fc2CC18585Ae790b546388F0DE4Ec6635), - 0x0000000000000000000000000000000000000000, // TODO: v2.1.0 RollupAdminLogic - 0x0000000000000000000000000000000000000000, // TODO: v2.1.0 RollupUserLogic + 0x2f9491DB1920726d0cFE8AC5F1caC1f730C5dC44, // v2.1.0 RollupAdminLogic + 0x5c93BAB9Ff2Fa3884b643bd8545C625De0633517, // v2.1.0 RollupUserLogic 0x0000000000000000000000000000000000000000, // TODO: anyTrustFastConfirmer 1 // TODO: newMinimumAssertionPeriod in blocks )