Skip to content

Validate fairmint quantity before comparisons#3430

Open
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-fairmint-quantity-validation-develop
Open

Validate fairmint quantity before comparisons#3430
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-fairmint-quantity-validation-develop

Conversation

@caydyan

@caydyan caydyan commented Jun 10, 2026

Copy link
Copy Markdown

Supersedes #3388 with the same fix rebased onto the current develop branch.

fairmint.validate() recorded quantity must be an integer for non-integer quantities, but then continued into fairminter-specific arithmetic and comparisons when the fairminter existed. For a paid fairminter, a value like "10" could reach quantity <= 0 and raise a Python TypeError instead of returning the compose-level validation error.

This PR stops fairmint validation before any quantity arithmetic when the quantity is not an integer.

Changes:

  • Tracks invalid non-integer fairmint quantity before looking up the fairminter.
  • Preserves the existing fairminter not found behavior when the asset is missing.
  • Returns the recorded quantity validation problem before arithmetic/comparison logic for existing fairminters.
  • Adds regression coverage for validate and compose paths.

Tests:

  • python -m pytest counterpartycore/test/units/messages/fairmint_test.py::test_validate counterpartycore/test/units/messages/fairmint_test.py::test_compose -q
  • python -m pytest counterpartycore/test/units/messages/fairmint_test.py -q
  • python -m ruff check counterpartycore/lib/messages/fairmint.py counterpartycore/test/units/messages/fairmint_test.py
  • python -m ruff format --check counterpartycore/lib/messages/fairmint.py counterpartycore/test/units/messages/fairmint_test.py
  • git diff --check

Bounty payment address (BTC): bc1qev5ant33v5y89qqjvcf4mh9hlax5svqf5xd7gc

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.

1 participant