Closed manoranjith closed 3 years ago
Collecting info on information that needs to be added to error messages:
could not execute transaction: context deadline exceeded
@anagha-ks, among the listed scenarios, I have reacted +1 to the ones that I also think need to be added. I have questions regarding points 7 and 8. As far as I understand the current design of subscriptions, there seems to be no subscription ID as such. The client has to subscribe and that context to receive the notifications. In case of the current reference implementation (gRPC in golang), the messages are received by running a thread in background that calls a function which blocks until a new notification is received. If the client has unsubscribed, it is upto the client to close this thread.
So I am not sure, if we can return the possible subscriptions or subscription ID ?
I have tried to categorize the errors into 5 groups based on what impact they could have and how they should be handled. Errors returned by each API will fall into one of these categories.
Category | Explanation | Handling |
---|---|---|
Participant | Caused by one of the channel participants not acting as per protocol | Agree with peer outside of the system |
Client | Caused by the request from client. Could be error in arguments or the configuration provided by the client to access external systems. | Use valid arguments, provide correct configuration to access external systems or fix the external systems; and retry. |
Protocol Fatal | Protocol aborted due to unexpected failure in external system. Could result in loss of funds. | Requires manual inspection of the error |
Internal | Caused due to an error in the node. | Requires manual inspection of the error |
Below tables contains the different errors in each category. Additional info is fields in the error response that will contain data required for handling the error as key value pairs. The keys are predefined for each error. In case, the program is allowed to define additional custom keys, it is indicated by adding [additional-allowed].
Category | Code | Error | Additional Info |
---|---|---|---|
Participant | 101 | Peer Response Timedout | Peer alias, response timeout |
Participant | 102 | Rejected by peer | Peer alias, reason |
Participant | 103 | Peer did not fund the channel in time | Peer alias, Funding timeout |
Participant | 104 | User response timeout expired | Expiry Unix Time |
Client | 201 | Resource not found | Resource type, value |
Client | 202 | Resource already exists | Resource type, value |
Client | 203 | Invalid arguments | Argument name, value, reason |
Client | 204 | Failed Pre-condition | Reason, [additional-allowed] |
Client | 205 | Invalid configuration | Configuration name, value, required condition |
Client | 206 | Blockchain node not reachable | Address, Timeout |
Client | 207 | Invalid contracts | Contract Type, Contract Address |
Protocol Fatal | 301 | Protocol aborted due to tx timeout | Tx type, Tx ID, Tx Timeout |
Protocol Fatal | 302 | Protocol aborted as blockchain node disconnected | Tx type, Tx ID, Blockchain Node Addr |
Internal | 401 | Unknown internal error | Nil |
Internal | 402 | Off-chain communication error | Nil |
Requesting feedback on this classification.
Update on 5.5.2021:
Below, I listed the errors returned by each API by classifying them into one of the above categories. The first column Src
contains where the error has to identified and defined as a sentinel error. N -> Node (perun-node) and F -> Framework (go-perun)
Additional info <>
indicates it's i value identifying a particular entity or resource and will be filled in by the software when creating the error.
Node.GetConfig (No error)
Node.OpenSession
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 205 | Invalid session configuration | Config name, config value, Required condition |
N | 206 | Blockchain node not reachable | Address, Timeout |
N | 207 | Invalid contracts found at given address | Contract type, contract address |
Node.Time (No error)
Node.Help (No error)
Session.AddContact
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 202 | Peer ID already present under same alias | Type: PeerAlias, Value: |
N | 203 | Peer Alias used by another peer id | Name: PeerAlias, Value: <>, Reason: Used for another peer id. |
N | 203 | Invalid off-chain address | Name: Offchain Address, Value: <>, Reason: <> |
Session.GetContact
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Peer alias | Type: PeerAlias, Value: |
Session.OpenPaymentChannel
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Peer alias not found in ID provider | Type: PeerAlias, Value: |
N | 203 | Invalid Amount | Name: Amount, Value: <>, Reason: <> |
N | 204 | Invalid Currency | Name: Currency, Value: <>, Reason: Supported currencies are |
F | 101 | Peer did not respond to channel proposal | Peer alias, response timeout |
F | 102 | Peer rejected the channel proposal | Peer alias, reason |
F | 103 | Peer did not fund the channel in time | Peer alias, funding timeout |
F:heavy_check_mark: | 301 | Funding transaction timedout | Tx Type: Funding, Tx ID: <>, Sender Addr: <> |
F | 302 | Insufficient funds for funding tx | Tx Type: Funding, Tx ID: <>, Sender Addr: <> |
F | 303 | Blockchain node disconnected during funding tx | Tx Type: Funding, Tx ID: <>, Blockchain Node Addr <> |
F | 304 | Insufficient balance for user |
Session.GetPaymentChannelsInfo
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
Session.SubscribeToPaymentChannelProposals
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 202 | Subscription already exists | Type: ChProposalSub, Value: |
Session.UnsubsubscribeFromPayChProposals
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | No Active subscription | Type: ChProposalSub, Value: |
Session.RespondToPayChProposal
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Proposal ID | Type: Proposal, Value: |
N | 104 | User response timeout expired | ExpiryUnixTimeStamp: <> |
F | 402 | Response not acknowledged by peer | |
F | 103 | Peer did not fund the channel in time | Peer alias, funding timeout |
F :heavy_check_mark: | 301 | Funding transaction timedout | Tx Type: Funding, Tx ID: <>, Sender Addr: <> |
F | 302 | Insufficient funds for funding tx | Tx Type: Funding, Tx ID: <>, Sender Addr: <> |
F | 303 | Blockchain node disconnected during funding tx | Tx Type: Funding, Tx ID: <>, Blockchain Node Addr <> |
F | 304 | Insufficient balance for user |
Session.Close
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 204 | Failed Pre-condition | Reason: Session has open channels, OpenChannels: |
Channel.SendUpdate
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Channel ID | Type: Channel, Value: |
N | 201 | Peer Alias not a participant in this channel | Type: PeerAlias, Value: |
N | 203 | Invalid Amount | Name: Amount, Value: <>, Reason: <> |
N | 204 | Invalid Currency | Name: Currency, Value: <>, Reason: Supported currencies are |
F | 101 | Peer did not respond to channel update | Peer alias, response timeout |
F | 102 | Peer rejected the channel update | Peer alias, reason |
Channel.SubscribeToPaymentChannelUpdates
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Channel ID | Type: Channel, Value: |
N | 202 | Subscription already exists | Type: ChUpdateSub, Value: |
Channel.UnsubsubscribeFromPayChUpdates
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Channel ID | Type: Channel, Value: |
N | 201 | No Active subscription | Type: ChUpdateSub, Value: |
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Channel ID | Type: Channel, Value: |
N | 201 | Unknown Update ID | Type: Update, Value: |
N | 104 | User response timeout expired | ExpiryUnixTimeStamp: <> |
F | 402 | Response not acknowledged by peer |
Channel.GetPayChInfo
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Channel ID | Type: Channel, Value: |
Channel.Close
Src | Code | Error message | Additional Info |
---|---|---|---|
N | 201 | Unknown Session ID | Type: Session, Value: |
N | 201 | Unknown Channel ID | Type: Channel, Value: |
F | 301 | Finalizing transaction timedout | Tx Type: Register, Tx ID: <>, Sender Addr: <> |
F | 302 | Insufficient funds for finalizing tx | Tx Type: Register, Tx ID: <>, Sender Addr: <> |
F | 303 | Blockchain node disconnected during finalizing tx | Tx Type: Register, Tx ID: <>, Blockchain Node Addr <> |
F | 301 | Withdrawing transaction timedout | Tx Type: Withdraw, Tx ID: <>, Sender Addr: <> |
F | 302 | Insufficient funds for withdrawing tx | Tx Type: Withdraw, Tx ID: <>, Sender Addr: <> |
F | 303 | Blockchain node disconnected during withdrawing tx | Tx Type: Withdraw, Tx ID: <>, Blockchain Node Addr <> |
@choeppler @danielksan81 @anagha-ks As discussed in the weekly call, I have updated the error classification to reflect the following changes, (For previous version, see the older revisions of the comment by clicking on edited
button in the comment header)
external safe
error category into client
error category . Because in both these cases, the source of error is the client request. The error could be in the requests itself (invalid arguments) or in the configuration provided by the client to access the external system. To fix this error which the user has to fix and retry the request. external unsafe
to protocol fatal
error, because the term is more descriptive.Also, to provide a context on the basis for the above classification.
204 Failed Pre-condition
), are additional fields optional allowed. In all other cases, they keys are fixed and it makes parsing on data easier on the client side independent of the programming language.Looking into the code of go-perun
framework, I noticed that some of the sentinel errors have already been defined. I am marking those with a :heavy_check_mark: after the F.
Re-opening the issue as the specification in the proposals repo needs to be updated and documentation needs to added for the API.
Motivation / Context
Among the errors returned by the perun-node,
These errors should be identified and the user of the API should be able to differentiate between different category of errors: Protocol errors, External system errors (that can be fixed by user), Perun-node internal errors etc.,
Description
List of APIs (to track the ones that are completed):
Relates to
Testing
Thread Safety