forked from OffchainLabs/nitro-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dad781b
commit 13486f6
Showing
3 changed files
with
49 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
struct HotShotCommitment { | ||
uint64 blockHeight; | ||
uint256 blockCommRoot; | ||
} | ||
|
||
interface IHotShot { | ||
function getHotShotCommitment(uint256 hotShotBlockHeight) external view returns (HotShotCommitment memory); | ||
function lagOverEscapeHatchThreshold( | ||
uint256 blockNumber, | ||
uint256 threshold | ||
) external view returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
contract MockHotShot { | ||
import "../bridge/IHotShot.sol"; | ||
|
||
contract MockHotShot is IHotShot { | ||
mapping(uint256 => uint256) public commitments; | ||
mapping(uint256 => bool) public availabilities; | ||
mapping(uint256 => bool) public livenesses; | ||
|
||
function getHotShotCommitment(uint256 hotShotBlockHeight) | ||
external | ||
view | ||
override | ||
returns (HotShotCommitment memory) | ||
{ | ||
return HotShotCommitment({ | ||
blockHeight: uint64(hotShotBlockHeight), | ||
blockCommRoot: commitments[hotShotBlockHeight] | ||
}); | ||
} | ||
|
||
function lagOverEscapeHatchThreshold(uint256 blockNumber, uint256 threshold) | ||
external | ||
view | ||
override | ||
returns (bool) | ||
{ | ||
return true; | ||
} | ||
|
||
function setCommitment(uint256 height, uint256 commitment) external { | ||
commitments[height] = commitment; | ||
} | ||
|
||
function setAvailability(uint256 l1Height, bool isLive) external { | ||
availabilities[l1Height] = isLive; | ||
function setLiveness(uint256 l1Height, bool isLive) external { | ||
livenesses[l1Height] = isLive; | ||
} | ||
} |