Skip to content

[Feature] Warning Screen for High Tx Fees - #722

Merged
newtonick merged 3 commits into
SeedSigner:devfrom
Chaitanya-Keyal:psbt-huge-fee-warning
Sep 23, 2026
Merged

newtonick merged 3 commits into
SeedSigner:devfrom
Chaitanya-Keyal:psbt-huge-fee-warning

Conversation

@Chaitanya-Keyal

@Chaitanya-Keyal Chaitanya-Keyal commented Apr 9, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR introduces a warning screen that appears before the PSBT math screen if the transaction includes unusually high fees. The goal is to ensure the user is explicitly made aware of any excessive fees before proceeding to sign the transaction.

Closes #721

Warning Condition

The warning is shown when:

  • The fee amount exceeds 25% of the sum of all outputs excluding change, and
  • There are outputs other than true change (and fee).

New Warning Screen:

image

Visual Warning in PSBT Flow Views

image image


This pull request is categorized as a:

  • New feature

Checklist

  • I’ve run pytest and made sure all unit tests pass before sumbitting the PR

If you modified or added functionality/workflow, did you add new unit tests?

  • Yes

The warning screen doesn’t currently apply to any of the existing test PSBT flows. I also noticed there aren’t tests for similar warnings (e.g. Full Spend), so figured it's not needed here either. Do let me know if a test needs to be added!

I have tested this PR on the following platforms/os:

Comment thread src/seedsigner/views/psbt_views.py Resolved
Comment thread src/seedsigner/views/psbt_views.py Resolved
Comment thread src/seedsigner/views/psbt_views.py Resolved
Comment thread src/seedsigner/views/psbt_views.py Resolved
@kdmukai

kdmukai commented Apr 13, 2025

Copy link
Copy Markdown
Contributor

Ideally this PR would include a flow test for the scenario that triggers this new View. But unfortunately we are missing a flow test for other similar psbt warning screens (e.g. "full spend"), so we don't have an easy copy-paste flow test to start from.

As noted elsewhere, I DO think we should get a unit test on the total output value calcs.

So:

  • refactor and add unit test: Blocker
  • flow test: nice to have; not a blocker
  • screenshot: Nice job already adding it!

@Chaitanya-Keyal

Copy link
Copy Markdown
Contributor Author

Hey @kdmukai,

Thanks a lot for the review!

I've updated the PR to incorporate all your suggestions:

  • Added two unit tests for checking the output value calculation:
    • One using mocked PSBT data.
    • One using a real PSBT (reused from an existing test). I think the mocked test should be sufficient, but included both for completeness — let me know if you'd prefer to drop the second one.
  • Updated the terminology from "huge fee" to "high fee" — noticed Sparrow Wallet also uses "high fee", and it does sound more natural. Open to renaming if you have a better suggestion.
  • Added a TODO comment for possibly making the threshold configurable via settings. The threshold value is now a named constant, so translations won't have to be redone in the future.

As for the flow test for this screen (and other PSBT warning views like "full spend"), it probably makes more sense to tackle that in a follow-up PR rather than squeeze it into this one. I can take that up once this is merged.

@Chaitanya-Keyal
Chaitanya-Keyal requested a review from kdmukai April 13, 2025 21:46
@Chaitanya-Keyal Chaitanya-Keyal changed the title [Feature] Warning Screen for Huge Fees [Feature] Warning Screen for High Tx Fees Apr 13, 2025
Comment thread src/seedsigner/models/psbt_parser.py Resolved
Comment thread src/seedsigner/models/psbt_parser.py Resolved
@Chaitanya-Keyal

Chaitanya-Keyal commented Apr 14, 2025 •

Copy link
Copy Markdown
Contributor Author

Hey @kdmukai,

Thanks again for your quick review! I've updated the PR with your suggestions:

  • Fixed the function not including self-transfers as output
  • Updated tests and added one more case to verify self transfer + change calculations

While I was working on these updates, I realized that it could be helpful to introduce a new variable in PSBTParser to explicitly track self-transfers. This would simplify calculations like the one in this function and also improve the screen selection logic in PSBTChangeDetailsView. By doing so, we can more easily differentiate between self-transfers and true change outputs, making the logic clearer and more reusable across the codebase.

Let me know your thoughts on this approach! If it sounds good, perhaps I'll start to work on that on another branch!

@Chaitanya-Keyal
Chaitanya-Keyal requested a review from kdmukai April 14, 2025 23:02
Comment thread tests/test_psbt_parser.py Resolved
@Chaitanya-Keyal
Chaitanya-Keyal requested a review from kdmukai April 22, 2025 16:19
@kdmukai kdmukai moved this from SoB In Progress to SoB Needs Code Review in @SeedSigner Development Board Jul 26, 2025
@newtonick newtonick added this to the 0.9.0 milestone Aug 6, 2025
@newtonick

Copy link
Copy Markdown
Collaborator

tACK. I reviewed the code but would love to get some additional eyes (beyond Keith and I) on this one since its code changes around parsing the PSBT amounts and displaying them to the user.

I've also not been consistent about the PR expectation should be around including an updated messages.pot files when new text is included that needs translation. So when/if this PR gets merged it would be knowing that the messages.pot would still need to be regenerated/extracted for the dev branch.

@alvroble

alvroble commented Aug 13, 2025 •

Copy link
Copy Markdown
Contributor

ACK tested as of 8910071 on Raspberry Pi Manual OS.

You could take it one step further. Sparrow displays a visual warning for the fee in the PSBT overview. I propose using the same approach here, perhaps by coloring the fees red when they are too high in the PSBTOverviewView and/or PSBTMathView (in addition to the warning view). This is because, when the user navigates back and forth, the PSBTHighFeeWarningView no longer appears.

The UI would look like this for the PSBTOverviewView (and something similar for PSBTMathView):

imagen

Maybe even adding some kind of warning sing like (!) or (high!) next to fee would be also useful too.

Feel free to check or cherry-pick the modifications from my repo alvroble@4f01eec.

@Chaitanya-Keyal

Chaitanya-Keyal commented Aug 15, 2025 •

Copy link
Copy Markdown
Contributor Author

Thanks @alvroble! That’s a great idea. I’ve updated the PR accordingly and added you as a co-author on the commit.

If the fee is high, both PSBTOverviewScreen and PSBTMathScreen now display "fee (!)" in the dire warning color.

I also moved the high-fee check into its own function in PSBTParser and added a corresponding unit test.

@Chaitanya-Keyal
Chaitanya-Keyal force-pushed the psbt-huge-fee-warning branch 2 times, most recently from 86dbe4f to 8a57621 Compare August 15, 2025 00:22
@alvroble

Copy link
Copy Markdown
Contributor

Thanks @Chaitanya-Keyal!! Now it looks like this:

PSBTOverviewView
imagen

PSBTMathView
imagen

@Chaitanya-Keyal
Chaitanya-Keyal force-pushed the psbt-huge-fee-warning branch 2 times, most recently from ef17c71 to aca9d21 Compare December 14, 2025 12:26
@Chaitanya-Keyal

Copy link
Copy Markdown
Contributor Author

Thanks @easyuxd! I've updated the view to use DireWarningScreen and the high fee label was already using DIRE_WARNING_COLOR. Updated screenshot is in the description, lmk what you think!

@easyuxd

easyuxd commented Dec 14, 2025

Copy link
Copy Markdown
Contributor

@Chaitanya-Keyal Thank you, looks great! ACK

--
Off-topic +@kdmukai:
This PR reminds me of how non-descriptive our titles are. It's not you, but how we originally designed these messaging screens. Since we focus on the screen title more than the small colored text below it, I had proposed removing the colored text and moving that content to the navbar. This would make the screens more scannable and free up valuable pixels. "Caution" doesn't mean much, especially when there's already a colored warning icon. Anyway, this type of change would be global, affecting all messaging screens and translations.

#606

Given the current experience, "Caution" seems as consistent a title as any.

@Chaitanya-Keyal
Chaitanya-Keyal force-pushed the psbt-huge-fee-warning branch 2 times, most recently from bcd1d24 to 4427f44 Compare February 16, 2026 21:35
@Chaitanya-Keyal
Chaitanya-Keyal force-pushed the psbt-huge-fee-warning branch 2 times, most recently from 598f2e3 to e70496b Compare July 22, 2026 06:08
@newtonick newtonick moved this from 0.9.0 Needs Code Review to 0.8.8 Needs Review in @SeedSigner Development Board Aug 24, 2026
@newtonick newtonick modified the milestones: 0.9.0, 0.8.8 Sep 19, 2026
@Chaitanya-Keyal
Chaitanya-Keyal force-pushed the psbt-huge-fee-warning branch 2 times, most recently from 3fea726 to 7cd450e Compare September 20, 2026 10:21
Chaitanya-Keyal and others added 2 commits September 20, 2026 16:03
Co-authored-by: alvroble <50918598+alvroble@users.noreply.github.com>
Both PSBTOverviewView and PSBTMathView asked the parser whether the fee was
high, and the overview asked twice (once for the screen, once for routing).
Each call re-summed the outputs through psbt.tx, which rebuilds the whole
transaction on every access. The totals it depends on are all fixed by the end
of parse(), so compute it there once and store it as is_high_fee, the same way
the other totals are exposed. has_high_fee() stays as the computation itself.
@newtonick

Copy link
Copy Markdown
Collaborator

ACK and reviewed.

@newtonick
newtonick merged commit 088b144 into SeedSigner:dev Sep 23, 2026
2 checks passed
@newtonick newtonick moved this from 0.8.8 Needs Review to 0.8.8 Merged in @SeedSigner Development Board Sep 23, 2026
@Chaitanya-Keyal
Chaitanya-Keyal deleted the psbt-huge-fee-warning branch September 23, 2026 03:04
renatoslopes pushed a commit to GRIFORTIS/3rdIteration-seedsigner that referenced this pull request Oct 9, 2026
Brings in SeedSigner#1044 (hold every claim of ours on a multisig
output to its script) and SeedSigner#722 (warn when the fee is high relative to what is
being sent).

Conflict resolution, keeping the fork's behaviour:
- verified_[input|output]_derivation_paths adopt upstream's
  List[List[DerivationPath]] shape; the fork's can_verify_derivations
  (WIF/BIP38/seedless pre-parse) and root_path (smartcard account xpub)
  handling are kept. _derive_with_cache_via_derivation_path gains an optional
  root_path so account-relative derivation keeps working.
- Upstream's PSBT*Error classes map onto the fork's InvalidPSBTError +
  RejectCode (FORGED_OUTPUT_OWNERSHIP, SURPLUS_DERIVATIONS, ...).
- High fee: upstream's PSBTHighFeeWarningView runs first in
  post_overview_destination, then continues into the fork's risk warning /
  identify-change flow. The fork's HIGH_FEE risk text is suppressed when the
  dedicated high fee screen has already been shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chaitanya-Keyal added a commit to Chaitanya-Keyal/seedsigner that referenced this pull request Oct 29, 2026
The OP_RETURN screenshot fixture simplifies the multisig psbt down to its
last output. Dropping the other outputs turned their ~9.3 BTC into fee,
which has tripped the high fee warning since SeedSigner#722, so the overview
screenshot showed a "fee (!)" mark that has nothing to do with OP_RETURN.
Fold the dropped value into the kept output instead, so the fee stays what
the base psbt paid.
Chaitanya-Keyal added a commit to Chaitanya-Keyal/seedsigner that referenced this pull request Nov 13, 2026
The OP_RETURN screenshot fixture simplifies the multisig psbt down to its
last output. Dropping the other outputs turned their ~9.3 BTC into fee,
which has tripped the high fee warning since SeedSigner#722, so the overview
screenshot showed a "fee (!)" mark that has nothing to do with OP_RETURN.
Fold the dropped value into the kept output instead, so the fee stays what
the base psbt paid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 0.8.8 Merged

Development

Successfully merging this pull request may close these issues.

[Feature Request] Warning Screen for High Tx Fees

5 participants