-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: expose underlying nim-ethers errors to logs #985
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,7 +277,11 @@ | |
method subscribeRequests*(market: OnChainMarket, | ||
callback: OnRequest): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: StorageRequested) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!StorageRequested) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in Request subscription", msg = eventErr.msg | ||
return | ||
Comment on lines
+281
to
+283
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment for most of these event subscriptions in the Market abstraction -- they are critical to node functionality, so should we log and continue or are they severe enough that we cannot assume normal node operation afterwards (thus warranting a Defect)? |
||
|
||
callback(event.requestId, | ||
event.ask, | ||
event.expiry) | ||
|
@@ -289,7 +293,11 @@ | |
method subscribeSlotFilled*(market: OnChainMarket, | ||
callback: OnSlotFilled): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: SlotFilled) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!SlotFilled) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in SlotFilled subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.requestId, event.slotIndex) | ||
|
||
convertEthersError: | ||
|
@@ -311,7 +319,11 @@ | |
method subscribeSlotFreed*(market: OnChainMarket, | ||
callback: OnSlotFreed): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: SlotFreed) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!SlotFreed) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in SlotFreed subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.requestId, event.slotIndex) | ||
|
||
convertEthersError: | ||
|
@@ -322,7 +334,11 @@ | |
market: OnChainMarket, | ||
callback: OnSlotReservationsFull): Future[MarketSubscription] {.async.} = | ||
|
||
proc onEvent(event: SlotReservationsFull) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!SlotReservationsFull) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in SlotReservationsFull subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.requestId, event.slotIndex) | ||
|
||
convertEthersError: | ||
|
@@ -332,7 +348,11 @@ | |
method subscribeFulfillment(market: OnChainMarket, | ||
callback: OnFulfillment): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: RequestFulfilled) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!RequestFulfilled) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in RequestFulfillment subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.requestId) | ||
|
||
convertEthersError: | ||
|
@@ -343,7 +363,11 @@ | |
requestId: RequestId, | ||
callback: OnFulfillment): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: RequestFulfilled) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!RequestFulfilled) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in RequestFulfillment subscription", msg = eventErr.msg | ||
return | ||
|
||
if event.requestId == requestId: | ||
callback(event.requestId) | ||
|
||
|
@@ -354,7 +378,11 @@ | |
method subscribeRequestCancelled*(market: OnChainMarket, | ||
callback: OnRequestCancelled): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: RequestCancelled) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!RequestCancelled) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in RequestCancelled subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.requestId) | ||
|
||
convertEthersError: | ||
|
@@ -365,7 +393,11 @@ | |
requestId: RequestId, | ||
callback: OnRequestCancelled): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: RequestCancelled) {.upraises:[].} = | ||
proc onEvent(eventResult: ?!RequestCancelled) {.upraises:[].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in RequestCancelled subscription", msg = eventErr.msg | ||
return | ||
|
||
if event.requestId == requestId: | ||
callback(event.requestId) | ||
|
||
|
@@ -376,7 +408,11 @@ | |
method subscribeRequestFailed*(market: OnChainMarket, | ||
callback: OnRequestFailed): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: RequestFailed) {.upraises:[]} = | ||
proc onEvent(eventResult: ?!RequestFailed) {.upraises:[]} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in RequestFailed subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.requestId) | ||
|
||
convertEthersError: | ||
|
@@ -387,7 +423,11 @@ | |
requestId: RequestId, | ||
callback: OnRequestFailed): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: RequestFailed) {.upraises:[]} = | ||
proc onEvent(eventResult: ?!RequestFailed) {.upraises:[]} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in RequestFailed subscription", msg = eventErr.msg | ||
return | ||
|
||
if event.requestId == requestId: | ||
callback(event.requestId) | ||
|
||
|
@@ -398,7 +438,11 @@ | |
method subscribeProofSubmission*(market: OnChainMarket, | ||
callback: OnProofSubmitted): | ||
Future[MarketSubscription] {.async.} = | ||
proc onEvent(event: ProofSubmitted) {.upraises: [].} = | ||
proc onEvent(eventResult: ?!ProofSubmitted) {.upraises: [].} = | ||
without event =? eventResult, eventErr: | ||
error "There was an error in ProofSubmitted subscription", msg = eventErr.msg | ||
return | ||
|
||
callback(event.id) | ||
|
||
convertEthersError: | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,8 +33,9 @@ marketplacesuite "Bug #821 - node crashes during erasure coding": | |||||||||||
let cid = clientApi.upload(data).get | ||||||||||||
|
||||||||||||
var requestId = none RequestId | ||||||||||||
proc onStorageRequested(event: StorageRequested) {.raises:[].} = | ||||||||||||
requestId = event.requestId.some | ||||||||||||
proc onStorageRequested(eventRes: ?!StorageRequested)= | ||||||||||||
if event =? eventRes: | ||||||||||||
requestId = event.requestId.some | ||||||||||||
Comment on lines
+36
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wdyt about raising a Defect (and fail the test) if there's an error in the callback?
Suggested change
|
||||||||||||
|
||||||||||||
let subscription = await marketplace.subscribe(StorageRequested, onStorageRequested) | ||||||||||||
|
||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -135,8 +135,9 @@ marketplacesuite "Marketplace payouts": | |||||||||||
let cid = clientApi.upload(data).get | ||||||||||||
|
||||||||||||
var slotIdxFilled = none UInt256 | ||||||||||||
proc onSlotFilled(event: SlotFilled) = | ||||||||||||
slotIdxFilled = some event.slotIndex | ||||||||||||
proc onSlotFilled(eventRes: ?!SlotFilled) = | ||||||||||||
if event =? eventRes: | ||||||||||||
slotIdxFilled = some event.slotIndex | ||||||||||||
Comment on lines
+138
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here...
Suggested change
|
||||||||||||
|
||||||||||||
let subscription = await marketplace.subscribe(SlotFilled, onSlotFilled) | ||||||||||||
|
||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of me thinks if the clock fails to update due to fetching a block error, then we should raise a Defect, because a correct clock is critical for proper node function. However, we don't know if it's a temporary error or not.
We could add an error count and trigger a Defect after a few errors, but that sounds potentially like an over-optimisation without data yet. Maybe for now we should add a metric and monitor it? Wdyt?