From 39da450c2ab7efaaa4f8ab5e51eee8a987a2a595 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 9 Jan 2023 15:19:00 +0100 Subject: [PATCH] [Storage] Move submitProof() to Proofs --- contracts/Marketplace.sol | 2 +- contracts/Proofs.sol | 2 +- contracts/Storage.sol | 4 ---- contracts/TestProofs.sol | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/contracts/Marketplace.sol b/contracts/Marketplace.sol index 8c47063..13d08df 100644 --- a/contracts/Marketplace.sol +++ b/contracts/Marketplace.sol @@ -89,7 +89,7 @@ contract Marketplace is Collateral, Proofs { require(balanceOf(msg.sender) >= collateral, "Insufficient collateral"); _expectProofs(slotId, requestId, request.ask.proofProbability); - _submitProof(slotId, proof); + submitProof(slotId, proof); slot.host = msg.sender; slot.requestId = requestId; diff --git a/contracts/Proofs.sol b/contracts/Proofs.sol index f8a5eac..bd405d5 100644 --- a/contracts/Proofs.sol +++ b/contracts/Proofs.sol @@ -161,7 +161,7 @@ contract Proofs { return isRequired && pointer < downtime; } - function _submitProof(SlotId id, bytes calldata proof) internal { + function submitProof(SlotId id, bytes calldata proof) public { require(proof.length > 0, "Invalid proof"); // TODO: replace by actual check require(!received[id][currentPeriod()], "Proof already submitted"); received[id][currentPeriod()] = true; diff --git a/contracts/Storage.sol b/contracts/Storage.sol index 7f6f616..57259a0 100644 --- a/contracts/Storage.sol +++ b/contracts/Storage.sol @@ -35,10 +35,6 @@ contract Storage is Marketplace { minCollateralThreshold = _minCollateralThreshold; } - function submitProof(SlotId slotId, bytes calldata proof) public { - _submitProof(slotId, proof); - } - function markProofAsMissing(SlotId slotId, uint256 period) public slotMustAcceptProofs(slotId) diff --git a/contracts/TestProofs.sol b/contracts/TestProofs.sol index 3a9954d..8ef95a6 100644 --- a/contracts/TestProofs.sol +++ b/contracts/TestProofs.sol @@ -56,10 +56,6 @@ contract TestProofs is Proofs { return _getPointer(id); } - function submitProof(SlotId id, bytes calldata proof) public { - _submitProof(id, proof); - } - function markProofAsMissing(SlotId id, uint256 _period) public { _markProofAsMissing(id, _period); }