Skip to content

feat: extend u5c ledger definition to allow historical utxos queries#723

Open
nicolasLuduena wants to merge 2 commits intotxpipe:mainfrom
nicolasLuduena:resolve-consumed-utxos-u5c
Open

feat: extend u5c ledger definition to allow historical utxos queries#723
nicolasLuduena wants to merge 2 commits intotxpipe:mainfrom
nicolasLuduena:resolve-consumed-utxos-u5c

Conversation

@nicolasLuduena
Copy link
Member

@nicolasLuduena nicolasLuduena commented Jan 14, 2026

Summary by CodeRabbit

  • New Features

    • Added API to retrieve historical UTXOs for missing references.
  • Improvements

    • Transaction mapping now merges historical UTXOs when resolving inputs.
    • Block mapping updated to leverage historical data during processing.
  • Tests

    • Test stubs and unit tests adjusted to compile with the expanded ledger API.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Adds get_historical_utxos(&self, refs: &[TxoRef]) -> Option<UtxoMap> to LedgerContext and enhances Mapper::map_tx to merge historical UTxOs for input refs missing from current UTxOs; tests updated to implement the new trait method in the test stub.

Changes

Cohort / File(s) Summary
LedgerContext trait
pallas-utxorpc/src/lib.rs
Added fn get_historical_utxos(&self, refs: &[TxoRef]) -> Option<UtxoMap>; to the LedgerContext trait.
Mapper mapping logic
pallas-utxorpc/src/lib.rs
Updated map_tx to compute missing_refs after get_utxos, call get_historical_utxos for missing refs when non-empty, and merge returned historical UTxOs into the utxos map before mapping. map_block usage updated to allow mapper access to historical UTxOs.
Tests / stubs
pallas-utxorpc/src/lib.rs (test module)
Implemented get_historical_utxos in the NoLedger test stub returning None and adjusted tests to compile with the expanded trait.

Sequence Diagram(s)

sequenceDiagram
    participant BlockMapper
    participant Mapper
    participant LedgerContext

    BlockMapper->>Mapper: map_tx(tx)
    Mapper->>LedgerContext: get_utxos(all_refs)
    LedgerContext-->>Mapper: current_utxos
    Mapper->>Mapper: compute missing_refs
    alt missing_refs not empty
        Mapper->>LedgerContext: get_historical_utxos(missing_refs)
        LedgerContext-->>Mapper: historical_utxos (or None)
        Mapper->>Mapper: merge historical_utxos into utxos
    end
    Mapper-->>BlockMapper: mapped tx
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through ledgers, sniffed each trace,
Found gaps in fields where UTxOs race,
I fetched the past with a gentle thump,
Merged old and new with a joyful jump,
Now transactions hop home safe and paced. 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: extending the u5c ledger definition to support historical UTXO queries, which is reflected in the new get_historical_utxos API and its integration into the mapping logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4afac8 and ab27006.

📒 Files selected for processing (1)
  • pallas-utxorpc/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pallas-utxorpc/src/lib.rs

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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