mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-11 21:44:40 +00:00
Fix proving with latest ethers bump (tested on master)
This commit is contained in:
parent
9e421e4a81
commit
6ba03b7a14
@ -1,6 +1,7 @@
|
|||||||
import std/options
|
import std/options
|
||||||
import pkg/chronicles
|
import pkg/chronicles
|
||||||
import ../../clock
|
import ../../clock
|
||||||
|
import ../../utils/exceptions
|
||||||
import ../statemachine
|
import ../statemachine
|
||||||
import ../salesagent
|
import ../salesagent
|
||||||
import ../salescontext
|
import ../salescontext
|
||||||
@ -29,8 +30,10 @@ method prove*(
|
|||||||
let proof = await onProve(slot)
|
let proof = await onProve(slot)
|
||||||
debug "Submitting proof", currentPeriod = currentPeriod, slotId = $slot.id
|
debug "Submitting proof", currentPeriod = currentPeriod, slotId = $slot.id
|
||||||
await market.submitProof(slot.id, proof)
|
await market.submitProof(slot.id, proof)
|
||||||
|
except CancelledError:
|
||||||
|
discard
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
error "Submitting proof failed", msg = e.msg
|
error "Submitting proof failed", msg = e.msgDetail
|
||||||
|
|
||||||
proc proveLoop(
|
proc proveLoop(
|
||||||
state: SaleProving,
|
state: SaleProving,
|
||||||
@ -84,7 +87,7 @@ method onCancelled*(state: SaleProving, request: StorageRequest): ?State =
|
|||||||
try:
|
try:
|
||||||
waitFor state.loop.cancelAndWait()
|
waitFor state.loop.cancelAndWait()
|
||||||
except CatchableError as e:
|
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
|
state.loop = nil
|
||||||
|
|
||||||
@ -96,7 +99,7 @@ method onFailed*(state: SaleProving, request: StorageRequest): ?State =
|
|||||||
try:
|
try:
|
||||||
waitFor state.loop.cancelAndWait()
|
waitFor state.loop.cancelAndWait()
|
||||||
except CatchableError as e:
|
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
|
state.loop = nil
|
||||||
|
|
||||||
@ -140,7 +143,7 @@ method run*(state: SaleProving, machine: Machine): Future[?State] {.async.} =
|
|||||||
try:
|
try:
|
||||||
await state.loop.cancelAndWait()
|
await state.loop.cancelAndWait()
|
||||||
except CatchableError as e:
|
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
|
state.loop = nil
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ when codex_enable_proof_failures:
|
|||||||
|
|
||||||
import ../../contracts/requests
|
import ../../contracts/requests
|
||||||
import ../../market
|
import ../../market
|
||||||
|
import ../../utils/exceptions
|
||||||
import ../salescontext
|
import ../salescontext
|
||||||
import ./proving
|
import ./proving
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ when codex_enable_proof_failures:
|
|||||||
proofCount: int
|
proofCount: int
|
||||||
|
|
||||||
proc onSubmitProofError(error: ref CatchableError, period: UInt256, slotId: SlotId) =
|
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.} =
|
method prove*(state: SaleProvingSimulated, slot: Slot, onProve: OnProve, market: Market, currentPeriod: Period) {.async.} =
|
||||||
trace "Processing proving in simulated mode"
|
trace "Processing proving in simulated mode"
|
||||||
@ -32,8 +33,8 @@ when codex_enable_proof_failures:
|
|||||||
try:
|
try:
|
||||||
warn "Submitting INVALID proof", period = currentPeriod, slotId = slot.id
|
warn "Submitting INVALID proof", period = currentPeriod, slotId = slot.id
|
||||||
await market.submitProof(slot.id, newSeq[byte](0))
|
await market.submitProof(slot.id, newSeq[byte](0))
|
||||||
except ProviderError as e:
|
except SignerError as e:
|
||||||
if not e.revertReason.contains("Invalid proof"):
|
if not e.msgDetail.contains("Invalid proof"):
|
||||||
onSubmitProofError(e, currentPeriod, slot.id)
|
onSubmitProofError(e, currentPeriod, slot.id)
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
onSubmitProofError(e, currentPeriod, slot.id)
|
onSubmitProofError(e, currentPeriod, slot.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user