Skip to content

Commit

Permalink
update: rollup creator behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 committed Dec 4, 2024
1 parent 023abf5 commit 7a95ffa
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
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(
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(
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

0 comments on commit 7a95ffa

Please sign in to comment.