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 {
MIPS mips = MIPS(mustGetAddress("Mips"));
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.
FaultDisputeGame gameImpl = FaultDisputeGame(payable(address(dgfProxy.gameImpls(GameTypes.CANNON))));
assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth());
......@@ -184,6 +193,9 @@ contract FPACOPS is Deploy, StdAssertions {
assertEq(gameImpl.clockExtension().raw(), cfg.faultGameClockExtension());
assertEq(gameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration());
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.
PermissionedDisputeGame soyGameImpl =
......@@ -195,15 +207,9 @@ contract FPACOPS is Deploy, StdAssertions {
assertEq(soyGameImpl.clockExtension().raw(), cfg.faultGameClockExtension());
assertEq(soyGameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration());
assertEq(soyGameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate()));
// 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());
assertEq(address(soyGameImpl.weth()), wethProxyAddr);
assertEq(address(soyGameImpl.anchorStateRegistry()), address(asr));
assertEq(address(soyGameImpl.vm()), address(mips));
}
/// @notice Prints a review of the fault proof configuration section of the deploy config.
......
......@@ -116,8 +116,8 @@
"sourceCodeHash": "0xc4dbd17217b63f8117f56f78c213e57dda304fee7577fe296e1d804ebe049542"
},
"src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0x989b87a852a1c4f50e4fb6872b8481334c8f11281984c96db565d40e042448ef",
"sourceCodeHash": "0x27b900bb305c9ee2c98df3f611bee8a9408086cf95d34442c557136803cdf8c6"
"initCodeHash": "0x8b8be450739ffdc236e5cbad7d59140d5c1f80cfc096c75260fb7224701fa3f3",
"sourceCodeHash": "0xe5bcdc2d310c46445a1f420db76225e0b5446671ba1c9a2f0b73e2a522faf967"
},
"src/dispute/weth/DelayedWETH.sol": {
"initCodeHash": "0x7b6ec89eaec09e369426e73161a9c6932223bb1f974377190c3f6f552995da35",
......
......@@ -91,6 +91,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "anchorStateRegistry",
"outputs": [
{
"internalType": "contract IAnchorStateRegistry",
"name": "registry_",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
......@@ -184,6 +197,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "ClaimHash",
"name": "",
"type": "bytes32"
}
],
"name": "claims",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "clockExtension",
......@@ -481,6 +513,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "resolvedSubgames",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rootClaim",
......@@ -592,6 +643,30 @@
"stateMutability": "nonpayable",
"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": [],
"name": "version",
......
......@@ -101,6 +101,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "anchorStateRegistry",
"outputs": [
{
"internalType": "contract IAnchorStateRegistry",
"name": "registry_",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
......@@ -207,6 +220,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "ClaimHash",
"name": "",
"type": "bytes32"
}
],
"name": "claims",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "clockExtension",
......@@ -517,6 +549,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "resolvedSubgames",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rootClaim",
......@@ -628,6 +679,30 @@
"stateMutability": "nonpayable",
"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": [],
"name": "version",
......
......@@ -20,6 +20,13 @@
"slot": "0",
"type": "enum GameStatus"
},
{
"bytes": "1",
"label": "initialized",
"offset": 17,
"slot": "0",
"type": "bool"
},
{
"bytes": "32",
"label": "claimData",
......@@ -55,18 +62,11 @@
"slot": "5",
"type": "mapping(uint256 => bool)"
},
{
"bytes": "1",
"label": "initialized",
"offset": 0,
"slot": "6",
"type": "bool"
},
{
"bytes": "64",
"label": "startingOutputRoot",
"offset": 0,
"slot": "7",
"slot": "6",
"type": "struct OutputRoot"
}
]
\ No newline at end of file
......@@ -20,6 +20,13 @@
"slot": "0",
"type": "enum GameStatus"
},
{
"bytes": "1",
"label": "initialized",
"offset": 17,
"slot": "0",
"type": "bool"
},
{
"bytes": "32",
"label": "claimData",
......@@ -55,18 +62,11 @@
"slot": "5",
"type": "mapping(uint256 => bool)"
},
{
"bytes": "1",
"label": "initialized",
"offset": 0,
"slot": "6",
"type": "bool"
},
{
"bytes": "64",
"label": "startingOutputRoot",
"offset": 0,
"slot": "7",
"slot": "6",
"type": "struct OutputRoot"
}
]
\ No newline at end of file
......@@ -62,8 +62,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
Position internal constant ROOT_POSITION = Position.wrap(1);
/// @notice Semantic version.
/// @custom:semver 0.16.1
string public constant version = "0.16.1";
/// @custom:semver 0.17.0
string public constant version = "0.17.0";
/// @notice The starting timestamp of the game
Timestamp public createdAt;
......@@ -74,23 +74,23 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
/// @inheritdoc IDisputeGame
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.
ClaimData[] public claimData;
/// @notice Credited balances for winning participants.
mapping(address => uint256) public credit;
/// @notice An internal mapping to allow for constant-time lookups of existing claims.
mapping(ClaimHash => bool) internal claims;
/// @notice A mapping to allow for constant-time lookups of existing claims.
mapping(ClaimHash => bool) public claims;
/// @notice An internal mapping of subgames rooted at a claim index to other claim indices in the subgame.
mapping(uint256 => uint256[]) internal subgames;
/// @notice A mapping of subgames rooted at a claim index to other claim indices in the subgame.
mapping(uint256 => uint256[]) public subgames;
/// @notice An interneal mapping of resolved subgames rooted at a claim index.
mapping(uint256 => bool) internal resolvedSubgames;
/// @notice Flag for the `initialize` function to prevent re-initialization.
bool internal initialized;
mapping(uint256 => bool) public resolvedSubgames;
/// @notice The latest finalized output root, serving as the anchor for output bisection.
OutputRoot public startingOutputRoot;
......@@ -715,6 +715,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
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.
function l2ChainId() external view returns (uint256 l2ChainId_) {
l2ChainId_ = L2_CHAIN_ID;
......
......@@ -70,6 +70,8 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
assertEq(gameProxy.splitDepth(), 2 ** 2);
assertEq(gameProxy.clockExtension().raw(), 3 hours);
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));
// 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