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 20850480246

Details

  • 16 of 67 (23.88%) changed or added relevant lines in 4 files are covered.
  • 77 unchanged lines in 18 files lost coverage.
  • Overall coverage decreased (-0.02%) to 56.974%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfqmsg/reject.go 3 9 33.33%
rfq/negotiator.go 12 23 52.17%
rfq/oracle.go 0 12 0.0%
taprpc/priceoraclerpc/price_oracle.pb.go 1 23 4.35%
Files with Coverage Reduction New Missed Lines %
asset/group_key.go 2 72.15%
fn/iter.go 2 62.07%
mssmt/compacted_tree.go 2 77.65%
rfq/negotiator.go 2 55.73%
tapdb/addrs.go 2 76.56%
tapdb/mssmt.go 2 90.45%
tapdb/multiverse.go 2 82.14%
tapdb/sqlc/transfers.sql.go 2 83.33%
commitment/tap.go 3 85.19%
proof/verifier.go 3 85.57%
Totals Coverage Status
Change from base Build 20833518484: -0.02%
Covered Lines: 65556
Relevant Lines: 115063

💛 - 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

// The rejection message will state that the oracle doesn't
// support the asset.
case ErrUnsupportedOracleAsset:
Copy link
Member

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?

Copy link
Member

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

Copy link
Member Author

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

Copy link
Member Author

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.

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
@jtobin jtobin force-pushed the oracle-error-codes branch 2 times, most recently from a36f4bc to a2daeee Compare December 3, 2025 11:49
@jtobin jtobin force-pushed the oracle-error-codes branch from a2daeee to 966f761 Compare December 3, 2025 12:16
@jtobin jtobin force-pushed the oracle-error-codes branch from 966f761 to 4fb7621 Compare December 9, 2025 11:16
@jtobin jtobin force-pushed the oracle-error-codes branch from 4fb7621 to 7c01663 Compare December 17, 2025 10:45
@jtobin jtobin requested a review from ffranr December 17, 2025 11:44
@jtobin jtobin force-pushed the oracle-error-codes branch from 7c01663 to 6d6ecdf Compare December 17, 2025 11:48
@lightninglabs-deploy
Copy link

@GeorgeTsagk: review reminder

jtobin added 3 commits January 9, 2026 15:26
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.
@jtobin jtobin force-pushed the oracle-error-codes branch from 6d6ecdf to 4d1f6ef Compare January 9, 2026 11:28
jtobin added 2 commits January 9, 2026 15:29
Adds a 'customRejectErr' function that handles errors resulting from
a price oracle query, producing a quote reject message.
Copy link
Member

@GeorgeTsagk GeorgeTsagk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GeorgeTsagk GeorgeTsagk added this pull request to the merge queue Jan 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 9, 2026
@jtobin jtobin added this pull request to the merge queue Jan 9, 2026
Merged via the queue into lightninglabs:main with commit af52ea3 Jan 9, 2026
27 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Taproot-Assets Project Board Jan 9, 2026
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: ✅ Done

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