Skip to content

Commit

Permalink
Merge pull request #13 from Transient-Labs/disable-initializer
Browse files Browse the repository at this point in the history
added disable initializer to constructor of BlockListRegistry
  • Loading branch information
mpeyfuss authored Feb 7, 2023
2 parents 678fe98 + 467b75a commit 7494a4b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/BlockListRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeabl
Constructor
//////////////////////////////////////////////////////////////////////////*/

/// @param disable - disable the initalizer on deployment
constructor(bool disable) {
if (disable) _disableInitializers();
}

/// @param newOwner - the initial owner of this contract
/// @param initBlockList - initial list of addresses to add to the blocklist
function initialize(address newOwner, address[] memory initBlockList) external initializer {
Expand Down
1 change: 1 addition & 0 deletions src/BlockListRegistryFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {BlockListRegistry} from "./BlockListRegistry.sol";
/// @title BlockListFactory
/// @notice contract factory to deploy blocklist registries.
/// @author transientlabs.xyz

contract BlockListRegistryFactory is Ownable {
/*//////////////////////////////////////////////////////////////////////////
Events
Expand Down
2 changes: 1 addition & 1 deletion test/integration_tests/BlockListIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract BlockListIntegrationTest is Test {
blockList.push(address(2));
blockList.push(address(3));

blockListRegistryTemplate = address(new BlockListRegistry());
blockListRegistryTemplate = address(new BlockListRegistry(true));
factory = new BlockListRegistryFactory(blockListRegistryTemplate);
registry = factory.createBlockListRegistry(blockList);
mockContract = new BlockListMock(registry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract BlockListUpgradeableIntegrationTest is Test {
blockList.push(address(2));
blockList.push(address(3));

blockListRegistryTemplate = address(new BlockListRegistry());
blockListRegistryTemplate = address(new BlockListRegistry(true));
factory = new BlockListRegistryFactory(blockListRegistryTemplate);
registry = factory.createBlockListRegistry(blockList);
mockContract = new BlockListMockUpgradeable();
Expand Down
4 changes: 3 additions & 1 deletion test/unit_tests/BlockListRegistry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ contract BlockListRegistryUnitTest is Test, BlockListRegistry {
bytes32 public constant NOT_ADMIN_ROLE = keccak256("NOT_ADMIN_ROLE");
BlockListRegistry public blocklist;

constructor() BlockListRegistry(false) {}

function setUp() public {
blocklist = new BlockListRegistry();
blocklist = new BlockListRegistry(false);
blocklist.initialize(address(this), initBlockedOperators);
}

Expand Down

0 comments on commit 7494a4b

Please sign in to comment.