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
06b48767
Unverified
Commit
06b48767
authored
Mar 19, 2024
by
smartcontracts
Committed by
GitHub
Mar 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maint(ct): misc comment cleanup (#9902)
Some miscellaneous comment cleanup for dispute contracts.
parent
a86de7a3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
37 deletions
+39
-37
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+3
-3
AnchorStateRegistry.sol
...ges/contracts-bedrock/src/dispute/AnchorStateRegistry.sol
+5
-0
DisputeGameFactory.sol
...ages/contracts-bedrock/src/dispute/DisputeGameFactory.sol
+10
-12
PermissionedDisputeGame.sol
...contracts-bedrock/src/dispute/PermissionedDisputeGame.sol
+5
-3
IAnchorStateRegistry.sol
...s-bedrock/src/dispute/interfaces/IAnchorStateRegistry.sol
+3
-3
DelayedWETH.sol
packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol
+13
-16
No files found.
packages/contracts-bedrock/semver-lock.json
View file @
06b48767
...
@@ -105,11 +105,11 @@
...
@@ -105,11 +105,11 @@
},
},
"src/dispute/AnchorStateRegistry.sol"
:
{
"src/dispute/AnchorStateRegistry.sol"
:
{
"initCodeHash"
:
"0x2f8c56069e43e306b0e40fba43109188b29328e83569560021a68aa5d9f2486b"
,
"initCodeHash"
:
"0x2f8c56069e43e306b0e40fba43109188b29328e83569560021a68aa5d9f2486b"
,
"sourceCodeHash"
:
"0xb
6e67d68b801b7a110207b0c33802ea94cf26f9a7f3ebba78123d930a2eb0b2a
"
"sourceCodeHash"
:
"0xb
a941ad1f941f5a4a066182d50634fa9b190085ed82779decef71c019ba963c5
"
},
},
"src/dispute/DisputeGameFactory.sol"
:
{
"src/dispute/DisputeGameFactory.sol"
:
{
"initCodeHash"
:
"0x80d749a56c1776930fe0deb5c3c646217716e5875ace99c4d036af0452236476"
,
"initCodeHash"
:
"0x80d749a56c1776930fe0deb5c3c646217716e5875ace99c4d036af0452236476"
,
"sourceCodeHash"
:
"0x
1e5a6deded88804971fc1847c9eac65921771bff353437c0b29ed2f55513b984
"
"sourceCodeHash"
:
"0x
f897c1a845a16cb8b217135a1c7819cdb20b315567066282f5860251e48d3611
"
},
},
"src/dispute/FaultDisputeGame.sol"
:
{
"src/dispute/FaultDisputeGame.sol"
:
{
"initCodeHash"
:
"0x9dcd4df1dd3e7a09dab46bfe1ebd9376f533cc533f9edce2f01aa754301e25aa"
,
"initCodeHash"
:
"0x9dcd4df1dd3e7a09dab46bfe1ebd9376f533cc533f9edce2f01aa754301e25aa"
,
...
@@ -117,7 +117,7 @@
...
@@ -117,7 +117,7 @@
},
},
"src/dispute/weth/DelayedWETH.sol"
:
{
"src/dispute/weth/DelayedWETH.sol"
:
{
"initCodeHash"
:
"0xf179e4249be6eda22b24ae2b32717f154f35edeb9dee0332aefa6fad3ace4dbe"
,
"initCodeHash"
:
"0xf179e4249be6eda22b24ae2b32717f154f35edeb9dee0332aefa6fad3ace4dbe"
,
"sourceCodeHash"
:
"0x
5f1f07aba545be48c76285fde404308b0c51f75777720d06d7fe5087e338c39a
"
"sourceCodeHash"
:
"0x
1a37c92242f612588f60256554107ee675678687b49b1f41087411dfcd6aabd3
"
},
},
"src/legacy/DeployerWhitelist.sol"
:
{
"src/legacy/DeployerWhitelist.sol"
:
{
"initCodeHash"
:
"0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d"
,
"initCodeHash"
:
"0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d"
,
...
...
packages/contracts-bedrock/src/dispute/AnchorStateRegistry.sol
View file @
06b48767
...
@@ -11,6 +11,11 @@ import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.
...
@@ -11,6 +11,11 @@ import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.
import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeTypes.sol";
/// @title AnchorStateRegistry
/// @notice The AnchorStateRegistry is a contract that stores the latest "anchor" state for each available
/// FaultDisputeGame type. The anchor state is the latest state that has been proposed on L1 and was not
/// challenged within the challenge period. By using stored anchor states, new FaultDisputeGame instances can
/// be initialized with a more recent starting state which reduces the amount of required offchain computation.
contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver {
contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver {
/// @notice Describes an initial anchor state for a game type.
/// @notice Describes an initial anchor state for a game type.
struct StartingAnchorRoot {
struct StartingAnchorRoot {
...
...
packages/contracts-bedrock/src/dispute/DisputeGameFactory.sol
View file @
06b48767
...
@@ -14,11 +14,10 @@ import "src/libraries/DisputeTypes.sol";
...
@@ -14,11 +14,10 @@ import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeErrors.sol";
import "src/libraries/DisputeErrors.sol";
/// @title DisputeGameFactory
/// @title DisputeGameFactory
/// @notice A factory contract for creating `IDisputeGame` contracts. All created dispute games
/// @notice A factory contract for creating `IDisputeGame` contracts. All created dispute games are stored in both a
/// are stored in both a mapping and an append only array. The timestamp of the creation
/// mapping and an append only array. The timestamp of the creation time of the dispute game is packed tightly
/// time of the dispute game is packed tightly into the storage slot with the address of
/// into the storage slot with the address of the dispute game to make offchain discoverability of playable
/// the dispute game. This is to make offchain discoverability of playable dispute games
/// dispute games easier.
/// easier.
contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver {
contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver {
/// @dev Allows for the creation of clone proxies with immutable arguments.
/// @dev Allows for the creation of clone proxies with immutable arguments.
using ClonesWithImmutableArgs for address;
using ClonesWithImmutableArgs for address;
...
@@ -33,17 +32,15 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
...
@@ -33,17 +32,15 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
/// @inheritdoc IDisputeGameFactory
/// @inheritdoc IDisputeGameFactory
mapping(GameType => uint256) public initBonds;
mapping(GameType => uint256) public initBonds;
/// @notice Mapping of a hash of `gameType || rootClaim || extraData` to
/// @notice Mapping of a hash of `gameType || rootClaim || extraData` to the deployed `IDisputeGame` clone (where
/// the deployed `IDisputeGame` clone.
// `||` denotes concatenation).
/// @dev Note: `||` denotes concatenation.
mapping(Hash => GameId) internal _disputeGames;
mapping(Hash => GameId) internal _disputeGames;
/// @notice an append-only array of disputeGames that have been created.
/// @notice An append-only array of disputeGames that have been created. Used by offchain game solvers to
/// @dev this accessor is used by offchain game solvers to efficiently
/// efficiently track dispute games.
/// track dispute games
GameId[] internal _disputeGameList;
GameId[] internal _disputeGameList;
/// @notice
c
onstructs a new DisputeGameFactory contract.
/// @notice
C
onstructs a new DisputeGameFactory contract.
constructor() OwnableUpgradeable() {
constructor() OwnableUpgradeable() {
initialize(address(0));
initialize(address(0));
}
}
...
@@ -115,6 +112,7 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
...
@@ -115,6 +112,7 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
// If a dispute game with the same UUID already exists, revert.
// If a dispute game with the same UUID already exists, revert.
if (GameId.unwrap(_disputeGames[uuid]) != bytes32(0)) revert GameAlreadyExists(uuid);
if (GameId.unwrap(_disputeGames[uuid]) != bytes32(0)) revert GameAlreadyExists(uuid);
// Pack the game ID.
GameId id = LibGameId.pack(_gameType, Timestamp.wrap(uint64(block.timestamp)), proxy_);
GameId id = LibGameId.pack(_gameType, Timestamp.wrap(uint64(block.timestamp)), proxy_);
// Store the dispute game id in the mapping & emit the `DisputeGameCreated` event.
// Store the dispute game id in the mapping & emit the `DisputeGameCreated` event.
...
...
packages/contracts-bedrock/src/dispute/PermissionedDisputeGame.sol
View file @
06b48767
...
@@ -11,12 +11,14 @@ import "src/libraries/DisputeErrors.sol";
...
@@ -11,12 +11,14 @@ import "src/libraries/DisputeErrors.sol";
/// @notice PermissionedDisputeGame is a contract that inherits from `FaultDisputeGame`, and contains two roles:
/// @notice PermissionedDisputeGame is a contract that inherits from `FaultDisputeGame`, and contains two roles:
/// - The `challenger` role, which is allowed to challenge a dispute.
/// - The `challenger` role, which is allowed to challenge a dispute.
/// - The `proposer` role, which is allowed to create proposals and participate in their game.
/// - The `proposer` role, which is allowed to create proposals and participate in their game.
/// This contract exists as a fallback mechanism in case of the failure of the fault proof system in the stage
/// This contract exists as a way for networks to support the fault proof iteration of the OptimismPortal
/// one release. It will not be the default implementation used, and eventually will be deprecated in favor of
/// contract without needing to support a fully permissionless system. Permissionless systems can introduce
/// a fully permissionless system.
/// costs that certain networks may not wish to support. This contract can also be used as a fallback mechanism
/// in case of a failure in the permissionless fault proof system in the stage one release.
contract PermissionedDisputeGame is FaultDisputeGame {
contract PermissionedDisputeGame is FaultDisputeGame {
/// @notice The proposer role is allowed to create proposals and participate in the dispute game.
/// @notice The proposer role is allowed to create proposals and participate in the dispute game.
address internal immutable PROPOSER;
address internal immutable PROPOSER;
/// @notice The challenger role is allowed to participate in the dispute game.
/// @notice The challenger role is allowed to participate in the dispute game.
address internal immutable CHALLENGER;
address internal immutable CHALLENGER;
...
...
packages/contracts-bedrock/src/dispute/interfaces/IAnchorStateRegistry.sol
View file @
06b48767
...
@@ -17,8 +17,8 @@ interface IAnchorStateRegistry {
...
@@ -17,8 +17,8 @@ interface IAnchorStateRegistry {
/// @return DisputeGameFactory address.
/// @return DisputeGameFactory address.
function disputeGameFactory() external view returns (IDisputeGameFactory);
function disputeGameFactory() external view returns (IDisputeGameFactory);
/// @notice Callable by FaultDisputeGame contracts to update the anchor state. Pulls the anchor
/// @notice Callable by FaultDisputeGame contracts to update the anchor state. Pulls the anchor
state directly from
///
state directly from the FaultDisputeGame contract and stores it in the registry if
///
the FaultDisputeGame contract and stores it in the registry if the new anchor state is valid and the
///
the new anchor state is valid and the
state is newer than the current anchor state.
/// state is newer than the current anchor state.
function tryUpdateAnchorState() external;
function tryUpdateAnchorState() external;
}
}
packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol
View file @
06b48767
...
@@ -11,16 +11,14 @@ import { WETH98 } from "src/dispute/weth/WETH98.sol";
...
@@ -11,16 +11,14 @@ import { WETH98 } from "src/dispute/weth/WETH98.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
/// @title DelayedWETH
/// @title DelayedWETH
/// @notice DelayedWETH is an extension to WETH9 that allows for delayed withdrawals. Accounts must
/// @notice DelayedWETH is an extension to WETH9 that allows for delayed withdrawals. Accounts must trigger an unlock
/// trigger an unlock function before they can withdraw WETH. Accounts must trigger unlock
/// function before they can withdraw WETH. Accounts must trigger unlock by specifying a sub-account and an
/// by specifying a sub-account and an amount of WETH to unlock. Accounts can trigger the
/// amount of WETH to unlock. Accounts can trigger the unlock function at any time, but must wait a delay
/// unlock function at any time, but must wait a delay period before they can withdraw
/// period before they can withdraw after the unlock function is triggered. DelayedWETH is designed to be used
/// after the unlock function is triggered. DelayedWETH is designed to be used by the
/// by the DisputeGame contracts where unlock will only be triggered after a dispute is resolved. DelayedWETH
/// DisputeGame contracts where unlock will only be triggered after a dispute is resolved.
/// is meant to sit behind a proxy contract and has an owner address that can pull WETH from any account and
/// DelayedWETH is meant to sit behind a proxy contract and has an owner address that can
/// can recover ETH from the contract itself. Variable and function naming vaguely follows the vibe of WETH9.
/// pull WETH from any account and can recover ETH from the contract itself. Variable and
/// Not the prettiest contract in the world, but it gets the job done.
/// function naming vaguely follows the vibe of WETH9. Not the prettiest contract in the
/// world, but it gets the job done.
contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
/// @notice Semantic version.
/// @notice Semantic version.
/// @custom:semver 0.2.0
/// @custom:semver 0.2.0
...
@@ -57,12 +55,11 @@ contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
...
@@ -57,12 +55,11 @@ contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
/// @inheritdoc IDelayedWETH
/// @inheritdoc IDelayedWETH
function unlock(address _guy, uint256 _wad) external {
function unlock(address _guy, uint256 _wad) external {
// Note that the unlock function can be called by any address, but the actual unlocking
// Note that the unlock function can be called by any address, but the actual unlocking capability still only
// capability still only gives the msg.sender the ability to withdraw from the account.
// gives the msg.sender the ability to withdraw from the account. As long as the unlock and withdraw functions
// As long as the unlock and withdraw functions are called with the proper recipient
// are called with the proper recipient addresses, this will be safe. Could be made safer by having external
// addresses, this will be safe. Could be made safer by having external accounts execute
// accounts execute withdrawals themselves but that would have added extra complexity and made DelayedWETH a
// withdrawals themselves but that would have added extra complexity and made DelayedWETH
// leaky abstraction, so we chose this instead.
// a leaky abstraction, so we chose this instead.
WithdrawalRequest storage wd = withdrawals[msg.sender][_guy];
WithdrawalRequest storage wd = withdrawals[msg.sender][_guy];
wd.timestamp = block.timestamp;
wd.timestamp = block.timestamp;
wd.amount += _wad;
wd.amount += _wad;
...
...
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