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
c2d6700c
Commit
c2d6700c
authored
Jun 21, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✂
parent
a7111f0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
34 deletions
+20
-34
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+13
-14
FaultDisputeGame.sol
.../contracts-bedrock/contracts/dispute/FaultDisputeGame.sol
+3
-7
FaultDisputeGame.t.sol
...s/contracts-bedrock/contracts/test/FaultDisputeGame.t.sol
+4
-13
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
c2d6700c
...
@@ -32,29 +32,28 @@ DisputeGameFactory_SetImplementation_Test:test_setImplementation_notOwner_revert
...
@@ -32,29 +32,28 @@ DisputeGameFactory_SetImplementation_Test:test_setImplementation_notOwner_revert
DisputeGameFactory_SetImplementation_Test:test_setImplementation_succeeds() (gas: 44243)
DisputeGameFactory_SetImplementation_Test:test_setImplementation_succeeds() (gas: 44243)
DisputeGameFactory_TransferOwnership_Test:test_transferOwnership_notOwner_reverts() (gas: 15950)
DisputeGameFactory_TransferOwnership_Test:test_transferOwnership_notOwner_reverts() (gas: 15950)
DisputeGameFactory_TransferOwnership_Test:test_transferOwnership_succeeds() (gas: 18642)
DisputeGameFactory_TransferOwnership_Test:test_transferOwnership_succeeds() (gas: 18642)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 497
412
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 497
017
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot:test_resolvesCorrectly_succeeds() (gas: 490
452
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot:test_resolvesCorrectly_succeeds() (gas: 490
057
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 49
4220
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 49
3886
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot:test_resolvesCorrectly_succeeds() (gas: 48
7260
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot:test_resolvesCorrectly_succeeds() (gas: 48
6926
)
FaultDisputeGame_Test:test_clockTimeExceeded_reverts() (gas: 26444)
FaultDisputeGame_Test:test_clockTimeExceeded_reverts() (gas: 26444)
FaultDisputeGame_Test:test_defendRoot_reverts() (gas: 13281)
FaultDisputeGame_Test:test_defendRoot_reverts() (gas: 13281)
FaultDisputeGame_Test:test_duplicateClaim_reverts() (gas: 103343)
FaultDisputeGame_Test:test_duplicateClaim_reverts() (gas: 103343)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 174
78
)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 174
31
)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 178
81
)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 178
34
)
FaultDisputeGame_Test:test_gameDepthExceeded_reverts() (gas: 40
7234
)
FaultDisputeGame_Test:test_gameDepthExceeded_reverts() (gas: 40
8128
)
FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10359)
FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10359)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 82
16
)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 82
81
)
FaultDisputeGame_Test:test_initialRootClaimData_succeeds() (gas: 17669)
FaultDisputeGame_Test:test_initialRootClaimData_succeeds() (gas: 17669)
FaultDisputeGame_Test:test_moveAgainstNonexistentParent_reverts() (gas: 246
33
)
FaultDisputeGame_Test:test_moveAgainstNonexistentParent_reverts() (gas: 246
11
)
FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 10901)
FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 10901)
FaultDisputeGame_Test:test_resolve_challengeContested() (gas: 221
617
)
FaultDisputeGame_Test:test_resolve_challengeContested() (gas: 221
222
)
FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9657)
FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9657)
FaultDisputeGame_Test:test_resolve_rootContested() (gas: 106
539
)
FaultDisputeGame_Test:test_resolve_rootContested() (gas: 106
144
)
FaultDisputeGame_Test:test_resolve_rootUncontested() (gas: 2
0173
)
FaultDisputeGame_Test:test_resolve_rootUncontested() (gas: 2
3697
)
FaultDisputeGame_Test:test_resolve_teamDeathmatch() (gas: 39
2416
)
FaultDisputeGame_Test:test_resolve_teamDeathmatch() (gas: 39
1960
)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8225)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8225)
FaultDisputeGame_Test:test_simpleAttack_succeeds() (gas: 107438)
FaultDisputeGame_Test:test_simpleAttack_succeeds() (gas: 107438)
FaultDisputeGame_Test:test_version_succeeds() (gas: 9802)
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/contracts/dispute/FaultDisputeGame.sol
View file @
c2d6700c
...
@@ -306,12 +306,6 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone {
...
@@ -306,12 +306,6 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone {
if (status != GameStatus.IN_PROGRESS) {
if (status != GameStatus.IN_PROGRESS) {
// If the game is not in progress, it cannot be resolved.
// If the game is not in progress, it cannot be resolved.
revert GameNotInProgress();
revert GameNotInProgress();
} else if (!claimData[0].countered) {
// If the root claim has never been countered, it implicitly wins.
status_ = GameStatus.DEFENDER_WINS;
status = status_;
emit Resolved(status_);
return status_;
}
}
// Search for the left-most dangling non-bottom node
// Search for the left-most dangling non-bottom node
...
@@ -341,7 +335,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone {
...
@@ -341,7 +335,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone {
Position traceIndex = claimPos.rightIndex(MAX_GAME_DEPTH);
Position traceIndex = claimPos.rightIndex(MAX_GAME_DEPTH);
if (Position.unwrap(traceIndex) < Position.unwrap(leftMostTraceIndex)) {
if (Position.unwrap(traceIndex) < Position.unwrap(leftMostTraceIndex)) {
leftMostTraceIndex = traceIndex;
leftMostTraceIndex = traceIndex;
leftMostIndex = i + 1;
unchecked {
leftMostIndex = i + 1;
}
}
}
}
}
...
...
packages/contracts-bedrock/contracts/test/FaultDisputeGame.t.sol
View file @
c2d6700c
...
@@ -21,10 +21,6 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
...
@@ -21,10 +21,6 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
* @dev The type of the game being tested.
* @dev The type of the game being tested.
*/
*/
GameType internal constant GAME_TYPE = GameType.wrap(0);
GameType internal constant GAME_TYPE = GameType.wrap(0);
/**
* @dev The current version of the `FaultDisputeGame` contract.
*/
string internal constant VERSION = "0.0.2";
/**
/**
* @dev The implementation of the game.
* @dev The implementation of the game.
...
@@ -83,13 +79,6 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -83,13 +79,6 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
assertEq(gameProxy.extraData(), EXTRA_DATA);
assertEq(gameProxy.extraData(), EXTRA_DATA);
}
}
/**
* @dev Tests that the game's version is set correctly.
*/
function test_version_succeeds() public {
assertEq(gameProxy.version(), VERSION);
}
/**
/**
* @dev Tests that the game's status is set correctly.
* @dev Tests that the game's status is set correctly.
*/
*/
...
@@ -196,10 +185,12 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -196,10 +185,12 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
function test_gameDepthExceeded_reverts() public {
function test_gameDepthExceeded_reverts() public {
Claim claim = Claim.wrap(bytes32(uint256(5)));
Claim claim = Claim.wrap(bytes32(uint256(5)));
for (uint256 i = 0; i < 5; i++) {
uint256 maxDepth = gameProxy.MAX_GAME_DEPTH();
for (uint256 i = 0; i <= maxDepth; i++) {
// At the max game depth, the `_move` function should revert with
// At the max game depth, the `_move` function should revert with
// the `GameDepthExceeded` error.
// the `GameDepthExceeded` error.
if (i ==
4
) {
if (i ==
maxDepth
) {
vm.expectRevert(GameDepthExceeded.selector);
vm.expectRevert(GameDepthExceeded.selector);
}
}
gameProxy.attack(i, claim);
gameProxy.attack(i, claim);
...
...
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