-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add game type event #14196
base: develop
Are you sure you want to change the base?
feat: add game type event #14196
Changes from all commits
93728f2
0babff2
4d7ace6
c0ddd48
26b5906
433df9a
ae49708
2296aee
39deb8b
17d66eb
bd7d438
cc3b6a4
8dde752
613d542
8e88746
64a1ef4
75717c1
88b7c20
ab37e6f
15fc23d
a0f0d0e
ad99fa3
ca61120
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,9 +144,9 @@ contract OPContractsManager is ISemver { | |
|
||
// -------- Constants and Variables -------- | ||
|
||
/// @custom:semver 1.2.2 | ||
/// @custom:semver 1.3.0 | ||
function version() public pure virtual returns (string memory) { | ||
return "1.2.2"; | ||
return "1.3.0"; | ||
} | ||
|
||
/// @notice Address of the SuperchainConfig contract shared by all chains. | ||
|
@@ -198,6 +198,15 @@ contract OPContractsManager is ISemver { | |
/// @param upgrader Address that initiated the upgrade | ||
event Upgraded(uint256 indexed l2ChainId, ISystemConfig indexed systemConfig, address indexed upgrader); | ||
|
||
/// @notice Emitted when a new game type is added to a chain | ||
/// @param l2ChainId Chain ID of the chain | ||
/// @param gameType Type of the game being | ||
/// @param newDisputeGame Address of the deployed dispute game | ||
/// @param oldDisputeGame Address of the old dispute game | ||
event GameTypeAdded( | ||
uint256 indexed l2ChainId, GameType indexed gameType, IDisputeGame newDisputeGame, IDisputeGame oldDisputeGame | ||
); | ||
Comment on lines
+206
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this event signature was approved by proofs I've update the event based on proofs input. |
||
|
||
// -------- Errors -------- | ||
|
||
/// @notice Thrown when an address other than the upgrade controller calls the setRC function. | ||
|
@@ -623,14 +632,15 @@ contract OPContractsManager is ISemver { | |
if (lastGameConfig >= gameTypeInt) revert InvalidGameConfigs(); | ||
lastGameConfig = gameTypeInt; | ||
|
||
// Grab the FDG from the SystemConfig. | ||
IFaultDisputeGame fdg = IFaultDisputeGame( | ||
// Grab the permissioned and fault dispute games from the SystemConfig. | ||
// We keep the FDG type as it reduces casting below. | ||
IFaultDisputeGame pdg = IFaultDisputeGame( | ||
address( | ||
getGameImplementation(getDisputeGameFactory(gameConfig.systemConfig), GameTypes.PERMISSIONED_CANNON) | ||
Comment on lines
+636
to
639
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old |
||
) | ||
); | ||
// Pull out the chain ID. | ||
uint256 l2ChainId = getL2ChainId(fdg); | ||
uint256 l2ChainId = getL2ChainId(pdg); | ||
|
||
// Deploy a new DelayedWETH proxy for this game if one hasn't already been specified. Leaving | ||
/// gameConfig.delayedWETH as the zero address will cause a new DelayedWETH to be deployed for this game. | ||
|
@@ -650,10 +660,13 @@ contract OPContractsManager is ISemver { | |
outputs[i].delayedWETH = gameConfig.delayedWETH; | ||
} | ||
|
||
// The FDG is only used for the event below, and only if it is being replaced, | ||
// so we declare it here, but only assign it below if needed. | ||
IFaultDisputeGame fdg; | ||
|
||
// The below sections are functionally the same. Both deploy a new dispute game. The dispute game type is | ||
// either permissioned or permissionless depending on game config. | ||
if (gameConfig.permissioned) { | ||
IPermissionedDisputeGame pdg = IPermissionedDisputeGame(address(fdg)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this rename is no longer necessary because of the change above. |
||
outputs[i].faultDisputeGame = IFaultDisputeGame( | ||
Blueprint.deployFrom( | ||
bps.permissionedDisputeGame1, | ||
|
@@ -669,15 +682,18 @@ contract OPContractsManager is ISemver { | |
gameConfig.disputeMaxClockDuration, | ||
gameConfig.vm, | ||
outputs[i].delayedWETH, | ||
getAnchorStateRegistry(IFaultDisputeGame(address(pdg))), | ||
getAnchorStateRegistry(pdg), | ||
l2ChainId | ||
), | ||
getProposer(pdg), | ||
getChallenger(pdg) | ||
getProposer(IPermissionedDisputeGame(address(pdg))), | ||
getChallenger(IPermissionedDisputeGame(address(pdg))) | ||
) | ||
) | ||
); | ||
} else { | ||
fdg = IFaultDisputeGame( | ||
address(getGameImplementation(getDisputeGameFactory(gameConfig.systemConfig), GameTypes.CANNON)) | ||
); | ||
outputs[i].faultDisputeGame = IFaultDisputeGame( | ||
Blueprint.deployFrom( | ||
bps.permissionlessDisputeGame1, | ||
|
@@ -693,7 +709,7 @@ contract OPContractsManager is ISemver { | |
gameConfig.disputeMaxClockDuration, | ||
gameConfig.vm, | ||
outputs[i].delayedWETH, | ||
getAnchorStateRegistry(fdg), | ||
getAnchorStateRegistry(pdg), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ASR for the PDG and FDG should be the same, so this change doesn't matter in practice, but curious why you didn't keep this as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this changed with the varname change above, so the semantic diff is actually smaller. But now that we're getting |
||
l2ChainId | ||
) | ||
) | ||
|
@@ -706,6 +722,18 @@ contract OPContractsManager is ISemver { | |
IDisputeGameFactory dgf = getDisputeGameFactory(gameConfig.systemConfig); | ||
setDGFImplementation(dgf, gameConfig.disputeGameType, IDisputeGame(address(outputs[i].faultDisputeGame))); | ||
dgf.setInitBond(gameConfig.disputeGameType, gameConfig.initialBond); | ||
|
||
if (gameConfig.permissioned) { | ||
// Emit event for the newly added game type with the old permissioned dispute game | ||
emit GameTypeAdded( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit, but can we do these event emissions in the above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mentioned that here: https://github.com/ethereum-optimism/optimism/pull/14196/files#r1953015117 If you think slightly odd event ordering is OK, we can do that. |
||
l2ChainId, gameConfig.disputeGameType, outputs[i].faultDisputeGame, IDisputeGame(address(pdg)) | ||
); | ||
} else { | ||
// Emit event for the newly added game type with the old fault dispute game | ||
emit GameTypeAdded( | ||
l2ChainId, gameConfig.disputeGameType, outputs[i].faultDisputeGame, IDisputeGame(address(fdg)) | ||
); | ||
} | ||
Comment on lines
+725
to
+736
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a tradeoff made here. This approach has the benefit of emitting the |
||
} | ||
|
||
return outputs; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semver lock check failing since OPPU needs a semver change