Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UpgradeAndEnableFastConfirmAction action #305

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -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
gzeoneth marked this conversation as resolved.
Show resolved Hide resolved
0x0000000000000000000000000000000000000000, // TODO: anyTrustFastConfirmer
1 // TODO: newMinimumAssertionPeriod in blocks
Comment on lines +13 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know we're in draft right now and these are marked with comments but just adding a blocking review so we definitely don't forget to set these

)
{}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// 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());

// Upgrade rollup logics
DoubleLogicUUPSUpgradeable(rollupAddress).upgradeTo(newPrimaryLogic);
DoubleLogicUUPSUpgradeable(rollupAddress).upgradeSecondaryTo(newSecondaryLogic);

// Setup AnyTrustFastConfirmer
require(
IRollupAdminFC(address(addressRegistry.rollup())).anyTrustFastConfirmer() == address(0),
godzillaba marked this conversation as resolved.
Show resolved Hide resolved
"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"
);
}
}
Loading