Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

feat: add index provider library#7

Merged
NikolasHaimerl merged 14 commits intomainfrom
nhaimerl-add-index-probier-library
Apr 8, 2025
Merged

feat: add index provider library#7
NikolasHaimerl merged 14 commits intomainfrom
nhaimerl-add-index-probier-library

Conversation

@NikolasHaimerl
Copy link
Contributor

This PR uses the newly released library to fetch index provider peer ids.

Related to
CheckerNetwork/index-provider-peer-id#10
CheckerNetwork/roadmap#250
CheckerNetwork/roadmap#244

@NikolasHaimerl NikolasHaimerl marked this pull request as ready for review April 1, 2025 20:58
@NikolasHaimerl NikolasHaimerl requested a review from bajtos April 1, 2025 20:58
@NikolasHaimerl NikolasHaimerl changed the title feat: add index probier library feat: add index provider library Apr 2, 2025
Comment on lines 26 to 31
return (
await getIndexProviderPeerId(minerId, smartContractClient, {
rpcUrl: RPC_URL,
rpcAuth: RPC_AUTH,
maxAttempts
})
Copy link
Member

Choose a reason for hiding this comment

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

This line is doing too much. Let's split it into two lines to make the code easier to read.

const { peerId } = await getIndexProviderPeerId(minerId, smartContractClient, {
  rpcUrl: RPC_URL,
  rpcAuth: RPC_AUTH,
  maxAttempts
})

return peerId

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f66700e

@bajtos bajtos requested a review from pyropy April 2, 2025 10:47
Nikolas Haimerl added 2 commits April 2, 2025 12:55
@NikolasHaimerl NikolasHaimerl requested a review from bajtos April 2, 2025 10:59
@pyropy
Copy link
Member

pyropy commented Apr 2, 2025

@NikolasHaimerl I have added the missing github workflows, would you mind merging main branch to your PR?

@bajtos
Copy link
Member

bajtos commented Apr 2, 2025

Let's wait until CheckerNetwork/spark-checker#129 is landed first, and then apply the same changes to this repository.

@NikolasHaimerl
Copy link
Contributor Author

Let's wait until CheckerNetwork/spark-checker#129 is landed first, and then apply the same changes to this repository.

The PR is ready for review now as CheckerNetwork/spark-checker#129 is merged.

const err = new Error(body.error.message)
err.name = 'FilecoinRpcError'
err.code = body.code
console.error(err)
Copy link
Member

Choose a reason for hiding this comment

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

the caller of the function should log. With that removed, we can remove the try/catch altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is the use case scenario here different to CheckerNetwork/spark-checker#129 (comment) ?

Copy link
Member

Choose a reason for hiding this comment

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

No I don't think so. It also seems to me that your commit wasn't yet approved by Miro, right?

My understanding is that it makes sense to wrap a function body in try/catch if you want to modify the error to be consistent, and then rethrow it. Here we're just logging the error and then throwing it. That's not providing any extra value, so should be removed.

Copy link
Member

Choose a reason for hiding this comment

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

I approved CheckerNetwork/spark-checker#129, it was already landed.

I agree we may not need the try/catch block here, but I consider it a detail I can live with.

Copy link
Contributor Author

@NikolasHaimerl NikolasHaimerl Apr 8, 2025

Choose a reason for hiding this comment

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

@juliangruber do you want a change here or should we keep the code in sync with spark-checker?

Copy link
Member

Choose a reason for hiding this comment

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

Up to you, I would prefer to change here and in spark-checker, but don't want to delay the work stream any further. If we keep this as is, I'm sure someone will eventually refactor it.

const err = new Error(body.error.message)
err.name = 'FilecoinRpcError'
err.code = body.code
console.error(err)
Copy link
Member

Choose a reason for hiding this comment

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

I approved CheckerNetwork/spark-checker#129, it was already landed.

I agree we may not need the try/catch block here, but I consider it a detail I can live with.

@NikolasHaimerl NikolasHaimerl merged commit ed11e3b into main Apr 8, 2025
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants