Skip to content

Fix: Reject multisig policies with m=0 or m>n and guard against ZeroDivisionError in fee calculation and #845

Open
odudex wants to merge 5 commits intoselfcustody:developfrom
odudex:zero_div_zero_multi
Open

Fix: Reject multisig policies with m=0 or m>n and guard against ZeroDivisionError in fee calculation and #845
odudex wants to merge 5 commits intoselfcustody:developfrom
odudex:zero_div_zero_multi

Conversation

@odudex
Copy link
Copy Markdown
Member

@odudex odudex commented Mar 30, 2026

What is this PR for?

Changes made to:

  • Code
  • Tests
  • Docs
  • CHANGELOG

Did you build the code and tested on device?

  • Yes, build and tested on Amigo
  • 100% fee Tx
  • 0ofM multisig rejection
  • NofM where N>M multisig rejection

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Docs update
  • Other

odudex added 3 commits March 30, 2026 09:51
…e outputs

Handles the case where all PSBT outputs are zero-value (e.g. OP_RETURN
only transactions) by checking out_amount > 0 before dividing. Sets
fee_percent to 100.0% when output amount is zero. Addresses audit C7.
Reject multisig policies with m=0 (zero signatures = anyone can spend)
or m>n (impossible quorum) when loading wallets from BlueWallet INI
format. Also adds defense-in-depth validation in descriptor loading
path. Addresses security audit C8 of selfcustody#843.
@odudex odudex force-pushed the zero_div_zero_multi branch from 04c71f0 to 8b535c2 Compare March 30, 2026 13:09
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.31%. Comparing base (e531811) to head (e389f4e).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #845   +/-   ##
========================================
  Coverage    97.31%   97.31%           
========================================
  Files           83       83           
  Lines        10581    10593   +12     
========================================
+ Hits         10297    10309   +12     
  Misses         284      284           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@odudex odudex marked this pull request as ready for review March 30, 2026 18:38
Copy link
Copy Markdown

@joaozinhom joaozinhom left a comment

Choose a reason for hiding this comment

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

CACK e389f4e

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