feat: add decentralized invoice rating oracle (#877) - #909
Merged
Kingsman-99 merged 2 commits intoSep 30, 2026
Merged
Kingsman-99 merged 2 commits into
Kingsman-99 merged 2 commits into
Conversation
Add rating_oracle_ext.rs implementing two parallel rating channels: 1. Payer ratings (1-5 stars; aggregated sum+count per invoice) 2. Oracle node ratings (admin-registered nodes push external scores) Entry points: - register_rating_oracle / remove_rating_oracle / is_rating_oracle (admin) - rate_invoice(payer, invoice_id, score, comment) - payers only, once each - push_oracle_rating(oracle, invoice_id, score) - oracle nodes; overwrites - get_invoice_rating(invoice_id) -> InvoiceRatingSummary - get_oracle_rating(invoice_id) -> Option<u32> Events: ora_add, ora_rem, inv_rat, ora_rat Storage: local RatingOracleKey enum (persistent + instance) Tests: 9 unit tests covering all paths and guard conditions Closes Stellar-split#877
|
@jacobjacobb4242 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #877 — Add decentralized invoice rating oracle
Adds a new
rating_oracle_ext.rsmodule implementing a two-channeldecentralized rating system: payer-submitted ratings and admin-registered
oracle node ratings.
Core functionality
Oracle node management (admin only):
register_rating_oracle(admin, oracle)— add an oracle node.remove_rating_oracle(admin, oracle)— remove an oracle node.is_rating_oracle(oracle)— membership check.Payer ratings:
rate_invoice(payer, invoice_id, score, comment)Oracle ratings:
push_oracle_rating(oracle, invoice_id, score)— oracle node pushes a score (1–5). Latest push overwrites; useful for live credit-score feeds.Read-only:
get_invoice_rating(invoice_id)→InvoiceRatingSummary { score_sum, count, raters }get_oracle_rating(invoice_id)→Option<u32>Events
(split, ora_add)oracle(split, ora_rem)oracle(split, inv_rat, invoice_id)(payer, score, comment)(split, ora_rat, invoice_id)(oracle, score)Storage
Local
RatingOracleKeyenum:RatingSummary(invoice_id)— aggregate struct in persistent storage.OracleScore(invoice_id)— latest oracle score in persistent storage.OracleNodes— registered oracle node list in instance storage.New type
InvoiceRatingSummary { score_sum: u64, count: u32, raters: Vec<Address> }Tests
9 unit tests:
Files changed
contracts/split/src/rating_oracle_ext.rscontracts/split/src/lib.rsmod rating_oracle_ext;Closes #877