Skip to content

Fix canonical tick bounds and maker validation#71

Merged
rdave8 merged 2 commits into
mainfrom
fix/outdated-tick-bounds
Jul 17, 2026
Merged

Fix canonical tick bounds and maker validation#71
rdave8 merged 2 commits into
mainfrom
fix/outdated-tick-bounds

Conversation

@rdave8

@rdave8 rdave8 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Expanded supported maker tick/price bounds, enabling approximately 1e-6 to 1e6 ranges.
  • Bug Fixes

    • Strengthened maker order validation to reject tick ranges outside the permitted protocol min/max, in addition to invalid ordering.
  • Tests

    • Updated boundary and conversion tests to reflect the new protocol min/max limits and adjusted expected tolerance/rounding behavior.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 16f7f101-cfc1-40be-9579-4d12c6cf8e32

📥 Commits

Reviewing files that changed from the base of the PR and between 765bf7d and c08fb74.

📒 Files selected for processing (1)
  • src/client/trades.rs

📝 Walkthrough

Walkthrough

The PR widens protocol price and maker tick bounds, updates boundary conversion and tick tests, and strengthens open_maker validation for out-of-range or improperly ordered tick ranges.

Changes

Maker tick bounds

Layer / File(s) Summary
Protocol price and boundary updates
src/constants.rs, src/convert.rs, src/math/tick.rs
Starting sqrt-price constants and maker tick limits are updated, with tests covering prices near 1e-6 and 1e6 and tick bounds of ±138180.
Maker tick-range validation
src/client/trades.rs
open_maker now rejects tick ranges outside MIN_TICK/MAX_TICK and ranges where tick_lower >= tick_upper.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: praz314159

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating canonical tick bounds and strengthening maker validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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/outdated-tick-bounds

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/convert.rs`:
- Around line 590-598: The price_1e-6_works test currently only checks success
and the conversion produces one unit below MIN_SQRT_PRICE_X96. Update
price_to_sqrt_price_x96’s rounding or boundary clamping so the exact 1e-6 input
returns MIN_SQRT_PRICE_X96, then change the test to assert equality with that
constant rather than only asserting is_ok().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 550305b4-6111-4a22-a7fe-5ae06712afee

📥 Commits

Reviewing files that changed from the base of the PR and between e6aaa24 and 765bf7d.

📒 Files selected for processing (4)
  • src/client/trades.rs
  • src/constants.rs
  • src/convert.rs
  • src/math/tick.rs

Comment thread src/convert.rs

@Praz314159 Praz314159 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

approving, but it seems like its worth fixing the off-by-1 error

@rdave8
rdave8 merged commit e5fa9d4 into main Jul 17, 2026
8 checks passed
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.

2 participants