Skip to content

Commit

Permalink
fix: rm guardian
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-manuel committed Oct 2, 2024
1 parent 875bc77 commit b4cdc4e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions deploy/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ library Deploy {
receiver = address(new OptimismReceiver(l1Authority, executor));
}

function setUpExecutorPermissions(address executor_, address receiver, address guardian)
function setUpExecutorPermissions(address executor_, address receiver)
internal
{
// NOTE: Using implementation instead of interface because OZ didn't define
// DEFAULT_ADMIN_ROLE in the IAccessControl interface.
Executor executor = Executor(executor_);

executor.grantRole(executor.SUBMISSION_ROLE(), receiver);
executor.grantRole(executor.GUARDIAN_ROLE(), guardian);
executor.revokeRole(executor.DEFAULT_ADMIN_ROLE(), address(this));
}

Expand Down
5 changes: 2 additions & 3 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ contract DeployBaseExecutor is Script {

function run() public {
address executor = Deploy.deployExecutor(100, 1000);

address receiver = Deploy.deployOptimismReceiver(Ethereum.SPARK_PROXY, executor);

// TODO: What is guardian here?
Deploy.setUpExecutorPermissions(executor, receiver, address(1));
Deploy.setUpExecutorPermissions(executor, receiver);
}

}
4 changes: 1 addition & 3 deletions test/Deploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ contract DeployTests is Test {
);

assertEq(executor.hasRole(executor.SUBMISSION_ROLE(), address(receiver)), false);
assertEq(executor.hasRole(executor.GUARDIAN_ROLE(), makeAddr("guardian")), false);
assertEq(executor.hasRole(executor.DEFAULT_ADMIN_ROLE(), address(this)), true);

Deploy.setUpExecutorPermissions(address(executor), address(receiver), makeAddr("guardian"));
Deploy.setUpExecutorPermissions(address(executor), address(receiver));

assertEq(executor.hasRole(executor.SUBMISSION_ROLE(), address(receiver)), true);
assertEq(executor.hasRole(executor.GUARDIAN_ROLE(), makeAddr("guardian")), true);
assertEq(executor.hasRole(executor.DEFAULT_ADMIN_ROLE(), address(this)), false);
}

Expand Down

0 comments on commit b4cdc4e

Please sign in to comment.