Skip to content

FIX (#1614) : Add comprehensive test to verify proofsForTransactions() does not modify UTXO set tree#2268

Open
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-1614
Open

FIX (#1614) : Add comprehensive test to verify proofsForTransactions() does not modify UTXO set tree#2268
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-1614

Conversation

@dimension-drifter
Copy link

Problem Statement

While the existing concurrent applyModifier() and proofsForTransactions() test ensures these methods can work in parallel, it doesn't explicitly verify that the UTXO set tree remains unmodified when proofsForTransactions() is called. There was concern that the tree might be inadvertently modified in some edge cases.

Solution

Added a new property test proofsForTransactions() does not modify UTXO set tree - extensive test that:

  1. Generates extensive test samples: Creates 50 blocks with ~50 transactions each (configurable to 500×500 for exhaustive testing)

  2. Explicitly verifies tree immutability:

    • Captures root digest before calling proofsForTransactions()
    • Verifies the digest remains identical after the call
    • Tests this pattern across multiple blocks to catch edge cases
  3. Validates the complete workflow:

    • Calls proofsForTransactions() and verifies success
    • Confirms digest from output corresponds to header's stateRoot
    • Confirms header.ADProofsRoot matches ADProofs.proofDigest(proofBytes)
    • Calls applyModifier() and verifies it completes successfully
    • Confirms the digest properly changes after applyModifier() (proving the modification path works correctly)
  4. Provides comprehensive coverage: Sequential testing over many blocks ensures edge cases are caught that might not appear in concurrent or single-block tests

Changes Made

  • File: UtxoStateSpecification.scala
  • Addition: New property test (~80 lines) added after the existing proofsForTransactions() does not change state digest test
  • Test parameters: Configurable numBlocks (default 50) and txsPerBlock (default 50) for flexible testing depth

Testing

The test can be run with:

sbt "testOnly org.ergoplatform.nodeView.state.UtxoStateSpecification"

@dimension-drifter dimension-drifter changed the title test: add extensive test for proofsForTransactions() to ensure UTXO s… FIX (#1614) : Add comprehensive test to verify proofsForTransactions() does not modify UTXO set tree Dec 13, 2025
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