Commit 6837780f authored by clabby's avatar clabby Committed by GitHub

chore(ctb): Expose ASR + mappings in FDG (#10211)

parent 3f297b65
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -177,6 +177,15 @@ contract FPACOPS is Deploy, StdAssertions { ...@@ -177,6 +177,15 @@ contract FPACOPS is Deploy, StdAssertions {
MIPS mips = MIPS(mustGetAddress("Mips")); MIPS mips = MIPS(mustGetAddress("Mips"));
assertEq(address(mips.oracle()), address(oracle)); assertEq(address(mips.oracle()), address(oracle));
// Check the AnchorStateRegistry configuration.
AnchorStateRegistry asr = AnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy"));
(Hash root1, uint256 l2BlockNumber1) = asr.anchors(GameTypes.CANNON);
(Hash root2, uint256 l2BlockNumber2) = asr.anchors(GameTypes.PERMISSIONED_CANNON);
assertEq(root1.raw(), cfg.faultGameGenesisOutputRoot());
assertEq(root2.raw(), cfg.faultGameGenesisOutputRoot());
assertEq(l2BlockNumber1, cfg.faultGameGenesisBlock());
assertEq(l2BlockNumber2, cfg.faultGameGenesisBlock());
// Check the FaultDisputeGame configuration. // Check the FaultDisputeGame configuration.
FaultDisputeGame gameImpl = FaultDisputeGame(payable(address(dgfProxy.gameImpls(GameTypes.CANNON)))); FaultDisputeGame gameImpl = FaultDisputeGame(payable(address(dgfProxy.gameImpls(GameTypes.CANNON))));
assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth()); assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth());
...@@ -184,6 +193,9 @@ contract FPACOPS is Deploy, StdAssertions { ...@@ -184,6 +193,9 @@ contract FPACOPS is Deploy, StdAssertions {
assertEq(gameImpl.clockExtension().raw(), cfg.faultGameClockExtension()); assertEq(gameImpl.clockExtension().raw(), cfg.faultGameClockExtension());
assertEq(gameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration()); assertEq(gameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration());
assertEq(gameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); assertEq(gameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate()));
assertEq(address(gameImpl.weth()), wethProxyAddr);
assertEq(address(gameImpl.anchorStateRegistry()), address(asr));
assertEq(address(gameImpl.vm()), address(mips));
// Check the security override yoke configuration. // Check the security override yoke configuration.
PermissionedDisputeGame soyGameImpl = PermissionedDisputeGame soyGameImpl =
...@@ -195,15 +207,9 @@ contract FPACOPS is Deploy, StdAssertions { ...@@ -195,15 +207,9 @@ contract FPACOPS is Deploy, StdAssertions {
assertEq(soyGameImpl.clockExtension().raw(), cfg.faultGameClockExtension()); assertEq(soyGameImpl.clockExtension().raw(), cfg.faultGameClockExtension());
assertEq(soyGameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration()); assertEq(soyGameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration());
assertEq(soyGameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); assertEq(soyGameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate()));
assertEq(address(soyGameImpl.weth()), wethProxyAddr);
// Check the AnchorStateRegistry configuration. assertEq(address(soyGameImpl.anchorStateRegistry()), address(asr));
AnchorStateRegistry asr = AnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy")); assertEq(address(soyGameImpl.vm()), address(mips));
(Hash root1, uint256 l2BlockNumber1) = asr.anchors(GameTypes.CANNON);
(Hash root2, uint256 l2BlockNumber2) = asr.anchors(GameTypes.PERMISSIONED_CANNON);
assertEq(root1.raw(), cfg.faultGameGenesisOutputRoot());
assertEq(root2.raw(), cfg.faultGameGenesisOutputRoot());
assertEq(l2BlockNumber1, cfg.faultGameGenesisBlock());
assertEq(l2BlockNumber2, cfg.faultGameGenesisBlock());
} }
/// @notice Prints a review of the fault proof configuration section of the deploy config. /// @notice Prints a review of the fault proof configuration section of the deploy config.
......
...@@ -116,8 +116,8 @@ ...@@ -116,8 +116,8 @@
"sourceCodeHash": "0xc4dbd17217b63f8117f56f78c213e57dda304fee7577fe296e1d804ebe049542" "sourceCodeHash": "0xc4dbd17217b63f8117f56f78c213e57dda304fee7577fe296e1d804ebe049542"
}, },
"src/dispute/FaultDisputeGame.sol": { "src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0x989b87a852a1c4f50e4fb6872b8481334c8f11281984c96db565d40e042448ef", "initCodeHash": "0x8b8be450739ffdc236e5cbad7d59140d5c1f80cfc096c75260fb7224701fa3f3",
"sourceCodeHash": "0x27b900bb305c9ee2c98df3f611bee8a9408086cf95d34442c557136803cdf8c6" "sourceCodeHash": "0xe5bcdc2d310c46445a1f420db76225e0b5446671ba1c9a2f0b73e2a522faf967"
}, },
"src/dispute/weth/DelayedWETH.sol": { "src/dispute/weth/DelayedWETH.sol": {
"initCodeHash": "0x7b6ec89eaec09e369426e73161a9c6932223bb1f974377190c3f6f552995da35", "initCodeHash": "0x7b6ec89eaec09e369426e73161a9c6932223bb1f974377190c3f6f552995da35",
......
...@@ -91,6 +91,19 @@ ...@@ -91,6 +91,19 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "anchorStateRegistry",
"outputs": [
{
"internalType": "contract IAnchorStateRegistry",
"name": "registry_",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -184,6 +197,25 @@ ...@@ -184,6 +197,25 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "ClaimHash",
"name": "",
"type": "bytes32"
}
],
"name": "claims",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "clockExtension", "name": "clockExtension",
...@@ -481,6 +513,25 @@ ...@@ -481,6 +513,25 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "resolvedSubgames",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "rootClaim", "name": "rootClaim",
...@@ -592,6 +643,30 @@ ...@@ -592,6 +643,30 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "subgames",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "version", "name": "version",
......
...@@ -101,6 +101,19 @@ ...@@ -101,6 +101,19 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "anchorStateRegistry",
"outputs": [
{
"internalType": "contract IAnchorStateRegistry",
"name": "registry_",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -207,6 +220,25 @@ ...@@ -207,6 +220,25 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "ClaimHash",
"name": "",
"type": "bytes32"
}
],
"name": "claims",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "clockExtension", "name": "clockExtension",
...@@ -517,6 +549,25 @@ ...@@ -517,6 +549,25 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "resolvedSubgames",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "rootClaim", "name": "rootClaim",
...@@ -628,6 +679,30 @@ ...@@ -628,6 +679,30 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "subgames",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "version", "name": "version",
......
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
"slot": "0", "slot": "0",
"type": "enum GameStatus" "type": "enum GameStatus"
}, },
{
"bytes": "1",
"label": "initialized",
"offset": 17,
"slot": "0",
"type": "bool"
},
{ {
"bytes": "32", "bytes": "32",
"label": "claimData", "label": "claimData",
...@@ -55,18 +62,11 @@ ...@@ -55,18 +62,11 @@
"slot": "5", "slot": "5",
"type": "mapping(uint256 => bool)" "type": "mapping(uint256 => bool)"
}, },
{
"bytes": "1",
"label": "initialized",
"offset": 0,
"slot": "6",
"type": "bool"
},
{ {
"bytes": "64", "bytes": "64",
"label": "startingOutputRoot", "label": "startingOutputRoot",
"offset": 0, "offset": 0,
"slot": "7", "slot": "6",
"type": "struct OutputRoot" "type": "struct OutputRoot"
} }
] ]
\ No newline at end of file
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
"slot": "0", "slot": "0",
"type": "enum GameStatus" "type": "enum GameStatus"
}, },
{
"bytes": "1",
"label": "initialized",
"offset": 17,
"slot": "0",
"type": "bool"
},
{ {
"bytes": "32", "bytes": "32",
"label": "claimData", "label": "claimData",
...@@ -55,18 +62,11 @@ ...@@ -55,18 +62,11 @@
"slot": "5", "slot": "5",
"type": "mapping(uint256 => bool)" "type": "mapping(uint256 => bool)"
}, },
{
"bytes": "1",
"label": "initialized",
"offset": 0,
"slot": "6",
"type": "bool"
},
{ {
"bytes": "64", "bytes": "64",
"label": "startingOutputRoot", "label": "startingOutputRoot",
"offset": 0, "offset": 0,
"slot": "7", "slot": "6",
"type": "struct OutputRoot" "type": "struct OutputRoot"
} }
] ]
\ No newline at end of file
...@@ -62,8 +62,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -62,8 +62,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
Position internal constant ROOT_POSITION = Position.wrap(1); Position internal constant ROOT_POSITION = Position.wrap(1);
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 0.16.1 /// @custom:semver 0.17.0
string public constant version = "0.16.1"; string public constant version = "0.17.0";
/// @notice The starting timestamp of the game /// @notice The starting timestamp of the game
Timestamp public createdAt; Timestamp public createdAt;
...@@ -74,23 +74,23 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -74,23 +74,23 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
GameStatus public status; GameStatus public status;
/// @notice Flag for the `initialize` function to prevent re-initialization.
bool internal initialized;
/// @notice An append-only array of all claims made during the dispute game. /// @notice An append-only array of all claims made during the dispute game.
ClaimData[] public claimData; ClaimData[] public claimData;
/// @notice Credited balances for winning participants. /// @notice Credited balances for winning participants.
mapping(address => uint256) public credit; mapping(address => uint256) public credit;
/// @notice An internal mapping to allow for constant-time lookups of existing claims. /// @notice A mapping to allow for constant-time lookups of existing claims.
mapping(ClaimHash => bool) internal claims; mapping(ClaimHash => bool) public claims;
/// @notice An internal mapping of subgames rooted at a claim index to other claim indices in the subgame. /// @notice A mapping of subgames rooted at a claim index to other claim indices in the subgame.
mapping(uint256 => uint256[]) internal subgames; mapping(uint256 => uint256[]) public subgames;
/// @notice An interneal mapping of resolved subgames rooted at a claim index. /// @notice An interneal mapping of resolved subgames rooted at a claim index.
mapping(uint256 => bool) internal resolvedSubgames; mapping(uint256 => bool) public resolvedSubgames;
/// @notice Flag for the `initialize` function to prevent re-initialization.
bool internal initialized;
/// @notice The latest finalized output root, serving as the anchor for output bisection. /// @notice The latest finalized output root, serving as the anchor for output bisection.
OutputRoot public startingOutputRoot; OutputRoot public startingOutputRoot;
...@@ -715,6 +715,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -715,6 +715,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
weth_ = WETH; weth_ = WETH;
} }
/// @notice Returns the anchor state registry contract.
function anchorStateRegistry() external view returns (IAnchorStateRegistry registry_) {
registry_ = ANCHOR_STATE_REGISTRY;
}
/// @notice Returns the chain ID of the L2 network this contract argues about. /// @notice Returns the chain ID of the L2 network this contract argues about.
function l2ChainId() external view returns (uint256 l2ChainId_) { function l2ChainId() external view returns (uint256 l2ChainId_) {
l2ChainId_ = L2_CHAIN_ID; l2ChainId_ = L2_CHAIN_ID;
......
...@@ -70,6 +70,8 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init { ...@@ -70,6 +70,8 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
assertEq(gameProxy.splitDepth(), 2 ** 2); assertEq(gameProxy.splitDepth(), 2 ** 2);
assertEq(gameProxy.clockExtension().raw(), 3 hours); assertEq(gameProxy.clockExtension().raw(), 3 hours);
assertEq(gameProxy.maxClockDuration().raw(), 3.5 days); assertEq(gameProxy.maxClockDuration().raw(), 3.5 days);
assertEq(address(gameProxy.weth()), address(delayedWeth));
assertEq(address(gameProxy.anchorStateRegistry()), address(anchorStateRegistry));
assertEq(address(gameProxy.vm()), address(_vm)); assertEq(address(gameProxy.vm()), address(_vm));
// Label the proxy // Label the proxy
......
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