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
b89f32ec
Commit
b89f32ec
authored
Dec 13, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ob-game: Prevent a proposal <= `GENESIS_BLOCK_NUMBER`
parent
5eab2ae1
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
57 deletions
+53
-57
outputbisectiongame.go
op-bindings/bindings/outputbisectiongame.go
+1
-1
outputbisectiongame_more.go
op-bindings/bindings/outputbisectiongame_more.go
+1
-1
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+2
-2
slither-report.json
packages/contracts-bedrock/slither-report.json
+27
-27
OutputBisectionGame.sol
...ges/contracts-bedrock/src/dispute/OutputBisectionGame.sol
+11
-7
OutputBisectionGame.t.sol
.../contracts-bedrock/test/dispute/OutputBisectionGame.t.sol
+11
-19
No files found.
op-bindings/bindings/outputbisectiongame.go
View file @
b89f32ec
This diff is collapsed.
Click to expand it.
op-bindings/bindings/outputbisectiongame_more.go
View file @
b89f32ec
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/semver-lock.json
View file @
b89f32ec
...
@@ -100,8 +100,8 @@
...
@@ -100,8 +100,8 @@
"sourceCodeHash"
:
"0xa995b54dce03ddf5c9c47451bd7181996b91398ad66b54ab0b8cbf582863a33e"
"sourceCodeHash"
:
"0xa995b54dce03ddf5c9c47451bd7181996b91398ad66b54ab0b8cbf582863a33e"
},
},
"src/dispute/OutputBisectionGame.sol"
:
{
"src/dispute/OutputBisectionGame.sol"
:
{
"initCodeHash"
:
"0x
d354d78579c42a9f0f8a8c9b5ef04f570fa3bd088f88102b431aca8d48fddaae
"
,
"initCodeHash"
:
"0x
e5799a4c06cf02fa1fba61129bd32d1a4b07df737a1f2b429b1acd7160093f0a
"
,
"sourceCodeHash"
:
"0x
98f65f2f2f07a525d360eba87e624f1cb44c52326f3b3f2bf7b6ee41a7ec4a2c
"
"sourceCodeHash"
:
"0x
f95c7b1575988853b10d4ad2219a6031be27278add5073f3e96854f41f75ba62
"
},
},
"src/legacy/DeployerWhitelist.sol"
:
{
"src/legacy/DeployerWhitelist.sol"
:
{
"initCodeHash"
:
"0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d"
,
"initCodeHash"
:
"0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d"
,
...
...
packages/contracts-bedrock/slither-report.json
View file @
b89f32ec
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/src/dispute/OutputBisectionGame.sol
View file @
b89f32ec
...
@@ -6,8 +6,6 @@ import { IOutputBisectionGame } from "src/dispute/interfaces/IOutputBisectionGam
...
@@ -6,8 +6,6 @@ import { IOutputBisectionGame } from "src/dispute/interfaces/IOutputBisectionGam
import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
import { IBondManager } from "src/dispute/interfaces/IBondManager.sol";
import { IBondManager } from "src/dispute/interfaces/IBondManager.sol";
import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
import { BlockOracle } from "src/dispute/BlockOracle.sol";
import { Clone } from "src/libraries/Clone.sol";
import { Clone } from "src/libraries/Clone.sol";
import { Types } from "src/libraries/Types.sol";
import { Types } from "src/libraries/Types.sol";
...
@@ -83,8 +81,8 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
...
@@ -83,8 +81,8 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
bool internal subgameAtRootResolved;
bool internal subgameAtRootResolved;
/// @notice Semantic version.
/// @notice Semantic version.
/// @custom:semver 0.0.1
5
/// @custom:semver 0.0.1
6
string public constant version = "0.0.1
5
";
string public constant version = "0.0.1
6
";
/// @param _gameType The type ID of the game.
/// @param _gameType The type ID of the game.
/// @param _absolutePrestate The absolute prestate of the instruction trace.
/// @param _absolutePrestate The absolute prestate of the instruction trace.
...
@@ -105,9 +103,8 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
...
@@ -105,9 +103,8 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
Duration _gameDuration,
Duration _gameDuration,
IBigStepper _vm
IBigStepper _vm
) {
) {
// The split depth cannot be greater than or equal to the max game depth, and it must
// The split depth cannot be greater than or equal to the max game depth.
// be even due to the constraint laid out in `verifyExecBisectionRoot`
if (_splitDepth >= _maxGameDepth) revert InvalidSplitDepth();
if (_splitDepth >= _maxGameDepth || _splitDepth % 2 != 0) revert InvalidSplitDepth();
GAME_TYPE = _gameType;
GAME_TYPE = _gameType;
ABSOLUTE_PRESTATE = _absolutePrestate;
ABSOLUTE_PRESTATE = _absolutePrestate;
...
@@ -446,6 +443,13 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
...
@@ -446,6 +443,13 @@ contract OutputBisectionGame is IOutputBisectionGame, Clone, ISemver {
//
//
// Implicit assumptions:
// Implicit assumptions:
// - The `gameStatus` state variable defaults to 0, which is `GameStatus.IN_PROGRESS`
// - The `gameStatus` state variable defaults to 0, which is `GameStatus.IN_PROGRESS`
//
// Explicit checks:
// - An output root cannot be proposed at or before the genesis block.
// Do not allow the game to be initialized if the root claim corresponds to a block at or before the
// configured genesis block number.
if (l2BlockNumber() <= GENESIS_BLOCK_NUMBER) revert UnexpectedRootClaim(rootClaim());
// Set the game's starting timestamp
// Set the game's starting timestamp
createdAt = Timestamp.wrap(uint64(block.timestamp));
createdAt = Timestamp.wrap(uint64(block.timestamp));
...
...
packages/contracts-bedrock/test/dispute/OutputBisectionGame.t.sol
View file @
b89f32ec
...
@@ -105,9 +105,7 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
...
@@ -105,9 +105,7 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
/// @dev Tests that the constructor of the `OutputBisectionGame` reverts when the `_splitDepth`
/// @dev Tests that the constructor of the `OutputBisectionGame` reverts when the `_splitDepth`
/// parameter is either:
/// parameter is greater than or equal to the `MAX_GAME_DEPTH`
/// 1. Greater than or equal to the `MAX_GAME_DEPTH`
/// 2. Odd
function test_constructor_wrongArgs_reverts(uint256 _splitDepth) public {
function test_constructor_wrongArgs_reverts(uint256 _splitDepth) public {
AlphabetVM2 alphabetVM = new AlphabetVM2(ABSOLUTE_PRESTATE);
AlphabetVM2 alphabetVM = new AlphabetVM2(ABSOLUTE_PRESTATE);
...
@@ -125,22 +123,6 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
...
@@ -125,22 +123,6 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
_gameDuration: Duration.wrap(7 days),
_gameDuration: Duration.wrap(7 days),
_vm: alphabetVM
_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,
_maxGameDepth: 2 ** 3,
_genesisBlockNumber: 0,
_genesisOutputRoot: Hash.wrap(bytes32(0)),
_splitDepth: _splitDepth,
_gameDuration: Duration.wrap(7 days),
_vm: alphabetVM
});
}
}
/// @dev Tests that the game's root claim is set correctly.
/// @dev Tests that the game's root claim is set correctly.
...
@@ -176,6 +158,16 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
...
@@ -176,6 +158,16 @@ contract OutputBisectionGame_Test is OutputBisectionGame_Init {
// `IOutputBisectionGame` Implementation Tests //
// `IOutputBisectionGame` Implementation Tests //
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
/// @dev Tests that the game cannot be initialized with an output root that commits to <= the configured genesis
/// block number
function testFuzz_initialize_cannotProposeGenesis_reverts(uint256 _blockNumber) public {
_blockNumber = bound(_blockNumber, 0, gameProxy.GENESIS_BLOCK_NUMBER());
Claim claim = _dummyClaim();
vm.expectRevert(abi.encodeWithSelector(UnexpectedRootClaim.selector, claim));
gameProxy = OutputBisectionGame(address(factory.create(GAME_TYPE, claim, abi.encode(_blockNumber))));
}
/// @dev Tests that the game is initialized with the correct data.
/// @dev Tests that the game is initialized with the correct data.
function test_initialize_correctData_succeeds() public {
function test_initialize_correctData_succeeds() public {
// Assert that the root claim is initialized correctly.
// Assert that the root claim is initialized correctly.
...
...
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