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
eb345128
Commit
eb345128
authored
Nov 30, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add split depth footgun checks
chores
parent
9718cf44
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
3 deletions
+44
-3
outputbisectiongame.go
op-bindings/bindings/outputbisectiongame.go
+1
-1
devnetL1-template.json
...es/contracts-bedrock/deploy-config/devnetL1-template.json
+1
-1
OutputBisectionGame.sol
...ges/contracts-bedrock/src/dispute/OutputBisectionGame.sol
+3
-1
OutputBisectionGame.t.sol
.../contracts-bedrock/test/dispute/OutputBisectionGame.t.sol
+39
-0
No files found.
op-bindings/bindings/outputbisectiongame.go
View file @
eb345128
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/deploy-config/devnetL1-template.json
View file @
eb345128
...
...
@@ -51,7 +51,7 @@
"faultGameMaxDuration"
:
1200
,
"outputBisectionGameGenesisBlock"
:
0
,
"outputBisectionGameGenesisOutputRoot"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
,
"outputBisectionGameSplitDepth"
:
1
5
,
"outputBisectionGameSplitDepth"
:
1
4
,
"systemConfigStartBlock"
:
0
,
"requiredProtocolVersion"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
,
"recommendedProtocolVersion"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
...
...
packages/contracts-bedrock/src/dispute/OutputBisectionGame.sol
View file @
eb345128
...
...
@@ -105,7 +105,9 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
Duration _gameDuration,
IBigStepper _vm
) {
if (_splitDepth >= _maxGameDepth) revert InvalidSplitDepth();
// The split depth cannot be greater than or equal to the max game depth, and it must
// be even due to the constraint laid out in `verifyExecBisectionRoot`
if (_splitDepth >= _maxGameDepth || _splitDepth % 2 != 0) revert InvalidSplitDepth();
GAME_TYPE = _gameType;
ABSOLUTE_PRESTATE = _absolutePrestate;
...
...
packages/contracts-bedrock/test/dispute/OutputBisectionGame.t.sol
View file @
eb345128
...
...
@@ -95,6 +95,45 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
// `IDisputeGame` Implementation Tests //
////////////////////////////////////////////////////////////////
/// @dev Tests that the constructor of the `OutputBisectionGame` reverts when the `_splitDepth`
/// parameter is either:
/// 1. Greater than or equal to the `MAX_GAME_DEPTH`
/// 2. Odd
function test_constructor_wrongArgs_reverts(uint256 _splitDepth) public {
AlphabetVM alphabetVM = new AlphabetVM(ABSOLUTE_PRESTATE);
// Test that the constructor reverts when the `_splitDepth` parameter is greater than or equal
// to the `MAX_GAME_DEPTH` parameter.
_splitDepth = bound(_splitDepth, 2 ** 3, type(uint256).max);
vm.expectRevert(InvalidSplitDepth.selector);
new OutputBisectionGame({
_gameType: GAME_TYPE,
_absolutePrestate: ABSOLUTE_PRESTATE,
_genesisBlockNumber: GENESIS_BLOCK_NUMBER,
_genesisOutputRoot: GENESIS_OUTPUT_ROOT,
_maxGameDepth: 2**3,
_splitDepth: _splitDepth,
_gameDuration: Duration.wrap(7 days),
_vm: alphabetVM
});
// Test that the constructor reverts when the `_splitDepth` parameter is odd.
_splitDepth = bound(_splitDepth, 0, 2 ** 3 - 1);
if (_splitDepth % 2 == 0) _splitDepth += 1;
vm.expectRevert(InvalidSplitDepth.selector);
new OutputBisectionGame({
_gameType: GAME_TYPE,
_absolutePrestate: ABSOLUTE_PRESTATE,
_genesisBlockNumber: GENESIS_BLOCK_NUMBER,
_genesisOutputRoot: GENESIS_OUTPUT_ROOT,
_maxGameDepth: 2**3,
_splitDepth: _splitDepth,
_gameDuration: Duration.wrap(7 days),
_vm: alphabetVM
});
}
/// @dev Tests that the game's root claim is set correctly.
function test_rootClaim_succeeds() public {
assertEq(Claim.unwrap(gameProxy.rootClaim()), Claim.unwrap(ROOT_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