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
3c30fa18
Unverified
Commit
3c30fa18
authored
Jul 22, 2024
by
DenseDenise
Committed by
GitHub
Jul 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add stepDefend success testcase (#11148)
parent
f6f8cd53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
FaultDisputeGame.t.sol
...ges/contracts-bedrock/test/dispute/FaultDisputeGame.t.sol
+33
-0
No files found.
packages/contracts-bedrock/test/dispute/FaultDisputeGame.t.sol
View file @
3c30fa18
...
...
@@ -846,6 +846,39 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
gameProxy.step(8, true, claimData5, hex"");
}
/// @dev Tests that successfully step with true defend claim when there is a true defend claim(claim7) in the
/// middle of the dispute game.
function test_stepDefendDummyClaim_defendTrueClaimInTheMiddle_succeeds() public {
// Give the test contract some ether
vm.deal(address(this), 1000 ether);
// Make claims all the way down the tree.
(,,,, Claim disputed,,) = gameProxy.claimData(0);
gameProxy.attack{ value: _getRequiredBond(0) }(disputed, 0, _dummyClaim());
(,,,, disputed,,) = gameProxy.claimData(1);
gameProxy.attack{ value: _getRequiredBond(1) }(disputed, 1, _dummyClaim());
(,,,, disputed,,) = gameProxy.claimData(2);
gameProxy.attack{ value: _getRequiredBond(2) }(disputed, 2, _dummyClaim());
(,,,, disputed,,) = gameProxy.claimData(3);
gameProxy.attack{ value: _getRequiredBond(3) }(disputed, 3, _dummyClaim());
(,,,, disputed,,) = gameProxy.claimData(4);
gameProxy.attack{ value: _getRequiredBond(4) }(disputed, 4, _changeClaimStatus(_dummyClaim(), VMStatuses.PANIC));
bytes memory claimData7 = abi.encode(7, 7);
Claim postState_ = Claim.wrap(gameImpl.vm().step(claimData7, hex"", bytes32(0)));
(,,,, disputed,,) = gameProxy.claimData(5);
gameProxy.attack{ value: _getRequiredBond(5) }(disputed, 5, _dummyClaim());
(,,,, disputed,,) = gameProxy.claimData(6);
bytes memory _dummyClaimData = abi.encode(gasleft(), gasleft());
gameProxy.defend{ value: _getRequiredBond(6) }(disputed, 6, postState_);
(,,,, disputed,,) = gameProxy.claimData(7);
gameProxy.attack{ value: _getRequiredBond(7) }(disputed, 7, Claim.wrap(keccak256(claimData7)));
gameProxy.addLocalData(LocalPreimageKey.DISPUTED_L2_BLOCK_NUMBER, 8, 0);
gameProxy.step(8, false, claimData7, hex"");
}
/// @dev Tests that step reverts with false attacking claim when there is a true defend claim(claim5) in the middle
/// of the dispute game.
function test_stepAttackTrueClaim_defendTrueClaimInTheMiddle_reverts() public {
...
...
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