Skip to content

Conversation

@jtobin
Copy link
Member

@jtobin jtobin commented Aug 25, 2025

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.)

@jtobin jtobin requested review from GeorgeTsagk and ffranr August 25, 2025 11:28
@jtobin jtobin added error handling RFQ Work relating to TAP channel Request For Quote (RFQ). labels Aug 25, 2025
@jtobin jtobin force-pushed the oracle-error-codes branch from 0a5e9ab to 6bdb36a Compare August 25, 2025 11:35
@coveralls
Copy link

coveralls commented Aug 25, 2025

Pull Request Test Coverage Report for Build 20061561733

Details

  • 4 of 77 (5.19%) changed or added relevant lines in 4 files are covered.
  • 51 unchanged lines in 16 files lost coverage.
  • Overall coverage decreased (-0.03%) to 56.727%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfqmsg/reject.go 3 9 33.33%
rfq/oracle.go 0 14 0.0%
rfq/negotiator.go 0 26 0.0%
taprpc/priceoraclerpc/price_oracle.pb.go 1 28 3.57%
Files with Coverage Reduction New Missed Lines %
commitment/tap.go 1 85.65%
rfq/negotiator.go 2 56.27%
tapdb/mssmt.go 2 90.45%
tapdb/universe.go 2 80.58%
universe/archive.go 2 81.28%
universe_rpc_diff.go 2 76.0%
universe/syncer.go 2 85.93%
itest/multisig.go 3 97.94%
tapdb/assets_store.go 3 79.16%
tapgarden/planter.go 3 80.26%
Totals Coverage Status
Change from base Build 20053123061: -0.03%
Covered Lines: 65354
Relevant Lines: 115208

💛 - Coveralls

@jtobin jtobin requested a review from ffranr August 28, 2025 15:47
@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Sep 4, 2025
@levmi levmi moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board Sep 11, 2025
Copy link
Contributor

@ffranr ffranr left a 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.

@levmi levmi added this to the v0.8 milestone Sep 25, 2025
@jtobin jtobin force-pushed the oracle-error-codes branch from 5eaf8a9 to a164c40 Compare October 16, 2025 01:44
@jtobin jtobin changed the base branch from main to 0-8-0-staging October 16, 2025 01:44
@jtobin jtobin requested review from GeorgeTsagk and ffranr October 21, 2025 18:49
@jtobin jtobin force-pushed the oracle-error-codes branch from a164c40 to e78d038 Compare October 21, 2025 19:02
@jtobin jtobin changed the base branch from 0-8-0-staging to main November 24, 2025 15:28
@jtobin jtobin force-pushed the oracle-error-codes branch from e78d038 to e8e57ec Compare November 24, 2025 15:30
@lightninglabs-deploy
Copy link

@GeorgeTsagk: review reminder
@ffranr: review reminder

@jtobin jtobin force-pushed the oracle-error-codes branch 2 times, most recently from a2daeee to 966f761 Compare December 3, 2025 12:16
Comment on lines +241 to +243
// public is a flag indicating that the error can be forwarded to peers.
bool public = 2;

Copy link
Contributor

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.

Copy link
Member Author

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.
@jtobin jtobin force-pushed the oracle-error-codes branch from 966f761 to 4fb7621 Compare December 9, 2025 11:16
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error handling RFQ Work relating to TAP channel Request For Quote (RFQ).

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

[feature]: structured error codes for price oracles [bug]: clearer error with price oracle that does not support the asset requested

6 participants