Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fetch payload CIDs from piece indexer #31

Merged
merged 163 commits into from
Jan 31, 2025
Merged

Conversation

NikolasHaimerl
Copy link
Contributor

@NikolasHaimerl NikolasHaimerl commented Jan 27, 2025

This MR proposes the following changes:

  1. Add a piece cid indexer which fetches miner IDs and payloads for miner IDs and piece CIDs
  2. Add tests for the piece indexer loop
  3. Refactor database access for better code visibility

The lookup operation for piece CIDs is not yet complete. The piece cid indexer does not have all combinations of minerID and piece CID for any built-in actor event. A follow-up PR which deals with this issue is described in this issue.
We do not want to add the piece indexer loop to the list of executables for now. This should be done as soon as missing payloads are also dealt with.

backend/lib/piece-indexer.js Outdated Show resolved Hide resolved
backend/lib/pix-service/service.js Outdated Show resolved Hide resolved
backend/test/deal-observer.test.js Outdated Show resolved Hide resolved
const LOOP_NAME = 'Piece Indexer'
while (true) {
const start = Date.now()
const queryLimit = 1000
Copy link
Member

@juliangruber juliangruber Jan 31, 2025

Choose a reason for hiding this comment

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

How did we come up with this magic number? It defines how many active deals we look at at a time. It looks like by tuning it we control the trade off between processing speed (how many deals to update in a loop iteration) and memory usage (but not concurrency).

Copy link
Member

Choose a reason for hiding this comment

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

I don't remember the details; it's best to ask @NikolasHaimerl. Your description looks correct to me.

This will be easy to tweak later, I think we should pick some reasonable number for now and move on. WDYT?

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

I quickly skimmed throught the latest version and it looks very reasonable to me. I don't see any major issues/blockers.

Copy link
Member

Choose a reason for hiding this comment

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

We already have piece-indexer - see https://github.com/CheckerNetwork/piece-indexer

How about calling this file piece-indexer-client.js?

(Not blocking this PR from landing.)

Copy link
Member

Choose a reason for hiding this comment

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

Good call, I found that confusing as well. Will fix

@juliangruber juliangruber merged commit 94a6c1e into main Jan 31, 2025
8 checks passed
@juliangruber juliangruber deleted the nhaimerl-piece-indexer branch January 31, 2025 19:04
Copy link

sentry-io bot commented Jan 31, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: Failed to make RPC request. getDealPayloadCid(piece-indexer-service) View Issue
  • ‼️ Error: Failed to make RPC request Filecoin.ChainHead rpcRequest(service) View Issue
  • ‼️ Error: Failed to make RPC request Filecoin.GetActorEventsRaw rpcRequest(service) View Issue
  • ‼️ error: relation "active_deals" does not exist loadDeals(deal-observer) View Issue
  • ‼️ Error: Connection terminated unexpectedly loadDeals(deal-observer) View Issue

Did you find this useful? React with a 👍 or 👎

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.

4 participants