Conversation
WalkthroughAn explicit seller permission check was added in Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (9)
✨ 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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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.
Hi @arkanoider
Now in purchase orders Mostrod sends the new-order message of the child order to the correct user, but when someone takes the child order that goes to waiting-buyer-invoice status, it sends the add-invoice message to the taker of the first order. In the database, in creator_pubkey, there is the trade key of the taker, not the maker (i mean the next trade key, no the key the used in 1st time)
In sales orders it still works well
|
great...i will revert this. It's weird it did not work before, will look deeper. |
Catrya
left a comment
There was a problem hiding this comment.
Hi @arkanoider mostro crashes when it receives the release action in a purchase range order.
2025-06-06T02:24:02.104833Z INFO mostrod::util: Sending DM, Event ID: be5822df7adf89c9dca0dd339b88b66e097efeb9fb7854b4f8e1f1ff37825db4 with payload: "{\"order\":{\"version\":1,\"request_id\":null,\"trade_index\":null,\"id\":\"02f51039-bd0f-492b-989d-e0fd7695f806\",\"action\":\"released\",\"payload\":null}}"
thread 'main' panicked at src/app/release.rs:187:74:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
…n range order is released
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/fiat_sent.rs(5 hunks)src/app/release.rs(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/app/fiat_sent.rs (1)
src/util.rs (1)
update_order_event(510-548)
src/app/release.rs (2)
src/util.rs (1)
enqueue_order_msg(848-863)src/app.rs (1)
e(372-372)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: tests
🔇 Additional comments (5)
src/app/fiat_sent.rs (2)
23-27: Good security check for buyer validation.The explicit check and clear comments help prevent unauthorized fiat sent actions.
37-91: Well-structured order update flow for range orders.The reorganization to defer database updates until after setting next trade fields is a good approach. This ensures all necessary fields are properly set before persisting to the database, which is crucial for child order routing in range orders.
src/app/release.rs (3)
77-80: Essential security check for seller validation.Good addition to ensure only the seller can release funds, maintaining proper order flow security.
182-215: Correct implementation for buy order child routing.This logic properly routes child orders to the buyer (maker) in buy orders by using the
next_trade_pubkeyandnext_trade_indexfields that were set during the fiat sent action. This fixes the issue where child orders were incorrectly sent to takers.
216-252: Well-structured conditional logic for order type handling.The explicit conditional branches for buy vs sell orders with creator validation ensure child orders are correctly routed to the appropriate party. The error handling for missing next trade information is comprehensive.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Catrya
left a comment
There was a problem hiding this comment.
@arkanoider I did some quick testing, it's assigning the child orders correctly now.
I haven’t tested it in privacy mode yet; I’ll do a bit more testing, but it’s heading in the right direction!
- splitted logic for handle release of buy and sell orders in a more readable way: two function manager for readability. - Added a missing thing in new master key of child orders: now when a normal user ( not in privacy mode ) completes a range order and so child order is created new master key is salted again so new master buyer/seller keys of child orders are different from previous.
|
@Catrya seems working on my side. Tested also privacy orders and seems ok. I fixed and refactored the code for better readability. Improved privacy: now child order master seller/buyer key is salted in case of normal user, previously they were the same of parent order. |
@Catrya
this is the fix for #490 .
Tested with a sell order and a buy order - now child order seems correctly sent to makers.
Summary by CodeRabbit