Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
1e2d7d11
Unverified
Commit
1e2d7d11
authored
Jun 14, 2023
by
Mark Tyneway
Committed by
GitHub
Jun 14, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6012 from ethereum-optimism/feat/upgradable-dgf
feat: upgradable dgf
parents
8e834128
c88c5cd7
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
246 additions
and
22 deletions
+246
-22
disputegamefactory.go
op-bindings/bindings/disputegamefactory.go
+190
-4
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+5
-5
.storage-layout
packages/contracts-bedrock/.storage-layout
+8
-4
DisputeGameFactory.sol
...ontracts-bedrock/contracts/dispute/DisputeGameFactory.sol
+24
-5
DisputeGameFactory.t.sol
...contracts-bedrock/contracts/test/DisputeGameFactory.t.sol
+19
-4
No files found.
op-bindings/bindings/disputegamefactory.go
View file @
1e2d7d11
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/.gas-snapshot
View file @
1e2d7d11
...
@@ -27,11 +27,11 @@ CrossDomainOwnable_Test:test_onlyOwner_notOwner_reverts() (gas: 10597)
...
@@ -27,11 +27,11 @@ CrossDomainOwnable_Test:test_onlyOwner_notOwner_reverts() (gas: 10597)
CrossDomainOwnable_Test:test_onlyOwner_succeeds() (gas: 34883)
CrossDomainOwnable_Test:test_onlyOwner_succeeds() (gas: 34883)
DeployerWhitelist_Test:test_owner_succeeds() (gas: 7582)
DeployerWhitelist_Test:test_owner_succeeds() (gas: 7582)
DeployerWhitelist_Test:test_storageSlots_succeeds() (gas: 33395)
DeployerWhitelist_Test:test_storageSlots_succeeds() (gas: 33395)
DisputeGameFactory_Test:test_owner_succeeds() (gas:
7627
)
DisputeGameFactory_Test:test_owner_succeeds() (gas:
12610
)
DisputeGameFactory_Test:test_setImplementation_notOwner_reverts() (gas: 1
1077
)
DisputeGameFactory_Test:test_setImplementation_notOwner_reverts() (gas: 1
6099
)
DisputeGameFactory_Test:test_setImplementation_succeeds() (gas:
38320
)
DisputeGameFactory_Test:test_setImplementation_succeeds() (gas:
44302
)
DisputeGameFactory_Test:test_transferOwnership_notOwner_reverts() (gas: 1
0979
)
DisputeGameFactory_Test:test_transferOwnership_notOwner_reverts() (gas: 1
5974
)
DisputeGameFactory_Test:test_transferOwnership_succeeds() (gas: 1
3225
)
DisputeGameFactory_Test:test_transferOwnership_succeeds() (gas: 1
8694
)
FeeVault_Test:test_constructor_succeeds() (gas: 18185)
FeeVault_Test:test_constructor_succeeds() (gas: 18185)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 352135)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 352135)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2950342)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2950342)
...
...
packages/contracts-bedrock/.storage-layout
View file @
1e2d7d11
...
@@ -255,7 +255,11 @@
...
@@ -255,7 +255,11 @@
| Name | Type | Slot | Offset | Bytes | Contract |
| Name | Type | Slot | Offset | Bytes | Contract |
|-----------------|--------------------------------------------|------|--------|-------|-------------------------------------------------------------|
|-----------------|--------------------------------------------|------|--------|-------|-------------------------------------------------------------|
| _owner | address | 0 | 0 | 20 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| _initialized | uint8 | 0 | 0 | 1 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| gameImpls | mapping(GameType => contract IDisputeGame) | 1 | 0 | 32 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| _initializing | bool | 0 | 1 | 1 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| disputeGames | mapping(Hash => contract IDisputeGame) | 2 | 0 | 32 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| __gap | uint256[50] | 1 | 0 | 1600 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| disputeGameList | contract IDisputeGame[] | 3 | 0 | 32 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| _owner | address | 51 | 0 | 20 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| __gap | uint256[49] | 52 | 0 | 1568 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| gameImpls | mapping(GameType => contract IDisputeGame) | 101 | 0 | 32 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| disputeGames | mapping(Hash => contract IDisputeGame) | 102 | 0 | 32 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
| disputeGameList | contract IDisputeGame[] | 103 | 0 | 32 | contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory |
packages/contracts-bedrock/contracts/dispute/DisputeGameFactory.sol
View file @
1e2d7d11
...
@@ -4,17 +4,20 @@ pragma solidity ^0.8.15;
...
@@ -4,17 +4,20 @@ pragma solidity ^0.8.15;
import "../libraries/DisputeTypes.sol";
import "../libraries/DisputeTypes.sol";
import "../libraries/DisputeErrors.sol";
import "../libraries/DisputeErrors.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ClonesWithImmutableArgs } from "@cwia/ClonesWithImmutableArgs.sol";
import { ClonesWithImmutableArgs } from "@cwia/ClonesWithImmutableArgs.sol";
import {
OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { IDisputeGame } from "./interfaces/IDisputeGame.sol";
import { IDisputeGame } from "./interfaces/IDisputeGame.sol";
import { IDisputeGameFactory } from "./interfaces/IDisputeGameFactory.sol";
import { IDisputeGameFactory } from "./interfaces/IDisputeGameFactory.sol";
import { IVersioned } from "./interfaces/IVersioned.sol";
/**
/**
* @title DisputeGameFactory
* @title DisputeGameFactory
* @notice A factory contract for creating `IDisputeGame` contracts.
* @notice A factory contract for creating `IDisputeGame` contracts.
*/
*/
contract DisputeGameFactory is Ownable
, IDisputeGameFactory
{
contract DisputeGameFactory is Ownable
Upgradeable, IDisputeGameFactory, IVersioned
{
/**
/**
* @dev Allows for the creation of clone proxies with immutable arguments.
* @dev Allows for the creation of clone proxies with immutable arguments.
*/
*/
...
@@ -40,11 +43,27 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
...
@@ -40,11 +43,27 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
IDisputeGame[] public disputeGameList;
IDisputeGame[] public disputeGameList;
/**
/**
* @notice Constructs a new DisputeGameFactory contract.
* @notice Constructs a new DisputeGameFactory contract. Set the owner
* to `address(0)` to prevent accidental usage of the implementation.
*/
constructor() OwnableUpgradeable() {
_transferOwnership(address(0));
}
/**
* @notice Initializes the contract.
* @param _owner The owner of the contract.
* @param _owner The owner of the contract.
*/
*/
constructor(address _owner) Ownable() {
function initialize(address _owner) external initializer {
transferOwnership(_owner);
__Ownable_init();
_transferOwnership(_owner);
}
/**
* @inheritdoc IVersioned
*/
function version() external pure returns (string memory) {
return "0.0.1";
}
}
/**
/**
...
...
packages/contracts-bedrock/contracts/test/DisputeGameFactory.t.sol
View file @
1e2d7d11
...
@@ -7,10 +7,10 @@ import "../libraries/DisputeErrors.sol";
...
@@ -7,10 +7,10 @@ import "../libraries/DisputeErrors.sol";
import { Test } from "forge-std/Test.sol";
import { Test } from "forge-std/Test.sol";
import { DisputeGameFactory } from "../dispute/DisputeGameFactory.sol";
import { DisputeGameFactory } from "../dispute/DisputeGameFactory.sol";
import { IDisputeGame } from "../dispute/interfaces/IDisputeGame.sol";
import { IDisputeGame } from "../dispute/interfaces/IDisputeGame.sol";
import { Proxy } from "../universal/Proxy.sol";
contract DisputeGameFactory_
Test
is Test {
contract DisputeGameFactory_
Initializer
is Test {
DisputeGameFactory factory;
DisputeGameFactory factory;
FakeClone fakeClone;
event DisputeGameCreated(
event DisputeGameCreated(
address indexed disputeProxy,
address indexed disputeProxy,
...
@@ -20,8 +20,23 @@ contract DisputeGameFactory_Test is Test {
...
@@ -20,8 +20,23 @@ contract DisputeGameFactory_Test is Test {
event ImplementationSet(address indexed impl, GameType indexed gameType);
event ImplementationSet(address indexed impl, GameType indexed gameType);
function setUp() public {
function setUp() public virtual {
factory = new DisputeGameFactory(address(this));
Proxy proxy = new Proxy(address(this));
DisputeGameFactory impl = new DisputeGameFactory();
proxy.upgradeToAndCall({
_implementation: address(impl),
_data: abi.encodeCall(impl.initialize, (address(this)))
});
factory = DisputeGameFactory(address(proxy));
}
}
contract DisputeGameFactory_Test is DisputeGameFactory_Initializer {
FakeClone fakeClone;
function setUp() public override {
super.setUp();
fakeClone = new FakeClone();
fakeClone = new FakeClone();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment