forked from OffchainLabs/nitro-contracts
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from EspressoSystems/jh/fraud
Update hotshot contract interface
- Loading branch information
Showing
3 changed files
with
53 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; | ||
} | ||
} |