Skip to content

traceFunds can fan out exponentially and hammer Horizon for a single claim #3

Description

@pitah23

Problem

traceFunds() (src/safetynet/tracing.ts) does a breadth-first walk of outgoing payments, following up to perHopLimit (default 10) new addresses per hop for maxHops (default 5) hops, with no cap on the total number of addresses/requests visited. Worst case the frontier grows 10x per hop (10 → 100 → 1,000 → 10,000 → 100,000), meaning a single claim-tracing job can issue on the order of 10^5 Horizon API calls before finishing — or get rate-limited by Horizon partway through and fail the whole trace.

Location

src/safetynet/tracing.ts (traceFunds)

Suggested fix

Add a total-node/request budget (e.g. max 200 addresses across the whole trace) independent of the per-hop and hop-count limits, and stop early once the budget is exhausted rather than only bounding hop depth and per-hop breadth.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions