Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

feat: go-libp2p v0.16.0 #398

Closed
wants to merge 6 commits into from
Closed

feat: go-libp2p v0.16.0 #398

wants to merge 6 commits into from

Conversation

lidel
Copy link
Member

@lidel lidel commented Nov 17, 2021

This PR aims to fix the interop tests in ipfs/kubo#8522 and close #396

  • switch to go-ipfs from WIP: update go-libp2p to v0.16.0 kubo#8522
  • refactortest/utils/circuit.js to use new go-ipfs-config keys
  • disable JS-GO circuit combinations that are not possible due to missing circuit v2 support in JS
  • make node bin/ipfs-interop.js -- -t node --grep "circuit" pass

@lidel lidel force-pushed the feat/go-libp2p-0.16 branch 3 times, most recently from 27beb3b to 9fece46 Compare November 18, 2021 20:56
Q: JS side of things does not seem to support v2 protocol(?)
Q: do we need to diable mdns, bootstrappers and routing to be sure this
works?
@lidel lidel force-pushed the feat/go-libp2p-0.16 branch from 9fece46 to 6d00cc7 Compare November 18, 2021 21:43
Most likely those cases fail because JS is unaware of reservation token
logic present in circuit v2 (or something else).

Need to be revisited after we have v2 in JS.
@lidel
Copy link
Member Author

lidel commented Nov 18, 2021

Refactored GO side of things to leverage circuit v2 and ensure correct relay is used by setting StaticRelays (both added in ipfs/kubo#8522).

Unfortunately JS side of things (js-ipfs running in nodejs or in browser) does not talk circuit v2 and some combinations fail to pass. Landing this in time for go-ipfs 0.11 is unlikely and I think we need to skip them for now – marked all cases with FIXME keyword so we don't forget + will fill issue in js-ipfs repo after this PR is reviewed.


For future reference, combinations which currently do not pass:

  • terse notation:
    a-r-b – node a talking to node b over relay r
    js is js-ipfs in node
    browser is js in a browser context (a regular webpage, for sake of making this list short)
    go is go-ipfs with circuit v2 (acting as a relay client or providing the service)
    💚 cigar (circuit works, both connect and send. note: if JS is the relay, means everyone involved speaks v1)
    💢 no cigar (failure, either connect or send)

  • test/circuit/all.js

    • 💚 go-go-go
    • 💢 js-go-go
    • 💢 go-go-js
    • 💢 js-go-js
    • 💚 go-js-go
    • 💚 js-js-go
    • 💚 go-js-js
    • 💚 js-js-js
  • test/circuit/browser.js

    • 💢 browser-go-js
    • 💢 browser-go-go
    • 💚 browser-js-js
    • 💚 browser-js-go
    • 💢 js-go-browser
    • 💢 go-go-browser
    • 💚 js-js-browser
    • 💚 go-js-browser
    • 💢 go-browser-browser (was already skipped due to lack of webrtc in go)
    • 💚 js-browser-browser
    • 💚 browser-browser-go
    • 💚 browser-browser-js

If I read this correctly, JS-IPFS cant use GO-IPFS relays v2 (fails in both node and browser scenarios), and needs to use v1 from js-ipfs until support for v2 is added to JS.

@lidel
Copy link
Member Author

lidel commented Nov 18, 2021

Sidenote:

  • Circuits that would fail due to JS missing circuit v2 are now skipped
  • CI failure is due to unrelated sharding changes in go-ipfs 0.11

@marten-seemann
Copy link
Member

There are 2 reasons why a test might fail here:

  1. JS doesn't speak circuit v2.
  2. If a Go node is connected to another peer via a v2 relay, it will only open streams for certain protocols (most notably, the hole punching protocol). That means that although a connection was successfully established, we might not be able to use it to transfer a file.

We probably should have another set of tests using relayd as a relay, configured as a v1 relay. With that configuration, all tests that we currently have should pass.

- go-ipfs 0.11+ can only act as relay v2
- js-ipfs remains v1 for now
- we can run relayd as reference implementation of v1 or v2, giving us
  additional check
- relayd can't be run in browser as it does not have ipfsd-ctl/aegir
  tooling go-ipfs and js-ipfs have
We want to see what works and what not
@lidel
Copy link
Member Author

lidel commented Nov 23, 2021

I've split circuit tests into v1 and v2 sections. v1 tests connect and send, v2 only tests connect.

Tests of circuit v1 and v2 work, there is an unrelated failure in hamt shards test - most likely go-ipfs from update-libp2p pulled in some changes

@achingbrain mind eyeballing this PR?

Note:

  • tests for v1 now actually work (previously, go-ipfs was smart enough to ignore relay and connect directly thanks to some combination of hints from DHT/MDNS/Bootstrappers ✨ 💫 )
  • kept old tests (some tests had to be disabled because go-ipfs only support v2)
  • in node, added new tests for v1 and v2 that use relayd (not sure if worth it, but i guess they can show us when js/go implementation is broken, while reference one still works)
  • we don't have JS orchestration for relayd in browsers, js-ipfs provides v1 in those contexts for now (go-ipfs/js-ipfs have a mature setup based on aegir/playwright/ipfsd-ctl where js/go-ipfs is spawned remotely, no such thing exists for relayd and not sure if it is worth the investment, if we expect v2 to land in js-ipfs soon)

latest execa is pure ESM and Electron does not speak that :|
@lidel
Copy link
Member Author

lidel commented Nov 23, 2021

CI was failing due to sharding changes, we continue this in #400 (CI is finally green there)

@lidel lidel closed this Nov 23, 2021
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.

update interop tests for go-libp2p v0.16
2 participants