Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/interface-store-6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Sep 16, 2024
2 parents 04fd961 + 9de08ef commit dd3cfd0
Show file tree
Hide file tree
Showing 101 changed files with 838 additions and 574 deletions.
22 changes: 11 additions & 11 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"packages/block-brokers": "3.0.3",
"packages/bitswap": "1.1.3",
"packages/car": "3.2.0",
"packages/dag-cbor": "3.0.5",
"packages/dag-json": "3.0.5",
"packages/helia": "4.2.5",
"packages/block-brokers": "3.0.4",
"packages/bitswap": "1.1.4",
"packages/car": "3.2.1",
"packages/dag-cbor": "3.0.6",
"packages/dag-json": "3.0.6",
"packages/helia": "4.2.6",
"packages/interface": "4.3.1",
"packages/interop": "6.1.7",
"packages/interop": "6.1.8",
"packages/ipns": "7.2.3",
"packages/json": "3.0.5",
"packages/mfs": "3.0.7",
"packages/strings": "3.0.5",
"packages/json": "3.0.6",
"packages/mfs": "3.0.8",
"packages/strings": "3.0.6",
"packages/unixfs": "3.0.7",
"packages/utils": "0.3.3",
"packages/http": "1.0.10",
"packages/http": "1.0.11",
"packages/routers": "1.1.1"
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ There are several other modules available outside this repo:

Helia v1 shipped in 202303 (see [releases](https://github.com/ipfs/helia/releases)), and development keeps on trucking as we work on initiatives in the [roadmap](#roadmap) and make performance improvements and bug fixes along the way.

## Release Process

For information about our release process, please see our [release process wiki](https://github.com/ipfs/helia/wiki/Development-and-Release-Process#how-helia-is-released).

# 🛣️ Roadmap

Please find and comment on [the Roadmap here](https://github.com/ipfs/helia/issues/5).
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/add-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"@helia/unixfs": "^3.0.4",
"@ipld/dag-pb": "^4.0.2",
"@libp2p/websockets": "^8.0.9",
"aegir": "^43.0.1",
"aegir": "^44.0.1",
"blockstore-fs": "^1.0.1",
"datastore-level": "^10.0.1",
"execa": "^8.0.1",
"helia": "^4.1.1",
"ipfs-unixfs-importer": "^15.1.5",
"ipfsd-ctl": "^14.0.0",
"ipfsd-ctl": "^15.0.0",
"it-all": "^3.0.4",
"it-drain": "^3.0.5",
"it-map": "^3.0.5",
"kubo": "^0.28.0",
"kubo-rpc-client": "^4.0.0",
"kubo-rpc-client": "^5.0.0",
"libp2p": "^1.1.0",
"multiformats": "^13.1.0",
"tinybench": "^2.4.0"
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/gc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"devDependencies": {
"@ipld/dag-pb": "^4.0.6",
"aegir": "^43.0.1",
"aegir": "^44.0.1",
"blockstore-fs": "^1.1.8",
"datastore-level": "^10.1.5",
"execa": "^8.0.1",
"helia": "^4.1.1",
"ipfsd-ctl": "^14.0.0",
"ipfsd-ctl": "^15.0.0",
"it-all": "^3.0.4",
"it-drain": "^3.0.5",
"it-map": "^3.0.5",
"kubo": "^0.28.0",
"kubo-rpc-client": "^4.0.0",
"kubo-rpc-client": "^5.0.0",
"multiformats": "^13.0.0",
"tinybench": "^2.5.1"
},
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/transfer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
"@helia/unixfs": "^3.0.3",
"@ipld/dag-pb": "^4.0.2",
"@libp2p/websockets": "^8.0.19",
"aegir": "^43.0.1",
"aegir": "^44.0.1",
"blockstore-fs": "^1.0.1",
"datastore-level": "^10.0.1",
"execa": "^8.0.1",
"helia": "^4.1.0",
"ipfs-unixfs-importer": "^15.1.1",
"ipfsd-ctl": "^14.0.0",
"ipfsd-ctl": "^15.0.0",
"it-all": "^3.0.1",
"it-buffer-stream": "^3.0.2",
"it-drain": "^3.0.1",
"it-map": "^3.0.2",
"kubo": "^0.28.0",
"kubo-rpc-client": "^4.0.0",
"kubo-rpc-client": "^5.0.0",
"libp2p": "^1.4.0",
"multiformats": "^13.1.0",
"tinybench": "^2.4.0"
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/transports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@libp2p/websockets": "^8.0.19",
"@libp2p/webtransport": "^4.0.29",
"@multiformats/multiaddr": "^12.2.1",
"aegir": "^43.0.1",
"aegir": "^44.0.1",
"blockstore-fs": "^1.1.10",
"blockstore-idb": "^1.1.8",
"datastore-idb": "^2.1.9",
Expand All @@ -42,7 +42,7 @@
"it-buffer-stream": "^3.0.2",
"it-drain": "^3.0.7",
"kubo": "^0.28.0",
"kubo-rpc-client": "^4.1.1",
"kubo-rpc-client": "^5.0.0",
"libp2p": "^1.4.0",
"multiformats": "^13.1.0",
"playwright-test": "^14.1.1",
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/transports/src/runner/helia/recipient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const cid = CID.parse(`${process.env.HELIA_CID}`)
const mas = `${process.env.HELIA_MULTIADDRS}`.split(',').map(str => multiaddr(str))
const signal = AbortSignal.timeout(parseInt(process.env.HELIA_TIMEOUT ?? '60000'))

const helia = await getHelia()

try {
const helia = await getHelia()

await helia.libp2p.dial(mas, {
signal
})
Expand Down
15 changes: 6 additions & 9 deletions benchmarks/transports/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ interface Impl {
}

const webRTCimpls: Record<string, Impl> = {
/*
https://issues.chromium.org/issues/40072842
chromium: {
type: 'helia',
exec: PLAYWRIGHT,
listen: (relay) => `${relay}/p2p-circuit,/webrtc`
},
*/
firefox: {
type: 'helia',
exec: PLAYWRIGHT,
args: ['--browser', 'firefox'],
listen: (relay) => `${relay}/p2p-circuit,/webrtc`
},
webkit: {
type: 'helia',
exec: PLAYWRIGHT,
args: ['--browser', 'webkit'],
listen: (relay) => `${relay}/p2p-circuit,/webrtc`
},
'node.js': {
type: 'helia',
listen: (relay) => `${relay}/p2p-circuit,/webrtc`
Expand Down Expand Up @@ -64,21 +67,15 @@ const webSocketimpls: Record<string, Impl> = {
}

const webTransportImpls: Record<string, Impl> = {
/*
// https://issues.chromium.org/issues/326887753?pli=1
chromium: {
type: 'helia',
exec: PLAYWRIGHT
},
*/
/*
playwright ships with firefox 121 at the time of writing, it needs 125
firefox: {
type: 'helia',
exec: PLAYWRIGHT,
args: ['--browser', 'firefox']
},
*/
kubo: {
type: 'kubo',
listen: () => '/ip4/127.0.0.1/udp/0/quic-v1/webtransport'
Expand Down
7 changes: 7 additions & 0 deletions packages/bitswap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.1.4](https://github.com/ipfs/helia/compare/bitswap-v1.1.3...bitswap-v1.1.4) (2024-09-13)


### Bug Fixes

* remove @libp2p/interfaces dep ([#591](https://github.com/ipfs/helia/issues/591)) ([e567717](https://github.com/ipfs/helia/commit/e567717102464a925f87cb10fc05808a50be960e))

## [1.1.3](https://github.com/ipfs/helia/compare/bitswap-v1.1.2...bitswap-v1.1.3) (2024-07-31)


Expand Down
18 changes: 9 additions & 9 deletions packages/bitswap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helia/bitswap",
"version": "1.1.3",
"version": "1.1.4",
"description": "JavaScript implementation of the Bitswap data exchange protocol used by Helia",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/helia/tree/main/packages/bitswap#readme",
Expand Down Expand Up @@ -150,10 +150,10 @@
"dependencies": {
"@helia/interface": "^4.3.1",
"@helia/utils": "^0.3.3",
"@libp2p/interface": "^1.1.2",
"@libp2p/logger": "^4.0.5",
"@libp2p/peer-collections": "^5.1.6",
"@libp2p/utils": "^5.2.3",
"@libp2p/interface": "^2.0.0",
"@libp2p/logger": "^5.0.0",
"@libp2p/peer-collections": "^6.0.0",
"@libp2p/utils": "^6.0.0",
"@multiformats/multiaddr": "^12.1.14",
"any-signal": "^4.1.1",
"interface-blockstore": "^5.2.9",
Expand All @@ -174,12 +174,12 @@
"uint8arrays": "^5.0.1"
},
"devDependencies": {
"@libp2p/crypto": "^4.0.6",
"@libp2p/interface-compliance-tests": "^5.1.3",
"@libp2p/peer-id-factory": "^4.0.5",
"@libp2p/crypto": "^5.0.0",
"@libp2p/interface-compliance-tests": "^6.0.0",
"@libp2p/peer-id": "^5.0.0",
"@types/sinon": "^17.0.3",
"aegir": "^44.0.1",
"blockstore-core": "^4.3.10",
"blockstore-core": "^5.0.0",
"delay": "^6.0.0",
"it-all": "^3.0.4",
"it-pair": "^2.0.6",
Expand Down
8 changes: 8 additions & 0 deletions packages/bitswap/src/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export class BlockTooLargeError extends Error {
static name = 'BlockTooLargeError'

constructor (message = 'Block too large') {
super(message)
this.name = 'BlockTooLargeError'
}
}
2 changes: 1 addition & 1 deletion packages/bitswap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export interface BitswapOptions {
*
* @default false
*/
runOnTransientConnections?: boolean
runOnLimitedConnections?: boolean

/**
* Enables loading esoteric hash functions
Expand Down
20 changes: 10 additions & 10 deletions packages/bitswap/src/network.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError, TypedEventEmitter, setMaxListeners } from '@libp2p/interface'
import { InvalidParametersError, NotStartedError, TimeoutError, TypedEventEmitter, UnsupportedProtocolError, setMaxListeners } from '@libp2p/interface'
import { PeerQueue, type PeerQueueJobOptions } from '@libp2p/utils/peer-queue'
import drain from 'it-drain'
import * as lp from 'it-length-prefixed'
Expand Down Expand Up @@ -41,7 +41,7 @@ export interface NetworkInit {
messageReceiveTimeout?: number
messageSendConcurrency?: number
protocols?: string[]
runOnTransientConnections?: boolean
runOnLimitedConnections?: boolean
maxOutgoingMessageSize?: number
maxIncomingMessageSize?: number
}
Expand Down Expand Up @@ -80,7 +80,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
private registrarIds: string[]
private readonly metrics: { blocksSent?: Counter, dataSent?: Counter }
private readonly sendQueue: PeerQueue<void, SendMessageJobOptions>
private readonly runOnTransientConnections: boolean
private readonly runOnLimitedConnections: boolean
private readonly maxOutgoingMessageSize: number
private readonly maxIncomingMessageSize: number

Expand All @@ -99,7 +99,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
this.maxInboundStreams = init.maxInboundStreams ?? DEFAULT_MAX_INBOUND_STREAMS
this.maxOutboundStreams = init.maxOutboundStreams ?? DEFAULT_MAX_OUTBOUND_STREAMS
this.messageReceiveTimeout = init.messageReceiveTimeout ?? DEFAULT_MESSAGE_RECEIVE_TIMEOUT
this.runOnTransientConnections = init.runOnTransientConnections ?? DEFAULT_RUN_ON_TRANSIENT_CONNECTIONS
this.runOnLimitedConnections = init.runOnLimitedConnections ?? DEFAULT_RUN_ON_TRANSIENT_CONNECTIONS
this.maxIncomingMessageSize = init.maxIncomingMessageSize ?? DEFAULT_MAX_OUTGOING_MESSAGE_SIZE
this.maxOutgoingMessageSize = init.maxOutgoingMessageSize ?? init.maxIncomingMessageSize ?? DEFAULT_MAX_INCOMING_MESSAGE_SIZE
this.metrics = {
Expand Down Expand Up @@ -127,7 +127,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
await this.libp2p.handle(this.protocols, this._onStream, {
maxInboundStreams: this.maxInboundStreams,
maxOutboundStreams: this.maxOutboundStreams,
runOnTransientConnection: this.runOnTransientConnections
runOnLimitedConnection: this.runOnLimitedConnections
})

// register protocol with topology
Expand Down Expand Up @@ -188,7 +188,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
this.log('incoming new bitswap %s stream from %p', stream.protocol, connection.remotePeer)
const abortListener = (): void => {
if (stream.status === 'open') {
stream.abort(new CodeError(`Incoming Bitswap stream timed out after ${this.messageReceiveTimeout}ms`, 'ERR_TIMEOUT'))
stream.abort(new TimeoutError(`Incoming Bitswap stream timed out after ${this.messageReceiveTimeout}ms`))
} else {
this.log('stream aborted with status %s', stream.status)
}
Expand Down Expand Up @@ -247,7 +247,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
for await (const provider of this.routing.findProviders(cid, options)) {
// make sure we can dial the provider
const dialable = await this.libp2p.isDialable(provider.multiaddrs, {
runOnTransientConnection: this.runOnTransientConnections
runOnLimitedConnection: this.runOnLimitedConnections
})

if (!dialable) {
Expand Down Expand Up @@ -300,7 +300,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
const message = options?.message

if (message == null) {
throw new CodeError('No message to send', 'ERR_NO_MESSAGE')
throw new InvalidParametersError('No message to send')
}

this.log('sendMessage to %p', peerId)
Expand Down Expand Up @@ -337,7 +337,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
*/
async connectTo (peer: PeerId, options?: AbortOptions & ProgressOptions<BitswapNetworkProgressEvents>): Promise<Connection> { // eslint-disable-line require-await
if (!this.running) {
throw new CodeError('Network isn\'t running', 'ERR_NOT_STARTED')
throw new NotStartedError('Network isn\'t running')
}

options?.onProgress?.(new CustomProgressEvent<PeerId>('bitswap:network:dial', peer))
Expand All @@ -359,7 +359,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
return true
}

throw new CodeError(`${peer} did not support ${BITSWAP_120}`, 'ERR_BITSWAP_UNSUPPORTED_BY_PEER')
throw new UnsupportedProtocolError(`${peer} did not support ${BITSWAP_120}`)
}
})
])
Expand Down
8 changes: 4 additions & 4 deletions packages/bitswap/src/pb/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */

import { type Codec, CodeError, decodeMessage, type DecodeOptions, encodeMessage, enumeration, message } from 'protons-runtime'
import { type Codec, decodeMessage, type DecodeOptions, encodeMessage, enumeration, MaxLengthError, message } from 'protons-runtime'
import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc'
import type { Uint8ArrayList } from 'uint8arraylist'

Expand Down Expand Up @@ -167,7 +167,7 @@ export namespace Wantlist {
switch (tag >>> 3) {
case 1: {
if (opts.limits?.entries != null && obj.entries.length === opts.limits.entries) {
throw new CodeError('decode error - map field "entries" had too many elements', 'ERR_MAX_LENGTH')
throw new MaxLengthError('Decode error - map field "entries" had too many elements')
}

obj.entries.push(WantlistEntry.codec().decode(reader, reader.uint32(), {
Expand Down Expand Up @@ -424,7 +424,7 @@ export namespace BitswapMessage {
}
case 3: {
if (opts.limits?.blocks != null && obj.blocks.length === opts.limits.blocks) {
throw new CodeError('decode error - map field "blocks" had too many elements', 'ERR_MAX_LENGTH')
throw new MaxLengthError('Decode error - map field "blocks" had too many elements')
}

obj.blocks.push(Block.codec().decode(reader, reader.uint32(), {
Expand All @@ -434,7 +434,7 @@ export namespace BitswapMessage {
}
case 4: {
if (opts.limits?.blockPresences != null && obj.blockPresences.length === opts.limits.blockPresences) {
throw new CodeError('decode error - map field "blockPresences" had too many elements', 'ERR_MAX_LENGTH')
throw new MaxLengthError('Decode error - map field "blockPresences" had too many elements')
}

obj.blockPresences.push(BlockPresence.codec().decode(reader, reader.uint32(), {
Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/src/peer-want-lists/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class Ledger {
})
}
} catch (err: any) {
if (err.code !== 'ERR_NOT_FOUND') {
if (err.name !== 'NotFoundError') {
throw err
}

Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BitswapSession extends AbstractSession<PeerId, BitswapWantProgressEvents>
}

toEvictionKey (provider: PeerId): Uint8Array | string {
return provider.toBytes()
return provider.toMultihash().bytes
}

equals (providerA: PeerId, providerB: PeerId): boolean {
Expand Down
Loading

0 comments on commit dd3cfd0

Please sign in to comment.