Commit 46977a7c authored by clabby's avatar clabby Committed by GitHub

fix(ctb): `LibGameType` downcast fix (#10152)

* fix(ctb): LibGameType cast fix

* bindings, locks, etc.
parent ac694e22
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"sourceCodeHash": "0xd3450653cecc14bf8fbc21f2fa9b4a5fde348c2b6313d72e74e08666201295a2" "sourceCodeHash": "0xd3450653cecc14bf8fbc21f2fa9b4a5fde348c2b6313d72e74e08666201295a2"
}, },
"src/L1/OptimismPortal2.sol": { "src/L1/OptimismPortal2.sol": {
"initCodeHash": "0x428eb70b0212733b6271d885741da959ba95e310bf963ead9f7e93a6846eb9ea", "initCodeHash": "0x12407ad2db89ab758460e1cbd93bdc61fc3c30b20acab6ab61c96c51767c16f6",
"sourceCodeHash": "0x1cd093d048b893846319bc242c8dd5744de1f675e87551de423e0ae4ab3216e1" "sourceCodeHash": "0x1cd093d048b893846319bc242c8dd5744de1f675e87551de423e0ae4ab3216e1"
}, },
"src/L1/ProtocolVersions.sol": { "src/L1/ProtocolVersions.sol": {
...@@ -108,8 +108,8 @@ ...@@ -108,8 +108,8 @@
"sourceCodeHash": "0xba941ad1f941f5a4a066182d50634fa9b190085ed82779decef71c019ba963c5" "sourceCodeHash": "0xba941ad1f941f5a4a066182d50634fa9b190085ed82779decef71c019ba963c5"
}, },
"src/dispute/DisputeGameFactory.sol": { "src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0xcbf28ecd117cbcbb9cea34dd75d2d0afbdc42865311b6fa94f23958c26186ab3", "initCodeHash": "0x3d65d1afd2ba6cd7ebb194859390579fd5dd95c1e18ca9a74f00d95a3a4de4fa",
"sourceCodeHash": "0x08f34cec56d58ea6ee7a47b5adcbeca6a68a5dd1daa949330b4bde86c2e605f5" "sourceCodeHash": "0xc4dbd17217b63f8117f56f78c213e57dda304fee7577fe296e1d804ebe049542"
}, },
"src/dispute/FaultDisputeGame.sol": { "src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0x42c04ec50860cf8f1f772bc77dcbd20e7e06554a0962d16eaad2ee5fd748cfe0", "initCodeHash": "0x42c04ec50860cf8f1f772bc77dcbd20e7e06554a0962d16eaad2ee5fd748cfe0",
......
...@@ -23,8 +23,8 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver ...@@ -23,8 +23,8 @@ contract DisputeGameFactory is OwnableUpgradeable, IDisputeGameFactory, ISemver
using LibClone for address; using LibClone for address;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 0.5.0 /// @custom:semver 0.6.0
string public constant version = "0.5.0"; string public constant version = "0.6.0";
/// @inheritdoc IDisputeGameFactory /// @inheritdoc IDisputeGameFactory
mapping(GameType => IDisputeGame) public gameImpls; mapping(GameType => IDisputeGame) public gameImpls;
......
...@@ -115,10 +115,10 @@ library LibVMStatus { ...@@ -115,10 +115,10 @@ library LibVMStatus {
/// @title LibGameType /// @title LibGameType
/// @notice This library contains helper functions for working with the `GameType` type. /// @notice This library contains helper functions for working with the `GameType` type.
library LibGameType { library LibGameType {
/// @notice Get the value of a `GameType` type in the form of the underlying uint8. /// @notice Get the value of a `GameType` type in the form of the underlying uint32.
/// @param _gametype The `GameType` type to get the value of. /// @param _gametype The `GameType` type to get the value of.
/// @return gametype_ The value of the `GameType` type as a uint8 type. /// @return gametype_ The value of the `GameType` type as a uint32 type.
function raw(GameType _gametype) internal pure returns (uint8 gametype_) { function raw(GameType _gametype) internal pure returns (uint32 gametype_) {
assembly { assembly {
gametype_ := _gametype gametype_ := _gametype
} }
......
...@@ -45,13 +45,13 @@ type Timestamp is uint64; ...@@ -45,13 +45,13 @@ type Timestamp is uint64;
/// @dev Unit: seconds /// @dev Unit: seconds
type Duration is uint64; type Duration is uint64;
/// @notice A `GameId` represents a packed 1 byte game ID, an 11 byte timestamp, and a 20 byte address. /// @notice A `GameId` represents a packed 4 byte game ID, a 8 byte timestamp, and a 20 byte address.
/// @dev The packed layout of this type is as follows: /// @dev The packed layout of this type is as follows:
/// ┌───────────┬───────────┐ /// ┌───────────┬───────────┐
/// │ Bits │ Value │ /// │ Bits │ Value │
/// ├───────────┼───────────┤ /// ├───────────┼───────────┤
/// │ [0, 8) │ Game Type │ /// │ [0, 32) │ Game Type │
/// │ [8, 96) │ Timestamp │ /// │ [32, 96) │ Timestamp │
/// │ [96, 256) │ Address │ /// │ [96, 256) │ Address │
/// └───────────┴───────────┘ /// └───────────┴───────────┘
type GameId is bytes32; type GameId is bytes32;
......
...@@ -32,7 +32,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_Init { ...@@ -32,7 +32,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_Init {
/// @dev Tests that the `create` function succeeds when creating a new dispute game /// @dev Tests that the `create` function succeeds when creating a new dispute game
/// with a `GameType` that has an implementation set. /// with a `GameType` that has an implementation set.
function testFuzz_create_succeeds( function testFuzz_create_succeeds(
uint8 gameType, uint32 gameType,
Claim rootClaim, Claim rootClaim,
bytes calldata extraData, bytes calldata extraData,
uint256 _value uint256 _value
...@@ -74,7 +74,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_Init { ...@@ -74,7 +74,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_Init {
/// @dev Tests that the `create` function reverts when creating a new dispute game with an incorrect bond amount. /// @dev Tests that the `create` function reverts when creating a new dispute game with an incorrect bond amount.
function testFuzz_create_incorrectBondAmount_reverts( function testFuzz_create_incorrectBondAmount_reverts(
uint8 gameType, uint32 gameType,
Claim rootClaim, Claim rootClaim,
bytes calldata extraData bytes calldata extraData
) )
...@@ -110,7 +110,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_Init { ...@@ -110,7 +110,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_Init {
} }
/// @dev Tests that the `create` function reverts when there exists a dispute game with the same UUID. /// @dev Tests that the `create` function reverts when there exists a dispute game with the same UUID.
function testFuzz_create_sameUUID_reverts(uint8 gameType, Claim rootClaim, bytes calldata extraData) public { function testFuzz_create_sameUUID_reverts(uint32 gameType, Claim rootClaim, bytes calldata extraData) public {
// Ensure that the `gameType` is within the bounds of the `GameType` enum's possible values. // Ensure that the `gameType` is within the bounds of the `GameType` enum's possible values.
GameType gt = GameType.wrap(uint8(bound(gameType, 0, 2))); GameType gt = GameType.wrap(uint8(bound(gameType, 0, 2)));
// Ensure the rootClaim has a VMStatus that disagrees with the validity. // Ensure the rootClaim has a VMStatus that disagrees with the validity.
...@@ -195,7 +195,7 @@ contract DisputeGameFactory_SetInitBond_Test is DisputeGameFactory_Init { ...@@ -195,7 +195,7 @@ contract DisputeGameFactory_SetInitBond_Test is DisputeGameFactory_Init {
contract DisputeGameFactory_GetGameUUID_Test is DisputeGameFactory_Init { contract DisputeGameFactory_GetGameUUID_Test is DisputeGameFactory_Init {
/// @dev Tests that the `getGameUUID` function returns the correct hash when comparing /// @dev Tests that the `getGameUUID` function returns the correct hash when comparing
/// against the keccak256 hash of the abi-encoded parameters. /// against the keccak256 hash of the abi-encoded parameters.
function testDiff_getGameUUID_succeeds(uint8 gameType, Claim rootClaim, bytes calldata extraData) public { function testDiff_getGameUUID_succeeds(uint32 gameType, Claim rootClaim, bytes calldata extraData) public {
// Ensure that the `gameType` is within the bounds of the `GameType` enum's possible values. // Ensure that the `gameType` is within the bounds of the `GameType` enum's possible values.
GameType gt = GameType.wrap(uint8(bound(gameType, 0, 2))); GameType gt = GameType.wrap(uint8(bound(gameType, 0, 2)));
...@@ -328,7 +328,7 @@ contract DisputeGameFactory_FindLatestGames_Test is DisputeGameFactory_Init { ...@@ -328,7 +328,7 @@ contract DisputeGameFactory_FindLatestGames_Test is DisputeGameFactory_Init {
// Create `_numGames` dispute games, with at least `_numSearchedGames` games. // Create `_numGames` dispute games, with at least `_numSearchedGames` games.
for (uint256 i; i < _numGames; i++) { for (uint256 i; i < _numGames; i++) {
uint8 gameType = i < _numSearchedGames ? 0 : 1; uint32 gameType = i < _numSearchedGames ? 0 : 1;
disputeGameFactory.create(GameType.wrap(gameType), Claim.wrap(bytes32(i)), abi.encode(i)); disputeGameFactory.create(GameType.wrap(gameType), Claim.wrap(bytes32(i)), abi.encode(i));
} }
......
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