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

chore: update to new multiformats #220

Merged
merged 9 commits into from
Jul 7, 2021

Conversation

achingbrain
Copy link
Member

Uses new CID class. Also swaps out various chai deps for version
bundled with aegir, updates aegir and fixes tests that start services
without tearing them down which stops the tests from finishing.

Uses new CID class.  Also swaps out various chai deps for version
bundled with aegir, updates aegir and fixes tests that start services
without tearing them down which stops the tests from finishing.
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

Mostly minor stuff, some are learnings from @rvagg cid import flags in ipfs-repo

src/utils.js Outdated
reject(errcode(new Error('Async function did not complete before timeout'), 'ETIMEDOUT'))
}, time)

if (timeout && timeout.unref) {
Copy link
Member

Choose a reason for hiding this comment

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

setTimeout return a number, timeoutId. Type checker is failing here as a consequence

Copy link
Member Author

Choose a reason for hiding this comment

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

In node it returns a Timeout which has an unref method property. Weird, maybe we need to tell ts that it's used under node.

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'm managed to refactor this away after removing the unnecessary async and using the p-timeout module instead of Promise.race.

src/content-routing/index.js Outdated Show resolved Hide resolved
@@ -28,19 +28,34 @@ export class Record implements IRecord {
constructor(p?: IRecord);

/** Record key. */
public key: Uint8Array;
public key?: (Uint8Array|null);
Copy link
Member

Choose a reason for hiding this comment

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

was this generated?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'm not sure why this changed, new patch release of protobufjs I guess?

src/providers.js Outdated Show resolved Hide resolved
src/rpc/handlers/add-provider.js Outdated Show resolved Hide resolved
src/rpc/handlers/get-providers.js Outdated Show resolved Hide resolved
src/index.js Outdated
this._running = false
this.randomWalk.stop()
this.providers.stop()
await this.network.stop()
Copy link
Member

Choose a reason for hiding this comment

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

This does not need to be a promise, but network.stop and network.start need to be fixed. Registrar does not return a promise anymore: https://github.com/libp2p/js-libp2p/blob/master/src/registrar.js#L87

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've removed all of the unnecessary async.

test/providers.spec.js Outdated Show resolved Hide resolved
test/utils/create-values.js Outdated Show resolved Hide resolved
@achingbrain achingbrain marked this pull request as draft May 26, 2021 14:07
@achingbrain
Copy link
Member Author

I've marked this as a draft so we can merge it when #3556 is green as it'll bubble everything all the way up. Please do continue review and/or approve as appropriate.

src/index.js Outdated Show resolved Hide resolved
achingbrain and others added 3 commits July 6, 2021 20:15
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
…js-libp2p-kad-dht into chore/update-to-new-multiformats
@achingbrain achingbrain marked this pull request as ready for review July 7, 2021 11:14
@achingbrain achingbrain merged commit 565eb00 into master Jul 7, 2021
@achingbrain achingbrain deleted the chore/update-to-new-multiformats branch July 7, 2021 12:58
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.

2 participants