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
f2ef2a0f
Commit
f2ef2a0f
authored
Aug 05, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
streamline
parent
2fbec5b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
34 deletions
+28
-34
FaultDisputeGame.t.sol
packages/contracts-bedrock/test/FaultDisputeGame.t.sol
+28
-34
No files found.
packages/contracts-bedrock/test/FaultDisputeGame.t.sol
View file @
f2ef2a0f
...
...
@@ -443,40 +443,34 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
FaultDisputeGame.OutputProposal memory disputed
) = gameProxy.proposals();
// Load the L1 head hash
gameProxy.addLocalData(1, 8);
bytes32 key = _getKey(1);
(bytes32 dat, uint256 datLen) = oracle.readPreimage(key, 8);
assertEq(dat, Hash.unwrap(gameProxy.l1Head()));
assertEq(datLen, 32);
// Load the starting output root
gameProxy.addLocalData(2, 8);
key = _getKey(2);
(dat, datLen) = oracle.readPreimage(key, 8);
assertEq(dat, Hash.unwrap(starting.outputRoot));
assertEq(datLen, 32);
// Load the disputed output root
gameProxy.addLocalData(3, 8);
key = _getKey(3);
(dat, datLen) = oracle.readPreimage(key, 8);
assertEq(dat, Hash.unwrap(disputed.outputRoot));
assertEq(datLen, 32);
// Load the starting L2 block number
gameProxy.addLocalData(4, 8);
key = _getKey(4);
(dat, datLen) = oracle.readPreimage(key, 8);
assertEq(dat, bytes32(uint256(starting.l2BlockNumber) << 0xC0));
assertEq(datLen, 8);
// Load the chain ID
gameProxy.addLocalData(5, 8);
key = _getKey(5);
(dat, datLen) = oracle.readPreimage(key, 8);
assertEq(dat, bytes32(block.chainid << 0xC0));
assertEq(datLen, 8);
bytes32[5] memory data = [
Hash.unwrap(gameProxy.l1Head()),
Hash.unwrap(starting.outputRoot),
Hash.unwrap(disputed.outputRoot),
bytes32(uint256(starting.l2BlockNumber) << 0xC0),
bytes32(block.chainid << 0xC0)
];
for (uint256 i = 1; i <= 5; i++) {
uint256 expectedLen = i > 3 ? 8 : 32;
gameProxy.addLocalData(i, 0);
bytes32 key = _getKey(i);
(bytes32 dat, uint256 datLen) = oracle.readPreimage(key, 0);
assertEq(dat >> 0xC0, bytes32(expectedLen));
// Account for the length prefix if i > 3 (the data stored
// at identifiers i <= 3 are 32 bytes long, so the expected
// length is already correct. If i > 3, the data is only 8
// bytes long, so the length prefix + the data is 16 bytes
// total.)
assertEq(datLen, expectedLen + (i > 3 ? 8 : 0));
gameProxy.addLocalData(i, 8);
key = _getKey(i);
(dat, datLen) = oracle.readPreimage(key, 8);
assertEq(dat, data[i - 1]);
assertEq(datLen, expectedLen);
}
}
/// @dev Helper to get the localized key for an identifier in the context of the game proxy.
...
...
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