Skip to content

Commit

Permalink
Merge pull request #226 from bobanetwork/emit-l2blocknumber
Browse files Browse the repository at this point in the history
Emit l2BlockNumber in the Resolved event
  • Loading branch information
boyuan-chen authored Aug 12, 2024
2 parents 97809e9 + 22ba25c commit e40a8e7
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 22 deletions.
46 changes: 32 additions & 14 deletions boba-bindings/bindings/faultdisputegame.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion boba-bindings/bindings/faultdisputegame_more.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"DisputeGameFactoryProxy": "0x29Bd67B23cAC0E6bbDe1373E3859Dd25510f3331",
"Mips": "0xC331b49Ac58dcaD21063177C735FD5215309BAE1",
"OptimismPortal2": "0x3e3a5D73f5044EFD0676468f221DeA9C4975c549",
"PreimageOracle": "0xF68050E774c2C26C1f1587522e6Df1f684eb1A58"
"PreimageOracle": "0xF68050E774c2C26C1f1587522e6Df1f684eb1A58",
"FaultDisputeGame": "0x5D20776Fb8D91181873F210bFb89eAA694217c0b",
"PermissionedDisputeGame": "0x49A14B793Dd55099111E3Fe9c9DF34c927d2193D"
}
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
"sourceCodeHash": "0x918c395ac5d77357f2551616aad0613e68893862edd14e554623eb16ee6ba148"
},
"src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0x5ea5b544b8d7b32f55f7864c25a2443a5db363ffd1c66e0799cbc7bccaf98526",
"sourceCodeHash": "0xe8d90f1a8f92732707e370767df260bc806be5be9808f150ebed2c6caa158734"
"initCodeHash": "0x80a58ca4305959f3d8f18898a750a5fc139f0614f173ff986e4262b26d7dcebd",
"sourceCodeHash": "0xf9bad7123a22e7755cafd2899d42c99f348161a8ac0d540015389c5234056cdd"
},
"src/dispute/weth/DelayedWETH.sol": {
"initCodeHash": "0xb9bbe005874922cd8f499e7a0a092967cfca03e012c1e41912b0c77481c71777",
Expand Down
12 changes: 12 additions & 0 deletions packages/contracts-bedrock/snapshots/abi/FaultDisputeGame.json
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,18 @@
"internalType": "enum GameStatus",
"name": "status",
"type": "uint8"
},
{
"indexed": true,
"internalType": "Claim",
"name": "rootClaim",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint256",
"name": "l2BlockNumber",
"type": "uint256"
}
],
"name": "Resolved",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,18 @@
"internalType": "enum GameStatus",
"name": "status",
"type": "uint8"
},
{
"indexed": true,
"internalType": "Claim",
"name": "rootClaim",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint256",
"name": "l2BlockNumber",
"type": "uint256"
}
],
"name": "Resolved",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
resolvedAt = Timestamp.wrap(uint64(block.timestamp));

// Update the status and emit the resolved event, note that we're performing an assignment here.
emit Resolved(status = status_);
emit Resolved(status = status_, rootClaim(), l2BlockNumber());

// Try to update the anchor state, this should not revert.
ANCHOR_STATE_REGISTRY.tryUpdateAnchorState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import "src/dispute/lib/Types.sol";
interface IDisputeGame is IInitializable {
/// @notice Emitted when the game is resolved.
/// @param status The status of the game after resolution.
event Resolved(GameStatus indexed status);
/// @param rootClaim The root claim of the DisputeGame.
/// @param l2BlockNumber The L2 block number at which the output root was generated.
event Resolved(GameStatus indexed status, Claim indexed rootClaim, uint256 indexed l2BlockNumber);

/// @notice Returns the timestamp that the DisputeGame contract was created at.
/// @return createdAt_ The timestamp that the DisputeGame contract was created at.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {

event Move(uint256 indexed parentIndex, Claim indexed pivot, address indexed claimant);

event Resolved(GameStatus indexed status, Claim indexed rootClaim, uint256 indexed l2BlockNumber);

event ReceiveETH(uint256 amount);

function init(Claim rootClaim, Claim absolutePrestate, uint256 l2BlockNumber) public {
Expand Down Expand Up @@ -951,6 +953,10 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
function test_resolve_rootUncontested_succeeds() public {
vm.warp(block.timestamp + 3 days + 12 hours);
gameProxy.resolveClaim(0, 0);

vm.expectEmit(true, true, true, false);
emit Resolved(GameStatus.DEFENDER_WINS, gameProxy.rootClaim(), gameProxy.l2BlockNumber());

assertEq(uint8(gameProxy.resolve()), uint8(GameStatus.DEFENDER_WINS));
}

Expand Down

Large diffs are not rendered by default.

0 comments on commit e40a8e7

Please sign in to comment.