Skip to content

Conversation

@NikolasHaimerl
Copy link
Contributor

@NikolasHaimerl NikolasHaimerl commented Apr 1, 2025

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 changed the title feat: add index probier library feat: add index provider library Apr 2, 2025
juliangruber
juliangruber previously approved these changes Apr 2, 2025
@juliangruber juliangruber dismissed their stale review April 2, 2025 10:27

forgot the one change request

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.

The change looks pretty good, let's improve the details.

@NikolasHaimerl
Copy link
Contributor Author

@bajtos it seems like the GLIF token we use for RPC calls cannot be used as well for the smart contract calls: https://github.com/CheckerNetwork/spark-deal-observer/actions/runs/14218917560/job/39841932436?pr=143#step:7:125

Should I use the RPC_AUTH from spark checker for the smart contract calls instead?
I am not 100% sure what the difference in those tokens is but it seems that if I use the one from spark-checker the smart contract calls work.

@NikolasHaimerl
Copy link
Contributor Author

Re: GLIF API token.

According to https://github.com/CheckerNetwork/spark-deal-observer/settings/secrets/actions, this repository uses the same Glif API token we use in all other GH repositories, too (it's an org-wide secret).

Places to check:

* Does the CI workflow propagate the secret to the env vars?

* Does your test code read the API token from the correct env var?

I suggest adding an assertion to verify that the API token is set so that tests fail early with a helpful error message if the token is not provided.

It seems like the GLIF_TOKEN is not picked up although it is set as a secret for the repo. I'll have a look.

Nikolas Haimerl and others added 3 commits April 2, 2025 16:59
@NikolasHaimerl
Copy link
Contributor Author

@bajtos @juliangruber authentication issue should be fixed now.

@juliangruber
Copy link
Member

juliangruber commented Apr 3, 2025

Blocked by #145

@bajtos
Copy link
Member

bajtos commented Apr 4, 2025

Blocked by #145

I disagree.

  • The current version on the main branch does not configure any timeouts for RPC API calls, see https://github.com/search?q=repo%3ACheckerNetwork%2Fspark-deal-observer%20timeout&type=code
  • This PR is a critical piece we need to ship to support Curio DDO deals. We have been working on that feature for 3 weeks now. I want to finish it ASAP.
  • Requiring this PR to introduce timeouts for RPC API calls is IMO a scope creep delaying an important feature from being shipped.

I propose the following steps forward:

  • Land this PR as soon as we have a version that works and with an acceptable code quality
  • Add timeouts and better TypeScript types as part of this milestone, but only after we finish other tasks required to allow Spark to test Curio DDO deals.

import {
getIndexProviderPeerId,
MINER_TO_PEERID_CONTRACT_ADDRESS, MINER_TO_PEERID_CONTRACT_ABI
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

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

Is there any follow-up issue (or a check-list item in an existing issue) to remind us that we need to remove this ts-ignore directive once index-provider-peer-id includes type definitions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is already a PR for it closing the issue that is tracking this: CheckerNetwork/index-provider-peer-id#21

Copy link
Member

Choose a reason for hiding this comment

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

I am confused. After you land that pull request and auto-close the issue, who is going to edit backend/lib/resolve-payload-cids.js in this repository to remove the // @ts-ignore line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After the pull request CheckerNetwork/index-provider-peer-id#21 is merged I can update the npm package version and then I should be able to remove the // @ts-ignore in all three repos.

Copy link
Member

Choose a reason for hiding this comment

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

Excellent!

My question at the top of this thread was about ensuring this cleanup task is not forgotten.

Is there any follow-up issue (or a check-list item in an existing issue) to remind us that we need to remove this ts-ignore directive once index-provider-peer-id includes type definitions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created subtasks in the original issue to keep track

Comment on lines 34 to 40
const getPeerId = async (/** @type {number} */ minerId) => {
const peerId = minerPeerIds.get(`f0${minerId}`)?.PeerId
if (!peerId) {
throw new Error(`Peer ID not found for miner ID: ${minerId}`)
}
return Promise.resolve({ peerId, source: 'TEST' })
}
Copy link
Member

Choose a reason for hiding this comment

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

Either remove the async keyword or make it return { peerId, source.. }, having both is redundant (you're creating a promise that's resolving with a promise that's resolving with the value).

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 330d290

@NikolasHaimerl NikolasHaimerl enabled auto-merge (squash) April 8, 2025 10:26
@NikolasHaimerl NikolasHaimerl merged commit 7a2a314 into main Apr 8, 2025
8 checks passed
@NikolasHaimerl NikolasHaimerl deleted the nhaimerl-add-index-probier-library branch April 8, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants