diff --git a/codex/sales/states/proving.nim b/codex/sales/states/proving.nim index 3d73ad06..6af5b011 100644 --- a/codex/sales/states/proving.nim +++ b/codex/sales/states/proving.nim @@ -1,6 +1,7 @@ import std/options import pkg/chronicles import ../../clock +import ../../utils/exceptions import ../statemachine import ../salesagent import ../salescontext @@ -29,8 +30,10 @@ method prove*( let proof = await onProve(slot) debug "Submitting proof", currentPeriod = currentPeriod, slotId = $slot.id await market.submitProof(slot.id, proof) + except CancelledError: + discard except CatchableError as e: - error "Submitting proof failed", msg = e.msg + error "Submitting proof failed", msg = e.msgDetail proc proveLoop( state: SaleProving, @@ -84,7 +87,7 @@ method onCancelled*(state: SaleProving, request: StorageRequest): ?State = try: waitFor state.loop.cancelAndWait() except CatchableError as e: - error "Error during cancelation of prooving loop", msg = e.msg + error "Error during cancellation of proving loop", msg = e.msg state.loop = nil @@ -96,7 +99,7 @@ method onFailed*(state: SaleProving, request: StorageRequest): ?State = try: waitFor state.loop.cancelAndWait() except CatchableError as e: - error "Error during cancelation of prooving loop", msg = e.msg + error "Error during cancellation of proving loop", msg = e.msg state.loop = nil @@ -136,12 +139,12 @@ method run*(state: SaleProving, machine: Machine): Future[?State] {.async.} = debug "Stopping proving.", requestId = $data.requestId, slotIndex if not state.loop.isNil: - if not state.loop.finished: - try: - await state.loop.cancelAndWait() - except CatchableError as e: - error "Error during cancelation of prooving loop", msg = e.msg + if not state.loop.finished: + try: + await state.loop.cancelAndWait() + except CatchableError as e: + error "Error during cancellation of proving loop", msg = e.msg - state.loop = nil + state.loop = nil return some State(SalePayout()) diff --git a/codex/sales/states/provingsimulated.nim b/codex/sales/states/provingsimulated.nim index 4ed9bba1..501987b5 100644 --- a/codex/sales/states/provingsimulated.nim +++ b/codex/sales/states/provingsimulated.nim @@ -8,6 +8,7 @@ when codex_enable_proof_failures: import ../../contracts/requests import ../../market + import ../../utils/exceptions import ../salescontext import ./proving @@ -20,7 +21,7 @@ when codex_enable_proof_failures: proofCount: int proc onSubmitProofError(error: ref CatchableError, period: UInt256, slotId: SlotId) = - error "Submitting invalid proof failed", period = period, slotId = $slotId, msg = error.msg + error "Submitting invalid proof failed", period = period, slotId = $slotId, msg = error.msgDetail method prove*(state: SaleProvingSimulated, slot: Slot, onProve: OnProve, market: Market, currentPeriod: Period) {.async.} = trace "Processing proving in simulated mode" @@ -32,8 +33,8 @@ when codex_enable_proof_failures: try: warn "Submitting INVALID proof", period = currentPeriod, slotId = slot.id await market.submitProof(slot.id, newSeq[byte](0)) - except ProviderError as e: - if not e.revertReason.contains("Invalid proof"): + except SignerError as e: + if not e.msgDetail.contains("Invalid proof"): onSubmitProofError(e, currentPeriod, slot.id) except CatchableError as e: onSubmitProofError(e, currentPeriod, slot.id)