Skip to content

Commit

Permalink
Merge branch 'main' into feat-bitswap-download-only
Browse files Browse the repository at this point in the history
  • Loading branch information
dozyio authored Feb 26, 2025
2 parents 92d61e4 + 45ca6bc commit 2e81e49
Show file tree
Hide file tree
Showing 63 changed files with 228 additions and 183 deletions.
11 changes: 11 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"import": [
"./node_modules/aegir/cspell.json"
],
"dictionaries": ["project"],
"dictionaryDefinitions": [{
"name": "project",
"path": "./.github/dictionary.txt",
"addWords": true
}]
}
1 change: 1 addition & 0 deletions .github/dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dont
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- run: npm run --if-present lint
- run: npm run --if-present dep-check
- run: npm run --if-present doc-check
- run: npm run --if-present spell-check

test-node:
needs: build
Expand Down
3 changes: 3 additions & 0 deletions FUNDING.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"filecoin": {
"ownedBy": "0xEF22379b7527762a00FC5820AF55BdE363624f03"
}
},
"opRetro": {
"projectId": "0x7f330267969cf845a983a9d4e7b7dbcca5c700a5191269af377836d109e0bb69"
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ There are several other modules available outside this repo:
- [`@helia/delegated-routing-v1-http-api`](https://github.com/ipfs/helia-delegated-routing-v1-http-api) An implementation of the [Delegated Routing v1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/) including a server and a client
- [Helia WNFS](https://github.com/shovelers/helia-wnfs) a [WNFS](https://guide.fission.codes/developers/webnative/file-system-wnfs) implementation built on top of Helia
- [`@helia/remote-pinning`](https://github.com/ipfs/helia-remote-pinning) A Helia client for communicating with [IPFS Pinning Services](https://ipfs.github.io/pinning-services-api-spec/)
- [`@helia/http-gateway`](https://github.com/ipfs/helia-http-gateway) An implentation of the [IPFS HTTP Gateway API](https://docs.ipfs.tech/concepts/ipfs-gateway/#gateway-types) built with Helia
- [`@helia/http-gateway`](https://github.com/ipfs/helia-http-gateway) An implementation of the [IPFS HTTP Gateway API](https://docs.ipfs.tech/concepts/ipfs-gateway/#gateway-types) built with Helia

# 📣 Project status

Expand Down
8 changes: 4 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ https://github.com/ipfs/helia/issues/5
- [Q2](#q2)
- [Drive Adoption](#drive-adoption)
- [Q3](#q3)
- [Support Fully Speced Delegated Routing Protocols and Endpoints](#support-fully-speced-delegated-routing-protocols-and-endpoints)
- [Support Fully Specified Delegated Routing Protocols and Endpoints](#support-fully-specified-delegated-routing-protocols-and-endpoints)
- [PL Delegate and Preload Nodes Will Be Shutting Down](#pl-delegate-and-preload-nodes-will-be-shutting-down)
- [Past Milestones](#past-milestones)
- [2022](#2022)
Expand All @@ -44,17 +44,17 @@ Improve "hospitality" of the project: https://github.com/ipfs/helia/issues/35

After Helia is functional and users can adopt it, Protocol Labs EngRes ceases maintaining the legacy js-ipfs project. Issue for tracking js-ipfs deprecation with roadsigns to Helia: https://github.com/ipfs/js-ipfs/issues/4336

Port over examples from js-ipfs-examples to helia-examples to help with onramping: https://github.com/ipfs/helia/issues/29
Port over examples from js-ipfs-examples to helia-examples to help with on-ramping: https://github.com/ipfs/helia/issues/29

Demonstrate a practical example of Helia in a service worker as a fallback for HTTP gateways: https://github.com/ipfs/in-web-browsers/issues/207

Setup mechanism for measuring adoption: https://github.com/ipfs/helia/issues/41

### Q3

#### Support Fully Speced Delegated Routing Protocols and Endpoints
#### Support Fully Specified Delegated Routing Protocols and Endpoints

While it will be possible from a connectivity perspective to make DHT queries from a browser, we expect various applications will want to still delegate out routing. [HTTP Routing v1](https://github.com/ipfs/specs/blob/main/routing/ROUTING_V1_HTTP.md) is a protocol for delegated routing that other IPFS implementations like Kubo have implemented. While it currently uses HTTP as a transport, it is speced and not tied to the Kubo RPC API.
While it will be possible from a connectivity perspective to make DHT queries from a browser, we expect various applications will want to still delegate out routing. [HTTP Routing v1](https://github.com/ipfs/specs/blob/main/routing/ROUTING_V1_HTTP.md) is a protocol for delegated routing that other IPFS implementations like Kubo have implemented. While it currently uses HTTP as a transport, it is specified and not tied to the Kubo RPC API.

#### PL Delegate and Preload Nodes Will Be Shutting Down

Expand Down
104 changes: 52 additions & 52 deletions benchmarks/add-dir/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion benchmarks/add-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@helia/unixfs": "^4.0.1",
"aegir": "^45.0.1",
"aegir": "^45.1.1",
"blockstore-core": "^5.0.2",
"blockstore-fs": "^2.0.1",
"datastore-core": "^10.0.2",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/gc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"devDependencies": {
"@ipld/dag-pb": "^4.0.6",
"aegir": "^45.0.1",
"aegir": "^45.1.1",
"blockstore-fs": "^2.0.1",
"datastore-level": "^11.0.1",
"execa": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/pinning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"devDependencies": {
"@ipld/dag-pb": "^4.0.6",
"aegir": "^45.0.1",
"aegir": "^45.1.1",
"blockstore-fs": "^2.0.1",
"datastore-level": "^11.0.1",
"execa": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/transfer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@ipld/dag-pb": "^4.0.2",
"@libp2p/tcp": "^10.0.1",
"@multiformats/multiaddr": "^12.3.1",
"aegir": "^45.0.1",
"aegir": "^45.1.1",
"blockstore-fs": "^2.0.1",
"datastore-level": "^11.0.1",
"helia": "^5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/transports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To run:
WebSockets (node.js -> node.js) filecoin defaults, 1068, 1642, 2092, 2812, 4117, 4423, 6117, 7820, 7182, 7816
//... results here
```
3. Graph the CSV data with your favourite graphing tool
3. Graph the CSV data with your favorite graphing tool

## Debugging

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/transports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@libp2p/websockets": "^9.0.0",
"@libp2p/webtransport": "^5.0.0",
"@multiformats/multiaddr": "^12.2.1",
"aegir": "^45.0.1",
"aegir": "^45.1.1",
"blockstore-fs": "^2.0.1",
"blockstore-idb": "^2.0.1",
"datastore-idb": "^3.0.0",
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/transports/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface Impl {
listen?(relay: Multiaddr): string
}

const webRTCimpls: Record<string, Impl> = {
const webRTCImpls: Record<string, Impl> = {
chromium: {
type: 'helia',
exec: PLAYWRIGHT,
Expand All @@ -46,7 +46,7 @@ const webRTCimpls: Record<string, Impl> = {
}
}

const webSocketimpls: Record<string, Impl> = {
const webSocketImpls: Record<string, Impl> = {
'node.js': {
type: 'helia',
listen: () => '/ip4/127.0.0.1/tcp/0/ws'
Expand Down Expand Up @@ -119,9 +119,9 @@ function addTests (name: string, impls: Record<string, Impl>, tests: Test[], rel
export function createTests (relay: Multiaddr): Test[] {
const output: Test[] = []

addTests('WebRTC', webRTCimpls, output, relay)
addTests('WebRTC', webRTCImpls, output, relay)
addTests('WebTransport', webTransportImpls, output, relay)
addTests('WebSockets', webSocketimpls, output, relay)
addTests('WebSockets', webSocketImpls, output, relay)
addTests('TCP', tcpImpls, output, relay)

return output
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
"lint": "aegir run lint",
"dep-check": "aegir run dep-check",
"doc-check": "aegir run doc-check",
"spell-check": "aegir spell-check",
"release": "run-s build docs:no-publish npm:release docs",
"npm:release": "aegir exec --bail false npm -- publish",
"release:rc": "aegir release-rc",
"docs": "aegir docs",
"docs:no-publish": "aegir docs --publish false"
},
"devDependencies": {
"aegir": "^45.0.1",
"aegir": "^45.1.1",
"npm-run-all": "^4.1.5"
},
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@libp2p/interface-compliance-tests": "^6.1.11",
"@libp2p/peer-id": "^5.0.8",
"@types/sinon": "^17.0.3",
"aegir": "^45.0.6",
"aegir": "^45.1.1",
"blockstore-core": "^5.0.2",
"delay": "^6.0.0",
"it-all": "^3.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {

// dial and wait for identify - this is to avoid opening a protocol stream
// that we are not going to use but depends on the remote node running the
// identitfy protocol
// identify protocol
const [
connection
] = await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/src/pb/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ message Block {

enum BlockPresenceType {
HaveBlock = 0;
DontHaveBlock = 1;
DoNotHaveBlock = 1;
}

message BlockPresence {
Expand Down
4 changes: 2 additions & 2 deletions packages/bitswap/src/pb/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ export namespace Block {

export enum BlockPresenceType {
HaveBlock = 'HaveBlock',
DontHaveBlock = 'DontHaveBlock'
DoNotHaveBlock = 'DoNotHaveBlock'
}

enum __BlockPresenceTypeValues {
HaveBlock = 0,
DontHaveBlock = 1
DoNotHaveBlock = 1
}

export namespace BlockPresenceType {
Expand Down
8 changes: 4 additions & 4 deletions packages/bitswap/src/peer-want-lists/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface PeerWantListEntry {
/**
* If we don't have the block and we've told them we don't have the block
*/
sentDontHave?: boolean
sentDoNotHave?: boolean
}

export class Ledger {
Expand Down Expand Up @@ -138,14 +138,14 @@ export class Ledger {
}

// we have already told them we don't have the block
if (entry.sentDontHave === true) {
if (entry.sentDoNotHave === true) {
continue
}

entry.sentDontHave = true
entry.sentDoNotHave = true
message.addBlockPresence(entry.cid, {
cid: entry.cid.bytes,
type: BlockPresenceType.DontHaveBlock
type: BlockPresenceType.DoNotHaveBlock
})
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/bitswap/src/want-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface WantListEntry {

export interface WantOptions extends AbortOptions, ProgressOptions<BitswapNetworkWantProgressEvents> {
/**
* Allow prioritising blocks
* Allow prioritizing blocks
*/
priority?: number
}
Expand All @@ -73,7 +73,7 @@ export interface WantBlockResult {
block: Uint8Array
}

export interface WantDontHaveResult {
export interface WantDoNotHaveResult {
sender: PeerId
cid: CID
has: false
Expand All @@ -86,7 +86,7 @@ export interface WantHaveResult {
block?: Uint8Array
}

export type WantPresenceResult = WantDontHaveResult | WantHaveResult
export type WantPresenceResult = WantDoNotHaveResult | WantHaveResult

export interface WantListEvents {
block: CustomEvent<WantBlockResult>
Expand Down Expand Up @@ -294,7 +294,7 @@ export class WantList extends TypedEventEmitter<WantListEvents> implements Start
await this.network.sendMessage(peerId, message)

// wait for peer response
const event = await raceEvent<CustomEvent<WantHaveResult | WantDontHaveResult>>(this, 'presence', options.signal, {
const event = await raceEvent<CustomEvent<WantHaveResult | WantDoNotHaveResult>>(this, 'presence', options.signal, {
filter: (event) => {
return peerId.equals(event.detail.sender) && uint8ArrayEquals(cid.multihash.digest, event.detail.cid.multihash.digest)
}
Expand Down Expand Up @@ -399,7 +399,7 @@ export class WantList extends TypedEventEmitter<WantListEvents> implements Start
}
})

this.safeDispatchEvent<WantHaveResult | WantDontHaveResult>('presence', {
this.safeDispatchEvent<WantHaveResult | WantDoNotHaveResult>('presence', {
detail: {
sender,
cid,
Expand Down Expand Up @@ -428,7 +428,7 @@ export class WantList extends TypedEventEmitter<WantListEvents> implements Start

this.log('received %s from %p for %c', type, sender, cid)

this.safeDispatchEvent<WantHaveResult | WantDontHaveResult>('presence', {
this.safeDispatchEvent<WantHaveResult | WantDoNotHaveResult>('presence', {
detail: {
sender,
cid,
Expand Down
12 changes: 6 additions & 6 deletions packages/bitswap/test/network.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('network', () => {

const lpstr = lpStream(localDuplex)

// garbage data, cannot be unmarshalled as protobuf
// garbage data, cannot be unmarshaled as protobuf
await lpstr.write(Uint8Array.from([0, 1, 2, 3]))

await pRetry(() => {
Expand Down Expand Up @@ -401,11 +401,11 @@ describe('network', () => {
})
messageA.addBlockPresence(cid3, {
cid: cid3.bytes,
type: BlockPresenceType.DontHaveBlock
type: BlockPresenceType.DoNotHaveBlock
})
messageA.addBlockPresence(cid5, {
cid: cid5.bytes,
type: BlockPresenceType.DontHaveBlock
type: BlockPresenceType.DoNotHaveBlock
})
messageA.addWantlistEntry(cid5, {
cid: cid5.bytes,
Expand All @@ -424,7 +424,7 @@ describe('network', () => {
})
messageB.addBlockPresence(cid4, {
cid: cid4.bytes,
type: BlockPresenceType.DontHaveBlock
type: BlockPresenceType.DoNotHaveBlock
})
messageB.addBlockPresence(cid5, {
cid: cid5.bytes,
Expand Down Expand Up @@ -478,13 +478,13 @@ describe('network', () => {
}])
expect(message).to.have.deep.property('blockPresences', [{
cid: cid3.bytes,
type: BlockPresenceType.DontHaveBlock
type: BlockPresenceType.DoNotHaveBlock
}, {
cid: cid5.bytes,
type: BlockPresenceType.HaveBlock
}, {
cid: cid4.bytes,
type: BlockPresenceType.DontHaveBlock
type: BlockPresenceType.DoNotHaveBlock
}])
expect(message).to.have.deep.property('wantlist', {
full: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/bitswap/test/peer-want-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ describe('peer-want-lists', () => {
expect(message.blocks).to.be.empty('should not have sent blocks')
expect(message.blockPresences).to.have.lengthOf(1)
expect([...message.blockPresences.values()][0].cid).to.equalBytes(cid.bytes)
expect([...message.blockPresences.values()][0].type).to.equal(BlockPresenceType.DontHaveBlock, 'should have sent DontHaveBlock presence')
expect([...message.blockPresences.values()][0].type).to.equal(BlockPresenceType.DoNotHaveBlock, 'should have sent DoNotHaveBlock presence')
})

it('should send requested blocks to peer when presence was requested but block size is less than maxSizeReplaceHasWithBlock', async () => {
Expand Down Expand Up @@ -437,7 +437,7 @@ describe('peer-want-lists', () => {
expect(message.blocks).to.be.empty('should not have sent blocks')
expect(message.blockPresences).to.have.lengthOf(1)
expect([...message.blockPresences.values()][0].cid).to.equalBytes(cid.bytes)
expect([...message.blockPresences.values()][0].type).to.equal(BlockPresenceType.DontHaveBlock, 'should have sent DontHaveBlock presence')
expect([...message.blockPresences.values()][0].type).to.equal(BlockPresenceType.DoNotHaveBlock, 'should have sent DoNotHaveBlock presence')
})

it('should remove wants when peer cancels', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-brokers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@multiformats/uri-to-multiaddr": "^8.0.0",
"@types/polka": "^0.5.7",
"@types/sinon": "^17.0.3",
"aegir": "^45.0.6",
"aegir": "^45.1.1",
"cors": "^2.8.5",
"polka": "^0.5.2",
"sinon": "^19.0.2",
Expand Down
Loading

0 comments on commit 2e81e49

Please sign in to comment.