fix(perps): Missing 1 decimal on price input when using preset on limit price#27907
fix(perps): Missing 1 decimal on price input when using preset on limit price#27907abretonc7s wants to merge 4 commits intomainfrom
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Limit price presets hardcoded 4 significant digits, truncating XRP-range prices to 3 decimals ($2.342) instead of 4 ($2.3418). Use DECIMAL_PRECISION_CONFIG.MaxSignificantFigures (5) to match the HyperLiquid API limit and PRICE_RANGES_UNIVERSAL display config. Also adds testIDs to all preset buttons for automated testing.
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
TAT-2399: Missing 1 decimal on price input when using preset on limit priceSummaryLimit price presets (Mid, Bid, Ask, -1%, -2%) used Root causeFile: All 5 preset button handlers called For XRP at $2.3418 (1 integer digit):
Reproduction commitSHA: Metro log excerpt: Confirmed: 3 decimals instead of expected 4 for XRP-range price. Changes
Test planAutomated
Manual (Gherkin)Feature: Limit price preset decimal precision
Scenario: Mid preset shows correct decimals for XRP
Given I am on the XRP Long Limit order screen
When I open the limit price bottom sheet
And I press the Mid preset button
Then the limit price shows 4 decimal places (e.g., $2.3418)
Scenario: All presets show correct decimals
Given I am on the XRP Long Limit order screen
When I press each preset (Mid, Bid, -1%, -2%)
Then each preset value has 4 decimal places
Scenario: Ask preset works for short orders
Given I am on the XRP Short Limit order screen
When I press the Ask preset button
Then the limit price shows 4 decimal placesEvidence
Ticket
|
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
Limit price presets (Mid, Bid, Ask, -1%, -2%) hardcoded
formatWithSignificantDigits(value, 4)— 4 significant digits. For XRP-range prices (~$2.34), this truncated values to 3 decimal places ($2.342) instead of the expected 4 ($2.3418). Fixed by usingDECIMAL_PRECISION_CONFIG.MaxSignificantFigures(= 5), matching the HyperLiquid API limit and thePRICE_RANGES_UNIVERSALdisplay config. Also added testIDs to all preset buttons for automated testing.Changelog
CHANGELOG entry: Fixed limit price preset buttons (Mid, Bid, Ask, percentage) truncating one decimal place for low-price assets like XRP
Related issues
Fixes: TAT-2399
Manual testing steps
Screenshots/Recordings
Before
Bug confirmed via CDP eval:
formatWithSignificantDigits(2.3418, 4)→2.342(3 decimals instead of 4)After
See .task/fix/tat-2399-0325-1840/artifacts/after.mp4
Validation Recipe
Automated validation recipe (validate-recipe.sh)
{ "pr": "27907", "title": "Limit price presets use correct decimal precision (5 sig figs)", "jira": "TAT-2399", "acceptance_criteria": [ "Tapping any limit price preset populates the value with market-correct decimal precision", "Validated on XRP (reported case) and SOL (different price range)", "All five presets covered: Mid, Bid, Ask, -1%, -2%", "No regression to manual limit price entry" ], "validate": { "static": ["yarn lint:tsc"], "runtime": { "pre_conditions": ["wallet.unlocked", "perps.feature_enabled"], "steps": [ {"id": "nav_xrp", "description": "Navigate to XRP market details", "action": "flow_ref", "ref": "market-discovery", "params": {"symbol": "XRP"}}, {"id": "press_long", "action": "press", "test_id": "perps-market-details-long-button"}, {"id": "wait_form", "action": "wait_for", "test_id": "perps-order-header-order-type-button"}, {"id": "press_order_type", "action": "press", "test_id": "perps-order-header-order-type-button"}, {"id": "wait_type_sheet", "action": "wait_for", "test_id": "perps-order-type-limit"}, {"id": "press_limit", "action": "press", "test_id": "perps-order-type-limit"}, {"id": "wait_limit_form", "action": "wait_for", "test_id": "perps-order-view-limit-price-row"}, {"id": "press_price_row", "action": "press", "test_id": "perps-order-view-limit-price-row"}, {"id": "wait_price_sheet", "action": "wait_for", "test_id": "keypad-delete-button"}, {"id": "press_mid_xrp", "action": "press", "test_id": "perps-limit-price-preset-mid"}, {"id": "wait_mid", "action": "wait", "ms": 500}, {"id": "check_mid_xrp", "description": "Assert Mid preset >= 4 decimals for XRP", "action": "eval_sync", "expression": "...", "assert": {"operator": "gt", "field": "decimals", "value": 3}}, {"id": "press_bid_xrp", "action": "press", "test_id": "perps-limit-price-preset-bid"}, {"id": "check_bid_xrp", "description": "Assert Bid >= 4 decimals", "action": "eval_sync", "assert": {"operator": "gt", "field": "decimals", "value": 3}}, {"id": "press_pct_minus1_xrp", "action": "press", "test_id": "perps-limit-price-preset--1"}, {"id": "check_pct_minus1_xrp", "description": "Assert -1% >= 4 decimals", "action": "eval_sync", "assert": {"operator": "gt", "field": "decimals", "value": 3}}, {"id": "press_pct_minus2_xrp", "action": "press", "test_id": "perps-limit-price-preset--2"}, {"id": "check_pct_minus2_xrp", "description": "Assert -2% >= 4 decimals", "action": "eval_sync", "assert": {"operator": "gt", "field": "decimals", "value": 3}}, {"id": "nav_sol", "action": "flow_ref", "ref": "market-discovery", "params": {"symbol": "SOL"}}, {"id": "check_mid_sol", "description": "SOL no-regression check", "action": "eval_sync", "assert": {"operator": "eq", "field": "isValid", "value": true}}, {"id": "nav_short_xrp", "action": "flow_ref", "ref": "market-discovery", "params": {"symbol": "XRP"}}, {"id": "check_ask_xrp", "description": "Assert Ask >= 4 decimals", "action": "eval_sync", "assert": {"operator": "gt", "field": "decimals", "value": 3}} ] } } }Full recipe:
.task/fix/tat-2399-0325-1840/artifacts/recipe.jsonPre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches limit-order price preset calculation/rounding, which can affect the exact order price submitted (especially for low-priced assets). Scope is small and covered by new unit tests and added stable
testIDs.Overview
Fixes limit price preset buttons (Mid/Bid/Ask and +/- % presets) to format using
DECIMAL_PRECISION_CONFIG.MaxSignificantFiguresinstead of a hardcoded 4 significant digits, preventing truncation for low-priced assets (e.g., XRP).Adds explicit
testIDs for each preset button (including percentage presets) and extendsPerpsLimitPriceBottomSheettests to assert correct precision for XRP-range prices.Written by Cursor Bugbot for commit 80a6f4f. This will update automatically on new commits. Configure here.