Commit cd24e96b authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6028 from ethereum-optimism/refcell/initializedgf

fix(ctb): Initialize DisputeGameFactory in Constructor
parents ae8a3a74 3ea3937e
This diff is collapsed.
......@@ -43,18 +43,17 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, IVersion
IDisputeGame[] public disputeGameList;
/**
* @notice Constructs a new DisputeGameFactory contract. Set the owner
* to `address(0)` to prevent accidental usage of the implementation.
* @notice Constructs a new DisputeGameFactory contract.
*/
constructor() OwnableUpgradeable() {
_transferOwnership(address(0));
initialize(address(0));
}
/**
* @notice Initializes the contract.
* @param _owner The owner of the contract.
*/
function initialize(address _owner) external initializer {
function initialize(address _owner) public initializer {
__Ownable_init();
_transferOwnership(_owner);
}
......
......@@ -29,6 +29,7 @@ contract DisputeGameFactory_Initializer is Test {
_data: abi.encodeCall(impl.initialize, (address(this)))
});
factory = DisputeGameFactory(address(proxy));
vm.label(address(factory), "DisputeGameFactoryProxy");
}
}
......
......@@ -2,6 +2,7 @@
pragma solidity ^0.8.15;
import { Test } from "forge-std/Test.sol";
import { DisputeGameFactory_Initializer } from "./DisputeGameFactory.t.sol";
import { DisputeGameFactory } from "../dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../dispute/FaultDisputeGame.sol";
......@@ -10,7 +11,7 @@ import "../libraries/DisputeErrors.sol";
import { LibClock } from "../dispute/lib/LibClock.sol";
import { LibPosition } from "../dispute/lib/LibPosition.sol";
contract FaultDisputeGame_Test is Test {
contract FaultDisputeGame_Test is DisputeGameFactory_Initializer {
/**
* @dev The root claim of the game.
*/
......@@ -28,10 +29,6 @@ contract FaultDisputeGame_Test is Test {
*/
string internal constant VERSION = "0.0.1";
/**
* @dev The factory that will be used to create the game.
*/
DisputeGameFactory internal factory;
/**
* @dev The implementation of the game.
*/
......@@ -43,10 +40,8 @@ contract FaultDisputeGame_Test is Test {
event Move(uint256 indexed parentIndex, Claim indexed pivot, address indexed claimant);
function setUp() public {
// Deploy a new dispute game factory.
factory = new DisputeGameFactory();
factory.initialize(address(this));
function setUp() public override {
super.setUp();
// Deploy an implementation of the fault game
gameImpl = new FaultDisputeGame();
// Register the game implementation with the factory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment