-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Context
The tx_unpacker maintains a UTxORegistry that tracks the live UTxO set, mapping TxOutRef → TxIdentifier. This enables converting transaction inputs into UTxOIdentifier (block_number + tx_index + output_index) for downstream modules like utxo_state.
When processing a transaction, the tx_unpacker:
- Looks up inputs in its registry to get the
TxIdentifier(to createUTxOIdentifier) - Removes those inputs from the registry (they're spent)
- Adds the new outputs to the registry
Problem
When bootstrapping from a snapshot, we bypass tx_unpacker entirely:
utxo_stategets the full UTxO set from the snapshottx_unpacker's registry remains empty
When new blocks arrive post-snapshot, tx_unpacker can't resolve inputs to UTxOIdentifier because they never passed through it. The tx_unpacker doesn't crash—it silently drops unresolvable inputs and logs an error. The result is incomplete delta messages where spent UTxOs never get marked as spent in utxo_state.
We cannot bootstrap the UTxORegistry from the snapshot because it doesn't contain block_number or tx_index—only TxOutRef (tx_hash + output_index).
Options Discussed
-
Revert to TxHash-based identifiers — Simpler and safer; removes dependency on block_number/tx_index. Need to assess memory impact on other modules (e.g., Address State)
-
Invent synthetic serial numbers — Pass snapshot through
tx_unpackerwith invented identifiers. Unclear if other components constructUTxOIdentifierfrom block_number independently. -
Bootstrap the registry somehow — Not feasible without the required data in snapshots.
Additional Consideration
The /tx/utxos endpoint requires data not immediately available in the requested transaction:
- Input UTxO values (chain_store could look these up)
- Hash of tx that consumed outputs (currently falls through the gaps)
Acceptance Criteria
- Snapshot bootstrap populates
utxo_statedirectly without breaking input resolution - Post-snapshot blocks correctly mark spent UTxOs
- Determine memory impact of TxHash-based approach on affected modules
- Clarify ownership of consumed_by_tx lookup between chain_store and utxo_state