Skip to content

fix: fix for bug introduced in 0.17.2 blocking range orders#705

Merged
grunch merged 1 commit intomainfrom
fix-range-orders
Apr 10, 2026
Merged

fix: fix for bug introduced in 0.17.2 blocking range orders#705
grunch merged 1 commit intomainfrom
fix-range-orders

Conversation

@arkanoider
Copy link
Copy Markdown
Collaborator

@arkanoider arkanoider commented Apr 10, 2026

Title

fix: allow range orders with fiat_amount == 0 in order_action

Summary

v0.17.2 started validating every new order with check_fiat_amount() unconditionally. Range orders encode the band with min_amount / max_amount and use fiat_amount == 0, so they were rejected before range handling ran. This change calls check_fiat_amount() only for single-amount orders (no min/max), restoring correct behavior for range listings without changing mostro-core.

Changes

  • In order_action (src/app/order.rs), gate check_fiat_amount() on min_amount and max_amount both absent.
  • Add a short comment explaining why (strict core check vs range placeholder fiat).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed order validation logic to properly handle both single-amount and range orders. Range orders can now process without triggering fiat amount validation errors.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3d24c8ba-c081-49d9-b690-870d37b862f5

📥 Commits

Reviewing files that changed from the base of the PR and between 2d96531 and 9314771.

📒 Files selected for processing (1)
  • src/app/order.rs

Walkthrough

The order_action function in src/app/order.rs is modified to conditionally validate fiat_amount only for single-amount orders. The check_fiat_amount() validation is now skipped for range orders where fiat amount is expected to be zero. All other validations and control flow remain unchanged.

Changes

Cohort / File(s) Summary
Conditional Fiat Validation
src/app/order.rs
Modified order_action to call check_fiat_amount() only when both min_amount and max_amount are None, bypassing this validation for range orders where fiat amount should be zero.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • grunch
  • Catrya
  • AndreaDiazCorreia

Poem

🐰 A careful hop through validation's maze,
Range orders skip the fiat gaze,
While single-amount hops still play by rules,
Smart conditions now our safety tools! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: addressing a regression in v0.17.2 that was blocking range orders, which aligns with the code change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-range-orders

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

tACK

Copy link
Copy Markdown
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

LGTM

@grunch grunch merged commit db62c5a into main Apr 10, 2026
8 checks passed
@grunch grunch deleted the fix-range-orders branch April 10, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants