Skip to content

Techdebt/update fpf core#109

Merged
kcw-grunt merged 4 commits into
developfrom
techdebt/update-fpf-core
May 3, 2026
Merged

Techdebt/update fpf core#109
kcw-grunt merged 4 commits into
developfrom
techdebt/update-fpf-core

Conversation

@kcw-grunt

@kcw-grunt kcw-grunt commented May 3, 2026

Copy link
Copy Markdown
Collaborator

📱 Description

This PR updates the FPF (False Positive Filter) core module and adds comprehensive test coverage for all global constants. It introduces a dust threshold validation in the transaction creation flow to prevent sending amounts below the standard P2PKH minimum (546 litoshis), refactors the Sender.createTransactionWithOpsOutputs method signature for clarity, and establishes a complete unit test suite validating layout constants, monetary values, identifiers, URLs, and network parameters.

Platform

  • iOS

🎯 Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🔧 Refactoring (code change that neither fixes a bug nor adds a feature)
  • 📚 Documentation update
  • 🎨 UI/UX improvement
  • ⚡ Performance improvement
  • 🧪 Test addition or improvement
  • ⚙️ CI/CD change

📋 Changes

New Components Added

  • litoshiDustThreshold constant (Constants+Events.swift): Added a module-level constant defining the standard P2PKH dust limit at 546 litoshis to prevent network rejection of sub-dust outputs.

Modifications

  • ConstantsTests.swift: Expanded from empty test class to comprehensive 305-line test suite with 50+ test methods covering:

    • Global layout constants (padding, corner radii, heights)
    • Protocol and domain constants (PIN digit, seed phrase length)
    • Dust threshold validation with Litecoin Core specification documentation
    • Monetary constants (maxMoney, satoshis/litoshis per coin)
    • Identifiers and URLs (currency codes, queue names, support/feedback emails, explorer URLs, MoonPay endpoints)
    • Network port validation (mainnet/testnet discrimination via E.isTestnet)
    • Padding subscript behavior (integer and fractional multipliers)
    • App version metadata validation
    • False positive rate enum ordering and ranges
    • Added @MainActor annotation and reordered imports per Swift conventions
  • Sender.swift:

    • Refactored createTransactionWithOpsOutputs(amount:to:) to createTransactionWithOpsOutputs(amount:toAddress:) for parameter clarity
    • Added guard clause validating amount > 0 with assertion failure
    • Added dust threshold check using new litoshiDustThreshold constant (546 litoshis)
    • Improved code formatting with consistent indentation
  • BentoSendConfirmView.swift: Updated method call to use new toAddress parameter name in createTransactionWithOpsOutputs invocation

  • Modules/core: Updated SPM module dependency (details not visible in truncated diff)

  • brainwallet.xcodeproj/project.pbxproj: Updated Xcode project configuration for core module integration

Removals

  • Removed empty test body from ConstantsTests class definition

📊 Statistics

  • Additions: 329 lines
  • Deletions: 17 lines
  • Files Changed: 6
  • Commits: 4

🧪 Tests Status

  • Tests ran successfully locally?
  • Added or updated unit tests? ✅ (ConstantsTests expanded to 305 lines with 50+ new test methods)
  • Added or updated UI tests?
  • Code coverage percentage of the codebase: __%

🎯 Reviewers

@kcw-grunt @josikie

@kcw-grunt
kcw-grunt requested a review from josikie May 3, 2026 12:13
@kcw-grunt kcw-grunt self-assigned this May 3, 2026
@kcw-grunt kcw-grunt added enhancement New feature or request ios labels May 3, 2026
@gruntsoftware gruntsoftware deleted a comment from github-actions Bot May 3, 2026
@kcw-grunt
kcw-grunt merged commit 5638a58 into develop May 3, 2026
3 of 7 checks passed
@kcw-grunt
kcw-grunt deleted the techdebt/update-fpf-core branch May 3, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant