[marketplace, proofs] simplify proofTimeout getter

This commit is contained in:
Mark Spanbroek 2023-01-16 11:23:40 +01:00 committed by markspanbroek
parent 6aa76257f8
commit de368708b2
3 changed files with 3 additions and 15 deletions

View File

@ -308,10 +308,6 @@ contract Marketplace is Collateral, Proofs, StateRetrieval {
return secondsPerPeriod;
}
function proofTimeout() public view returns (uint256) {
return _timeout();
}
function proofEnd(SlotId slotId) public view override returns (uint256) {
return requestEnd(_slot(slotId).requestId);
}

View File

@ -5,7 +5,7 @@ import "./Requests.sol";
import "./Periods.sol";
abstract contract Proofs is Periods {
uint256 private immutable timeout;
uint256 public immutable proofTimeout;
uint8 private immutable downtime;
constructor(
@ -14,7 +14,7 @@ abstract contract Proofs is Periods {
uint8 __downtime
) Periods(__period) {
require(block.number > 256, "Insufficient block height");
timeout = __timeout;
proofTimeout = __timeout;
downtime = __downtime;
}
@ -25,10 +25,6 @@ abstract contract Proofs is Periods {
mapping(SlotId => mapping(Period => bool)) private received;
mapping(SlotId => mapping(Period => bool)) private missing;
function _timeout() internal view returns (uint256) {
return timeout;
}
// Override this to let the proving system know when proofs for a
// slot are no longer required.
function proofEnd(SlotId id) public view virtual returns (uint256);
@ -130,7 +126,7 @@ abstract contract Proofs is Periods {
function _markProofAsMissing(SlotId id, Period missedPeriod) internal {
uint256 periodEnd = periodEnd(missedPeriod);
require(periodEnd < block.timestamp, "Period has not ended yet");
require(block.timestamp < periodEnd + timeout, "Validation timed out");
require(block.timestamp < periodEnd + proofTimeout, "Validation timed out");
require(!received[id][missedPeriod], "Proof was submitted, not missing");
require(_isProofRequired(id, missedPeriod), "Proof was not required");
require(!missing[id][missedPeriod], "Proof already marked as missing");

View File

@ -22,10 +22,6 @@ contract TestProofs is Proofs {
return ends[slotId];
}
function timeout() public view returns (uint256) {
return _timeout();
}
function startRequiringProofs(SlotId slot, uint256 _probability) public {
_startRequiringProofs(slot, _probability);
}