Skip to content

Validate UTXO vout range#3427

Open
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-utxo-vout-format-validation-develop
Open

Validate UTXO vout range#3427
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-utxo-vout-format-validation-develop

Conversation

@caydyan

@caydyan caydyan commented Jun 10, 2026

Copy link
Copy Markdown

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

utxosinfo.is_utxo_format() accepted UTXO strings with vout above the uint32 outpoint index range. That allowed impossible values such as 4294967296 to pass initial validation and fail later during transaction-input serialization.

This PR rejects outpoint indexes outside the valid uint32 range at the parser boundary.

Changes:

  • Adds MAX_UINT32 = 2**32 - 1.
  • Rejects UTXO strings where vout is above that limit.
  • Adds regression coverage for the upper-bound behavior.

Tests:

  • python -m pytest counterpartycore/test/units/parser/utxosinfo_test.py counterpartycore/test/units/api/composer_test.py::test_prepare_inputs_set -q
  • python -m ruff check counterpartycore/lib/parser/utxosinfo.py counterpartycore/test/units/parser/utxosinfo_test.py
  • python -m ruff format --check counterpartycore/lib/parser/utxosinfo.py counterpartycore/test/units/parser/utxosinfo_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