mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-02 13:33:10 +00:00
chore: fix custom error handling when simulating invalid proofs (#1217)
* Fix custom error handling when simulating invalid proofs * Update error message
This commit is contained in:
parent
45ade0e3c1
commit
2e1306ac2d
@ -366,7 +366,12 @@ method submitProof*(
|
|||||||
market: OnChainMarket, id: SlotId, proof: Groth16Proof
|
market: OnChainMarket, id: SlotId, proof: Groth16Proof
|
||||||
) {.async: (raises: [CancelledError, MarketError]).} =
|
) {.async: (raises: [CancelledError, MarketError]).} =
|
||||||
convertEthersError("Failed to submit proof"):
|
convertEthersError("Failed to submit proof"):
|
||||||
|
try:
|
||||||
discard await market.contract.submitProof(id, proof).confirm(1)
|
discard await market.contract.submitProof(id, proof).confirm(1)
|
||||||
|
except Proofs_InvalidProof as parent:
|
||||||
|
raise newException(
|
||||||
|
ProofInvalidError, "Failed to submit proof because the proof is invalid", parent
|
||||||
|
)
|
||||||
|
|
||||||
method markProofAsMissing*(
|
method markProofAsMissing*(
|
||||||
market: OnChainMarket, id: SlotId, period: Period
|
market: OnChainMarket, id: SlotId, period: Period
|
||||||
|
|||||||
@ -20,6 +20,7 @@ type
|
|||||||
MarketError* = object of CodexError
|
MarketError* = object of CodexError
|
||||||
SlotStateMismatchError* = object of MarketError
|
SlotStateMismatchError* = object of MarketError
|
||||||
SlotReservationNotAllowedError* = object of MarketError
|
SlotReservationNotAllowedError* = object of MarketError
|
||||||
|
ProofInvalidError* = object of MarketError
|
||||||
Subscription* = ref object of RootObj
|
Subscription* = ref object of RootObj
|
||||||
OnRequest* =
|
OnRequest* =
|
||||||
proc(id: RequestId, ask: StorageAsk, expiry: uint64) {.gcsafe, upraises: [].}
|
proc(id: RequestId, ask: StorageAsk, expiry: uint64) {.gcsafe, upraises: [].}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ 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, Groth16Proof.default)
|
await market.submitProof(slot.id, Groth16Proof.default)
|
||||||
except Proofs_InvalidProof as e:
|
except ProofInvalidError as e:
|
||||||
discard # expected
|
discard # expected
|
||||||
except CancelledError as error:
|
except CancelledError as error:
|
||||||
raise error
|
raise error
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user