Skip to content

Conversation

@nelsonksh
Copy link

@nelsonksh nelsonksh commented Oct 12, 2025

Summary by CodeRabbit

  • New Features
    • Transaction watch stream now includes the full originating block with each event, providing richer context for consumers.
    • Cardano block data and native serialized bytes are embedded alongside transactions to improve traceability and analysis.
    • Backward-compatible: existing clients continue to work while receiving additional block information for more comprehensive processing.

@nelsonksh nelsonksh requested a review from scarmuega as a code owner October 12, 2025 16:01
@coderabbitai
Copy link

coderabbitai bot commented Oct 12, 2025

Walkthrough

The change updates block_to_txs in src/serve/grpc/watch.rs to populate AnyChainTx.block with a constructed AnyChainBlock (native_bytes from the block body and chain = Cardano with CBOR via mapper.map_block_cbor(body)). Previously block was None. No public signatures changed.

Changes

Cohort / File(s) Summary
gRPC watch: enrich AnyChainTx with block
src/serve/grpc/watch.rs
Populate AnyChainTx.block with AnyChainBlock (native_bytes from body; chain = Cardano(mapper.map_block_cbor(body))). Replaces prior None placeholder. No signature or public API changes.

Sequence Diagram(s)

sequenceDiagram
    participant Source as Chain Source
    participant Watch as Watcher (block_to_txs)
    participant Map as Mapper
    participant GRPC as gRPC Server
    participant Client as Client

    Source->>Watch: Emit block body
    rect rgb(235,255,235)
    note over Watch: New behavior — embed block
    Watch->>Map: map_block_cbor(body)
    Map-->>Watch: block_cbor
    Watch->>Watch: Build AnyChainBlock(native_bytes, chain=Cardano(block_cbor))
    Watch->>GRPC: AnyChainTx{ tx, block: Some(AnyChainBlock) }
    GRPC-->>Client: Stream AnyChainTx with block populated
    end

    rect rgb(245,245,245)
    note over Watch: Prior behavior — no block
    Watch->>GRPC: AnyChainTx{ tx, block: None }
    GRPC-->>Client: Stream AnyChainTx without block
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibbled bytes from Cardano’s stream,
Lifted a body into a blocky dream;
CBOR crumbs tucked neat inside,
Now transactions travel with a guide—
Thump-thump! my paws applaud the tweak,
Blocks ride along whenever clients peek. 🥕✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 succinctly captures the main change of embedding a block into WatchTx within the utxorpc service, matching the internal update that populates the block field in the returned transactions.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af80f39 and 2469b06.

📒 Files selected for processing (1)
  • src/serve/grpc/watch.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/serve/grpc/watch.rs

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee4e732 and af80f39.

📒 Files selected for processing (1)
  • src/serve/grpc/watch.rs (1 hunks)

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.

2 participants