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: meta=eof for IPIP-431; ask for and expect (but not require) from http fetches #378

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Aug 11, 2023

@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2023

Codecov Report

Merging #378 (edff039) into main (26c5ca7) will decrease coverage by 0.27%.
The diff coverage is 61.76%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
- Coverage   77.40%   77.14%   -0.27%     
==========================================
  Files          86       87       +1     
  Lines        6423     6493      +70     
==========================================
+ Hits         4972     5009      +37     
- Misses       1194     1223      +29     
- Partials      257      261       +4     
Files Changed Coverage Δ
cmd/lassie/fetch.go 31.54% <0.00%> (-0.39%) ⬇️
pkg/types/types.go 80.26% <0.00%> (+2.63%) ⬆️
pkg/retriever/httpretriever.go 73.97% <41.66%> (-11.75%) ⬇️
pkg/httputil/server.go 75.51% <50.00%> (ø)
pkg/internal/testutil/mockroundtripper.go 81.95% <78.57%> (-0.62%) ⬇️
pkg/server/http/ipfs.go 88.02% <87.50%> (ø)
pkg/httputil/metadata/metadata.go 91.66% <91.66%> (ø)
pkg/verifiedcar/verifiedcar.go 83.22% <100.00%> (ø)

@rvagg
Copy link
Member Author

rvagg commented Aug 11, 2023

$ go run ./cmd/lassie fetch -p --provider /ip4/127.0.0.1/tcp/3030/http/p2p/12D3KooWSQ1Qg74oMQ7uAHh8gtME2HdENJMiaoyLnjDQn3drvagg bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze/wiki/Dog
Fetching bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze/wiki/Dog from specified provider(s)
Querying indexer for bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze...
Using the specified storage provider(s):
        12D3KooWSQ1Qg74oMQ7uAHh8gtME2HdENJMiaoyLnjDQn3drvagg, Protocols: [transport-ipfs-gateway-http]
Retrieving from [12D3KooWSQ1Qg74oMQ7uAHh8gtME2HdENJMiaoyLnjDQn3drvagg] (started-retrieval)...
Retrieving from [12D3KooWSQ1Qg74oMQ7uAHh8gtME2HdENJMiaoyLnjDQn3drvagg] (connected-to-provider)...
Retrieving from [12D3KooWSQ1Qg74oMQ7uAHh8gtME2HdENJMiaoyLnjDQn3drvagg] (first-byte-received)...
Received 8 blocks / 452 KiB...
Fetched [bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze] from [12D3KooWSQ1Qg74oMQ7uAHh8gtME2HdENJMiaoyLnjDQn3drvagg]:
        Duration: 9.924479ms
          Blocks: 8
           Bytes: 452 KiB
        Checksum: 1e20fb44804ec610f99a65afbb413b0656fec971541afc411eda58c4dd34a12eba01

Running on a local version of ipld/frisbii#15 that handles meta=eof, we decode the metadata and check it against what we have and report the checksum value to stdout. If the upstream doesn't know about meta=eof then it just processes it as normal, and doesn't print the checksum.

(Note the "checksum" here is in lieu of whatever the eventual signed thing needs to be as per IPIP-431, this is for demonstration purposes for now).

/cc @bajtos @lidel

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.

2 participants