Skip to content

Commit

Permalink
audit: disable timelock in constructor (#224)
Browse files Browse the repository at this point in the history
* refactor: constructor disables timelock

* chore: remove non proxy timelock tests

* chore: remove constructor params

---------

Co-authored-by: Orlando <[email protected]>
  • Loading branch information
Orland0x and Orlando authored Jun 27, 2023
1 parent 9f5f1fe commit 3bc77f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
19 changes: 5 additions & 14 deletions src/execution-strategies/TimelockExecutionStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,11 @@ contract TimelockExecutionStrategy is SimpleQuorumExecutionStrategy, IERC1155Rec
/// renounce ownership of the contract while still maintaining a veto guardian.
address public vetoGuardian;

/// @notice Constructor
/// @param _owner Address of the owner of this contract.
/// @param _vetoGuardian Address of the veto guardian.
/// @param _spaces Array of whitelisted space contracts.
/// @param _timelockDelay The timelock delay in seconds.
/// @param _quorum The quorum required to execute a proposal.
constructor(
address _owner,
address _vetoGuardian,
address[] memory _spaces,
uint256 _timelockDelay,
uint256 _quorum
) {
setUp(abi.encode(_owner, _vetoGuardian, _spaces, _timelockDelay, _quorum));
/// @notice Constructor.
/// @dev We enforce implementations of this contract to be disabled as a security measure to prevent delegate
/// calls to the SELFDESTRUCT opcode, irrecoverably disabling all the proxies using that implementation.
constructor() {
setUp(abi.encode(address(1), address(1), new address[](0), 0, 0));
}

/// @notice Initialization function, should be called immediately after deploying a new proxy to this contract.
Expand Down
25 changes: 1 addition & 24 deletions test/TimelockExecutionStrategy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,6 @@ abstract contract TimelockExecutionStrategyTest is SpaceTest {
}

function testSetUp() public {
address[] memory spaces = new address[](1);
spaces[0] = address(space);
timelockExecutionStrategy = new TimelockExecutionStrategy(owner, vetoGuardian, spaces, 1000, quorum);

assertEq(timelockExecutionStrategy.owner(), owner);
assertEq(timelockExecutionStrategy.vetoGuardian(), vetoGuardian);
assertEq(timelockExecutionStrategy.quorum(), quorum);
Expand All @@ -520,33 +516,14 @@ abstract contract TimelockExecutionStrategyTest is SpaceTest {
}
}

contract TimelockExecutionStrategyTestDirect is TimelockExecutionStrategyTest {
function setUp() public override {
super.setUp();

address[] memory spaces = new address[](1);
spaces[0] = address(space);

timelockExecutionStrategy = new TimelockExecutionStrategy(owner, vetoGuardian, spaces, 1000, quorum);
vm.deal(address(owner), 1000);
payable(timelockExecutionStrategy).transfer(1000);
}
}

contract TimelockExecutionStrategyTestProxy is TimelockExecutionStrategyTest {
function setUp() public override {
super.setUp();

address[] memory spaces = new address[](1);
spaces[0] = address(space);
address[] memory emptyArray = new address[](1);
TimelockExecutionStrategy masterExecutionStrategy = new TimelockExecutionStrategy(
address(1),
address(0),
emptyArray,
0,
0
);
TimelockExecutionStrategy masterExecutionStrategy = new TimelockExecutionStrategy();

timelockExecutionStrategy = TimelockExecutionStrategy(
payable(
Expand Down

0 comments on commit 3bc77f3

Please sign in to comment.