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

Update RollupCreator #36

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
48 changes: 31 additions & 17 deletions src/rollup/RollupCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ contract RollupCreator is Ownable {
address validatorUtils,
address validatorWalletCreator
);
event TemplatesUpdated();

struct RollupDeploymentParams {
Config config;
Expand All @@ -45,24 +44,27 @@ contract RollupCreator is Ownable {
address eigenDARollupManager;
}

BridgeCreator public bridgeCreator;
IOneStepProofEntry public osp;
IChallengeManager public challengeManagerTemplate;
IRollupAdmin public rollupAdminLogic;
IRollupUser public rollupUserLogic;
IUpgradeExecutor public upgradeExecutorLogic;
modifier onlyUnfrozen() {
require(!deploymentFrozen, "Deployment no longer permitted from this creator");
_;
}

address public validatorUtils;
address public validatorWalletCreator;
BridgeCreator public immutable bridgeCreator;
IOneStepProofEntry public immutable osp;
IChallengeManager public immutable challengeManagerTemplate;
IRollupAdmin public immutable rollupAdminLogic;
IRollupUser public immutable rollupUserLogic;
IUpgradeExecutor public immutable upgradeExecutorLogic;

DeployHelper public l2FactoriesDeployer;
address public immutable validatorUtils;
address public immutable validatorWalletCreator;

constructor() Ownable() {}
DeployHelper public immutable l2FactoriesDeployer;

// creator receives back excess fees (for deploying L2 factories) so it can refund the caller
receive() external payable {}
bool public deploymentFrozen;
string public version;

function setTemplates(
constructor(
Copy link
Collaborator

Choose a reason for hiding this comment

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

biggest concern with removing setTemplates is that this new patten breaks the deploy script flows: https://github.com/Layr-Labs/nitro-contracts/blob/eigenda-v2.1.0/scripts/local-deployment/deployCreator.ts#L50-L66

BridgeCreator _bridgeCreator,
IOneStepProofEntry _osp,
IChallengeManager _challengeManagerLogic,
Expand All @@ -71,8 +73,10 @@ contract RollupCreator is Ownable {
IUpgradeExecutor _upgradeExecutorLogic,
address _validatorUtils,
address _validatorWalletCreator,
DeployHelper _l2FactoriesDeployer
) external onlyOwner {
DeployHelper _l2FactoriesDeployer,
address _creatorOwner,
string memory _version
) Ownable() {
bridgeCreator = _bridgeCreator;
osp = _osp;
challengeManagerTemplate = _challengeManagerLogic;
Expand All @@ -82,7 +86,16 @@ contract RollupCreator is Ownable {
validatorUtils = _validatorUtils;
validatorWalletCreator = _validatorWalletCreator;
l2FactoriesDeployer = _l2FactoriesDeployer;
emit TemplatesUpdated();

_transferOwnership(_creatorOwner);
version = _version;
}

// creator receives back excess fees (for deploying L2 factories) so it can refund the caller
receive() external payable {}

function freezeDeployment() external onlyOwner {
deploymentFrozen = true;
}

/**
Expand Down Expand Up @@ -111,6 +124,7 @@ contract RollupCreator is Ownable {
function createRollup(RollupDeploymentParams memory deployParams)
public
payable
onlyUnfrozen
returns (address)
{
{
Expand Down
7 changes: 4 additions & 3 deletions test/foundry/RollupCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ contract RollupCreatorTest is Test {
function setUp() public {
//// deploy rollup creator and set templates
vm.startPrank(deployer);
rollupCreator = new RollupCreator();
deployHelper = new DeployHelper();

// deploy BridgeCreators
Expand All @@ -75,7 +74,7 @@ contract RollupCreatorTest is Test {
rollupUser = _rollupUser;

//// deploy creator and set logic
rollupCreator.setTemplates(
rollupCreator = new RollupCreator(
ethenotethan marked this conversation as resolved.
Show resolved Hide resolved
bridgeCreator,
ospEntry,
challengeManager,
Expand All @@ -84,7 +83,9 @@ contract RollupCreatorTest is Test {
upgradeExecutorLogic,
address(new ValidatorUtils()),
address(new ValidatorWalletCreator()),
deployHelper
deployHelper,
deployer,
"4.2.0"
);

vm.stopPrank();
Expand Down
Loading