Skip to content

Conversation

@freemans13
Copy link
Collaborator

No description provided.

@freemans13 freemans13 self-assigned this Dec 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

🤖 Claude Code Review

Status: Complete


Critical Issue Found:

This PR introduces a breaking bug by removing the automatic field dependency logic from addAbstractedBins. When fields.TxInpoints is requested (which is included in utxo.MetaFields), the code previously auto-added fields.Inputs and fields.External. Without these fields, external transaction processing will fail.

See inline comments for details:

Recommendation: Restore the removed addAbstractedBins logic to maintain backward compatibility and prevent runtime failures.

Positive aspects:

  • Excellent memory optimization strategy with ParseInputReferencesOnly
  • Comprehensive test coverage for the new parser
  • Good use of streaming to avoid double memory allocation
  • SQL store correctly updated to match Aerospike behavior

func parseInputReferencesOnly(reader io.Reader) ([]*bt.Input, error) {

// Parse version (4 bytes)
var version uint32
Copy link
Contributor

@github-actions github-actions bot Dec 2, 2025

Choose a reason for hiding this comment

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

Fixed - The code now correctly uses io.CopyN(io.Discard, reader, 4) to skip the version bytes without assigning to an unused variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

✅ Confirmed fixed in latest commit. The code now correctly uses io.CopyN(io.Discard, reader, 4) at line 1455.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
65.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

…d Extended needed if TxInpoints is specified
}
}

if slices.Contains(newBins, fields.Tx) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Critical Bug: The removed logic here (lines 456-459 in previous version) automatically added fields.Inputs and fields.External when TxInpoints was requested. Without this, callers using utxo.MetaFields will fail on external transactions because bins will not contain the required data. Fix: Restore the deleted TxInpoints check or remove TxInpoints from utxo.MetaFields.

// Default fields - optimized for common use cases without scripts
// Services that need full transaction (persister, API) explicitly request fields.Tx
// TxInpoints requires Inputs and External fields to be fetched
bins := []fields.FieldName{fields.Fee, fields.SizeInBytes, fields.TxInpoints, fields.Inputs, fields.External, fields.BlockIDs, fields.IsCoinbase}
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistency: This comment states "TxInpoints requires Inputs and External fields to be fetched" but the default bins list below manually includes these fields. The removed addAbstractedBins logic was supposed to add these automatically. Now callers who explicitly pass item.Fields (line 534-535) will bypass this default and miss the required dependencies.

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