Repository navigation
Feat: invoice prioritization, creator fee tiers, invoice metadata & confidential payment tracking (#918, #919, #920, #921) - #984
Open
kossyomma-beep wants to merge 4 commits into
Conversation
- Add PriorityTier (Low/Normal/High/Critical) derived from a 0-1000 score - Add InvoicePriority record with per-invoice storage - Keep per-tier queues sorted by score desc, then invoice id asc - Validate score range, invoice status and caller authorization (Critical tier restricted to admins) - Add sort_invoices_by_priority, get_next_priority_invoice, get_priority_queue, prune_priority_queue and tier weight lookup - Emit pri_set / pri_clr events
- Add CreatorFeeTier table with versioned CreatorFeeTierConfig - Validate tiers: zero-based start, ascending volume thresholds, non-increasing fee rates, bounded tier count and max fee - Binary-search tier lookup on lifetime creator volume - Add calc_creator_fee quote (gross, fee, net) at the tier rate - Track creator tier changes via sync_creator_fee_tier - Allow single-tier rate updates and clearing the table - Emit cfee_cfg / cfee_chg events
- Add MetadataEntry with per-key versioning, author and timestamp - Store each entry under its own key with an insertion-ordered index - Validate key charset/length, value size and per-invoice entry limit - Restrict writes to creator/co-creators on non-cancelled invoices - Add single and batch set, remove, clear and permanent lock - Add get, get entry, has, list keys and get-all access methods - Emit meta_set / meta_del / meta_lck events
- Add ConfidentialRecord storing only a Pedersen commitment over BLS12-381 G1, never the plaintext amount - Verify a Fiat-Shamir proof of knowledge of the commitment opening, bound to invoice id and payer to prevent replay - Maintain a homomorphic aggregate commitment so the creator can prove the invoice total without revealing individual amounts - Store encrypted amounts as bounded opaque ciphertext with a SHA-256 integrity digest - Add a per-invoice hash-chained audit trail with chain verification - Add record/opening re-verification, summary, payer list and paged audit trail queries - Emit ctrk_rec / ctrk_ver events without amount data
|
@kossyomma-beep 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.
Summary
Adds four new contract features, each in its own module under
contracts/split/src/with a separate#[contractimpl]block. Changes tolib.rsarelimited to module registration, and new events are added to
events.rs.#918 — Invoice prioritization (
priority.rs)PriorityTier(Low / Normal / High / Critical) derived from a 0–1000 score, with resource-allocation weights (1/2/4/8)InvoicePriorityrecord per invoice; per-tier queues kept sorted by score (desc), then invoice id (asc)set_invoice_priority,clear_invoice_priority,get_invoice_priority,sort_invoices_by_priority,get_next_priority_invoice,get_priority_queue,prune_priority_queue, tier lookup/weight helpers#919 — Fee tier system for creators (
creator_fee_tiers.rs)CreatorFeeTierConfigof up to 10CreatorFeeTiers (zero-based start, ascending thresholds, non-increasing fees, 10% cap)calc_creator_feereturns gross / fee / net at the tier rate; falls back to the platform fee when no tiers are configuredsync_creator_fee_tier(emits an event on tier change); single-tier rate updates and clearing#920 — Invoice metadata storage (
invoice_metadata.rs)MetadataEntrykey-value store per invoice with per-key versioning, author and timestamp[a-z0-9_.-], values ≤ 256 bytes, ≤ 20 entries per invoice; creator/co-creator writes only#921 — Confidential payment tracking (
confidential_tracking.rs)Events
pri_set,pri_clr,cfee_cfg,cfee_chg,meta_set,meta_del,meta_lck,ctrk_rec,ctrk_verTests
Unit tests are included in each new module (tier boundaries, sorting, tier lookup and validation, metadata validation, ZK proof verification and tamper
detection, homomorphic aggregation, audit chain integrity).
Notes
can be wired in later.
Closes #918
Closes #919
Closes #920
Closes #921