merge with master

This commit is contained in:
Sasha 2024-03-12 23:58:57 +01:00
commit de5d71e6ff
No known key found for this signature in database
81 changed files with 584 additions and 1061 deletions

2
.gitignore vendored
View File

@ -13,4 +13,4 @@ test-results
playwright-report playwright-report
example example
allure-results allure-results
packages/local-peer-cache-discovery/mock_local_storage packages/discovery/mock_local_storage

View File

@ -4,12 +4,9 @@
"packages/interfaces": "0.0.22", "packages/interfaces": "0.0.22",
"packages/message-hash": "0.1.11", "packages/message-hash": "0.1.11",
"packages/enr": "0.0.21", "packages/enr": "0.0.21",
"packages/peer-exchange": "0.0.20",
"packages/core": "0.0.27", "packages/core": "0.0.27",
"packages/dns-discovery": "0.0.21",
"packages/message-encryption": "0.0.25", "packages/message-encryption": "0.0.25",
"packages/relay": "0.0.10", "packages/relay": "0.0.10",
"packages/sdk": "0.0.23", "packages/rln": "0.1.2",
"packages/local-peer-cache-discovery": "1.0.0", "packages/sdk": "0.0.23"
"packages/rln": "0.1.2"
} }

View File

@ -24,9 +24,19 @@ module.exports = [
}, },
{ {
name: "DNS discovery", name: "DNS discovery",
path: "packages/dns-discovery/bundle/index.js", path: "packages/discovery/bundle/index.js",
import: "{ PeerDiscoveryDns }", import: "{ PeerDiscoveryDns }",
}, },
{
name: "Peer Exchange discovery",
path: "packages/discovery/bundle/index.js",
import: "{ wakuPeerExchangeDiscovery }",
},
{
name: "Local Peer Cache Discovery",
path: "packages/discovery/bundle/index.js",
import: "{ wakuLocalPeerCacheDiscovery }",
},
{ {
name: "Privacy preserving protocols", name: "Privacy preserving protocols",
path: "packages/relay/bundle/index.js", path: "packages/relay/bundle/index.js",

323
package-lock.json generated
View File

@ -13,9 +13,7 @@
"packages/enr", "packages/enr",
"packages/core", "packages/core",
"packages/relay", "packages/relay",
"packages/peer-exchange", "packages/discovery",
"packages/dns-discovery",
"packages/local-peer-cache-discovery",
"packages/message-encryption", "packages/message-encryption",
"packages/rln", "packages/rln",
"packages/sdk", "packages/sdk",
@ -2974,7 +2972,8 @@
}, },
"node_modules/@libp2p/interfaces": { "node_modules/@libp2p/interfaces": {
"version": "3.3.2", "version": "3.3.2",
"license": "Apache-2.0 OR MIT", "resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-3.3.2.tgz",
"integrity": "sha512-p/M7plbrxLzuQchvNwww1Was7ZeGE2NaOFulMaZBYIihU8z3fhaV+a033OqnC/0NTX/yhfdNOG7znhYq3XoR/g==",
"engines": { "engines": {
"node": ">=16.0.0", "node": ">=16.0.0",
"npm": ">=7.0.0" "npm": ">=7.0.0"
@ -5241,9 +5240,10 @@
"link": true "link": true
}, },
"node_modules/@waku/create-app": { "node_modules/@waku/create-app": {
"version": "0.1.1-7c24ffa", "version": "0.1.1-504bcd4",
"resolved": "https://registry.npmjs.org/@waku/create-app/-/create-app-0.1.1-504bcd4.tgz",
"integrity": "sha512-rTGTHLEtEgdmxBTU9ZduEWcZgZG7JsQqIxjHhn3rQNmtggeXjZ5xWo/FAKYcx3Bc1B9igQVUMS/v8NvAGuDd4A==",
"dev": true, "dev": true,
"license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"commander": "^9.4.1", "commander": "^9.4.1",
"enquirer": "^2.3.6", "enquirer": "^2.3.6",
@ -5298,10 +5298,26 @@
"node": ">= 10.0.0" "node": ">= 10.0.0"
} }
}, },
"node_modules/@waku/dns-discovery": { "node_modules/@waku/discovery": {
"resolved": "packages/dns-discovery", "resolved": "packages/discovery",
"link": true "link": true
}, },
"node_modules/@waku/dns-discovery": {
"version": "0.0.21",
"resolved": "https://registry.npmjs.org/@waku/dns-discovery/-/dns-discovery-0.0.21.tgz",
"integrity": "sha512-l6TVLNiP9HjVrSCWRVP4pKGAADkPzMY2+/tFxnLI1lx3NWmBrkwsEsZHKlfGpdDTT3130nxXkvENcswqWLsc1w==",
"dependencies": {
"@waku/enr": "0.0.21",
"@waku/utils": "0.0.15",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
"uint8arrays": "^5.0.1"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@waku/enr": { "node_modules/@waku/enr": {
"resolved": "packages/enr", "resolved": "packages/enr",
"link": true "link": true
@ -5311,8 +5327,17 @@
"link": true "link": true
}, },
"node_modules/@waku/local-peer-cache-discovery": { "node_modules/@waku/local-peer-cache-discovery": {
"resolved": "packages/local-peer-cache-discovery", "version": "1.0.0",
"link": true "resolved": "https://registry.npmjs.org/@waku/local-peer-cache-discovery/-/local-peer-cache-discovery-1.0.0.tgz",
"integrity": "sha512-He3xudQF8cMbQUU2q9nUlinSW8FSwKX51DLwhPhblVVwhrfdmjvfhjCaMaq2YDoA+y88CIqQG0bLxxl5QADpWQ==",
"dependencies": {
"@libp2p/interface": "^1.1.2",
"@waku/interfaces": "^0.0.22",
"@waku/utils": "^0.0.15"
},
"engines": {
"node": ">=18"
}
}, },
"node_modules/@waku/message-encryption": { "node_modules/@waku/message-encryption": {
"resolved": "packages/message-encryption", "resolved": "packages/message-encryption",
@ -5323,8 +5348,24 @@
"link": true "link": true
}, },
"node_modules/@waku/peer-exchange": { "node_modules/@waku/peer-exchange": {
"resolved": "packages/peer-exchange", "version": "0.0.20",
"link": true "resolved": "https://registry.npmjs.org/@waku/peer-exchange/-/peer-exchange-0.0.20.tgz",
"integrity": "sha512-Tbdw80VAk4Or6sKUX4LPCkuDo4zYB1/6hOLOMbSo1ck7w8ADNkcByyD5W/wVCmE4wM8Yen2Awb/auIsqunM8LQ==",
"dependencies": {
"@libp2p/interfaces": "^3.3.2",
"@waku/core": "0.0.27",
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15",
"debug": "^4.3.4",
"it-all": "^3.0.4",
"it-length-prefixed": "^9.0.4",
"it-pipe": "^3.0.1"
},
"engines": {
"node": ">=18"
}
}, },
"node_modules/@waku/proto": { "node_modules/@waku/proto": {
"resolved": "packages/proto", "resolved": "packages/proto",
@ -8167,6 +8208,7 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
<<<<<<< HEAD
"node_modules/cosmiconfig": { "node_modules/cosmiconfig": {
"version": "8.0.0", "version": "8.0.0",
"dev": true, "dev": true,
@ -8181,6 +8223,8 @@
"node": ">=14" "node": ">=14"
} }
}, },
=======
>>>>>>> 5296bfbad8d98d2ee40e6570a6ad4546c86b9fcf
"node_modules/cpu-features": { "node_modules/cpu-features": {
"version": "0.0.9", "version": "0.0.9",
"hasInstallScript": true, "hasInstallScript": true,
@ -27138,7 +27182,7 @@
"version": "0.1.0", "version": "0.1.0",
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.40.1", "@playwright/test": "^1.40.1",
"@waku/create-app": "^0.1.1-7c24ffa", "@waku/create-app": "^0.1.1-504bcd4",
"dotenv-flow": "^4.1.0", "dotenv-flow": "^4.1.0",
"serve": "^14.2.1" "serve": "^14.2.1"
} }
@ -27193,17 +27237,79 @@
}, },
"peerDependencies": { "peerDependencies": {
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"@waku/enr": "^0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/message-hash": "^0.1.11",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15",
"libp2p": "^1.1.2" "libp2p": "^1.1.2"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@multiformats/multiaddr": { "@multiformats/multiaddr": {
"optional": true "optional": true
},
"@waku/interfaces": {
"optional": true
}
}
},
"packages/discovery": {
"name": "@waku/discovery",
"version": "0.0.1",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/proto": "^0.0.6",
"@waku/utils": "0.0.15",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
"uint8arrays": "^5.0.1"
},
"devDependencies": {
"@libp2p/peer-id": "^4.0.4",
"@libp2p/peer-id-factory": "^4.0.5",
"@multiformats/multiaddr": "^12.0.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.11",
"@types/node-localstorage": "^1.3.3",
"@waku/build-utils": "*",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"cspell": "^8.3.2",
"mocha": "^10.3.0",
"node-localstorage": "^3.0.5",
"npm-run-all": "^4.1.5",
"rollup": "^4.12.0",
"sinon": "^17.0.1"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@libp2p/interface": "^1.1.2",
"@waku/core": "0.0.27",
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@libp2p/interface": {
"optional": true
},
"@waku/interfaces": {
"optional": true
} }
} }
}, },
"packages/dns-discovery": { "packages/dns-discovery": {
"name": "@waku/dns-discovery", "name": "@waku/dns-discovery",
"version": "0.0.21", "version": "0.0.20",
"extraneous": true,
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@waku/enr": "0.0.21", "@waku/enr": "0.0.21",
@ -27231,6 +27337,16 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/enr": { "packages/enr": {
@ -27267,6 +27383,19 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@multiformats/multiaddr": "^12.0.0",
"@waku/interfaces": "0.0.22",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@multiformats/multiaddr": {
"optional": true
},
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/interfaces": { "packages/interfaces": {
@ -27286,7 +27415,8 @@
}, },
"packages/local-peer-cache-discovery": { "packages/local-peer-cache-discovery": {
"name": "@waku/local-peer-cache-discovery", "name": "@waku/local-peer-cache-discovery",
"version": "1.0.0", "version": "0.0.1",
"extraneous": true,
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@libp2p/interface": "^1.1.2", "@libp2p/interface": "^1.1.2",
@ -27311,6 +27441,7 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
<<<<<<< HEAD
} }
}, },
"packages/local-peer-cache-discovery/node_modules/@cspell/cspell-bundled-dicts": { "packages/local-peer-cache-discovery/node_modules/@cspell/cspell-bundled-dicts": {
@ -27698,6 +27829,21 @@
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
=======
},
"peerDependencies": {
"@libp2p/interface": "^1.1.2",
"@waku/interfaces": "0.0.22",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@libp2p/interface": {
"optional": true
},
"@waku/interfaces": {
"optional": true
}
>>>>>>> 5296bfbad8d98d2ee40e6570a6ad4546c86b9fcf
} }
}, },
"packages/message-encryption": { "packages/message-encryption": {
@ -27731,6 +27877,17 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@waku/core": "0.0.27",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/message-hash": { "packages/message-hash": {
@ -27762,11 +27919,21 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@waku/interfaces": "0.0.22",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/peer-exchange": { "packages/peer-exchange": {
"name": "@waku/peer-exchange", "name": "@waku/peer-exchange",
"version": "0.0.20", "version": "0.0.19",
"extraneous": true,
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@libp2p/interfaces": "^3.3.2", "@libp2p/interfaces": "^3.3.2",
@ -27793,6 +27960,18 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@waku/core": "0.0.27",
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/proto": { "packages/proto": {
@ -27841,6 +28020,21 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@chainsafe/libp2p-gossipsub": "^12.0.0",
"@waku/core": "0.0.27",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@chainsafe/libp2p-gossipsub": {
"optional": true
},
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/rln": { "packages/rln": {
@ -29463,6 +29657,7 @@
"@libp2p/ping": "^1.0.12", "@libp2p/ping": "^1.0.12",
"@libp2p/websockets": "^8.0.11", "@libp2p/websockets": "^8.0.11",
"@waku/core": "0.0.27", "@waku/core": "0.0.27",
"@waku/discovery": "0.0.1",
"@waku/dns-discovery": "0.0.21", "@waku/dns-discovery": "0.0.21",
"@waku/interfaces": "0.0.22", "@waku/interfaces": "0.0.22",
"@waku/local-peer-cache-discovery": "^1.0.0", "@waku/local-peer-cache-discovery": "^1.0.0",
@ -29486,7 +29681,22 @@
"node": ">=18" "node": ">=18"
}, },
"peerDependencies": { "peerDependencies": {
"@libp2p/bootstrap": "^10" "@libp2p/bootstrap": "^10",
"@waku/core": "0.0.27",
"@waku/dns-discovery": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/local-peer-cache-discovery": "^1.0.0",
"@waku/peer-exchange": "^0.0.20",
"@waku/relay": "0.0.10",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@libp2p/bootstrap": {
"optional": true
},
"@waku/interfaces": {
"optional": true
}
} }
}, },
"packages/tests": { "packages/tests": {
@ -29518,9 +29728,8 @@
"@types/mocha": "^10.0.6", "@types/mocha": "^10.0.6",
"@types/sinon": "^17.0.3", "@types/sinon": "^17.0.3",
"@types/tail": "^2.2.3", "@types/tail": "^2.2.3",
"@waku/dns-discovery": "*", "@waku/discovery": "*",
"@waku/message-encryption": "*", "@waku/message-encryption": "*",
"@waku/peer-exchange": "*",
"@waku/sdk": "*", "@waku/sdk": "*",
"allure-commandline": "^2.27.0", "allure-commandline": "^2.27.0",
"allure-mocha": "^2.9.2", "allure-mocha": "^2.9.2",
@ -29561,6 +29770,14 @@
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"peerDependencies": {
"@waku/interfaces": "0.0.22"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
} }
} }
}, },
@ -31377,7 +31594,9 @@
} }
}, },
"@libp2p/interfaces": { "@libp2p/interfaces": {
"version": "3.3.2" "version": "3.3.2",
"resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-3.3.2.tgz",
"integrity": "sha512-p/M7plbrxLzuQchvNwww1Was7ZeGE2NaOFulMaZBYIihU8z3fhaV+a033OqnC/0NTX/yhfdNOG7znhYq3XoR/g=="
}, },
"@libp2p/logger": { "@libp2p/logger": {
"version": "4.0.6", "version": "4.0.6",
@ -32842,7 +33061,7 @@
"version": "file:packages/browser-tests", "version": "file:packages/browser-tests",
"requires": { "requires": {
"@playwright/test": "^1.40.1", "@playwright/test": "^1.40.1",
"@waku/create-app": "^0.1.1-7c24ffa", "@waku/create-app": "^0.1.1-504bcd4",
"dotenv-flow": "^4.1.0", "dotenv-flow": "^4.1.0",
"serve": "^14.2.1" "serve": "^14.2.1"
} }
@ -32888,7 +33107,9 @@
} }
}, },
"@waku/create-app": { "@waku/create-app": {
"version": "0.1.1-7c24ffa", "version": "0.1.1-504bcd4",
"resolved": "https://registry.npmjs.org/@waku/create-app/-/create-app-0.1.1-504bcd4.tgz",
"integrity": "sha512-rTGTHLEtEgdmxBTU9ZduEWcZgZG7JsQqIxjHhn3rQNmtggeXjZ5xWo/FAKYcx3Bc1B9igQVUMS/v8NvAGuDd4A==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "^9.4.1", "commander": "^9.4.1",
@ -32925,8 +33146,8 @@
} }
} }
}, },
"@waku/dns-discovery": { "@waku/discovery": {
"version": "file:packages/dns-discovery", "version": "file:packages/discovery",
"requires": { "requires": {
"@libp2p/peer-id": "^4.0.4", "@libp2p/peer-id": "^4.0.4",
"@libp2p/peer-id-factory": "^4.0.5", "@libp2p/peer-id-factory": "^4.0.5",
@ -32935,18 +33156,36 @@
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.11", "@types/chai": "^4.3.11",
"@types/node-localstorage": "^1.3.3",
"@waku/build-utils": "*", "@waku/build-utils": "*",
"@waku/enr": "0.0.21", "@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22", "@waku/interfaces": "0.0.22",
"@waku/proto": "^0.0.6",
"@waku/utils": "0.0.15", "@waku/utils": "0.0.15",
"chai": "^4.3.10", "chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"cspell": "^8.3.2", "cspell": "^8.3.2",
"debug": "^4.3.4", "debug": "^4.3.4",
"dns-query": "^0.11.2", "dns-query": "^0.11.2",
"hi-base32": "^0.5.1", "hi-base32": "^0.5.1",
"mocha": "^10.3.0", "mocha": "^10.3.0",
"node-localstorage": "^3.0.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^4.12.0", "rollup": "^4.12.0",
"sinon": "^17.0.1",
"uint8arrays": "^5.0.1"
}
},
"@waku/dns-discovery": {
"version": "0.0.21",
"resolved": "https://registry.npmjs.org/@waku/dns-discovery/-/dns-discovery-0.0.21.tgz",
"integrity": "sha512-l6TVLNiP9HjVrSCWRVP4pKGAADkPzMY2+/tFxnLI1lx3NWmBrkwsEsZHKlfGpdDTT3130nxXkvENcswqWLsc1w==",
"requires": {
"@waku/enr": "0.0.21",
"@waku/utils": "0.0.15",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
"uint8arrays": "^5.0.1" "uint8arrays": "^5.0.1"
} }
}, },
@ -32990,16 +33229,13 @@
} }
}, },
"@waku/local-peer-cache-discovery": { "@waku/local-peer-cache-discovery": {
"version": "file:packages/local-peer-cache-discovery", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@waku/local-peer-cache-discovery/-/local-peer-cache-discovery-1.0.0.tgz",
"integrity": "sha512-He3xudQF8cMbQUU2q9nUlinSW8FSwKX51DLwhPhblVVwhrfdmjvfhjCaMaq2YDoA+y88CIqQG0bLxxl5QADpWQ==",
"requires": { "requires": {
"@libp2p/interface": "^1.1.2", "@libp2p/interface": "^1.1.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.11",
"@types/node-localstorage": "^1.3.3",
"@waku/build-utils": "*",
"@waku/interfaces": "^0.0.22", "@waku/interfaces": "^0.0.22",
<<<<<<< HEAD
"@waku/utils": "^0.0.15", "@waku/utils": "^0.0.15",
"chai": "^4.3.10", "chai": "^4.3.10",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
@ -33273,6 +33509,9 @@
"version": "1.0.0", "version": "1.0.0",
"dev": true "dev": true
} }
=======
"@waku/utils": "^0.0.15"
>>>>>>> 5296bfbad8d98d2ee40e6570a6ad4546c86b9fcf
} }
}, },
"@waku/message-encryption": { "@waku/message-encryption": {
@ -33326,27 +33565,20 @@
} }
}, },
"@waku/peer-exchange": { "@waku/peer-exchange": {
"version": "file:packages/peer-exchange", "version": "0.0.20",
"resolved": "https://registry.npmjs.org/@waku/peer-exchange/-/peer-exchange-0.0.20.tgz",
"integrity": "sha512-Tbdw80VAk4Or6sKUX4LPCkuDo4zYB1/6hOLOMbSo1ck7w8ADNkcByyD5W/wVCmE4wM8Yen2Awb/auIsqunM8LQ==",
"requires": { "requires": {
"@libp2p/interfaces": "^3.3.2", "@libp2p/interfaces": "^3.3.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@waku/build-utils": "*",
"@waku/core": "0.0.27", "@waku/core": "0.0.27",
"@waku/enr": "0.0.21", "@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22", "@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6", "@waku/proto": "0.0.6",
"@waku/utils": "0.0.15", "@waku/utils": "0.0.15",
"chai": "^4.3.10",
"cspell": "^8.3.2",
"debug": "^4.3.4", "debug": "^4.3.4",
"it-all": "^3.0.4", "it-all": "^3.0.4",
"it-length-prefixed": "^9.0.4", "it-length-prefixed": "^9.0.4",
"it-pipe": "^3.0.1", "it-pipe": "^3.0.1"
"npm-run-all": "^4.1.5",
"rollup": "^4.12.0",
"uint8arraylist": "^2.4.3"
} }
}, },
"@waku/proto": { "@waku/proto": {
@ -34665,6 +34897,7 @@
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@waku/build-utils": "*", "@waku/build-utils": "*",
"@waku/core": "0.0.27", "@waku/core": "0.0.27",
"@waku/discovery": "0.0.1",
"@waku/dns-discovery": "0.0.21", "@waku/dns-discovery": "0.0.21",
"@waku/interfaces": "0.0.22", "@waku/interfaces": "0.0.22",
"@waku/local-peer-cache-discovery": "^1.0.0", "@waku/local-peer-cache-discovery": "^1.0.0",
@ -34690,11 +34923,10 @@
"@types/sinon": "^17.0.3", "@types/sinon": "^17.0.3",
"@types/tail": "^2.2.3", "@types/tail": "^2.2.3",
"@waku/core": "*", "@waku/core": "*",
"@waku/dns-discovery": "*", "@waku/discovery": "*",
"@waku/enr": "*", "@waku/enr": "*",
"@waku/interfaces": "*", "@waku/interfaces": "*",
"@waku/message-encryption": "*", "@waku/message-encryption": "*",
"@waku/peer-exchange": "*",
"@waku/sdk": "*", "@waku/sdk": "*",
"@waku/utils": "*", "@waku/utils": "*",
"allure-commandline": "^2.27.0", "allure-commandline": "^2.27.0",
@ -36455,6 +36687,7 @@
"vary": "^1" "vary": "^1"
} }
}, },
<<<<<<< HEAD
"cosmiconfig": { "cosmiconfig": {
"version": "8.0.0", "version": "8.0.0",
"dev": true, "dev": true,
@ -36465,6 +36698,8 @@
"path-type": "^4.0.0" "path-type": "^4.0.0"
} }
}, },
=======
>>>>>>> 5296bfbad8d98d2ee40e6570a6ad4546c86b9fcf
"cpu-features": { "cpu-features": {
"version": "0.0.9", "version": "0.0.9",
"optional": true, "optional": true,

View File

@ -10,9 +10,7 @@
"packages/enr", "packages/enr",
"packages/core", "packages/core",
"packages/relay", "packages/relay",
"packages/peer-exchange", "packages/discovery",
"packages/dns-discovery",
"packages/local-peer-cache-discovery",
"packages/message-encryption", "packages/message-encryption",
"packages/rln", "packages/rln",
"packages/sdk", "packages/sdk",

View File

@ -12,7 +12,7 @@
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.40.1", "@playwright/test": "^1.40.1",
"@waku/create-app": "^0.1.1-7c24ffa", "@waku/create-app": "^0.1.1-504bcd4",
"dotenv-flow": "^4.1.0", "dotenv-flow": "^4.1.0",
"serve": "^14.2.1" "serve": "^14.2.1"
} }

View File

@ -109,11 +109,19 @@
}, },
"peerDependencies": { "peerDependencies": {
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"libp2p": "^1.1.2" "libp2p": "^1.1.2",
"@waku/enr": "^0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/message-hash": "^0.1.11",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@multiformats/multiaddr": { "@multiformats/multiaddr": {
"optional": true "optional": true
},
"@waku/interfaces": {
"optional": true
} }
}, },
"files": [ "files": [

View File

@ -6,7 +6,7 @@ import {
IMessage, IMessage,
Libp2p, Libp2p,
ProtocolCreateOptions, ProtocolCreateOptions,
SendError ProtocolError
} from "@waku/interfaces"; } from "@waku/interfaces";
import { PushResponse } from "@waku/proto"; import { PushResponse } from "@waku/proto";
import { isMessageSizeUnderCap } from "@waku/utils"; import { isMessageSizeUnderCap } from "@waku/utils";
@ -32,7 +32,7 @@ type PreparePushMessageResult =
} }
| { | {
query: null; query: null;
error: SendError; error: ProtocolError;
}; };
type CoreSendResult = type CoreSendResult =
@ -66,12 +66,12 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
try { try {
if (!message.payload || message.payload.length === 0) { if (!message.payload || message.payload.length === 0) {
log.error("Failed to send waku light push: payload is empty"); log.error("Failed to send waku light push: payload is empty");
return { query: null, error: SendError.EMPTY_PAYLOAD }; return { query: null, error: ProtocolError.EMPTY_PAYLOAD };
} }
if (!(await isMessageSizeUnderCap(encoder, message))) { if (!(await isMessageSizeUnderCap(encoder, message))) {
log.error("Failed to send waku light push: message is bigger than 1MB"); log.error("Failed to send waku light push: message is bigger than 1MB");
return { query: null, error: SendError.SIZE_TOO_BIG }; return { query: null, error: ProtocolError.SIZE_TOO_BIG };
} }
const protoMessage = await encoder.toProtoObj(message); const protoMessage = await encoder.toProtoObj(message);
@ -79,7 +79,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
log.error("Failed to encode to protoMessage, aborting push"); log.error("Failed to encode to protoMessage, aborting push");
return { return {
query: null, query: null,
error: SendError.ENCODE_FAILED error: ProtocolError.ENCODE_FAILED
}; };
} }
@ -90,7 +90,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return { return {
query: null, query: null,
error: SendError.GENERIC_FAIL error: ProtocolError.GENERIC_FAIL
}; };
} }
} }
@ -126,7 +126,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return { return {
success: null, success: null,
failure: { failure: {
error: SendError.REMOTE_PEER_FAULT, error: ProtocolError.REMOTE_PEER_FAULT,
peerId: peer.id peerId: peer.id
} }
}; };
@ -146,7 +146,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return { return {
success: null, success: null,
failure: { failure: {
error: SendError.GENERIC_FAIL, error: ProtocolError.GENERIC_FAIL,
peerId: peer.id peerId: peer.id
} }
}; };
@ -165,7 +165,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return { return {
success: null, success: null,
failure: { failure: {
error: SendError.DECODE_FAILED, error: ProtocolError.DECODE_FAILED,
peerId: peer.id peerId: peer.id
} }
}; };
@ -176,7 +176,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return { return {
success: null, success: null,
failure: { failure: {
error: SendError.REMOTE_PEER_FAULT, error: ProtocolError.REMOTE_PEER_FAULT,
peerId: peer.id peerId: peer.id
} }
}; };
@ -187,7 +187,7 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return { return {
success: null, success: null,
failure: { failure: {
error: SendError.REMOTE_PEER_REJECTED, error: ProtocolError.REMOTE_PEER_REJECTED,
peerId: peer.id peerId: peer.id
} }
}; };

View File

@ -1,10 +1,12 @@
import type { PeerId } from "@libp2p/interface"; import type { PeerId } from "@libp2p/interface";
import { IncomingStreamData } from "@libp2p/interface"; import { IncomingStreamData } from "@libp2p/interface";
import type { import {
IMetadata, type IMetadata,
Libp2pComponents, type Libp2pComponents,
PeerIdStr, type PeerIdStr,
ShardInfo ProtocolError,
QueryResult,
type ShardInfo
} from "@waku/interfaces"; } from "@waku/interfaces";
import { proto_metadata } from "@waku/proto"; import { proto_metadata } from "@waku/proto";
import { encodeRelayShard, Logger, shardInfoToPubsubTopics } from "@waku/utils"; import { encodeRelayShard, Logger, shardInfoToPubsubTopics } from "@waku/utils";
@ -21,7 +23,7 @@ export const MetadataCodec = "/vac/waku/metadata/1.0.0";
class Metadata extends BaseProtocol implements IMetadata { class Metadata extends BaseProtocol implements IMetadata {
private libp2pComponents: Libp2pComponents; private libp2pComponents: Libp2pComponents;
handshakesConfirmed: Set<PeerIdStr> = new Set(); handshakesConfirmed: Map<PeerIdStr, ShardInfo> = new Map();
constructor( constructor(
public shardInfo: ShardInfo, public shardInfo: ShardInfo,
@ -57,13 +59,13 @@ class Metadata extends BaseProtocol implements IMetadata {
async (source) => await all(source) async (source) => await all(source)
); );
const remoteShardInfoResponse = const { error, shardInfo } = this.decodeMetadataResponse(encodedResponse);
this.decodeMetadataResponse(encodedResponse);
await this.savePeerShardInfo( if (error) {
connection.remotePeer, return;
remoteShardInfoResponse }
);
await this.savePeerShardInfo(connection.remotePeer, shardInfo);
} catch (error) { } catch (error) {
log.error("Error handling metadata request", error); log.error("Error handling metadata request", error);
} }
@ -72,12 +74,15 @@ class Metadata extends BaseProtocol implements IMetadata {
/** /**
* Make a metadata query to a peer * Make a metadata query to a peer
*/ */
async query(peerId: PeerId): Promise<ShardInfo> { async query(peerId: PeerId): Promise<QueryResult> {
const request = proto_metadata.WakuMetadataRequest.encode(this.shardInfo); const request = proto_metadata.WakuMetadataRequest.encode(this.shardInfo);
const peer = await this.peerStore.get(peerId); const peer = await this.peerStore.get(peerId);
if (!peer) { if (!peer) {
throw new Error(`Peer ${peerId.toString()} not found`); return {
shardInfo: null,
error: ProtocolError.NO_PEER_AVAILABLE
};
} }
const stream = await this.getStream(peer); const stream = await this.getStream(peer);
@ -90,22 +95,38 @@ class Metadata extends BaseProtocol implements IMetadata {
async (source) => await all(source) async (source) => await all(source)
); );
const decodedResponse = this.decodeMetadataResponse(encodedResponse); const { error, shardInfo } = this.decodeMetadataResponse(encodedResponse);
await this.savePeerShardInfo(peerId, decodedResponse); if (error) {
return {
shardInfo: null,
error
};
}
return decodedResponse; await this.savePeerShardInfo(peerId, shardInfo);
return {
shardInfo,
error: null
};
} }
public async confirmOrAttemptHandshake(peerId: PeerId): Promise<void> { public async confirmOrAttemptHandshake(peerId: PeerId): Promise<QueryResult> {
if (this.handshakesConfirmed.has(peerId.toString())) return; const shardInfo = this.handshakesConfirmed.get(peerId.toString());
if (shardInfo) {
return {
shardInfo,
error: null
};
}
await this.query(peerId); return await this.query(peerId);
return;
} }
private decodeMetadataResponse(encodedResponse: Uint8ArrayList[]): ShardInfo { private decodeMetadataResponse(
encodedResponse: Uint8ArrayList[]
): QueryResult {
const bytes = new Uint8ArrayList(); const bytes = new Uint8ArrayList();
encodedResponse.forEach((chunk) => { encodedResponse.forEach((chunk) => {
@ -115,9 +136,18 @@ class Metadata extends BaseProtocol implements IMetadata {
bytes bytes
) as ShardInfo; ) as ShardInfo;
if (!response) log.error("Error decoding metadata response"); if (!response) {
log.error("Error decoding metadata response");
return {
shardInfo: null,
error: ProtocolError.DECODE_FAILED
};
}
return response; return {
shardInfo: response,
error: null
};
} }
private async savePeerShardInfo( private async savePeerShardInfo(
@ -131,7 +161,7 @@ class Metadata extends BaseProtocol implements IMetadata {
} }
}); });
this.handshakesConfirmed.add(peerId.toString()); this.handshakesConfirmed.set(peerId.toString(), shardInfo);
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "@waku/dns-discovery", "name": "@waku/discovery",
"version": "0.0.21", "version": "0.0.1",
"description": "DNS Peer Discovery (EIP-1459)", "description": "Contains various discovery mechanisms: DNS Discovery (EIP-1459, Peer Exchange, Local Peer Cache Discovery.",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"module": "./dist/index.js", "module": "./dist/index.js",
"exports": { "exports": {
@ -12,7 +12,7 @@
}, },
"type": "module", "type": "module",
"author": "Waku Team", "author": "Waku Team",
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/dns-discovery#readme", "homepage": "https://github.com/waku-org/js-waku/tree/master/packages/discovery#readme",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/waku-org/js-waku.git" "url": "https://github.com/waku-org/js-waku.git"
@ -51,6 +51,8 @@
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@waku/interfaces": "0.0.22",
"@waku/proto": "^0.0.6",
"@waku/enr": "0.0.21", "@waku/enr": "0.0.21",
"@waku/utils": "0.0.15", "@waku/utils": "0.0.15",
"debug": "^4.3.4", "debug": "^4.3.4",
@ -66,13 +68,32 @@
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.11", "@types/chai": "^4.3.11",
"@types/node-localstorage": "^1.3.3",
"@waku/build-utils": "*", "@waku/build-utils": "*",
"@waku/interfaces": "0.0.22",
"chai": "^4.3.10", "chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"cspell": "^8.3.2", "cspell": "^8.3.2",
"mocha": "^10.3.0", "mocha": "^10.3.0",
"node-localstorage": "^3.0.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^4.12.0" "rollup": "^4.12.0",
"sinon": "^17.0.1"
},
"peerDependencies": {
"@waku/core": "0.0.27",
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15",
"@libp2p/interface": "^1.1.2"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
},
"@libp2p/interface": {
"optional": true
}
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -0,0 +1,21 @@
// DNS Discovery
export { PeerDiscoveryDns, wakuDnsDiscovery } from "./dns/dns_discovery.js";
export { enrTree } from "./dns/constants.js";
export { DnsNodeDiscovery } from "./dns/dns.js";
// Peer Exchange Discovery
export {
wakuPeerExchange,
PeerExchangeCodec,
WakuPeerExchange
} from "./peer-exchange/waku_peer_exchange.js";
export {
wakuPeerExchangeDiscovery,
PeerExchangeDiscovery
} from "./peer-exchange/waku_peer_exchange_discovery.js";
// Local Peer Cache Discovery
export {
LocalPeerCacheDiscovery,
wakuLocalPeerCacheDiscovery
} from "./local-peer-cache/index.js";

View File

@ -11,14 +11,21 @@ import { LocalStoragePeerInfo } from "@waku/interfaces";
import chai, { expect } from "chai"; import chai, { expect } from "chai";
import chaiAsPromised from "chai-as-promised"; import chaiAsPromised from "chai-as-promised";
import { MemoryDatastore } from "datastore-core/memory"; import { MemoryDatastore } from "datastore-core/memory";
import { LocalStorage } from "node-localstorage";
import sinon from "sinon"; import sinon from "sinon";
import { LocalPeerCacheDiscovery } from "./index.js"; import { LocalPeerCacheDiscovery } from "./index.js";
chai.use(chaiAsPromised); chai.use(chaiAsPromised);
global.localStorage = new LocalStorage("./mock_local_storage"); // dynamically importing the local storage polyfill for node
if (typeof window === "undefined") {
try {
const { LocalStorage } = await import("node-localstorage");
global.localStorage = new LocalStorage("./scratch");
} catch (error) {
console.error("Failed to load localStorage polyfill:", error);
}
}
const mockPeers = [ const mockPeers = [
{ {

View File

@ -6,5 +6,5 @@
"tsBuildInfoFile": "dist/.tsbuildinfo" "tsBuildInfoFile": "dist/.tsbuildinfo"
}, },
"include": ["src"], "include": ["src"],
"exclude": ["src/**/*.spec.ts", "src/test_utils"] "exclude": ["src/**/*.spec.ts"]
} }

View File

@ -1,305 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The file is maintained by [Release Please](https://github.com/googleapis/release-please) based on [Conventional Commits](https://www.conventionalcommits.org) specification,
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.6 to 0.0.7
* devDependencies
* @waku/interfaces bumped from 0.0.8 to 0.0.9
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.7 to 0.0.8
* @waku/utils bumped from 0.0.2 to 0.0.3
* devDependencies
* @waku/interfaces bumped from 0.0.9 to 0.0.10
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.8 to 0.0.9
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.10 to 0.0.11
* @waku/utils bumped from 0.0.4 to 0.0.5
* devDependencies
* @waku/interfaces bumped from 0.0.11 to 0.0.12
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.12 to 0.0.13
* @waku/utils bumped from 0.0.6 to 0.0.7
* devDependencies
* @waku/interfaces bumped from 0.0.13 to 0.0.14
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.19 to 0.0.20
* @waku/utils bumped from 0.0.13 to 0.0.14
* devDependencies
* @waku/interfaces bumped from 0.0.20 to 0.0.21
## [0.0.21](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.20...dns-discovery-v0.0.21) (2024-03-04)
### ⚠ BREAKING CHANGES
* protocols filter peers as per configured shard ([#1756](https://github.com/waku-org/js-waku/issues/1756))
### Features
* Protocols filter peers as per configured shard ([#1756](https://github.com/waku-org/js-waku/issues/1756)) ([477c2a5](https://github.com/waku-org/js-waku/commit/477c2a5918f2f75cd2c14bc6ed75e1687c5a09b4))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.20 to 0.0.21
* @waku/utils bumped from 0.0.14 to 0.0.15
* devDependencies
* @waku/interfaces bumped from 0.0.21 to 0.0.22
## [0.0.19](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.18...dns-discovery-v0.0.19) (2023-11-01)
### Features
* Logger with log levels ([#1672](https://github.com/waku-org/js-waku/issues/1672)) ([0f7d63e](https://github.com/waku-org/js-waku/commit/0f7d63ef93716223dc8fea7e8cb09e12e267b386))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.18 to 0.0.19
* @waku/utils bumped from 0.0.12 to 0.0.13
* devDependencies
* @waku/interfaces bumped from 0.0.19 to 0.0.20
## [0.0.18](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.17...dns-discovery-v0.0.18) (2023-10-16)
### Features
* Add Firefox and Webkit to karma ([#1598](https://github.com/waku-org/js-waku/issues/1598)) ([d9e4bcb](https://github.com/waku-org/js-waku/commit/d9e4bcbe3f7bcc092f20621bd362d76426701dab))
* **static-sharding:** Filter peer connections per shards ([#1626](https://github.com/waku-org/js-waku/issues/1626)) ([124a29e](https://github.com/waku-org/js-waku/commit/124a29ebba59c05fbbf199d969e6ba3f9e57d45b))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.17 to 0.0.18
* @waku/utils bumped from 0.0.11 to 0.0.12
* devDependencies
* @waku/interfaces bumped from 0.0.18 to 0.0.19
## [0.0.17](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.16...dns-discovery-v0.0.17) (2023-09-11)
### ⚠ BREAKING CHANGES
* upgrade to libp2p@0.45 ([#1400](https://github.com/waku-org/js-waku/issues/1400))
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316))
### Features
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316)) ([50c2c25](https://github.com/waku-org/js-waku/commit/50c2c2540f3c5ff78d93f3fea646da0eee246e17))
* Allow passing of multiple ENR URLs to DNS Discovery & dial multiple peers in parallel ([#1379](https://github.com/waku-org/js-waku/issues/1379)) ([f32d7d9](https://github.com/waku-org/js-waku/commit/f32d7d9fe0b930b4fa9c46b8644e6d21be45d5c1))
* **dns-discovery:** Set default for `NodeRequirements` ([#1466](https://github.com/waku-org/js-waku/issues/1466)) ([aab9c08](https://github.com/waku-org/js-waku/commit/aab9c08caefb9f72460261ec0c38df88ae0f02ce))
* Upgrade to libp2p@0.45 ([#1400](https://github.com/waku-org/js-waku/issues/1400)) ([420e6c6](https://github.com/waku-org/js-waku/commit/420e6c698dd8f44d40d34e47d876da5d2e1ce85e))
### Bug Fixes
* **dns-discovery:** Use DOH list from dns-query ([1dd3210](https://github.com/waku-org/js-waku/commit/1dd32101baf2750527369f7f25981882aa1f9527))
* Improve connection manager error handling + edge cases ([#1450](https://github.com/waku-org/js-waku/issues/1450)) ([785df52](https://github.com/waku-org/js-waku/commit/785df528fe6e5010a61391994e222028dbc4e4c5))
* Remove typesVersions ([#1359](https://github.com/waku-org/js-waku/issues/1359)) ([0ad1954](https://github.com/waku-org/js-waku/commit/0ad19540d527309e0174afa7e9fff2924570d361))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.16 to 0.0.17
* @waku/utils bumped from 0.0.10 to 0.0.11
* devDependencies
* @waku/interfaces bumped from 0.0.17 to 0.0.18
## [0.0.16](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.15...dns-discovery-v0.0.16) (2023-08-02)
### Bug Fixes
* Improve connection manager error handling + edge cases ([#1450](https://github.com/waku-org/js-waku/issues/1450)) ([785df52](https://github.com/waku-org/js-waku/commit/785df528fe6e5010a61391994e222028dbc4e4c5))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.15 to 0.0.16
* @waku/utils bumped from 0.0.9 to 0.0.10
* devDependencies
* @waku/interfaces bumped from 0.0.16 to 0.0.17
## [0.0.15](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.14...dns-discovery-v0.0.15) (2023-07-26)
### ⚠ BREAKING CHANGES
* upgrade to libp2p@0.45 ([#1400](https://github.com/waku-org/js-waku/issues/1400))
### Features
* Upgrade to libp2p@0.45 ([#1400](https://github.com/waku-org/js-waku/issues/1400)) ([420e6c6](https://github.com/waku-org/js-waku/commit/420e6c698dd8f44d40d34e47d876da5d2e1ce85e))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.14 to 0.0.15
* @waku/utils bumped from 0.0.8 to 0.0.9
* devDependencies
* @waku/interfaces bumped from 0.0.15 to 0.0.16
## [0.0.14](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.13...dns-discovery-v0.0.14) (2023-06-08)
### Features
* Allow passing of multiple ENR URLs to DNS Discovery & dial multiple peers in parallel ([#1379](https://github.com/waku-org/js-waku/issues/1379)) ([f32d7d9](https://github.com/waku-org/js-waku/commit/f32d7d9fe0b930b4fa9c46b8644e6d21be45d5c1))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.13 to 0.0.14
* @waku/utils bumped from 0.0.7 to 0.0.8
* devDependencies
* @waku/interfaces bumped from 0.0.14 to 0.0.15
## [0.0.12](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.11...dns-discovery-v0.0.12) (2023-05-18)
### ⚠ BREAKING CHANGES
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316))
### Features
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316)) ([50c2c25](https://github.com/waku-org/js-waku/commit/50c2c2540f3c5ff78d93f3fea646da0eee246e17))
### Bug Fixes
* Remove typesVersions ([#1359](https://github.com/waku-org/js-waku/issues/1359)) ([0ad1954](https://github.com/waku-org/js-waku/commit/0ad19540d527309e0174afa7e9fff2924570d361))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from * to 0.0.12
* @waku/utils bumped from * to 0.0.6
* devDependencies
* @waku/interfaces bumped from * to 0.0.13
## [0.0.10](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.9...dns-discovery-v0.0.10) (2023-04-03)
### Bug Fixes
* **dns-discovery:** Use DOH list from dns-query ([1dd3210](https://github.com/waku-org/js-waku/commit/1dd32101baf2750527369f7f25981882aa1f9527))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.9 to 0.0.10
* @waku/utils bumped from 0.0.3 to 0.0.4
* devDependencies
* @waku/interfaces bumped from 0.0.10 to 0.0.11
## [0.0.6](https://github.com/waku-org/js-waku/compare/dns-discovery-v0.0.5...dns-discovery-v0.0.6) (2023-03-16)
### ⚠ BREAKING CHANGES
* add exports map to @waku/utils ([#1201](https://github.com/waku-org/js-waku/issues/1201))
* directly convert from ENR to `PeerInfo`, remove unneeded utility
* extract decoder code
* bump typescript
* bump libp2p dependencies
### Features
* Add mocha to dns-discovery ([#1154](https://github.com/waku-org/js-waku/issues/1154)) ([f945eb9](https://github.com/waku-org/js-waku/commit/f945eb90c49bb54322c4cb58c20cfdeee72ff4f2))
* DNS discovery as default bootstrap discovery ([#1114](https://github.com/waku-org/js-waku/issues/1114)) ([11819fc](https://github.com/waku-org/js-waku/commit/11819fc7b14e18385d421facaf2af0832cad1da8))
### Bug Fixes
* **dns-discovery/peer-exchange:** Check if peer is already tagged ([952aadd](https://github.com/waku-org/js-waku/commit/952aadd7bbbe1a7265c5126c1678f552bef0648d))
* Prettier and cspell ignore CHANGELOG ([#1235](https://github.com/waku-org/js-waku/issues/1235)) ([4d7b3e3](https://github.com/waku-org/js-waku/commit/4d7b3e39e6761afaf5d05a13cc4b3c23e15f9bd5))
### Miscellaneous Chores
* Add exports map to @waku/utils ([#1201](https://github.com/waku-org/js-waku/issues/1201)) ([a30b2bd](https://github.com/waku-org/js-waku/commit/a30b2bd747dedeef69b46cfafb88898ba35d8f67))
* Bump libp2p dependencies ([803ae7b](https://github.com/waku-org/js-waku/commit/803ae7bd8ed3de665026446c23cde90e7eba9d36))
* Bump typescript ([12d86e6](https://github.com/waku-org/js-waku/commit/12d86e6abcc68e27c39ca86b4f0dc2b68cdd6000))
* Directly convert from ENR to `PeerInfo`, remove unneeded utility ([6dbcde0](https://github.com/waku-org/js-waku/commit/6dbcde041ab8fa8c2df75cc25319a0eccf6b0454))
* Extract decoder code ([130c49b](https://github.com/waku-org/js-waku/commit/130c49b636807063364f309da0da2a24a68f2178))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from * to 0.0.6
* @waku/utils bumped from * to 0.0.2
* devDependencies
* @waku/interfaces bumped from * to 0.0.8
## [Unreleased]
## [0.0.5] - 2023-01-25
### Changed
- Replaced OpenDNS with AhaDNS in the default DoH DNS list.
### Fixed
- Moved `chai` to `devDependencies`.
## [0.0.4] - 2023-01-18
### Changed
- Improved test coverage, various fixes.
[unreleased]: https://github.com/waku-org/js-waku/compare/@waku/dns-discovery@0.0.5...HEAD
[0.0.5]: https://github.com/status-im/js-waku/compare/@waku/dns-discovery@0.0.4...@waku/dns-discovery@0.0.5
[0.0.4]: https://github.com/status-im/js-waku/compare/f7f28f03b01fa5bc89eaeb083b68981169b45c39...@waku/dns-discovery@0.0.4

View File

@ -1,10 +0,0 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "dist/",
"rootDir": "src",
"tsBuildInfoFile": "dist/.tsbuildinfo"
},
"include": ["src"],
"exclude": ["src/**/*.spec.ts", "src/test_utils"]
}

View File

@ -1,4 +0,0 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -78,6 +78,19 @@
"rollup": "^4.12.0", "rollup": "^4.12.0",
"uint8arrays": "^5.0.1" "uint8arrays": "^5.0.1"
}, },
"peerDependencies": {
"@waku/utils": "0.0.15",
"@waku/interfaces": "0.0.22",
"@multiformats/multiaddr": "^12.0.0"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
},
"@multiformats/multiaddr": {
"optional": true
}
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -1,11 +1,25 @@
import type { PeerId } from "@libp2p/interface"; import type { PeerId } from "@libp2p/interface";
import type { ShardInfo } from "./enr.js"; import type { ShardInfo } from "./enr.js";
import type { IBaseProtocolCore, ShardingParams } from "./protocols.js"; import type {
IBaseProtocolCore,
ProtocolError,
ShardingParams
} from "./protocols.js";
export type QueryResult =
| {
shardInfo: ShardInfo;
error: null;
}
| {
shardInfo: null;
error: ProtocolError;
};
// IMetadata always has shardInfo defined while it is optionally undefined in IBaseProtocol // IMetadata always has shardInfo defined while it is optionally undefined in IBaseProtocol
export interface IMetadata extends Omit<IBaseProtocolCore, "shardInfo"> { export interface IMetadata extends Omit<IBaseProtocolCore, "shardInfo"> {
shardInfo: ShardingParams; shardInfo: ShardingParams;
confirmOrAttemptHandshake(peerId: PeerId): Promise<void>; confirmOrAttemptHandshake(peerId: PeerId): Promise<QueryResult>;
query(peerId: PeerId): Promise<ShardInfo | undefined>; query(peerId: PeerId): Promise<QueryResult>;
} }

View File

@ -101,7 +101,7 @@ export type Callback<T extends IDecodedMessage> = (
msg: T msg: T
) => void | Promise<void>; ) => void | Promise<void>;
export enum SendError { export enum ProtocolError {
/** Could not determine the origin of the fault. Best to check connectivity and try again */ /** Could not determine the origin of the fault. Best to check connectivity and try again */
GENERIC_FAIL = "Generic error", GENERIC_FAIL = "Generic error",
/** /**
@ -150,7 +150,7 @@ export enum SendError {
} }
export interface Failure { export interface Failure {
error: SendError; error: ProtocolError;
peerId?: PeerId; peerId?: PeerId;
} }

View File

@ -1,6 +0,0 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json"
}
};

View File

@ -1,6 +0,0 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -1,26 +0,0 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,20 +0,0 @@
# Changelog
## 1.0.0 (2024-03-04)
### ⚠ BREAKING CHANGES
* rename local-discovery to local-peer-cache-discovery ([#1867](https://github.com/waku-org/js-waku/issues/1867))
### Miscellaneous Chores
* Rename local-discovery to local-peer-cache-discovery ([#1867](https://github.com/waku-org/js-waku/issues/1867)) ([f3cb10d](https://github.com/waku-org/js-waku/commit/f3cb10d484bac134377b8cfd77e077ffc33bd319))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/interfaces bumped from ^0.0.21 to ^0.0.22
* @waku/utils bumped from ^0.0.14 to ^0.0.15

View File

@ -1,3 +0,0 @@
const config = require("../../karma.conf.cjs");
module.exports = config;

View File

@ -1,83 +0,0 @@
{
"name": "@waku/local-peer-cache-discovery",
"version": "1.0.0",
"description": "Local Peer Cache keeps records of healthy peers in the browser's local storage for quicker bootstrapping.",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"type": "module",
"author": "Waku Team",
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/local-peer-cache-discovery#readme",
"repository": {
"type": "git",
"url": "https://github.com/waku-org/js-waku.git"
},
"bugs": {
"url": "https://github.com/waku-org/js-waku/issues"
},
"license": "MIT OR Apache-2.0",
"keywords": [
"waku",
"decentralized",
"secure",
"communication",
"web3",
"ethereum",
"dapps",
"privacy"
],
"scripts": {
"build": "run-s build:**",
"build:esm": "tsc",
"build:bundle": "rollup --config rollup.config.js",
"fix": "run-s fix:*",
"fix:lint": "eslint src *.js --fix",
"check": "run-s check:*",
"check:lint": "eslint src --ext .ts",
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
"check:tsc": "tsc -p tsconfig.dev.json",
"prepublish": "npm run build",
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
"test": "NODE_ENV=test run-s test:*",
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha"
},
"engines": {
"node": ">=18"
},
"dependencies": {
"@libp2p/interface": "^1.1.2",
"@waku/interfaces": "^0.0.22",
"@waku/utils": "^0.0.15"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.11",
"@types/node-localstorage": "^1.3.3",
"@waku/build-utils": "*",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"cspell": "^7.3.2",
"mocha": "^10.2.0",
"node-localstorage": "^3.0.5",
"npm-run-all": "^4.1.5",
"rollup": "^4.12.0",
"sinon": "^17.0.1"
},
"files": [
"dist",
"bundle",
"src/**/*.ts",
"!**/*.spec.*",
"!**/*.json",
"CHANGELOG.md",
"LICENSE",
"README.md"
]
}

View File

@ -1,24 +0,0 @@
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { extractExports } from "@waku/build-utils";
import * as packageJson from "./package.json" assert { type: "json" };
const input = extractExports(packageJson);
export default {
input,
output: {
dir: "bundle",
format: "esm"
},
plugins: [
commonjs(),
json(),
nodeResolve({
browser: true,
preferBuiltins: false
})
]
};

View File

@ -1,3 +0,0 @@
{
"extends": "../../tsconfig.dev"
}

View File

@ -1,4 +0,0 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -99,6 +99,17 @@
"process": "^0.11.10", "process": "^0.11.10",
"rollup": "^4.12.0" "rollup": "^4.12.0"
}, },
"peerDependencies": {
"@waku/core": "0.0.27",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -72,6 +72,15 @@
"process": "^0.11.10", "process": "^0.11.10",
"rollup": "^4.12.0" "rollup": "^4.12.0"
}, },
"peerDependencies": {
"@waku/interfaces": "0.0.22",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -1,6 +0,0 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json"
}
};

View File

@ -1,285 +0,0 @@
# Changelog
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.12 to 0.0.13
* @waku/enr bumped from 0.0.7 to 0.0.8
* @waku/proto bumped from 0.0.3 to 0.0.4
* @waku/utils bumped from * to 0.0.3
* devDependencies
* @waku/interfaces bumped from 0.0.9 to 0.0.10
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from 0.0.8 to 0.0.9
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.14 to 0.0.15
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.15 to 0.0.16
* @waku/enr bumped from 0.0.9 to 0.0.10
* @waku/utils bumped from 0.0.3 to 0.0.4
* devDependencies
* @waku/interfaces bumped from 0.0.10 to 0.0.11
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.16 to 0.0.17
* @waku/enr bumped from 0.0.10 to 0.0.11
* @waku/utils bumped from 0.0.4 to 0.0.5
* devDependencies
* @waku/interfaces bumped from 0.0.11 to 0.0.12
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.18 to 0.0.19
* @waku/enr bumped from 0.0.12 to 0.0.13
* @waku/proto bumped from * to 0.0.5
* @waku/utils bumped from 0.0.6 to 0.0.7
* devDependencies
* @waku/interfaces bumped from 0.0.13 to 0.0.14
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.19 to 0.0.20
* @waku/enr bumped from 0.0.13 to 0.0.14
* @waku/utils bumped from 0.0.7 to 0.0.8
* devDependencies
* @waku/interfaces bumped from 0.0.14 to 0.0.15
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.25 to 0.0.26
* @waku/enr bumped from 0.0.19 to 0.0.20
* @waku/interfaces bumped from 0.0.20 to 0.0.21
* @waku/proto bumped from 0.0.5 to 0.0.6
* @waku/utils bumped from 0.0.13 to 0.0.14
## [0.0.20](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.19...peer-exchange-v0.0.20) (2024-03-04)
### ⚠ BREAKING CHANGES
* protocols filter peers as per configured shard ([#1756](https://github.com/waku-org/js-waku/issues/1756))
### Features
* Decouple sharding params out of core ([e138b4f](https://github.com/waku-org/js-waku/commit/e138b4f5c49a35a37830e31e8be87d824f53249f))
* Protocols filter peers as per configured shard ([#1756](https://github.com/waku-org/js-waku/issues/1756)) ([477c2a5](https://github.com/waku-org/js-waku/commit/477c2a5918f2f75cd2c14bc6ed75e1687c5a09b4))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.26 to 0.0.27
* @waku/enr bumped from 0.0.20 to 0.0.21
* @waku/interfaces bumped from 0.0.21 to 0.0.22
* @waku/utils bumped from 0.0.14 to 0.0.15
## [0.0.18](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.17...peer-exchange-v0.0.18) (2023-11-01)
### Features
* Logger with log levels ([#1672](https://github.com/waku-org/js-waku/issues/1672)) ([0f7d63e](https://github.com/waku-org/js-waku/commit/0f7d63ef93716223dc8fea7e8cb09e12e267b386))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.24 to 0.0.25
* @waku/enr bumped from 0.0.18 to 0.0.19
* @waku/interfaces bumped from 0.0.19 to 0.0.20
* @waku/utils bumped from 0.0.12 to 0.0.13
## [0.0.17](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.16...peer-exchange-v0.0.17) (2023-10-16)
### Features
* **static-sharding:** Filter peer connections per shards ([#1626](https://github.com/waku-org/js-waku/issues/1626)) ([124a29e](https://github.com/waku-org/js-waku/commit/124a29ebba59c05fbbf199d969e6ba3f9e57d45b))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.23 to 0.0.24
* @waku/enr bumped from 0.0.17 to 0.0.18
* @waku/interfaces bumped from 0.0.18 to 0.0.19
* @waku/utils bumped from 0.0.11 to 0.0.12
## [0.0.16](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.15...peer-exchange-v0.0.16) (2023-09-11)
### ⚠ BREAKING CHANGES
* set peer-exchange with default bootstrap ([#1469](https://github.com/waku-org/js-waku/issues/1469))
### Features
* Pre-emptive stream creation for protocols ([#1516](https://github.com/waku-org/js-waku/issues/1516)) ([b4f8216](https://github.com/waku-org/js-waku/commit/b4f821676120aa06f4772eed62fb105d5afae7c6))
* Set peer-exchange with default bootstrap ([#1469](https://github.com/waku-org/js-waku/issues/1469)) ([81a52a8](https://github.com/waku-org/js-waku/commit/81a52a8097ba948783c9d798ba362af0f27e1c10))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.22 to 0.0.23
* @waku/enr bumped from 0.0.16 to 0.0.17
* @waku/interfaces bumped from 0.0.17 to 0.0.18
* @waku/utils bumped from 0.0.10 to 0.0.11
## [0.0.15](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.14...peer-exchange-v0.0.15) (2023-08-02)
### Bug Fixes
* Improve connection manager error handling + edge cases ([#1450](https://github.com/waku-org/js-waku/issues/1450)) ([785df52](https://github.com/waku-org/js-waku/commit/785df528fe6e5010a61391994e222028dbc4e4c5))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.21 to 0.0.22
* @waku/enr bumped from 0.0.15 to 0.0.16
* @waku/utils bumped from 0.0.9 to 0.0.10
* @waku/interfaces bumped from 0.0.16 to 0.0.17
## [0.0.14](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.13...peer-exchange-v0.0.14) (2023-07-26)
### ⚠ BREAKING CHANGES
* upgrade to libp2p@0.45 ([#1400](https://github.com/waku-org/js-waku/issues/1400))
### Features
* Enable event emission for peer discovery/connection in ConnectionManager ([#1438](https://github.com/waku-org/js-waku/issues/1438)) ([6ce898d](https://github.com/waku-org/js-waku/commit/6ce898d77132f30b5d8f33b48c7f6276992a486e))
* Upgrade to libp2p@0.45 ([#1400](https://github.com/waku-org/js-waku/issues/1400)) ([420e6c6](https://github.com/waku-org/js-waku/commit/420e6c698dd8f44d40d34e47d876da5d2e1ce85e))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.20 to 0.0.21
* @waku/enr bumped from 0.0.14 to 0.0.15
* @waku/utils bumped from 0.0.8 to 0.0.9
* @waku/interfaces bumped from 0.0.15 to 0.0.16
## [0.0.11](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.10...peer-exchange-v0.0.11) (2023-05-18)
### ⚠ BREAKING CHANGES
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316))
### Features
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316)) ([50c2c25](https://github.com/waku-org/js-waku/commit/50c2c2540f3c5ff78d93f3fea646da0eee246e17))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from * to 0.0.18
* @waku/enr bumped from * to 0.0.12
* @waku/utils bumped from * to 0.0.6
* devDependencies
* @waku/interfaces bumped from * to 0.0.13
## [0.0.5](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.4...peer-exchange-v0.0.5) (2023-03-23)
### Features
* Compliance test for peer-exchange discovery ([#1186](https://github.com/waku-org/js-waku/issues/1186)) ([5b0c3c3](https://github.com/waku-org/js-waku/commit/5b0c3c3cac3ddb5687d8f59457d6056527a8666c))
### Bug Fixes
* @waku/peer-exchange uses @waku/core and should depend on it ([e922ed4](https://github.com/waku-org/js-waku/commit/e922ed49ec70553227751518251152c765efd07c))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from * to 0.0.12
* @waku/enr bumped from 0.0.6 to 0.0.7
* devDependencies
* @waku/interfaces bumped from 0.0.8 to 0.0.9
## [0.0.4](https://github.com/waku-org/js-waku/compare/peer-exchange-v0.0.3...peer-exchange-v0.0.4) (2023-03-16)
### ⚠ BREAKING CHANGES
* directly convert from ENR to `PeerInfo`, remove unneeded utility
* extract decoder code
* bump typescript
* bump all prod dependencies
* bump libp2p dependencies
### Features
* Codec as a property of the protocol implementations ([a5ff788](https://github.com/waku-org/js-waku/commit/a5ff788eed419556e11319f22ca9e3109c81df92))
* DNS discovery as default bootstrap discovery ([#1114](https://github.com/waku-org/js-waku/issues/1114)) ([11819fc](https://github.com/waku-org/js-waku/commit/11819fc7b14e18385d421facaf2af0832cad1da8))
### Bug Fixes
* **dns-discovery/peer-exchange:** Check if peer is already tagged ([952aadd](https://github.com/waku-org/js-waku/commit/952aadd7bbbe1a7265c5126c1678f552bef0648d))
* Prettier and cspell ignore CHANGELOG ([#1235](https://github.com/waku-org/js-waku/issues/1235)) ([4d7b3e3](https://github.com/waku-org/js-waku/commit/4d7b3e39e6761afaf5d05a13cc4b3c23e15f9bd5))
* Remove initialising peer-exchange while creating a node ([#1158](https://github.com/waku-org/js-waku/issues/1158)) ([1b41569](https://github.com/waku-org/js-waku/commit/1b4156902387ea35b24b3d6f5d22e4635ea8cf18))
### Miscellaneous Chores
* Bump all prod dependencies ([88cc76d](https://github.com/waku-org/js-waku/commit/88cc76d2b811e1fa4460207f38704ecfe18fb260))
* Bump libp2p dependencies ([803ae7b](https://github.com/waku-org/js-waku/commit/803ae7bd8ed3de665026446c23cde90e7eba9d36))
* Bump typescript ([12d86e6](https://github.com/waku-org/js-waku/commit/12d86e6abcc68e27c39ca86b4f0dc2b68cdd6000))
* Directly convert from ENR to `PeerInfo`, remove unneeded utility ([6dbcde0](https://github.com/waku-org/js-waku/commit/6dbcde041ab8fa8c2df75cc25319a0eccf6b0454))
* Extract decoder code ([130c49b](https://github.com/waku-org/js-waku/commit/130c49b636807063364f309da0da2a24a68f2178))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from * to 0.0.6
* @waku/proto bumped from * to 0.0.3
* devDependencies
* @waku/interfaces bumped from * to 0.0.8
## Changelog
All notable changes to this project will be documented in this file.
The file is maintained by [Release Please](https://github.com/googleapis/release-please) based on [Conventional Commits](https://www.conventionalcommits.org) specification,
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,83 +0,0 @@
{
"name": "@waku/peer-exchange",
"version": "0.0.20",
"description": "Peer Exchange (https://rfc.vac.dev/spec/34/) protocol for Waku",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"type": "module",
"author": "Waku Team",
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/peer-exchange#readme",
"repository": {
"type": "git",
"url": "https://github.com/waku-org/js-waku.git"
},
"bugs": {
"url": "https://github.com/waku-org/js-waku/issues"
},
"license": "MIT OR Apache-2.0",
"keywords": [
"waku",
"decentralized",
"secure",
"communication",
"web3",
"ethereum",
"dapps",
"privacy"
],
"scripts": {
"build": "run-s build:**",
"build:esm": "tsc",
"build:bundle": "rollup --config rollup.config.js",
"fix": "run-s fix:*",
"fix:lint": "eslint src *.js --fix",
"check": "run-s check:*",
"check:lint": "eslint src *.js",
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
"check:tsc": "tsc -p tsconfig.dev.json",
"prepublish": "npm run build",
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
},
"engines": {
"node": ">=18"
},
"dependencies": {
"@libp2p/interfaces": "^3.3.2",
"@waku/core": "0.0.27",
"@waku/enr": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15",
"debug": "^4.3.4",
"it-all": "^3.0.4",
"it-length-prefixed": "^9.0.4",
"it-pipe": "^3.0.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@waku/build-utils": "*",
"chai": "^4.3.10",
"cspell": "^8.3.2",
"npm-run-all": "^4.1.5",
"rollup": "^4.12.0",
"uint8arraylist": "^2.4.3"
},
"files": [
"dist",
"bundle",
"src/**/*.ts",
"!**/*.spec.*",
"!**/*.json",
"CHANGELOG.md",
"LICENSE",
"README.md"
]
}

View File

@ -1,24 +0,0 @@
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { extractExports } from "@waku/build-utils";
import * as packageJson from "./package.json" assert { type: "json" };
const input = extractExports(packageJson);
export default {
input,
output: {
dir: "bundle",
format: "esm"
},
plugins: [
commonjs(),
json(),
nodeResolve({
browser: true,
preferBuiltins: false
})
]
};

View File

@ -1,3 +0,0 @@
{
"extends": "../../tsconfig.dev"
}

View File

@ -1,10 +0,0 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "dist/",
"rootDir": "src",
"tsBuildInfoFile": "dist/.tsbuildinfo"
},
"include": ["src"],
"exclude": ["src/**/*.spec.ts", "src/test_utils"]
}

View File

@ -1,4 +0,0 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -66,6 +66,21 @@
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"rollup": "^4.12.0" "rollup": "^4.12.0"
}, },
"peerDependencies": {
"@waku/core": "0.0.27",
"@waku/interfaces": "0.0.22",
"@waku/proto": "0.0.6",
"@waku/utils": "0.0.15",
"@chainsafe/libp2p-gossipsub": "^12.0.0"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
},
"@chainsafe/libp2p-gossipsub": {
"optional": true
}
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -20,8 +20,8 @@ import {
IRelay, IRelay,
Libp2p, Libp2p,
ProtocolCreateOptions, ProtocolCreateOptions,
ProtocolError,
PubsubTopic, PubsubTopic,
SendError,
SendResult SendResult
} from "@waku/interfaces"; } from "@waku/interfaces";
import { isWireSizeUnderCap, toAsyncIterator } from "@waku/utils"; import { isWireSizeUnderCap, toAsyncIterator } from "@waku/utils";
@ -109,7 +109,7 @@ class Relay implements IRelay {
successes, successes,
failures: [ failures: [
{ {
error: SendError.TOPIC_NOT_CONFIGURED error: ProtocolError.TOPIC_NOT_CONFIGURED
} }
] ]
}; };
@ -122,7 +122,7 @@ class Relay implements IRelay {
successes, successes,
failures: [ failures: [
{ {
error: SendError.ENCODE_FAILED error: ProtocolError.ENCODE_FAILED
} }
] ]
}; };
@ -134,7 +134,7 @@ class Relay implements IRelay {
successes, successes,
failures: [ failures: [
{ {
error: SendError.SIZE_TOO_BIG error: ProtocolError.SIZE_TOO_BIG
} }
] ]
}; };

View File

@ -66,6 +66,7 @@
"@libp2p/mplex": "^10.0.12", "@libp2p/mplex": "^10.0.12",
"@libp2p/ping": "^1.0.12", "@libp2p/ping": "^1.0.12",
"@libp2p/websockets": "^8.0.11", "@libp2p/websockets": "^8.0.11",
"@waku/discovery": "0.0.1",
"@waku/core": "0.0.27", "@waku/core": "0.0.27",
"@waku/dns-discovery": "0.0.21", "@waku/dns-discovery": "0.0.21",
"@waku/interfaces": "0.0.22", "@waku/interfaces": "0.0.22",
@ -88,7 +89,22 @@
"rollup": "^4.12.0" "rollup": "^4.12.0"
}, },
"peerDependencies": { "peerDependencies": {
"@libp2p/bootstrap": "^10" "@libp2p/bootstrap": "^10",
"@waku/core": "0.0.27",
"@waku/dns-discovery": "0.0.21",
"@waku/interfaces": "0.0.22",
"@waku/local-peer-cache-discovery": "^1.0.0",
"@waku/peer-exchange": "^0.0.20",
"@waku/relay": "0.0.10",
"@waku/utils": "0.0.15"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
},
"@libp2p/bootstrap": {
"optional": true
}
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -7,7 +7,7 @@ import {
type IMessage, type IMessage,
type Libp2p, type Libp2p,
type ProtocolCreateOptions, type ProtocolCreateOptions,
SendError, ProtocolError,
type SendResult type SendResult
} from "@waku/interfaces"; } from "@waku/interfaces";
import { ensurePubsubTopicIsConfigured, Logger } from "@waku/utils"; import { ensurePubsubTopicIsConfigured, Logger } from "@waku/utils";
@ -37,7 +37,7 @@ export class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK {
return { return {
failures: [ failures: [
{ {
error: SendError.TOPIC_NOT_CONFIGURED error: ProtocolError.TOPIC_NOT_CONFIGURED
} }
], ],
successes: [] successes: []
@ -48,7 +48,7 @@ export class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK {
if (!peers.length) { if (!peers.length) {
return { return {
successes, successes,
failures: [{ error: SendError.NO_PEER_AVAILABLE }] failures: [{ error: ProtocolError.NO_PEER_AVAILABLE }]
}; };
} }
@ -69,7 +69,7 @@ export class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK {
} }
} else { } else {
log.error("Failed to send message to peer", result.reason); log.error("Failed to send message to peer", result.reason);
failures.push({ error: SendError.GENERIC_FAIL }); failures.push({ error: ProtocolError.GENERIC_FAIL });
// TODO: handle renewing faulty peers with new peers (https://github.com/waku-org/js-waku/issues/1463) // TODO: handle renewing faulty peers with new peers (https://github.com/waku-org/js-waku/issues/1463)
} }
} }

View File

@ -74,9 +74,8 @@
"@types/mocha": "^10.0.6", "@types/mocha": "^10.0.6",
"@types/sinon": "^17.0.3", "@types/sinon": "^17.0.3",
"@types/tail": "^2.2.3", "@types/tail": "^2.2.3",
"@waku/dns-discovery": "*", "@waku/discovery": "*",
"@waku/message-encryption": "*", "@waku/message-encryption": "*",
"@waku/peer-exchange": "*",
"@waku/sdk": "*", "@waku/sdk": "*",
"allure-commandline": "^2.27.0", "allure-commandline": "^2.27.0",
"allure-mocha": "^2.9.2", "allure-mocha": "^2.9.2",

View File

@ -8,7 +8,7 @@ import {
enrTree, enrTree,
PeerDiscoveryDns, PeerDiscoveryDns,
wakuDnsDiscovery wakuDnsDiscovery
} from "@waku/dns-discovery"; } from "@waku/discovery";
import { Libp2pComponents } from "@waku/interfaces"; import { Libp2pComponents } from "@waku/interfaces";
import { createLightNode } from "@waku/sdk"; import { createLightNode } from "@waku/sdk";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -3,7 +3,7 @@ import {
DefaultPubsubTopic, DefaultPubsubTopic,
IRateLimitProof, IRateLimitProof,
LightNode, LightNode,
SendError ProtocolError
} from "@waku/interfaces"; } from "@waku/interfaces";
import { utf8ToBytes } from "@waku/sdk"; import { utf8ToBytes } from "@waku/sdk";
import { expect } from "chai"; import { expect } from "chai";
@ -97,7 +97,7 @@ const runTests = (strictNodeCheck: boolean): void => {
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
console.log("validated 1"); console.log("validated 1");
expect(pushResponse.failures?.map((failure) => failure.error)).to.include( expect(pushResponse.failures?.map((failure) => failure.error)).to.include(
SendError.EMPTY_PAYLOAD ProtocolError.EMPTY_PAYLOAD
); );
console.log("validated 2"); console.log("validated 2");
expect(await serviceNodes.messageCollector.waitForMessages(1)).to.eq( expect(await serviceNodes.messageCollector.waitForMessages(1)).to.eq(
@ -190,7 +190,7 @@ const runTests = (strictNodeCheck: boolean): void => {
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
expect( expect(
pushResponse.failures?.map((failure) => failure.error) pushResponse.failures?.map((failure) => failure.error)
).to.include(SendError.REMOTE_PEER_REJECTED); ).to.include(ProtocolError.REMOTE_PEER_REJECTED);
expect(await serviceNodes.messageCollector.waitForMessages(1)).to.eq( expect(await serviceNodes.messageCollector.waitForMessages(1)).to.eq(
false false
); );
@ -262,7 +262,7 @@ const runTests = (strictNodeCheck: boolean): void => {
}); });
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
expect(pushResponse.failures?.map((failure) => failure.error)).to.include( expect(pushResponse.failures?.map((failure) => failure.error)).to.include(
SendError.SIZE_TOO_BIG ProtocolError.SIZE_TOO_BIG
); );
expect(await serviceNodes.messageCollector.waitForMessages(1)).to.eq( expect(await serviceNodes.messageCollector.waitForMessages(1)).to.eq(
false false

View File

@ -3,7 +3,7 @@ import {
DefaultPubsubTopic, DefaultPubsubTopic,
IRateLimitProof, IRateLimitProof,
LightNode, LightNode,
SendError ProtocolError
} from "@waku/interfaces"; } from "@waku/interfaces";
import { utf8ToBytes } from "@waku/sdk"; import { utf8ToBytes } from "@waku/sdk";
import { expect } from "chai"; import { expect } from "chai";
@ -85,7 +85,7 @@ describe("Waku Light Push: Single Node", function () {
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
expect(pushResponse.failures?.map((failure) => failure.error)).to.include( expect(pushResponse.failures?.map((failure) => failure.error)).to.include(
SendError.EMPTY_PAYLOAD ProtocolError.EMPTY_PAYLOAD
); );
expect(await messageCollector.waitForMessages(1)).to.eq(false); expect(await messageCollector.waitForMessages(1)).to.eq(false);
}); });
@ -167,7 +167,7 @@ describe("Waku Light Push: Single Node", function () {
} else { } else {
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
expect(pushResponse.failures?.map((failure) => failure.error)).to.include( expect(pushResponse.failures?.map((failure) => failure.error)).to.include(
SendError.REMOTE_PEER_REJECTED ProtocolError.REMOTE_PEER_REJECTED
); );
expect(await messageCollector.waitForMessages(1)).to.eq(false); expect(await messageCollector.waitForMessages(1)).to.eq(false);
} }
@ -234,7 +234,7 @@ describe("Waku Light Push: Single Node", function () {
}); });
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
expect(pushResponse.failures?.map((failure) => failure.error)).to.include( expect(pushResponse.failures?.map((failure) => failure.error)).to.include(
SendError.SIZE_TOO_BIG ProtocolError.SIZE_TOO_BIG
); );
expect(await messageCollector.waitForMessages(1)).to.eq(false); expect(await messageCollector.waitForMessages(1)).to.eq(false);
}); });

View File

@ -52,11 +52,22 @@ describe("Metadata Protocol", function () {
await waku.start(); await waku.start();
await waku.libp2p.dialProtocol(nwaku1Ma, MetadataCodec); await waku.libp2p.dialProtocol(nwaku1Ma, MetadataCodec);
const shardInfoRes = if (!waku.libp2p.services.metadata) {
await waku.libp2p.services.metadata?.query(nwaku1PeerId); expect(waku.libp2p.services.metadata).to.not.be.undefined;
return;
}
const { error, shardInfo: shardInfoRes } =
await waku.libp2p.services.metadata.query(nwaku1PeerId);
if (error) {
expect(error).to.be.null;
return;
}
expect(shardInfoRes).to.not.be.undefined; expect(shardInfoRes).to.not.be.undefined;
expect(shardInfoRes?.clusterId).to.equal(shardInfo.clusterId); expect(shardInfoRes.clusterId).to.equal(shardInfo.clusterId);
expect(shardInfoRes?.shards).to.deep.equal(shardInfo.shards); expect(shardInfoRes.shards).to.deep.equal(shardInfo.shards);
const activeConnections = waku.libp2p.getConnections(); const activeConnections = waku.libp2p.getConnections();
expect(activeConnections.length).to.equal(1); expect(activeConnections.length).to.equal(1);
@ -89,11 +100,22 @@ describe("Metadata Protocol", function () {
await waku.start(); await waku.start();
await waku.libp2p.dialProtocol(nwaku1Ma, MetadataCodec); await waku.libp2p.dialProtocol(nwaku1Ma, MetadataCodec);
const shardInfoRes = if (!waku.libp2p.services.metadata) {
await waku.libp2p.services.metadata?.query(nwaku1PeerId); expect(waku.libp2p.services.metadata).to.not.be.undefined;
return;
}
const { error, shardInfo: shardInfoRes } =
await waku.libp2p.services.metadata.query(nwaku1PeerId);
if (error) {
expect(error).to.be.null;
return;
}
expect(shardInfoRes).to.not.be.undefined; expect(shardInfoRes).to.not.be.undefined;
expect(shardInfoRes?.clusterId).to.equal(shardInfo1.clusterId); expect(shardInfoRes.clusterId).to.equal(shardInfo1.clusterId);
expect(shardInfoRes?.shards).to.deep.equal(shardInfo1.shards); expect(shardInfoRes.shards).to.deep.equal(shardInfo1.shards);
const activeConnections = waku.libp2p.getConnections(); const activeConnections = waku.libp2p.getConnections();
expect(activeConnections.length).to.equal(1); expect(activeConnections.length).to.equal(1);

View File

@ -1,6 +1,6 @@
import tests from "@libp2p/interface-compliance-tests/peer-discovery"; import tests from "@libp2p/interface-compliance-tests/peer-discovery";
import { PeerExchangeCodec, PeerExchangeDiscovery } from "@waku/discovery";
import type { LightNode } from "@waku/interfaces"; import type { LightNode } from "@waku/interfaces";
import { PeerExchangeCodec, PeerExchangeDiscovery } from "@waku/peer-exchange";
import { createLightNode } from "@waku/sdk"; import { createLightNode } from "@waku/sdk";
import { singleShardInfoToPubsubTopic } from "@waku/utils"; import { singleShardInfoToPubsubTopic } from "@waku/utils";

View File

@ -1,7 +1,7 @@
import { bootstrap } from "@libp2p/bootstrap"; import { bootstrap } from "@libp2p/bootstrap";
import type { PeerId } from "@libp2p/interface"; import type { PeerId } from "@libp2p/interface";
import { wakuPeerExchangeDiscovery } from "@waku/discovery";
import type { LightNode, PeersByDiscoveryResult } from "@waku/interfaces"; import type { LightNode, PeersByDiscoveryResult } from "@waku/interfaces";
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
import { createLightNode, Tags } from "@waku/sdk"; import { createLightNode, Tags } from "@waku/sdk";
import { Logger, singleShardInfoToPubsubTopic } from "@waku/utils"; import { Logger, singleShardInfoToPubsubTopic } from "@waku/utils";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -3,8 +3,8 @@ import {
Fleet, Fleet,
getPredefinedBootstrapNodes getPredefinedBootstrapNodes
} from "@waku/core/lib/predefined_bootstrap_nodes"; } from "@waku/core/lib/predefined_bootstrap_nodes";
import { wakuPeerExchangeDiscovery } from "@waku/discovery";
import type { LightNode } from "@waku/interfaces"; import type { LightNode } from "@waku/interfaces";
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
import { createLightNode, DefaultPubsubTopic } from "@waku/sdk"; import { createLightNode, DefaultPubsubTopic } from "@waku/sdk";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -2,12 +2,12 @@ import { bootstrap } from "@libp2p/bootstrap";
import type { PeerId } from "@libp2p/interface"; import type { PeerId } from "@libp2p/interface";
import { multiaddr } from "@multiformats/multiaddr"; import { multiaddr } from "@multiformats/multiaddr";
import type { Multiaddr } from "@multiformats/multiaddr"; import type { Multiaddr } from "@multiformats/multiaddr";
import type { LightNode, PeerInfo } from "@waku/interfaces";
import { import {
PeerExchangeCodec, PeerExchangeCodec,
WakuPeerExchange, WakuPeerExchange,
wakuPeerExchangeDiscovery wakuPeerExchangeDiscovery
} from "@waku/peer-exchange"; } from "@waku/discovery";
import type { LightNode, PeerInfo } from "@waku/interfaces";
import { createLightNode, Libp2pComponents } from "@waku/sdk"; import { createLightNode, Libp2pComponents } from "@waku/sdk";
import { Logger, singleShardInfoToPubsubTopic } from "@waku/utils"; import { Logger, singleShardInfoToPubsubTopic } from "@waku/utils";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -1,5 +1,5 @@
import { createEncoder } from "@waku/core"; import { createEncoder } from "@waku/core";
import { IRateLimitProof, RelayNode, SendError } from "@waku/interfaces"; import { IRateLimitProof, ProtocolError, RelayNode } from "@waku/interfaces";
import { createRelayNode } from "@waku/sdk/relay"; import { createRelayNode } from "@waku/sdk/relay";
import { utf8ToBytes } from "@waku/utils/bytes"; import { utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai"; import { expect } from "chai";
@ -135,7 +135,7 @@ describe("Waku Relay, Publish", function () {
payload: utf8ToBytes("") payload: utf8ToBytes("")
}); });
expect(pushResponse.failures?.[0].error).to.eq( expect(pushResponse.failures?.[0].error).to.eq(
SendError.TOPIC_NOT_CONFIGURED ProtocolError.TOPIC_NOT_CONFIGURED
); );
await delay(400); await delay(400);
expect(await messageCollector.waitForMessages(1)).to.eq(false); expect(await messageCollector.waitForMessages(1)).to.eq(false);
@ -148,7 +148,7 @@ describe("Waku Relay, Publish", function () {
}); });
expect(pushResponse.successes.length).to.eq(0); expect(pushResponse.successes.length).to.eq(0);
expect(pushResponse.failures?.map((failure) => failure.error)).to.include( expect(pushResponse.failures?.map((failure) => failure.error)).to.include(
SendError.SIZE_TOO_BIG ProtocolError.SIZE_TOO_BIG
); );
await delay(400); await delay(400);
expect(await messageCollector.waitForMessages(1)).to.eq(false); expect(await messageCollector.waitForMessages(1)).to.eq(false);

View File

@ -1,6 +1,6 @@
import { bootstrap } from "@libp2p/bootstrap"; import { bootstrap } from "@libp2p/bootstrap";
import type { PeerId } from "@libp2p/interface"; import type { PeerId } from "@libp2p/interface";
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange"; import { wakuPeerExchangeDiscovery } from "@waku/discovery";
import { import {
ContentTopicInfo, ContentTopicInfo,
createLightNode, createLightNode,

View File

@ -1,7 +1,7 @@
import { import {
LightNode, LightNode,
ProtocolError,
Protocols, Protocols,
SendError,
ShardInfo, ShardInfo,
SingleShardInfo SingleShardInfo
} from "@waku/interfaces"; } from "@waku/interfaces";
@ -93,7 +93,7 @@ describe("Static Sharding: Running Nodes", function () {
} }
const errors = failures?.map((failure) => failure.error); const errors = failures?.map((failure) => failure.error);
expect(errors).to.include(SendError.TOPIC_NOT_CONFIGURED); expect(errors).to.include(ProtocolError.TOPIC_NOT_CONFIGURED);
}); });
}); });

View File

@ -1,5 +1,5 @@
import { bootstrap } from "@libp2p/bootstrap"; import { bootstrap } from "@libp2p/bootstrap";
import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery"; import { enrTree, wakuDnsDiscovery } from "@waku/discovery";
import { LightNode } from "@waku/interfaces"; import { LightNode } from "@waku/interfaces";
import { createLightNode } from "@waku/sdk"; import { createLightNode } from "@waku/sdk";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -83,6 +83,14 @@
"fast-check": "^3.15.1", "fast-check": "^3.15.1",
"rollup": "^4.12.0" "rollup": "^4.12.0"
}, },
"peerDependencies": {
"@waku/interfaces": "0.0.22"
},
"peerDependenciesMeta": {
"@waku/interfaces": {
"optional": true
}
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -100,7 +100,7 @@ export const pubsubTopicToSingleShardInfo = (
}; };
//TODO: move part of BaseProtocol instead of utils //TODO: move part of BaseProtocol instead of utils
// return `SendError.TOPIC_NOT_CONFIGURED` instead of throwing // return `ProtocolError.TOPIC_NOT_CONFIGURED` instead of throwing
export function ensurePubsubTopicIsConfigured( export function ensurePubsubTopicIsConfigured(
pubsubTopic: PubsubTopic, pubsubTopic: PubsubTopic,
configuredTopics: PubsubTopic[] configuredTopics: PubsubTopic[]

View File

@ -11,13 +11,11 @@
"packages/interfaces": {}, "packages/interfaces": {},
"packages/message-hash": {}, "packages/message-hash": {},
"packages/enr": {}, "packages/enr": {},
"packages/peer-exchange": {},
"packages/core": {}, "packages/core": {},
"packages/dns-discovery": {},
"packages/message-encryption": {}, "packages/message-encryption": {},
"packages/sdk": {}, "packages/sdk": {},
"packages/relay": {}, "packages/relay": {},
"packages/local-peer-cache-discovery": {}, "packages/rln": {},
"packages/rln": {} "packages/discovery": {}
} }
} }