chore: config typescript#904
Conversation
141f2b3 to
170ebfb
Compare
| - uses: actions/checkout@v2 | ||
| - run: yarn | ||
| - run: yarn lint | ||
| - run: npm install |
There was a problem hiding this comment.
Because yarn does not run prepare in the dependencies, libp2p-interfaces branch does not have types
| concurrency = MAX_PARALLEL_DIALS, | ||
| timeout = DIAL_TIMEOUT, | ||
| perPeerLimit = MAX_PER_PEER_DIALS, | ||
| maxParallelDials = MAX_PARALLEL_DIALS, |
There was a problem hiding this comment.
This is an internal breaking change. No one should be creating a dialer from here though. If we don't want to change this, we can create a separate typedef for core options and keep things as they were. However, keeping different names for the same things does not seem the best call
There was a problem hiding this comment.
"No one should be" famous last words, how much confidence do you have in this?
There was a problem hiding this comment.
Does not make sense to require the Dialer and use it as a specific piece. However, I agree and it will be safe to just ship a breaking change at this point
There was a problem hiding this comment.
If you're adding types it's good to ship as a major anyway as there will almost certainly be some disruption.
| * @property {number} [interval = 300e3] | ||
| * @property {number} [timeout = 10e3] | ||
| * | ||
| * @typedef {Object} DhtOptions |
There was a problem hiding this comment.
This should probably go away when we work on the configuration improvements project. We currently also specify the DHT options in https://github.com/libp2p/js-libp2p/blob/master/src/config.js#L52 , but in theory we should accept other DHT implementations and this might mean different configurations.
| // Enforce NIST SP 800-132 | ||
| if (this.opts.passPhrase && this.opts.passPhrase.length < 20) { | ||
| throw new Error('passPhrase must be least 20 characters') | ||
| if (this.opts.pass && this.opts.pass.length < 20) { |
There was a problem hiding this comment.
Same situation as in the Dialer
718bc3d to
09fb967
Compare
09fb967 to
5e9c17d
Compare
5e9c17d to
a3a2f15
Compare
754a7b9 to
59a40a3
Compare
| _maybeDisconnectOne () { | ||
| if (this._options.minConnections < this.connections.size) { | ||
| const peerValues = Array.from(this._peerValues).sort(byPeerValue) | ||
| const peerValues = Array.from(new Map([...this._peerValues.entries()].sort((a, b) => a[1] - b[1]))) |
There was a problem hiding this comment.
This was a bug! this.peerValues is a map<string, number>
| _onDisconnect (connection) { | ||
| for (const [, topology] of this.topologies) { | ||
| topology.disconnect(connection.remotePeer, error) | ||
| topology.disconnect(connection.remotePeer) |
There was a problem hiding this comment.
topology.disconnect only has one parameter
59a40a3 to
a18ed22
Compare
9c1d7da to
78019a1
Compare
| "version": "0.0.1", | ||
| "private": true, | ||
| "description": "", | ||
| "main": "dist/index.html", |
There was a problem hiding this comment.
parcel thing per their new updates
| @@ -127,22 +137,24 @@ | |||
| "libp2p-delegated-peer-routing": "^0.8.0", | |||
There was a problem hiding this comment.
lots of ^ in here for <1 dependencies, seems over-optimistic about how this is going to get consumed into the future
There was a problem hiding this comment.
In the future, I would like that we get confidence in the APIs to ship v1 of all the things.
There was a problem hiding this comment.
My personal preference is to get to 1.0.0 ASAP (I've even set my default version to 1.0.0) because of the semver mess below 1 is just madness for signalling and ranges. The rules are basically "YOLO" which is useless for downstream users.
The problem with <0 is that your only signal for "breaking" changes is the minor version, but we've got ^ in here so there's no way to block breaking changes slipping in when we update one of these components. For <1, it's usually best to use ~ to account for the semver-minor bumps for breaking changes. Anyone using the current version of the library, even if they pin to the specific version, is going to get a newer, broken transitive dependency (like libp2p-delegated-peer-routing) when they do their next npm install because we've shipped with ^.
Alternatively, just don't treat 1.0.0 as anything special and ship it so we can use semver properly from there on.
There was a problem hiding this comment.
Yes,I totally agree on this. The team has had a lot of concerns about shipping 1.0.0, but we need to have a plan to get to this point. I think that as part of sudo work we should create a plan on where should we be to land 1.0.0 on everything
There was a problem hiding this comment.
Please ship v1 of things!
Alternatively, just don't treat 1.0.0 as anything special and ship it so we can use semver properly from there on.
Yes!
There was a problem hiding this comment.
we will need to do this refactor as part of the maintenance work and will affect most of our repos. So, this might be a good opportunity to ship v1 of libp2p modules
| */ | ||
|
|
||
| /** | ||
| * @param {{ id: Uint8Array; pubkey: { Type: any, Data: Uint8Array; }; }} exchange |
There was a problem hiding this comment.
fixed by relying on protobufjs instead of protons, which offers us all the types for protobuf definitions
| * Returns a clone of the internal movingAverages | ||
| * | ||
| * @returns {Object} | ||
| * @returns {typeof Object.assign} |
There was a problem hiding this comment.
No need for this, it can be inferred automatically. Good catch
rvagg
left a comment
There was a problem hiding this comment.
what's the versioning strategy going to be with this one? seems like a lot of potential to break for users - aside from the Dialer options the types might introduce breakage?
bd10429 to
2bff878
Compare
My initial idea was to ship a patch, but with all the types changes, I feel it will be safer to release a breaking change. This will have consequences on the release chain of upcoming releases (pinned issues), but they will probably be affected either way. |
58bf45e to
040495d
Compare
f436ef9 to
5159d23
Compare
|
|
||
| // Create the Connection Manager | ||
| if (this._options.connectionManager.minPeers) { // Remove in 0.29 | ||
| // @ts-ignore deprecated, needs to be removed on breaking change |
There was a problem hiding this comment.
Since we are doing a breaking change, I am going to remove this!
c47f022 to
8e91334
Compare
achingbrain
left a comment
There was a problem hiding this comment.
LGTM, just some small nits.
| - uses: actions/checkout@v2 | ||
| - run: yarn | ||
| - run: yarn lint | ||
| - uses: gozala/[email protected] |
There was a problem hiding this comment.
Did this get pulled out intentionally? It is quite useful.
There was a problem hiding this comment.
I changed based on: https://github.com/ipfs/aegir/blob/master/md/github-actions.md
Thought the recommendation was ts -p check
There was a problem hiding this comment.
The error reporter action shows you which lines have errors in a visual form as part of the PR, the aegir command makes you dig through the console output. Both do the same thing and use the same rules but the action is a little more user friendly IMHO.
5d10d7e to
d206a25
Compare
Co-authored-by: Alex Potsides <[email protected]>
d206a25 to
98325d9
Compare
This PR aims to:
anyallowedesbuildThere are internal breaking changes in the Dialer and Keychain property names to match what comes from the external config
Needs:
Unblocks:
Closes: #891
Solves some of the items from #830 (DHT, Config and Keychain)
BREAKING CHANGES:
top level types were updated, [email protected] is used, dialer and keychain internal property names changed and connectionManager minPeers is not supported anymore