js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

feat: circuit v2

Open mpetrunic opened this issue 3 years ago • 4 comments

closes #1029 Implemented:

  • hop protocol + unit tests
  • stop protocol + unit tests
  • integrated into transport with v1 fallback
  • real reservation store
  • sending reservations and maintaining relays
  • reservation client - establishing reservations on relay

Open questions:

  • ~~ what to use as storage for reservation store? ~~
  • the best way to do periodic refreshing of reservations?
  • is there a way for tagging connections as priority so they don't get removed?

~~At this point, test/relay/relay.node.js should pass but it doesn't. From my debugging, it breaks at upgrading connection but cannot figure out why (it hangs and then aborts) so I would appreciate somebody with more knowledge of how it works to take a look at it.~~ - fixed

mpetrunic avatar Feb 25 '22 13:02 mpetrunic

the best way to do periodic refreshing of reservations?

Not sure whether this is a js-libp2p specific question, or a general question. In case it is of some help, below is the reservation renewal state machine in rust-libp2p:

https://github.com/libp2p/rust-libp2p/blob/fd31d61a7f9ca652e4adb006e2a16a8a5a32ccea/protocols/relay/src/v2/client/handler.rs#L588-L716

mxinden avatar Feb 28 '22 15:02 mxinden

the best way to do periodic refreshing of reservations?

Not sure whether this is a js-libp2p specific question, or a general question. In case it is of some help, below is the reservation renewal state machine in rust-libp2p:

https://github.com/libp2p/rust-libp2p/blob/fd31d61a7f9ca652e4adb006e2a16a8a5a32ccea/protocols/relay/src/v2/client/handler.rs#L588-L716

Tnx that is certainly useful. But yeah, seems like it's too part question, as I'm also curious where to put that code inside js-libp2p 😅

mpetrunic avatar Feb 28 '22 15:02 mpetrunic

@achingbrain Could you help me with test/dialing/resolver.spec.js It seems like it's trying to use libp2p from aegir.js as a relay but in circuiv2 it takes too long to create a reservation with that libp2p and test fails before that happens. Any ideas on how to fix/circumvent that.

I could easily fix it if I could get access to that libp2p variable as I could stub reservation before test starts.

mpetrunic avatar Mar 23 '22 13:03 mpetrunic

@achingbrain @wemeetagain finally got this in a working state. There is probably a lot of weird stuff as this PR has gone trough numerous merges with a lot of conflicts

mpetrunic avatar Jul 31 '22 09:07 mpetrunic

@mpetrunic @achingbrain : what are the next steps for getting this over the line? Is it just about code review?

BigLep avatar Sep 27 '22 12:09 BigLep

This is still missing the ability to purge expired reservations but not sure how to architect this as I would need to figure out where to put the reservation store so that it became Startable.

mpetrunic avatar Oct 07 '22 10:10 mpetrunic

closing in favor of https://github.com/libp2p/js-libp2p/pull/1475

p-shahi avatar Nov 07 '22 22:11 p-shahi