Skip to content

fix: skip scraper lookup for txHash#8517

Open
troykessler wants to merge 7 commits intomainfrom
fix/skip-txhash-lookup
Open

fix: skip scraper lookup for txHash#8517
troykessler wants to merge 7 commits intomainfrom
fix/skip-txhash-lookup

Conversation

@troykessler
Copy link
Copy Markdown
Contributor

@troykessler troykessler commented Apr 3, 2026

Description

This PR improves relaying speed for cctp fast transfers by storing the origin tx hash for each message id and submitting it to the ccip-server so it does not need to make an expensive scraper lookup.

Drive-by changes

Related issues

Backward compatibility

The origin_tx_hash is optional and therefore fully backwards compatible

Testing

Deployed on testnet cctp fast transfer route and updated the testnet relayer and offchain lookup server for testing, it is confirmed that the scraper is being skipped now


Open with Devin

@troykessler troykessler requested a review from nambrot April 3, 2026 15:44
@troykessler troykessler self-assigned this Apr 3, 2026
@github-project-automation github-project-automation bot moved this to In Review in Hyperlane Tasks Apr 3, 2026
@troykessler troykessler changed the title fix: skip txhash lookup fix: optimize cctip fast transfer Apr 3, 2026
@troykessler troykessler force-pushed the fix/skip-txhash-lookup branch from 40d4cb1 to 882c034 Compare April 7, 2026 06:34
@troykessler troykessler changed the title fix: optimize cctip fast transfer fix: skip scraper lookup for txHash Apr 7, 2026
@troykessler troykessler marked this pull request as ready for review April 7, 2026 06:57
devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Adds storage and propagation of an origin transaction hash: DB APIs and RocksDB persist/retrieve H512 by message ID; relayer retrieves and includes origin_tx_hash in CCIP-read offchain requests; TypeScript CCIP service accepts and prefers a provided origin_tx_hash for attestation lookup.

Changes

Cohort / File(s) Summary
Release Configuration
\.changeset/odd-turtles-rhyme.md
New changeset marking a patch release for @hyperlane-xyz/ccip-server recording the origin transaction hash skip-scraper behavior.
Database Trait & Implementations
rust/main/hyperlane-base/src/db/mod.rs, rust/main/hyperlane-base/src/db/rocks/hyperlane_db.rs
Added H512 support and store_dispatched_tx_hash_by_message_id / retrieve_dispatched_tx_hash_by_message_id to HyperlaneDb; RocksDB persists and retrieves H512 keyed by message ID.
Database Tests
rust/main/hyperlane-base/src/db/rocks/test_utils.rs, rust/main/hyperlane-base/src/tests/mock_hyperlane_db.rs
Added test validating store/retrieve of dispatched tx hash and updated mock DB to include new methods/signatures.
Relayer Metadata Building
rust/main/agents/relayer/src/msg/metadata/base_builder.rs, rust/main/agents/relayer/src/msg/metadata/ccip_read/mod.rs
Extended BuildsBaseMetadata with retrieve_origin_tx_hash_by_message_id; relayer fetch populates origin_tx_hash, converts H512 to hex, logs, and includes it in offchain request body; added request/response debug traces.
Relayer Mocks/Tests
rust/main/agents/relayer/src/test_utils/mock_base_builder.rs
Mock base builder implements new retrieve_origin_tx_hash_by_message_id method (returns Ok(None) in mock).
TypeScript Service
typescript/ccip-server/src/services/CCTPService.ts
getCCTPAttestation signature changed to accept originTxHash; POST handler extracts and validates origin_tx_hash and the service prefers provided hash, otherwise falls back to DB/scraper lookup.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant TSService as TypeScript Service
    participant Relayer as Rust Relayer
    participant DB as RocksDB
    participant Scraper as Scraper/Fallback

    rect rgba(100, 200, 150, 0.5)
    Note over Client,TSService: Client may send origin_tx_hash to service
    end

    Client->>TSService: POST /getCctpAttestation (message, origin_tx_hash?)
    TSService->>TSService: Validate origin_tx_hash
    alt origin_tx_hash provided
        TSService->>TSService: Use provided origin_tx_hash
    else no origin_tx_hash
        TSService->>Relayer: request origin tx hash by message id
        Relayer->>DB: retrieve_dispatched_tx_hash_by_message_id(message_id)
        DB-->>Relayer: Option<H512>
        Relayer->>Relayer: Convert H512 → hex string
        Relayer-->>TSService: origin_tx_hash (or none)
        alt origin_tx_hash returned
            TSService->>TSService: Use relayer-provided origin_tx_hash
        else
            TSService->>Scraper: fallback scraper lookup
            Scraper-->>TSService: tx_hash (or none)
        end
    end
    TSService->>TSService: Resolve attestation with tx_hash
    TSService-->>Client: Attestation response
Loading
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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
Title check ✅ Passed The title accurately describes the main change—skipping scraper lookup for transaction hashes by storing and submitting origin tx hashes.
Description check ✅ Passed The PR description covers all required sections: clear description of the change, backward compatibility discussion, and testing details. Well-structured and comprehensive.

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

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


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.

coderabbitai[bot]

This comment was marked as resolved.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.21%. Comparing base (aba2261) to head (f9f718f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8517   +/-   ##
=======================================
  Coverage   77.21%   77.21%           
=======================================
  Files         130      130           
  Lines        3533     3533           
  Branches      294      294           
=======================================
  Hits         2728     2728           
  Misses        788      788           
  Partials       17       17           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 74.55% <ø> (ø)
isms 81.46% <ø> (ø)
token 87.33% <ø> (ø)
middlewares 87.87% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

devin-ai-integration[bot]

This comment was marked as resolved.

@paulbalaji
Copy link
Copy Markdown
Collaborator

@claude review

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 7, 2026

Claude finished @paulbalaji's task in 4m 2s —— View job


PR Review: fix: skip scraper lookup for txHash

  • Gather context and understand changes
  • Run security and code review
  • Post inline PR review comments

Review submitted as a consolidated PR review with inline comments.

Summary: Solid PR overall. The fix: pr review commit addressed prior feedback well (GET handler fix, runtime validation replacing as cast). One remaining item: the .ok().flatten() in the Rust CCIP-read path silently swallows DB errors — should log a warning on failure for debuggability.

claude[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rust/main/agents/relayer/src/msg/metadata/ccip_read/mod.rs`:
- Around line 296-300: The debug logging currently dumps sensitive payloads via
the tracing::debug call that includes ?body (and similarly the raw response body
around the other tracing::debug), so replace those direct dumps with
non-sensitive metadata: log interpolated_url as before but change ?body to a
size or presence indicator (e.g., body.len() or "present"/"empty") and for the
response log record response length/status or a short hex hash (not full
content); update the tracing::debug invocations in the offchain lookup POST send
(the call that references interpolated_url and body) and the subsequent response
logging (the later tracing::debug that logs the raw response body) to use
size/presence or hash instead of dumping raw payloads.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 953501d0-8c37-469e-8ae2-18c83efc116f

📥 Commits

Reviewing files that changed from the base of the PR and between f9f718f and 746d6ad.

📒 Files selected for processing (2)
  • rust/main/agents/relayer/src/msg/metadata/ccip_read/mod.rs
  • typescript/ccip-server/src/services/CCTPService.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • typescript/ccip-server/src/services/CCTPService.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants