-
Notifications
You must be signed in to change notification settings - Fork 137
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
base: main
Are you sure you want to change the base?
Conversation
0a5e9ab to
6bdb36a
Compare
Pull Request Test Coverage Report for Build 20061561733Details
💛 - Coveralls |
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
|
@GeorgeTsagk: review reminder |
e8e57ec to
a36f4bc
Compare
a2daeee to
966f761
Compare
| // public is a flag indicating that the error can be forwarded to peers. | ||
| bool public = 2; | ||
|
|
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 don’t think the price oracle should decide whether a tapd node forwards an error to its peer. That decision belongs entirely to tapd in my view. So IMO the price oracle shouldn’t signal whether an error is “public” or not.
We want to be able to query price oracle services operated by third parties.
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.
Hmm. This one might be a little tricky; I agree that the price oracle shouldn't be able to determine what gets relayed, but I feel it's beneficial for it to be able to mark an error as being public/benign/etc., even if that's only the oracle's opinion on that. One is trusting the oracle's opinion on prices already anyway.
I would be inclined to start with "trust the oracle," but maybe a satisfying solution would be to be able to set a config option to run tapd in "private mode," in which tapd only forwards opaque rejection errors? I.e., even if an oracle has indicated that something should be considered public?
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.
966f761 to
4fb7621
Compare
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.
Adds a 'customRejectErr' function that handles errors resulting from a price oracle query, producing a quote reject message. The changes in the next commit will augment this function to disambiguate between public/private errors.
Adds a flag (defaulting to false) that indicates that the error returned by a price oracle should be considered public, and can be safely forwarded to peers. Updates proto definitions accordingly.
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.)