-
Notifications
You must be signed in to change notification settings - Fork 0
feat: peer id smart contract lookup #2
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
Conversation
I assume the returned peer id is encoded and needs to be unpacked, rather than being corrupted. If JSON-RPC providers responded with corrupted data, we'd have a bigger issue. In any case, good to use a library then |
Co-authored-by: Julian Gruber <[email protected]>
Co-authored-by: Julian Gruber <[email protected]>
Co-authored-by: Julian Gruber <[email protected]>
Co-authored-by: Julian Gruber <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking great so far 👏🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NikolasHaimerl How is the code in this pull request different from the implementation we have already shipped in spark-checker (via CheckerNetwork/spark-checker#117)?
I'd like to avoid second review of the code I have already approved.
The code is very similar to that from CheckerNetwork/spark-checker#117, the only difference is the repo and the fact that we do not use |
I would assume so, yes. I tried a bunch of different decoding methods including |
Co-authored-by: Julian Gruber <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me, but RPC_AUTH
needs to be passed by the library consumer, and RPC_URL
should be changeable by the consumer.
I personally prefer to document things as they are available, so for now I would document the constants |
I documented the two here: deaacf6 |
I believe you committed this to the wrong branch? |
.github/workflows/ci.yml
Outdated
@@ -13,7 +13,11 @@ jobs: | |||
with: | |||
node-version: 22 | |||
- run: npm ci | |||
env: | |||
RPC_AUTH: ${{secrets.GLIF_API_TOKEN}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm ci
is installing dependencies; why does it need an RPC auth token? Can we remove this env:
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm ci
is installing dependencies; why does it need an RPC auth token? Can we remove thisenv:
block?
@NikolasHaimerl PTAL ☝🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committed in 7263220
Co-authored-by: Miroslav Bajtoš <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
I see two things remaining to address:
ci.yml
comment below- missing documentation in README (did you perhaps accidentally push the commit to a different branch)?
.github/workflows/ci.yml
Outdated
@@ -13,7 +13,11 @@ jobs: | |||
with: | |||
node-version: 22 | |||
- run: npm ci | |||
env: | |||
RPC_AUTH: ${{secrets.GLIF_API_TOKEN}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm ci
is installing dependencies; why does it need an RPC auth token? Can we remove thisenv:
block?
@NikolasHaimerl PTAL ☝🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment + missing docs (wrong branch)
Co-authored-by: Julian Gruber <[email protected]>
…ub.com/CheckerNetwork/index-provider-peer-id into nhaimerl-peer-id-smart-contract-lookup
Yes, too many working branches on this library I feel. The change is in 66c0c16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after you address Julian's two comments above 👏🏻
Co-authored-by: Julian Gruber <[email protected]>
Co-authored-by: Julian Gruber <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(as soon as CI passes) |
…ub.com/CheckerNetwork/index-provider-peer-id into nhaimerl-peer-id-smart-contract-lookup
Smart Contract Client for IPNI Peer ID Resolution
This PR adds a new module that allows retrieving Filecoin index provider peer IDs from the on-chain smart contract. Key additions:
getIndexProviderPeerIdFromSmartContract
function to retrieve peer IDs for miner IDsThis shared module will be used by other Spark components to resolve miner IDs to their corresponding IPNI peer IDs.
I tried using a regular rpc function as we have for spark-checker but I kept getting corrupt data for the Peer Id, so I defaulted back to using ethers and leave the change to rpc usage for a later point in time.
Related to
CheckerNetwork/roadmap#250
CheckerNetwork/spark-checker#118
CheckerNetwork/spark-checker#117