diff --git a/codex/contracts/proofs.nim b/codex/contracts/proofs.nim index a33f5550..81ee8b68 100644 --- a/codex/contracts/proofs.nim +++ b/codex/contracts/proofs.nim @@ -22,14 +22,6 @@ method periodicity*(proofs: OnChainProofs): Future[Periodicity] {.async.} = let period = await proofs.storage.proofPeriod() return Periodicity(seconds: period) -method isSlotCancelled*(proofs: OnChainProofs, - id: SlotId): Future[bool] {.async.} = - return await proofs.storage.isSlotCancelled(id) - -method isCancelled*(proofs: OnChainProofs, - id: RequestId): Future[bool] {.async.} = - return await proofs.storage.isCancelled(id) - method isProofRequired*(proofs: OnChainProofs, id: SlotId): Future[bool] {.async.} = return await proofs.storage.isProofRequired(id) diff --git a/codex/contracts/storage.nim b/codex/contracts/storage.nim index 62610b01..9989a2e5 100644 --- a/codex/contracts/storage.nim +++ b/codex/contracts/storage.nim @@ -45,8 +45,6 @@ proc proofTimeout*(storage: Storage): UInt256 {.contract, view.} proc proofEnd*(storage: Storage, id: SlotId): UInt256 {.contract, view.} proc missingProofs*(storage: Storage, id: SlotId): UInt256 {.contract, view.} -proc isCancelled*(storage: Storage, id: RequestId): bool {.contract, view.} -proc isSlotCancelled*(storage: Storage, id: SlotId): bool {.contract, view.} proc isProofRequired*(storage: Storage, id: SlotId): bool {.contract, view.} proc willProofBeRequired*(storage: Storage, id: SlotId): bool {.contract, view.} proc getChallenge*(storage: Storage, id: SlotId): array[32, byte] {.contract, view.} diff --git a/codex/proving.nim b/codex/proving.nim index a97fd120..05b88de2 100644 --- a/codex/proving.nim +++ b/codex/proving.nim @@ -42,19 +42,11 @@ proc removeEndedContracts(proving: Proving) {.async.} = ended.incl(id) proving.slots.excl(ended) -proc removeCancelledContracts(proving: Proving) {.async.} = - var cancelled: HashSet[SlotId] - for id in proving.slots: - if (await proving.proofs.isSlotCancelled(id)): - cancelled.incl(id) - proving.slots.excl(cancelled) - proc run(proving: Proving) {.async.} = try: while true: let currentPeriod = await proving.getCurrentPeriod() await proving.removeEndedContracts() - await proving.removeCancelledContracts() for id in proving.slots: if (await proving.proofs.isProofRequired(id)) or (await proving.proofs.willProofBeRequired(id)): diff --git a/codex/storageproofs/timing/proofs.nim b/codex/storageproofs/timing/proofs.nim index d0456a1b..6995a346 100644 --- a/codex/storageproofs/timing/proofs.nim +++ b/codex/storageproofs/timing/proofs.nim @@ -18,14 +18,6 @@ method periodicity*(proofs: Proofs): Future[Periodicity] {.base, async.} = raiseAssert("not implemented") -method isSlotCancelled*(proofs: Proofs, - id: SlotId): Future[bool] {.base, async.} = - raiseAssert("not implemented") - -method isCancelled*(proofs: Proofs, - id: RequestId): Future[bool] {.base, async.} = - raiseAssert("not implemented") - method isProofRequired*(proofs: Proofs, id: SlotId): Future[bool] {.base, async.} = raiseAssert("not implemented") diff --git a/tests/codex/helpers/mockproofs.nim b/tests/codex/helpers/mockproofs.nim index 13966f79..25bfc6ee 100644 --- a/tests/codex/helpers/mockproofs.nim +++ b/tests/codex/helpers/mockproofs.nim @@ -7,7 +7,6 @@ import pkg/codex/storageproofs type MockProofs* = ref object of Proofs periodicity: Periodicity - cancelledSlots: HashSet[SlotId] proofsRequired: HashSet[SlotId] proofsToBeRequired: HashSet[SlotId] proofEnds: Table[SlotId, UInt256] @@ -33,16 +32,6 @@ proc setProofRequired*(mock: MockProofs, id: SlotId, required: bool) = else: mock.proofsRequired.excl(id) -proc setSlotCancelled*(mock: MockProofs, id: SlotId, required: bool) = - if required: - mock.cancelledSlots.incl(id) - else: - mock.cancelledSlots.excl(id) - -method isSlotCancelled*(mock: MockProofs, - id: SlotId): Future[bool] {.async.} = - return mock.cancelledSlots.contains(id) - method isProofRequired*(mock: MockProofs, id: SlotId): Future[bool] {.async.} = return mock.proofsRequired.contains(id) diff --git a/tests/codex/testproving.nim b/tests/codex/testproving.nim index 6ecd3dfe..cea76107 100644 --- a/tests/codex/testproving.nim +++ b/tests/codex/testproving.nim @@ -90,19 +90,6 @@ suite "Proving": proving.onProofRequired = onProofRequired proofs.setProofRequired(id, true) await proofs.advanceToNextPeriod() - check not called - - test "stops watching when contract is cancelled": - let id = SlotId.example - proving.add(id) - var called: bool - proc onProofRequired(id: SlotId) = - called = true - proofs.setProofRequired(id, true) - await proofs.advanceToNextPeriod() - proving.onProofRequired = onProofRequired - proofs.setSlotCancelled(id, true) - await proofs.advanceToNextPeriod() check not proving.slots.contains(id) check not called diff --git a/tests/contracts/testContracts.nim b/tests/contracts/testContracts.nim index 676a12b2..83681c45 100644 --- a/tests/contracts/testContracts.nim +++ b/tests/contracts/testContracts.nim @@ -76,20 +76,10 @@ ethersuite "Storage contracts": await provider.advanceTimeTo(await storage.proofEnd(slotId)) await storage.payoutSlot(request.id, 0.u256) - test "a request is cancelled after expiry": - check not await storage.isCancelled(request.id) - await provider.advanceTimeTo(request.expiry + 1) - check await storage.isCancelled(request.id) - - test "a slot is cancelled after expiry": - check not await storage.isSlotCancelled(slotId) - await provider.advanceTimeTo(request.expiry + 1) - check await storage.isSlotCancelled(slotId) - test "cannot mark proofs missing for cancelled request": await provider.advanceTimeTo(request.expiry + 1) switchAccount(client) let missingPeriod = periodicity.periodOf(await provider.currentTime()) await provider.advanceTime(periodicity.seconds) - revertsWith "Request was cancelled": + revertsWith "Slot not accepting proofs": await storage.markProofAsMissing(slotId, missingPeriod) diff --git a/vendor/dagger-contracts b/vendor/dagger-contracts index 06bbfdb3..06e58fdc 160000 --- a/vendor/dagger-contracts +++ b/vendor/dagger-contracts @@ -1 +1 @@ -Subproject commit 06bbfdb3a64428d1f5367f8cb6488ec093eddff5 +Subproject commit 06e58fdc4923999cb93e54b55a5e68da26435628