Commit 632525f4 authored by clabby's avatar clabby Committed by GitHub

feat(ctb): `raw()` helper on dispute UDTs (#8789)

* Add `raw()` helper to UDTs to reduce boilerplate syntax

* fmt

* slither + semver lock

* fmt
parent 12900b75
This diff is collapsed.
...@@ -4,15 +4,14 @@ pragma solidity ^0.8.15; ...@@ -4,15 +4,14 @@ pragma solidity ^0.8.15;
import { Script } from "forge-std/Script.sol"; import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol"; import { console2 as console } from "forge-std/console2.sol";
import { FaultDisputeGame_Init } from "../test/dispute/FaultDisputeGame.t.sol"; import { FaultDisputeGame_Init } from "test/dispute/FaultDisputeGame.t.sol";
import { DisputeGameFactory } from "../src/dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../src/dispute/FaultDisputeGame.sol"; import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { IFaultDisputeGame } from "../src/dispute/interfaces/IFaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import "../src/libraries/DisputeTypes.sol"; import "src/libraries/DisputeTypes.sol";
import "../src/libraries/DisputeErrors.sol"; import "src/libraries/DisputeErrors.sol";
import { LibClock } from "../src/dispute/lib/LibClock.sol"; import { LibPosition } from "src/dispute/lib/LibPosition.sol";
import { LibPosition } from "../src/dispute/lib/LibPosition.sol";
/** /**
* @title FaultDisputeGameViz * @title FaultDisputeGameViz
......
...@@ -92,8 +92,8 @@ ...@@ -92,8 +92,8 @@
"sourceCodeHash": "0x64290a5d8138c46d2ecd308e3ef62ba04663049cce8a271b9a686ddd2e630391" "sourceCodeHash": "0x64290a5d8138c46d2ecd308e3ef62ba04663049cce8a271b9a686ddd2e630391"
}, },
"src/dispute/FaultDisputeGame.sol": { "src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0xbd89fd5227cf5c52309cbaa24175351491180f6ff5b7a40a542bfc0e80d6ec00", "initCodeHash": "0xd93d6ae410ba47724c40094ae3a19d8e9db4c5daaf43d367c4b7af0af6fccfa0",
"sourceCodeHash": "0xbf39a67d44f5bcdaf65b202c393c538a87903a172056f4fb548645120f38d88c" "sourceCodeHash": "0xeb4ef33b0134a69ddf50c59494ae05b60c07e22e0634f69aafc213fbed6e1a2b"
}, },
"src/legacy/BlockOracle.sol": { "src/legacy/BlockOracle.sol": {
"initCodeHash": "0x183ce41fb2842c9853f08955ddd91e345126028fad64e07ed14f593cbf9c88bc", "initCodeHash": "0x183ce41fb2842c9853f08955ddd91e345126028fad64e07ed14f593cbf9c88bc",
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
"sourceCodeHash": "0xb518a9f56136a910f2450098b4823c9982f93883fe4a9ef6f6b0a89355965d38" "sourceCodeHash": "0xb518a9f56136a910f2450098b4823c9982f93883fe4a9ef6f6b0a89355965d38"
}, },
"src/legacy/FaultDisputeGame.sol": { "src/legacy/FaultDisputeGame.sol": {
"initCodeHash": "0xbd89fd5227cf5c52309cbaa24175351491180f6ff5b7a40a542bfc0e80d6ec00", "initCodeHash": "0xd93d6ae410ba47724c40094ae3a19d8e9db4c5daaf43d367c4b7af0af6fccfa0",
"sourceCodeHash": "0xdc119ac6d4766e6ee88fcaff31f7ef3b8f5ac79055bc426dd3c6872f3df0eb30" "sourceCodeHash": "0x16c1020857324372169e66c57c1927c19f7763bbaa69dc9c51ae4750d9e6c7a4"
}, },
"src/legacy/L1BlockNumber.sol": { "src/legacy/L1BlockNumber.sol": {
"initCodeHash": "0xd586c4f93caf1753e53fcdc05eb547c1f3a69afda2904ae9f9d851b73e1c9c1d", "initCodeHash": "0xd586c4f93caf1753e53fcdc05eb547c1f3a69afda2904ae9f9d851b73e1c9c1d",
......
...@@ -176,4 +176,13 @@ library LibPosition { ...@@ -176,4 +176,13 @@ library LibPosition {
move_ := shl(1, or(iszero(_isAttack), _position)) move_ := shl(1, or(iszero(_isAttack), _position))
} }
} }
/// @notice Get the value of a `Position` type in the form of the underlying uint128.
/// @param _position The position to get the value of.
/// @return raw_ The value of the `position` as a uint128 type.
function raw(Position _position) internal pure returns (uint128 raw_) {
assembly {
raw_ := _position
}
}
} }
...@@ -36,4 +36,91 @@ library LibClock { ...@@ -36,4 +36,91 @@ library LibClock {
timestamp_ := shr(0xC0, shl(0xC0, _clock)) timestamp_ := shr(0xC0, shl(0xC0, _clock))
} }
} }
/// @notice Get the value of a `Clock` type in the form of the underlying uint128.
/// @param _clock The `Clock` type to get the value of.
/// @return clock_ The value of the `Clock` type as a uint128 type.
function raw(Clock _clock) internal pure returns (uint128 clock_) {
assembly {
clock_ := _clock
}
}
}
/// @title LibClaim
/// @notice This library contains helper functions for working with the `Claim` type.
library LibClaim {
/// @notice Get the value of a `Claim` type in the form of the underlying bytes32.
/// @param _claim The `Claim` type to get the value of.
/// @return claim_ The value of the `Claim` type as a bytes32 type.
function raw(Claim _claim) internal pure returns (bytes32 claim_) {
assembly {
claim_ := _claim
}
}
}
/// @title LibDuration
/// @notice This library contains helper functions for working with the `Duration` type.
library LibDuration {
/// @notice Get the value of a `Duration` type in the form of the underlying uint64.
/// @param _duration The `Duration` type to get the value of.
/// @return duration_ The value of the `Duration` type as a uint64 type.
function raw(Duration _duration) internal pure returns (uint64 duration_) {
assembly {
duration_ := _duration
}
}
}
/// @title LibHash
/// @notice This library contains helper functions for working with the `Hash` type.
library LibHash {
/// @notice Get the value of a `Hash` type in the form of the underlying bytes32.
/// @param _hash The `Hash` type to get the value of.
/// @return hash_ The value of the `Hash` type as a bytes32 type.
function raw(Hash _hash) internal pure returns (bytes32 hash_) {
assembly {
hash_ := _hash
}
}
}
/// @title LibTimestamp
/// @notice This library contains helper functions for working with the `Timestamp` type.
library LibTimestamp {
/// @notice Get the value of a `Timestamp` type in the form of the underlying uint64.
/// @param _timestamp The `Timestamp` type to get the value of.
/// @return timestamp_ The value of the `Timestamp` type as a uint64 type.
function raw(Timestamp _timestamp) internal pure returns (uint64 timestamp_) {
assembly {
timestamp_ := _timestamp
}
}
}
/// @title LibVMStatus
/// @notice This library contains helper functions for working with the `VMStatus` type.
library LibVMStatus {
/// @notice Get the value of a `VMStatus` type in the form of the underlying uint8.
/// @param _vmstatus The `VMStatus` type to get the value of.
/// @return vmstatus_ The value of the `VMStatus` type as a uint8 type.
function raw(VMStatus _vmstatus) internal pure returns (uint8 vmstatus_) {
assembly {
vmstatus_ := _vmstatus
}
}
}
/// @title LibGameType
/// @notice This library contains helper functions for working with the `GameType` type.
library LibGameType {
/// @notice Get the value of a `GameType` type in the form of the underlying uint8.
/// @param _gametype The `GameType` type to get the value of.
/// @return gametype_ The value of the `GameType` type as a uint8 type.
function raw(GameType _gametype) internal pure returns (uint8 gametype_) {
assembly {
gametype_ := _gametype
}
}
} }
...@@ -14,7 +14,7 @@ import { Types } from "src/libraries/Types.sol"; ...@@ -14,7 +14,7 @@ import { Types } from "src/libraries/Types.sol";
import { ISemver } from "src/universal/ISemver.sol"; import { ISemver } from "src/universal/ISemver.sol";
import { LibHashing } from "src/dispute/lib/LibHashing.sol"; import { LibHashing } from "src/dispute/lib/LibHashing.sol";
import { LibPosition } from "src/dispute/lib/LibPosition.sol"; import { LibPosition } from "src/dispute/lib/LibPosition.sol";
import { LibClock } from "src/dispute/lib/LibClock.sol"; import { LibClock } from "src/dispute/lib/LibUDT.sol";
import "src/libraries/DisputeTypes.sol"; import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeErrors.sol"; import "src/libraries/DisputeErrors.sol";
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
import { LibHashing } from "../dispute/lib/LibHashing.sol"; import { LibHashing } from "src/dispute/lib/LibHashing.sol";
import { LibPosition } from "../dispute/lib/LibPosition.sol"; import {
import { LibClock } from "../dispute/lib/LibClock.sol"; LibClaim,
import { LibGameId } from "../dispute/lib/LibGameId.sol"; LibHash,
LibDuration,
LibClock,
LibTimestamp,
LibVMStatus,
LibGameType
} from "src/dispute/lib/LibUDT.sol";
import { LibPosition } from "src/dispute/lib/LibPosition.sol";
import { LibGameId } from "src/dispute/lib/LibGameId.sol";
using LibClaim for Claim global;
using LibHashing for Claim global; using LibHashing for Claim global;
using LibHash for Hash global;
using LibPosition for Position global; using LibPosition for Position global;
using LibDuration for Duration global;
using LibClock for Clock global; using LibClock for Clock global;
using LibGameId for GameId global; using LibGameId for GameId global;
using LibTimestamp for Timestamp global;
using LibVMStatus for VMStatus global;
using LibGameType for GameType global;
/// @notice A custom type for a generic hash. /// @notice A custom type for a generic hash.
type Hash is bytes32; type Hash is bytes32;
......
...@@ -13,7 +13,7 @@ import { PreimageKeyLib } from "src/cannon/PreimageKeyLib.sol"; ...@@ -13,7 +13,7 @@ import { PreimageKeyLib } from "src/cannon/PreimageKeyLib.sol";
import "src/libraries/DisputeTypes.sol"; import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeErrors.sol"; import "src/libraries/DisputeErrors.sol";
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { LibClock } from "src/dispute/lib/LibClock.sol"; import { LibClock } from "src/dispute/lib/LibUDT.sol";
import { LibPosition } from "src/dispute/lib/LibPosition.sol"; import { LibPosition } from "src/dispute/lib/LibPosition.sol";
import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol"; import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
import { AlphabetVM } from "test/mocks/AlphabetVM.sol"; import { AlphabetVM } from "test/mocks/AlphabetVM.sol";
...@@ -68,13 +68,13 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init { ...@@ -68,13 +68,13 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
gameProxy = FaultDisputeGame(address(factory.create(GAME_TYPE, rootClaim, extraData))); gameProxy = FaultDisputeGame(address(factory.create(GAME_TYPE, rootClaim, extraData)));
// Check immutables // Check immutables
assertEq(GameType.unwrap(gameProxy.gameType()), GameType.unwrap(GAME_TYPE)); assertEq(gameProxy.gameType().raw(), GAME_TYPE.raw());
assertEq(Claim.unwrap(gameProxy.absolutePrestate()), Claim.unwrap(absolutePrestate)); assertEq(gameProxy.absolutePrestate().raw(), absolutePrestate.raw());
assertEq(gameProxy.genesisBlockNumber(), genesisBlockNumber); assertEq(gameProxy.genesisBlockNumber(), genesisBlockNumber);
assertEq(Hash.unwrap(gameProxy.genesisOutputRoot()), Hash.unwrap(genesisOutputRoot)); assertEq(gameProxy.genesisOutputRoot().raw(), genesisOutputRoot.raw());
assertEq(gameProxy.maxGameDepth(), 2 ** 3); assertEq(gameProxy.maxGameDepth(), 2 ** 3);
assertEq(gameProxy.splitDepth(), 2 ** 2); assertEq(gameProxy.splitDepth(), 2 ** 2);
assertEq(Duration.unwrap(gameProxy.gameDuration()), 7 days); assertEq(gameProxy.gameDuration().raw(), 7 days);
assertEq(address(gameProxy.vm()), address(_vm)); assertEq(address(gameProxy.vm()), address(_vm));
// Label the proxy // Label the proxy
...@@ -126,7 +126,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -126,7 +126,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/// @dev Tests that the game's root claim is set correctly. /// @dev Tests that the game's root claim is set correctly.
function test_rootClaim_succeeds() public { function test_rootClaim_succeeds() public {
assertEq(Claim.unwrap(gameProxy.rootClaim()), Claim.unwrap(ROOT_CLAIM)); assertEq(gameProxy.rootClaim().raw(), ROOT_CLAIM.raw());
} }
/// @dev Tests that the game's extra data is set correctly. /// @dev Tests that the game's extra data is set correctly.
...@@ -136,20 +136,20 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -136,20 +136,20 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/// @dev Tests that the game's starting timestamp is set correctly. /// @dev Tests that the game's starting timestamp is set correctly.
function test_createdAt_succeeds() public { function test_createdAt_succeeds() public {
assertEq(Timestamp.unwrap(gameProxy.createdAt()), block.timestamp); assertEq(gameProxy.createdAt().raw(), block.timestamp);
} }
/// @dev Tests that the game's type is set correctly. /// @dev Tests that the game's type is set correctly.
function test_gameType_succeeds() public { function test_gameType_succeeds() public {
assertEq(GameType.unwrap(gameProxy.gameType()), GameType.unwrap(GAME_TYPE)); assertEq(gameProxy.gameType().raw(), GAME_TYPE.raw());
} }
/// @dev Tests that the game's data is set correctly. /// @dev Tests that the game's data is set correctly.
function test_gameData_succeeds() public { function test_gameData_succeeds() public {
(GameType gameType, Claim rootClaim, bytes memory _extraData) = gameProxy.gameData(); (GameType gameType, Claim rootClaim, bytes memory _extraData) = gameProxy.gameData();
assertEq(GameType.unwrap(gameType), GameType.unwrap(GAME_TYPE)); assertEq(gameType.raw(), GAME_TYPE.raw());
assertEq(Claim.unwrap(rootClaim), Claim.unwrap(ROOT_CLAIM)); assertEq(rootClaim.raw(), ROOT_CLAIM.raw());
assertEq(_extraData, extraData); assertEq(_extraData, extraData);
} }
...@@ -195,17 +195,15 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -195,17 +195,15 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
(uint32 parentIndex, bool countered, Claim claim, Position position, Clock clock) = gameProxy.claimData(0); (uint32 parentIndex, bool countered, Claim claim, Position position, Clock clock) = gameProxy.claimData(0);
assertEq(parentIndex, type(uint32).max); assertEq(parentIndex, type(uint32).max);
assertEq(countered, false); assertEq(countered, false);
assertEq(Claim.unwrap(claim), Claim.unwrap(ROOT_CLAIM)); assertEq(claim.raw(), ROOT_CLAIM.raw());
assertEq(Position.unwrap(position), 1); assertEq(position.raw(), 1);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(0), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(0), Timestamp.wrap(uint64(block.timestamp))))
);
// Assert that the `createdAt` timestamp is correct. // Assert that the `createdAt` timestamp is correct.
assertEq(Timestamp.unwrap(gameProxy.createdAt()), block.timestamp); assertEq(gameProxy.createdAt().raw(), block.timestamp);
// Assert that the blockhash provided is correct. // Assert that the blockhash provided is correct.
assertEq(Hash.unwrap(gameProxy.l1Head()), blockhash(block.number - 1)); assertEq(gameProxy.l1Head().raw(), blockhash(block.number - 1));
} }
/// @dev Tests that a move while the game status is not `IN_PROGRESS` causes the call to revert /// @dev Tests that a move while the game status is not `IN_PROGRESS` causes the call to revert
...@@ -279,25 +277,19 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -279,25 +277,19 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/// @notice Static unit test for the correctness of the chess clock incrementation. /// @notice Static unit test for the correctness of the chess clock incrementation.
function test_move_clockCorrectness_succeeds() public { function test_move_clockCorrectness_succeeds() public {
(,,,, Clock clock) = gameProxy.claimData(0); (,,,, Clock clock) = gameProxy.claimData(0);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(0), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(0), Timestamp.wrap(uint64(block.timestamp))))
);
Claim claim = _dummyClaim(); Claim claim = _dummyClaim();
vm.warp(block.timestamp + 15); vm.warp(block.timestamp + 15);
gameProxy.attack(0, claim); gameProxy.attack(0, claim);
(,,,, clock) = gameProxy.claimData(1); (,,,, clock) = gameProxy.claimData(1);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(15), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(15), Timestamp.wrap(uint64(block.timestamp))))
);
vm.warp(block.timestamp + 10); vm.warp(block.timestamp + 10);
gameProxy.attack(1, claim); gameProxy.attack(1, claim);
(,,,, clock) = gameProxy.claimData(2); (,,,, clock) = gameProxy.claimData(2);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(10), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(10), Timestamp.wrap(uint64(block.timestamp))))
);
// We are at the split depth, so we need to set the status byte of the claim // We are at the split depth, so we need to set the status byte of the claim
// for the next move. // for the next move.
...@@ -306,16 +298,12 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -306,16 +298,12 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
vm.warp(block.timestamp + 10); vm.warp(block.timestamp + 10);
gameProxy.attack(2, claim); gameProxy.attack(2, claim);
(,,,, clock) = gameProxy.claimData(3); (,,,, clock) = gameProxy.claimData(3);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(25), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(25), Timestamp.wrap(uint64(block.timestamp))))
);
vm.warp(block.timestamp + 10); vm.warp(block.timestamp + 10);
gameProxy.attack(3, claim); gameProxy.attack(3, claim);
(,,,, clock) = gameProxy.claimData(4); (,,,, clock) = gameProxy.claimData(4);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(20), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(20), Timestamp.wrap(uint64(block.timestamp))))
);
} }
/// @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
...@@ -364,11 +352,9 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -364,11 +352,9 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
// Assert correctness of the attack claim's data. // Assert correctness of the attack claim's data.
assertEq(parentIndex, 0); assertEq(parentIndex, 0);
assertEq(countered, false); assertEq(countered, false);
assertEq(Claim.unwrap(claim), Claim.unwrap(counter)); assertEq(claim.raw(), counter.raw());
assertEq(Position.unwrap(position), Position.unwrap(Position.wrap(1).move(true))); assertEq(position.raw(), Position.wrap(1).move(true).raw());
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(5), Timestamp.wrap(uint64(block.timestamp))).raw());
Clock.unwrap(clock), Clock.unwrap(LibClock.wrap(Duration.wrap(5), Timestamp.wrap(uint64(block.timestamp))))
);
// Grab the claim data of the parent. // Grab the claim data of the parent.
(parentIndex, countered, claim, position, clock) = gameProxy.claimData(0); (parentIndex, countered, claim, position, clock) = gameProxy.claimData(0);
...@@ -376,12 +362,9 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -376,12 +362,9 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
// Assert correctness of the parent claim's data. // Assert correctness of the parent claim's data.
assertEq(parentIndex, type(uint32).max); assertEq(parentIndex, type(uint32).max);
assertEq(countered, true); assertEq(countered, true);
assertEq(Claim.unwrap(claim), Claim.unwrap(ROOT_CLAIM)); assertEq(claim.raw(), ROOT_CLAIM.raw());
assertEq(Position.unwrap(position), 1); assertEq(position.raw(), 1);
assertEq( assertEq(clock.raw(), LibClock.wrap(Duration.wrap(0), Timestamp.wrap(uint64(block.timestamp - 5))).raw());
Clock.unwrap(clock),
Clock.unwrap(LibClock.wrap(Duration.wrap(0), Timestamp.wrap(uint64(block.timestamp - 5))))
);
} }
/// @dev Tests that making a claim at the execution trace bisection root level with an invalid status /// @dev Tests that making a claim at the execution trace bisection root level with an invalid status
...@@ -569,13 +552,13 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -569,13 +552,13 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
gameProxy.attack(4, _changeClaimStatus(_dummyClaim(), VMStatuses.PANIC)); gameProxy.attack(4, _changeClaimStatus(_dummyClaim(), VMStatuses.PANIC));
// Expected start/disputed claims // Expected start/disputed claims
bytes32 startingClaim = Hash.unwrap(gameProxy.genesisOutputRoot()); bytes32 startingClaim = gameProxy.genesisOutputRoot().raw();
bytes32 disputedClaim = bytes32(uint256(3)); bytes32 disputedClaim = bytes32(uint256(3));
Position disputedPos = LibPosition.wrap(4, 0); Position disputedPos = LibPosition.wrap(4, 0);
// Expected local data // Expected local data
bytes32[5] memory data = bytes32[5] memory data =
[Hash.unwrap(gameProxy.l1Head()), startingClaim, disputedClaim, bytes32(0), bytes32(block.chainid << 0xC0)]; [gameProxy.l1Head().raw(), startingClaim, disputedClaim, bytes32(0), bytes32(block.chainid << 0xC0)];
for (uint256 i = 1; i <= 5; i++) { for (uint256 i = 1; i <= 5; i++) {
uint256 expectedLen = i > 3 ? 8 : 32; uint256 expectedLen = i > 3 ? 8 : 32;
...@@ -616,7 +599,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -616,7 +599,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
// Expected local data // Expected local data
bytes32[5] memory data = [ bytes32[5] memory data = [
Hash.unwrap(gameProxy.l1Head()), gameProxy.l1Head().raw(),
startingClaim, startingClaim,
disputedClaim, disputedClaim,
bytes32(uint256(1) << 0xC0), bytes32(uint256(1) << 0xC0),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { LibClock } from "src/dispute/lib/LibClock.sol"; import { LibClock } from "src/dispute/lib/LibUDT.sol";
import "src/libraries/DisputeTypes.sol"; import "src/libraries/DisputeTypes.sol";
/// @notice Tests for `LibClock` /// @notice Tests for `LibClock`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment