Skip to content

Conversation

@matiwinnetou
Copy link
Collaborator

No description provided.

@matiwinnetou matiwinnetou changed the base branch from main to develop November 7, 2025 10:47
@matiwinnetou matiwinnetou force-pushed the operations-parsing-refak branch from d43ec40 to 1fcd95f Compare November 7, 2025 10:57
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

✅ Preprod Tests: PASSED

📊 View Detailed Test Report

🔗 Action Run #87

Tests run against preprod network with live blockchain data

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

✅ Preprod Tests: PASSED

📊 View Detailed Test Report

🔗 Action Run #90

Tests run against preprod network with live blockchain data

@matiwinnetou matiwinnetou force-pushed the operations-parsing-refak branch 2 times, most recently from 6c73dba to f02b569 Compare November 7, 2025 13:25
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

✅ Preprod Tests: PASSED

📊 View Detailed Test Report

🔗 Action Run #91

Tests run against preprod network with live blockchain data

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

✅ Preprod Tests: PASSED

📊 View Detailed Test Report

🔗 Action Run #92

Tests run against preprod network with live blockchain data

@matiwinnetou matiwinnetou force-pushed the operations-parsing-refak branch from f02b569 to 83ad587 Compare November 7, 2025 13:52
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

✅ Preprod Tests: PASSED

📊 View Detailed Test Report

🔗 Action Run #93

Tests run against preprod network with live blockchain data

1 similar comment
@github-actions
Copy link
Contributor

✅ Preprod Tests: PASSED

📊 View Detailed Test Report

🔗 Action Run #93

Tests run against preprod network with live blockchain data

@matiwinnetou matiwinnetou force-pushed the operations-parsing-refak branch from 83ad587 to 6b2f28a Compare November 14, 2025 11:43
Mateusz Czeladka added 2 commits November 14, 2025 14:24
Remove duplicate dRepVoteDelegation operations from integration test
golden files. These duplicates were appearing due to the certificate
processing logic creating operations twice.

This fix aligns with the TransactionOperationParser refactoring that
properly handles DRep vote delegation certificates.
@matiwinnetou matiwinnetou force-pushed the operations-parsing-refak branch from 6b2f28a to 45c05cd Compare November 14, 2025 13:27
@matiwinnetou matiwinnetou marked this pull request as ready for review November 14, 2025 14:03
invariants

Fixed 4 failing /construction/parse golden tests that had duplicate
operations at index 3. Tests expected 5 operations but API correctly
returned 4.

Added operation invariant tests to prevent ordering bugs:
- assert_operations_ordered() - ensures operations sorted by index
- assert_operations_sequential() - ensures indices [0, 1, 2, ...]

Covers /search/transactions, /block, and /block/transaction endpoints.

This would have caught the bug where /construction/parse returns
operations in processing order (inputs → outputs → certs → withdrawals)
instead of sorted by operation_identifier.index.
@linconvidal
Copy link
Member

I fixed the other failing tests but found a small issue with the /construction/parse endpoint.

The API is returning operations in the order they were processed (inputs → outputs → certs → withdrawals), but the test expects them sorted by their operation_identifier.index values.

uv run tests/integration/test_construction_api.py -u http://localhost:8082 "parse/complex_transactions/withdrawal_with_drep_delegation.json"

Expected: Array ordered by index [0, 1, 2, 3]

{
  "operations": [
    { "operation_identifier": { "index": 0 }, "type": "input", ... },
    { "operation_identifier": { "index": 1 }, "type": "output", ... },
    { "operation_identifier": { "index": 2 }, "type": "withdrawal", "amount": {...}, ... },
    { "operation_identifier": { "index": 3 }, "type": "dRepVoteDelegation", ... }
  ]
}

Actual: Array ordered [0, 1, 3, 2]

{
  "operations": [
    { "operation_identifier": { "index": 0 }, "type": "input", ... },
    { "operation_identifier": { "index": 1 }, "type": "output", ... },
    { "operation_identifier": { "index": 3 }, "type": "dRepVoteDelegation", ... },
    { "operation_identifier": { "index": 2 }, "type": "withdrawal", "amount": {...}, ... }
  ]
}

The test fails because it accesses operations[2] expecting the withdrawal (index 2), but gets the dRepVoteDelegation (index 3) instead → operations[2].amount: Missing in actual response.

We just need to sort the operations list by index before returning it.

@cardano-foundation cardano-foundation deleted a comment from github-actions bot Nov 20, 2025
@cardano-foundation cardano-foundation deleted a comment from github-actions bot Nov 20, 2025
- Sort operations by operation_identifier.index before returning
  from getOperationsFromTransactionData() to ensure consistent
  ordering (0, 1, 2, ...)
- Add OperationOrdering test class with shouldReturnOperationsSortedByIndex
  test to verify sorting behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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.

3 participants