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
62efabbf
Commit
62efabbf
authored
Jun 21, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test naming convention
parent
374cd9a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
37 deletions
+38
-37
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+24
-23
FaultDisputeGame.t.sol
...s/contracts-bedrock/contracts/test/FaultDisputeGame.t.sol
+5
-5
LibPosition.t.sol
packages/contracts-bedrock/contracts/test/LibPosition.t.sol
+9
-9
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
62efabbf
...
@@ -32,30 +32,30 @@ DisputeGameFactory_SetImplementation_Test:test_setImplementation_notOwner_revert
...
@@ -32,30 +32,30 @@ 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: 498304)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 497198)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 500038)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 499064)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot:test_resolvesCorrectly_succeeds() (gas: 490057)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot:test_resolvesCorrectly_succeeds() (gas: 489092)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 495173)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 494067)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 496907)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 495933)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot:test_resolvesCorrectly_succeeds() (gas: 486926)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot:test_resolvesCorrectly_succeeds() (gas: 485961)
FaultDisputeGame_Test:test_clockTimeExceeded_reverts() (gas: 26444)
FaultDisputeGame_Test:test_defendRoot_invalidMove_reverts() (gas: 13250)
FaultDisputeGame_Test:test_defendRoot_reverts() (gas: 13281)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 17409)
FaultDisputeGame_Test:test_duplicateClaim_reverts() (gas: 103343)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 17431)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 17834)
FaultDisputeGame_Test:test_gameData_succeeds() (gas: 17834)
FaultDisputeGame_Test:test_gameDepthExceeded_reverts() (gas: 408128)
FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10337)
FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10359)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8216)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8281)
FaultDisputeGame_Test:test_initialRootClaimData_succeeds() (gas: 17691)
FaultDisputeGame_Test:test_initialRootClaimData_succeeds() (gas: 17669)
FaultDisputeGame_Test:test_move_clockTimeExceeded_reverts() (gas: 26410)
FaultDisputeGame_Test:test_moveAgainstNonexistentParent_reverts() (gas: 24611)
FaultDisputeGame_Test:test_move_duplicateClaim_reverts() (gas: 103231)
FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 10901)
FaultDisputeGame_Test:test_move_gameDepthExceeded_reverts() (gas: 407967)
FaultDisputeGame_Test:test_resolve_challengeContested() (gas: 221222)
FaultDisputeGame_Test:test_move_gameNotInProgress_reverts() (gas: 10923)
FaultDisputeGame_Test:test_move_nonExistentParent_reverts() (gas: 24632)
FaultDisputeGame_Test:test_resolve_challengeContested() (gas: 221074)
FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9657)
FaultDisputeGame_Test:test_resolve_notInProgress_reverts() (gas: 9657)
FaultDisputeGame_Test:test_resolve_rootContested() (gas: 1061
44
)
FaultDisputeGame_Test:test_resolve_rootContested() (gas: 1061
20
)
FaultDisputeGame_Test:test_resolve_rootUncontested() (gas: 236
97
)
FaultDisputeGame_Test:test_resolve_rootUncontested() (gas: 236
30
)
FaultDisputeGame_Test:test_resolve_teamDeathmatch() (gas: 391
960
)
FaultDisputeGame_Test:test_resolve_teamDeathmatch() (gas: 391
731
)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 82
25
)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 82
03
)
FaultDisputeGame_Test:test_simpleAttack_succeeds() (gas: 107
438
)
FaultDisputeGame_Test:test_simpleAttack_succeeds() (gas: 107
322
)
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)
...
@@ -230,7 +230,7 @@ LegacyERC20ETH_Test:test_mint_doesNotExist_reverts() (gas: 10627)
...
@@ -230,7 +230,7 @@ LegacyERC20ETH_Test:test_mint_doesNotExist_reverts() (gas: 10627)
LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957)
LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957)
LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755)
LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755)
LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524)
LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524)
LibPosition_Test:test_pos_correctness
() (gas: 38668
)
LibPosition_Test:test_pos_correctness
_succeeds() (gas: 38711
)
MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5736)
MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5736)
MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58975)
MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58975)
MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35852)
MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35852)
...
@@ -460,3 +460,4 @@ SystemConfig_Setters_TestFail:test_setResourceConfig_notOwner_reverts() (gas: 11
...
@@ -460,3 +460,4 @@ SystemConfig_Setters_TestFail:test_setResourceConfig_notOwner_reverts() (gas: 11
SystemConfig_Setters_TestFail:test_setResourceConfig_zeroDenominator_reverts() (gas: 13039)
SystemConfig_Setters_TestFail:test_setResourceConfig_zeroDenominator_reverts() (gas: 13039)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 10616)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 10616)
TransferOnionTest:test_constructor_succeeds() (gas: 564855)
TransferOnionTest:test_constructor_succeeds() (gas: 564855)
TransferOnionTest:test_unwrap_succeeds() (gas: 724955)
\ No newline at end of file
packages/contracts-bedrock/contracts/test/FaultDisputeGame.t.sol
View file @
62efabbf
...
@@ -157,7 +157,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -157,7 +157,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/**
/**
* @dev Tests that an attempt to defend the root claim reverts with the `CannotDefendRootClaim` error.
* @dev Tests that an attempt to defend the root claim reverts with the `CannotDefendRootClaim` error.
*/
*/
function test_defendRoot_reverts() public {
function test_defendRoot_
invalidMove_
reverts() public {
vm.expectRevert(CannotDefendRootClaim.selector);
vm.expectRevert(CannotDefendRootClaim.selector);
gameProxy.defend(0, Claim.wrap(bytes32(uint256(5))));
gameProxy.defend(0, Claim.wrap(bytes32(uint256(5))));
}
}
...
@@ -166,7 +166,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -166,7 +166,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
* @dev Tests that an attempt to move against a claim that does not exist reverts with the
* @dev Tests that an attempt to move against a claim that does not exist reverts with the
* `ParentDoesNotExist` error.
* `ParentDoesNotExist` error.
*/
*/
function test_move
AgainstNone
xistentParent_reverts() public {
function test_move
_nonE
xistentParent_reverts() public {
Claim claim = Claim.wrap(bytes32(uint256(5)));
Claim claim = Claim.wrap(bytes32(uint256(5)));
// Expect an out of bounds revert for an attack
// Expect an out of bounds revert for an attack
...
@@ -182,7 +182,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -182,7 +182,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
* @dev Tests that an attempt to move at the maximum game depth reverts with the
* @dev Tests that an attempt to move at the maximum game depth reverts with the
* `GameDepthExceeded` error.
* `GameDepthExceeded` error.
*/
*/
function test_gameDepthExceeded_reverts() public {
function test_
move_
gameDepthExceeded_reverts() public {
Claim claim = Claim.wrap(bytes32(uint256(5)));
Claim claim = Claim.wrap(bytes32(uint256(5)));
uint256 maxDepth = gameProxy.MAX_GAME_DEPTH();
uint256 maxDepth = gameProxy.MAX_GAME_DEPTH();
...
@@ -201,7 +201,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -201,7 +201,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
* @dev Tests that a move made after the clock time has exceeded reverts with the
* @dev Tests that a move made after the clock time has exceeded reverts with the
* `ClockTimeExceeded` error.
* `ClockTimeExceeded` error.
*/
*/
function test_clockTimeExceeded_reverts() public {
function test_
move_
clockTimeExceeded_reverts() public {
// Warp ahead past the clock time for the first move (3 1/2 days)
// Warp ahead past the clock time for the first move (3 1/2 days)
vm.warp(block.timestamp + 3 days + 12 hours + 1);
vm.warp(block.timestamp + 3 days + 12 hours + 1);
vm.expectRevert(ClockTimeExceeded.selector);
vm.expectRevert(ClockTimeExceeded.selector);
...
@@ -212,7 +212,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
...
@@ -212,7 +212,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
* @dev Tests that an identical claim cannot be made twice. The duplicate claim attempt should
* @dev Tests that an identical claim cannot be made twice. The duplicate claim attempt should
* revert with the `ClaimAlreadyExists` error.
* revert with the `ClaimAlreadyExists` error.
*/
*/
function test_duplicateClaim_reverts() public {
function test_
move_
duplicateClaim_reverts() public {
Claim claim = Claim.wrap(bytes32(uint256(5)));
Claim claim = Claim.wrap(bytes32(uint256(5)));
// Make the first move. This should succeed.
// Make the first move. This should succeed.
...
...
packages/contracts-bedrock/contracts/test/LibPosition.t.sol
View file @
62efabbf
...
@@ -28,7 +28,7 @@ contract LibPosition_Test is Test {
...
@@ -28,7 +28,7 @@ contract LibPosition_Test is Test {
/**
/**
* @notice Tests that the `depth` function correctly shifts out the `depth` from a packed `Position` type.
* @notice Tests that the `depth` function correctly shifts out the `depth` from a packed `Position` type.
*/
*/
function testFuzz_depth_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_depth_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Position position = LibPosition.wrap(_depth, _indexAtDepth);
Position position = LibPosition.wrap(_depth, _indexAtDepth);
...
@@ -38,7 +38,7 @@ contract LibPosition_Test is Test {
...
@@ -38,7 +38,7 @@ contract LibPosition_Test is Test {
/**
/**
* @notice Tests that the `indexAtDepth` function correctly shifts out the `indexAtDepth` from a packed `Position` type.
* @notice Tests that the `indexAtDepth` function correctly shifts out the `indexAtDepth` from a packed `Position` type.
*/
*/
function testFuzz_indexAtDepth_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_indexAtDepth_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
Position position = LibPosition.wrap(_depth, _indexAtDepth);
Position position = LibPosition.wrap(_depth, _indexAtDepth);
...
@@ -48,7 +48,7 @@ contract LibPosition_Test is Test {
...
@@ -48,7 +48,7 @@ contract LibPosition_Test is Test {
/**
/**
* @notice Tests that the `left` function correctly computes the position of the left child.
* @notice Tests that the `left` function correctly computes the position of the left child.
*/
*/
function testFuzz_left_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_left_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
...
@@ -62,7 +62,7 @@ contract LibPosition_Test is Test {
...
@@ -62,7 +62,7 @@ contract LibPosition_Test is Test {
/**
/**
* @notice Tests that the `right` function correctly computes the position of the right child.
* @notice Tests that the `right` function correctly computes the position of the right child.
*/
*/
function testFuzz_right_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_right_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
// Depth bound: [0, 63]
// Depth bound: [0, 63]
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
...
@@ -77,7 +77,7 @@ contract LibPosition_Test is Test {
...
@@ -77,7 +77,7 @@ contract LibPosition_Test is Test {
/**
/**
* @notice Tests that the `parent` function correctly computes the position of the parent.
* @notice Tests that the `parent` function correctly computes the position of the parent.
*/
*/
function testFuzz_parent_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_parent_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
_depth = uint8(bound(_depth, 1, MAX_DEPTH));
_depth = uint8(bound(_depth, 1, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
...
@@ -92,7 +92,7 @@ contract LibPosition_Test is Test {
...
@@ -92,7 +92,7 @@ contract LibPosition_Test is Test {
* @notice Tests that the `rightIndex` function correctly computes the deepest, right most index relative
* @notice Tests that the `rightIndex` function correctly computes the deepest, right most index relative
* to a given position.
* to a given position.
*/
*/
function testFuzz_rightIndex_correctness(
function testFuzz_rightIndex_correctness
_suceeds
(
uint64 _maxDepth,
uint64 _maxDepth,
uint8 _depth,
uint8 _depth,
uint64 _indexAtDepth
uint64 _indexAtDepth
...
@@ -120,7 +120,7 @@ contract LibPosition_Test is Test {
...
@@ -120,7 +120,7 @@ contract LibPosition_Test is Test {
* a given position.
* a given position.
* @dev `attack` is an alias for `left`, but we test it separately for completeness.
* @dev `attack` is an alias for `left`, but we test it separately for completeness.
*/
*/
function testFuzz_attack_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_attack_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
// Depth bound: [0, 63]
// Depth bound: [0, 63]
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_depth = uint8(bound(_depth, 0, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
...
@@ -138,7 +138,7 @@ contract LibPosition_Test is Test {
...
@@ -138,7 +138,7 @@ contract LibPosition_Test is Test {
* @dev A defense can only be given if the position does not belong to the root claim, hence the bound of [1, 127]
* @dev A defense can only be given if the position does not belong to the root claim, hence the bound of [1, 127]
* on the depth.
* on the depth.
*/
*/
function testFuzz_defend_correctness(uint8 _depth, uint64 _indexAtDepth) public {
function testFuzz_defend_correctness
_suceeds
(uint8 _depth, uint64 _indexAtDepth) public {
// Depth bound: [1, 63]
// Depth bound: [1, 63]
_depth = uint8(bound(_depth, 1, MAX_DEPTH));
_depth = uint8(bound(_depth, 1, MAX_DEPTH));
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
_indexAtDepth = boundIndexAtDepth(_depth, _indexAtDepth);
...
@@ -154,7 +154,7 @@ contract LibPosition_Test is Test {
...
@@ -154,7 +154,7 @@ contract LibPosition_Test is Test {
* @notice A static unit test for the correctness of all gindicies, (depth, index) combos,
* @notice A static unit test for the correctness of all gindicies, (depth, index) combos,
* and the trace index in a tree of max depth = 4.
* and the trace index in a tree of max depth = 4.
*/
*/
function test_pos_correctness() public {
function test_pos_correctness
_succeeds
() public {
uint256 maxDepth = 4;
uint256 maxDepth = 4;
Position p = LibPosition.wrap(0, 0);
Position p = LibPosition.wrap(0, 0);
...
...
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