Commit 30c242d9 authored by clabby's avatar clabby

Initialize `FaultDisputeGame` with the current L1 head hash

parent 1888081c
...@@ -48,6 +48,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -48,6 +48,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
IBondManager public bondManager; IBondManager public bondManager;
/// @inheritdoc IFaultDisputeGame
Hash public l1Head;
/// @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;
...@@ -243,7 +246,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -243,7 +246,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// @inheritdoc IFaultDisputeGame /// @inheritdoc IFaultDisputeGame
function l2BlockNumber() public pure returns (uint256 l2BlockNumber_) { function l2BlockNumber() public pure returns (uint256 l2BlockNumber_) {
l2BlockNumber_ = _getArgUint256(0x40); l2BlockNumber_ = _getArgUint256(0x20);
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
...@@ -336,8 +339,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -336,8 +339,7 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
function extraData() public pure returns (bytes memory extraData_) { function extraData() public pure returns (bytes memory extraData_) {
// The extra data starts at the third word within the cwia calldata. // The extra data starts at the second word within the cwia calldata.
// Account for the `l2BlockNumber` argument @ 0x40.
extraData_ = _getArgDynBytes(0x20, 0x20); extraData_ = _getArgDynBytes(0x20, 0x20);
} }
...@@ -378,7 +380,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver { ...@@ -378,7 +380,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, Semver {
}) })
); );
// TODO(clabby): Load the local data into the preimage oracle. // Set the L1 head hash at the time of the game's creation.
l1Head = Hash.wrap(blockhash(block.number));
} }
/// @notice Returns the length of the `claimData` array. /// @notice Returns the length of the `claimData` array.
......
...@@ -53,6 +53,9 @@ interface IFaultDisputeGame is IDisputeGame { ...@@ -53,6 +53,9 @@ interface IFaultDisputeGame is IDisputeGame {
bytes calldata _proof bytes calldata _proof
) external; ) external;
/// @notice Returns the L1 block hash at the time of the game's creation.
function l1Head() external view returns (Hash l1Head_);
/// @notice The l2BlockNumber that the `rootClaim` commits to. The trace being bisected within /// @notice The l2BlockNumber that the `rootClaim` commits to. The trace being bisected within
/// the game is from `l2BlockNumber - 1` -> `l2BlockNumber`. /// the game is from `l2BlockNumber - 1` -> `l2BlockNumber`.
/// @return l2BlockNumber_ The l2BlockNumber that the `rootClaim` commits to. /// @return l2BlockNumber_ The l2BlockNumber that the `rootClaim` commits to.
......
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