Skip to content

Fix fee selection errors in connect popup send flow - #30818

Open
marekrjpolak wants to merge 1 commit into
developfrom
fix/fee-level-modal
Open

Fix fee selection errors in connect popup send flow#30818
marekrjpolak wants to merge 1 commit into
developfrom
fix/fee-level-modal

Conversation

@marekrjpolak

@marekrjpolak marekrjpolak commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

3rd party send flow (composeTransaction call without account/fees) had some corner cases in fee selection. I've tried to resolve them without changing much of the Suite-only logic:

  • when normal fee level was missing, nothing was selected
    • fixed by falling back to any other fee level as a default in SelectFeeModal (both useForm and useFees)
    • removed defaultValue: 'normal' from CollapsibleFees as it had beaten the form defaults somehow
  • when normal fee level was missing, it wasn't possible to set custom fees
    • fixed by allowing custom fees in CollapsibleFees even when normal level isn't there
    • it should be enough that the currently selected fee level exists to get default value for custom fee, see useFees hook
  • when only custom fee level was present, nothing was shown at all
    • fixed by using custom level as a default in this case
    • switching to standard fee is allowed only when there's at least one standard fee level

🤖 LLM Test Recommendations

Summary: Both changed files affect fee selection and display: CollapsibleFees in send/swap/stake forms and SelectFeeModal in device confirmation prompts. The highest-risk regressions are incorrect custom fee behavior, miscalculated totals, or broken fee rendering on the device. A small set of tests covering custom fees and device fee assertions across send, swap, stake, and sell flows provides strong confidence without running the full suite.

Changed files (2)
  • packages/suite/src/components/suite/modals/ReduxModal/DeviceConfirmationModal/SelectFeeModal.tsx
  • packages/suite/src/components/wallet/Fees/CollapsibleFees/CollapsibleFees.tsx

Recommended tests (12)

🔴 High priority (8)
  • suite/e2e/tests/staking/eth/initial-stake.test.ts — Exercises the ETH staking form's fee handling (CollapsibleFees) and asserts the device confirmation prompt shows the correct staking amount and fee, directly covering both changed components in a staking flow.
  • suite/e2e/tests/staking/sol/initial-stake.test.ts — Validates SOL staking fee/rent display on the staking form and the device prompt, including model-specific fee screens, so it directly tests fee rendering in CollapsibleFees and SelectFeeModal.
  • suite/e2e/tests/trading/sell-inputs.test.ts — Explicitly tests custom fee selection, fraction buttons, max amount accounting for custom fees, and fee validation for both BTC and SOL sell forms, hitting CollapsibleFees behavior and downstream fee display.
  • suite/e2e/tests/trading/swap-fees-bitcoin.test.ts — Sets a custom BTC fee rate in the swap form, asserts the device prompt total equals fee plus send amount and shows the custom fee rate, directly testing both CollapsibleFees and SelectFeeModal.
  • suite/e2e/tests/trading/swap-fees-ethereum.test.ts — Configures custom Ethereum gas limit, max fee per gas, and priority fee in the swap form and verifies all gas/fee values on the device prompt, covering both fee components end-to-end.
  • suite/e2e/tests/wallet/send-doge.test.ts — Verifies the device confirmation prompt shows the correct send amount, total, and fee for a Dogecoin transaction, so a regression in SelectFeeModal fee rendering would be caught.
  • suite/e2e/tests/wallet/send-eth.test.ts — Fills custom Ethereum gas parameters in the send form and asserts detailed fee breakdown (gas limit, max fee, priority fee, total) on both the UI device prompt and the hardware emulator, directly touching both changed files.
  • suite/e2e/tests/wallet/send-sol.test.ts — Uses Send Max and verifies max fee, total sent, and device prompt fee/amount for a Solana transaction, making it a strong end-to-end check of CollapsibleFees calculations and SelectFeeModal display.
🟡 Medium priority (4)
  • suite/e2e/tests/staking/ada/stake.test.ts — Covers the Cardano staking flow where deposit and fee amounts are displayed and confirmed on the device, sharing fee infrastructure with the changed components.
  • suite/e2e/tests/trading/sell-bitcoin.test.ts — Validates sell form fee calculation and device prompt fee/amount for a BTC sell, providing additional coverage of fee rendering beyond the custom-fee-focused sell-inputs test.
  • suite/e2e/tests/trading/sell-ethereum.test.ts — Tests custom Ethereum fee parameters in the sell flow and verifies the device prompt, complementing swap-fees-ethereum and send-eth for sell-specific fee handling.
  • suite/e2e/tests/trading/swap-coins.test.ts — Executes a SOL-to-BTC swap and checks device prompt fee and total, helping ensure cross-chain swap fee display in SelectFeeModal remains correct.

Updated: 2026-08-04T16:07:39.061Z

🌐 Preview deployments

🌐 Suite Web preview: https://dev.suite.sldev.cz/suite-web/fix/fee-level-modal/web/

🔍 Currents Test Results

🔍 Suite desktop test results: View in Currents

🔍 Suite web test results: View in Currents

🔒 Quarantined E2E Tests

Trezor Suite (web) — 3 test(s)
Test Type
Trading - Navigation > Navigate to 🤖 auto
Quarantine test: "TrezorConnect webextension -> Suite Web,second call after popup was closed by user should work" 🙋 manual
Quarantine test: "Recovery T2T1 - dry run,Recovery after partial recovery" 🙋 manual

Updated: 2026-08-04T16:08:39.646Z • 3 test(s) total

Trezor Suite (desktop) — 3 test(s)
Test Type
Trading - Navigation > Navigate to 🤖 auto
Quarantine test: "Recovery - dry run,Recovery after partial recovery" 🙋 manual
Quarantine test: "Recovery - dry run,Recovery with device reconnection" 🙋 manual

Updated: 2026-08-04T16:08:18.355Z • 3 test(s) total

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts fee-level defaulting and UI gating in the Connect popup “select fee” send flow to handle edge cases where the usual normal fee level is missing, and to support “custom-only” fee offerings.

Changes:

  • Compute safer form defaults for fee selection in the Connect popup SelectFeeModal (including defaulting away from missing normal).
  • Update CollapsibleFees to allow switching between custom/standard fees when normal is absent, using an available standard level when present.
  • Remove the useWatch defaultValue: 'normal' override so form defaults aren’t unintentionally beaten by the collapsible component.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/suite/src/components/wallet/Fees/CollapsibleFees/CollapsibleFees.tsx Removes useWatch default override and adjusts custom/standard switching logic for missing normal.
packages/suite/src/components/suite/modals/ReduxModal/DeviceConfirmationModal/SelectFeeModal.tsx Adds computed defaultValues for the popup fee form and passes them consistently into useForm + useFees.
Suppressed comments (2)

packages/suite/src/components/wallet/Fees/CollapsibleFees/CollapsibleFees.tsx:110

  • JSX comment formatting: start with an uppercase letter and end with a period.
                                        {/* allow switching to non-custom fee only when there is some */}
                                        {isCustomFee && !!defaultFeeLevel && (

packages/suite/src/components/wallet/Fees/CollapsibleFees/CollapsibleFees.tsx:121

  • JSX comment formatting: start with an uppercase letter and end with a period.
                                        {/* in order to have sensible default for custom fee, selected fee level must exist (see useFees hook) */}
                                        {!isCustomFee && !!selectedFeeLevel && (

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marekrjpolak
marekrjpolak marked this pull request as ready for review August 4, 2026 16:22
@marekrjpolak marekrjpolak moved this to 🔎 Needs review in Suite Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Needs review

Development

Successfully merging this pull request may close these issues.

2 participants