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

Update web3.storage API #70

Merged
merged 11 commits into from
Nov 29, 2023
Merged

Update web3.storage API #70

merged 11 commits into from
Nov 29, 2023

Conversation

juliangruber
Copy link
Member

@juliangruber juliangruber commented Nov 24, 2023

Files are now published to the root entry of the CID (vs at /measurements.json), therefore this PR and the spark-api PR need to be merged together.

Links:

@juliangruber juliangruber requested a review from bajtos November 27, 2023 13:20
@juliangruber juliangruber marked this pull request as ready for review November 27, 2023 13:20
lib/preprocess.js Outdated Show resolved Hide resolved
bin/dry-run.js Outdated Show resolved Hide resolved
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 don't see any obvious problem. I have a few questions and discussion points, but none of that is blocking this PR from being merged & deployed.

@bajtos

This comment was marked as outdated.

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 take that back - I think there is a bug.

@@ -47,7 +47,7 @@ const ieContract = new ethers.Contract(
)
const ieContractWithSigner = ieContract.connect(signer)
const web3Storage = new Web3Storage({ token: WEB3_STORAGE_API_TOKEN })
const fetchMeasurements = (cid) => fetchMeasurementsViaClient(web3Storage, cid)
const fetchMeasurements = (cid) => fetchMeasurementsTrustless(web3Storage, cid)
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a bug to me, fetchMeasurementsTrustless accepts a single argument:

export const fetchMeasurementsTrustless = async cid => {

Can you please add some tests for this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just spotted it as well. How do you propose we test this? This is the binary entry point 🤔

Copy link
Member

Choose a reason for hiding this comment

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

How do you propose we test this? This is the binary entry point 🤔

Ah, you are right. We haven't figured out how to automatically test our binary entry points yet, and I guess we have bigger fish to fry.

How about testing this manually - run the service locally (via npm start?), wait for the first measurement to be committed on the chain, and check it's correctly fetched.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess Typescript is the most exciting option for bin script validation. Will run manually though for now

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.

LGTM with few suggestions to consider.

README.md Show resolved Hide resolved
bin/spark-evaluate.js Outdated Show resolved Hide resolved
lib/preprocess.js Outdated Show resolved Hide resolved
lib/preprocess.js Show resolved Hide resolved
@juliangruber juliangruber merged commit 70b6695 into main Nov 29, 2023
5 checks passed
@juliangruber juliangruber deleted the update/web3storage branch November 29, 2023 13:05
This was referenced Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ done
Development

Successfully merging this pull request may close these issues.

2 participants