Feaure privacy range order#97
Conversation
WalkthroughThe pull request restructures how dispute information is handled by introducing a new Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant S as SolverDisputeInfo::new
participant U as User Data
C->>S: Call new(Option<User> initiator, Option<User> counterpart)
alt Initiator not in privacy mode
S->>U: Retrieve initiator data (rating, reviews, created_at)
S->>S: Create UserDisputeInfo for initiator
else Initiator in privacy mode
S->>S: Set initiator_info to None
end
alt Counterpart not in privacy mode
S->>U: Retrieve counterpart data (rating, reviews, created_at)
S->>S: Create UserDisputeInfo for counterpart
else Counterpart in privacy mode
S->>S: Set counterpart_info to None
end
S-->>C: Return SolverDisputeInfo instance
sequenceDiagram
participant C as Client
participant O as Order::is_full_privacy_order
participant B as Buyer Data
participant S as Seller Data
C->>O: Call is_full_privacy_order()
O->>B: Check buyer public key vs master key
O->>S: Check seller public key vs master key
O-->>C: Return (buyer_privacy, seller_privacy)
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/order.rs (1)
343-363: Implementation looks good but documentation could be clearerThe new method
is_full_privacy_ordercorrectly checks if buyers and sellers are using their master public keys directly, which indicates full privacy mode. This aligns well with the PR objective of relocating the full privacy check.However, there's a minor grammatical issue in the documentation comment.
-/// check if a user is creating a full privacy order so he doesn't to have reputation +/// Check if users are operating in full privacy mode (using master public keys directly) +/// Returns a tuple of (buyer_privacy_status, seller_privacy_status)src/dispute.rs (2)
74-80: Remove extra blank line in struct declarationThe new
UserDisputeInfostruct looks good but has an unnecessary blank line between the derive attribute and struct declaration.#[derive(Debug, Default, Deserialize, Serialize, Clone)] - pub struct UserDisputeInfo { pub rating: f64, pub reviews: i64, pub operating_days: u64, }
118-144: Fix typo in variable nameThe implementation correctly handles optional user information and calculates operating days properly. However, there's a typo in the variable name.
if let Some(counterpart) = counterpart { let now = Timestamp::now(); - let couterpart_operating_days = (now.as_u64() - counterpart.created_at as u64) / 86400; + let counterpart_operating_days = (now.as_u64() - counterpart.created_at as u64) / 86400; counterpart_info = Some(UserDisputeInfo { rating: counterpart.total_rating, reviews: counterpart.total_reviews, - operating_days: couterpart_operating_days, + operating_days: counterpart_operating_days, }); counterpart_full_privacy = false; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/dispute.rs(5 hunks)src/order.rs(1 hunks)
🔇 Additional comments (3)
src/dispute.rs (3)
94-97: LGTM - Good encapsulation of privacy-related fieldsThese new fields properly support the full privacy functionality by tracking both privacy status and conditionally including user information. This is more maintainable than individual fields.
115-116: Good change to support optional user informationMaking the user parameters optional aligns with the full privacy functionality, allowing the method to handle cases where user information might not be available.
156-159: LGTM - Proper initialization of new fieldsThe fields are initialized correctly based on the values calculated earlier in the method.
@grunch @Catrya ,
I moved the check for
full privacy ordersinmostro-coreto use it directly as order method and improvedSolverDisputeInfoto have optional fields in case of full privacy orders.Summary by CodeRabbit