-
Notifications
You must be signed in to change notification settings - Fork 140
rfq+rfqmsg: add structured price oracle error codes #1766
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
Conversation
0a5e9ab to
6bdb36a
Compare
Pull Request Test Coverage Report for Build 20850480246Details
💛 - Coveralls |
rfq/negotiator.go
Outdated
|
|
||
| // The rejection message will state that the oracle doesn't | ||
| // support the asset. | ||
| case ErrUnsupportedOracleAsset: |
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.
in the future would we append to this switch all the cases for codes that are considered public?
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.
If I read the iota list of all error codes I don't really have some information source as to whether they are public or internal error codes.
We could follow a convention that all non-zero codes are public (with appropriate docs in the definitions ofcs)
Or further extend the oracle error with a direct Internal bool flag, that explicitly indicates whether this code/msg should be shared or not
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.
Yeah I like that latter idea -- let the oracle indicate whether the error is intended to be public/private. 👍
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.
Coming back to this: I decided to axe the 'public' flag for this changeset, so customRejectErr is again the arbiter of whether we forward opaque or more detailed error messages, based on the code value. I do like the 'public' idea, in the meantime, as a kind of hint from the oracle as to whether an error is appropriate to relay, so maybe I can make another argument for it in the future.
I think there's no immediate need to codify a hard public/private scheme at the moment. We may want other nonzero codes to be considered private, for example. I'd be inclined to pick that issue up again when it's time to add/handle more codes.
ffranr
left a comment
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.
I've taken another look through this.
IMO needs commit squash and then we can review the set of commits which will be merged.
5eaf8a9 to
a164c40
Compare
965998d to
83a4116
Compare
a164c40 to
e78d038
Compare
2b3ac4f to
035a840
Compare
e78d038 to
e8e57ec
Compare
a36f4bc to
a2daeee
Compare
a2daeee to
966f761
Compare
966f761 to
4fb7621
Compare
4fb7621 to
7c01663
Compare
7c01663 to
6d6ecdf
Compare
|
@GeorgeTsagk: review reminder |
Adds the 'RejectCode' type, as well as the 'PriceOracleUnspecifiedRejectCode' and 'PriceOracleUnavailableRejectCode' consts to represent the two protocol-defined rejection error codes of 0 and 1, respectively. The 'NewRejectErr' utility produces a RejectErr with the UnspecifiedRejectCode code, but pairs it with a custom error message.
Defines an OracleErrorCode type representing error codes returned by a price oracle, and updates proto definitions accordingly.
Marshalls oracle error codes received over-the-wire into OracleErrorCode values, which are returned in oracle error responses.
6d6ecdf to
4d1f6ef
Compare
Adds a 'customRejectErr' function that handles errors resulting from a price oracle query, producing a quote reject message.
GeorgeTsagk
left a comment
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.
LGTM
Adds some structure to price oracle error codes, along with some custom handling for them. In particular, a code of '1' now corresponds to an 'unsupported asset' error, which, considered a 'public' error, is forwarded in the customizable message field of the reject messages sent to peers. An error with any other code continues, at present, to be treated as an unspecified error.
Resolves #1749, #1326.
(This is a refinement over the closed #1751, which forwarded errors indiscriminately.)