-
Notifications
You must be signed in to change notification settings - Fork 9
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!: add circuitv2 relay tests #83
Conversation
@@ -64,11 +64,11 @@ function runConnectTests (name: string, factory: DaemonFactory, optionsA: SpawnO | |||
|
|||
// verify connected peers | |||
const knownPeersAfterConnect1 = await daemons[0].client.listPeers() | |||
expect(knownPeersAfterConnect1).to.have.lengthOf(1) | |||
expect(knownPeersAfterConnect1).to.have.length.greaterThanOrEqual(1) |
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.
listPeers
was returning two peers with the same peer ID. On further inspection, this was the same peer with two different local addresses. eg. Peer A has addresses /ip4/127.0.0.1/tcp/36543
and /ip4/192.168.1.2/tcp/36543
src/pubsub/floodsub.ts
Outdated
@@ -12,8 +13,9 @@ export function floodsubTests (factory: DaemonFactory) { | |||
for (const typeB of nodeTypes) { | |||
runFloodsubTests( | |||
factory, | |||
{ type: typeA, pubsub: true, pubsubRouter: 'floodsub' }, | |||
{ type: typeB, pubsub: true, pubsubRouter: 'floodsub' } | |||
// RSA key ensures the `key` field is set in the generated signed message |
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.
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.
Since libp2p/js-libp2p-pubsub#118 has been merged can all the pubsub related changes can be reverted, or are they still necessary?
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 seems like tests are still failing with:
libp2p:pubsub starting +8ms
libp2p:pubsub started +5ms
libp2p:pubsub connected 12D3KooWBaiBJ1ngvSyYJYYnKuEQNWx2j4b3s2z8c3z5shGLRM8U +60ms
libp2p:pubsub new peer 12D3KooWBaiBJ1ngvSyYJYYnKuEQNWx2j4b3s2z8c3z5shGLRM8U +48ms
libp2p:pubsub rpc from 12D3KooWBaiBJ1ngvSyYJYYnKuEQNWx2j4b3s2z8c3z5shGLRM8U +1ms
libp2p:pubsub subscribe to topic: test-topic +3ms
libp2p:pubsub rpc from 12D3KooWBaiBJ1ngvSyYJYYnKuEQNWx2j4b3s2z8c3z5shGLRM8U +802ms
libp2p:pubsub messages from 12D3KooWBaiBJ1ngvSyYJYYnKuEQNWx2j4b3s2z8c3z5shGLRM8U +1ms
libp2p:pubsub:error CodeError: Need key when signature policy is StrictSign but it was missing
libp2p:pubsub:error at EventTarget.getMsgId (file:///home/ckousik/projects/js-libp2p/node_modules/@libp2p/pubsub/src/index.ts:458:17)
libp2p:pubsub:error at EventTarget.processMessage (file:///home/ckousik/projects/js-libp2p/node_modules/@libp2p/floodsub/src/index.ts:76:31)
libp2p:pubsub:error at file:///home/ckousik/projects/js-libp2p/node_modules/@libp2p/pubsub/src/index.ts:376:22
libp2p:pubsub:error at processTicksAndRejections (node:internal/process/task_queues:96:5)
libp2p:pubsub:error at file:///home/ckousik/projects/js-libp2p/node_modules/p-queue/dist/index.js:118:36 +0ms
^C libp2p:pubsub stopping +2s
libp2p:pubsub delete peer 12D3KooWBaiBJ1ngvSyYJYYnKuEQNWx2j4b3s2z8c3z5shGLRM8U +0ms
libp2p:pubsub stopped +0ms
Could we merge this and open an issue for updating libp2p/pubsub and reverting this change?
depends on libp2p/js-libp2p-pubsub#118 |
@ckousik please request a review when this is ready again. Thank you! |
95e5d46
to
2336330
Compare
It seems like this PR is ready for review again cc @MarcoPolo There is one unresolved question here from @achingbrain though: #83 (comment) |
src/relay/index.ts
Outdated
// without this the socket can close before we receive a response | ||
const responseReceived = defer() | ||
const input = [uint8ArrayFromString('test')] | ||
const output = await pipe( |
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.
I don't doubt that this is correct because you tested this. But do you feel like this is confusing? or is it just me? Not saying you could have written this better, just that the iterable + pipe abstraction is confusing to me.
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.
Yeah, so this is the same issue that is observed in the stream tests. Please refer to https://github.com/libp2p/interop/blob/master/src/streams/echo.ts#L77-L94
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.
Oh I see. Latest versions of go-libp2p shouldn't have this issue with ping so you can probably just use the ping protocol.
Fine to not change.
@achingbrain The latest change causes a failure when dialing over js.
The internal error is correct, but it is hidden by https://github.com/libp2p/js-libp2p/blob/master/src/connection-manager/dialer/dial-request.ts#L85 . Should we skip matching the error for js? |
@ckousik this will be fixed by a push to the libp2p branch updating the versions, give me a few minutes. |
Adds circuitv2 relay tests.