Merge pull request #1330 from waku-org/chore/it-length-prefixed-9.0.1

This commit is contained in:
fryorcraken.eth 2023-05-06 14:16:33 +10:00 committed by GitHub
commit 72d1a80207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 220 additions and 26 deletions

222
package-lock.json generated
View File

@ -9,9 +9,9 @@
"packages/utils",
"packages/proto",
"packages/interfaces",
"packages/message-hash",
"packages/enr",
"packages/core",
"packages/message-hash",
"packages/peer-exchange",
"packages/dns-discovery",
"packages/message-encryption",
@ -1475,6 +1475,22 @@
"npm": ">=8.7.0"
}
},
"node_modules/@chainsafe/libp2p-gossipsub/node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@chainsafe/libp2p-noise": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/@chainsafe/libp2p-noise/-/libp2p-noise-11.0.1.tgz",
@ -1505,6 +1521,22 @@
"npm": ">=7.0.0"
}
},
"node_modules/@chainsafe/libp2p-noise/node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@chainsafe/netmask": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@chainsafe/netmask/-/netmask-2.0.0.tgz",
@ -3412,6 +3444,22 @@
"npm": ">=7.0.0"
}
},
"node_modules/@libp2p/multistream-select/node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@libp2p/peer-collections": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@libp2p/peer-collections/-/peer-collections-3.0.0.tgz",
@ -3699,6 +3747,22 @@
"npm": ">=7.0.0"
}
},
"node_modules/@libp2p/pubsub/node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@libp2p/topology": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@libp2p/topology/-/topology-4.0.1.tgz",
@ -14373,12 +14437,12 @@
}
},
"node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-9.0.1.tgz",
"integrity": "sha512-ZBD8ZFLERj8d1q9CeBtk0eJ4EpeI3qwnkmWtemBSm3ZI2dM8PUweNVk5haZ2vw3EIq2uYQiabV9YwNm6EASM4A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"it-stream-types": "^2.0.1",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
@ -14388,6 +14452,15 @@
"npm": ">=7.0.0"
}
},
"node_modules/it-length-prefixed/node_modules/it-stream-types": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/it-stream-types/-/it-stream-types-2.0.1.tgz",
"integrity": "sha512-6DmOs5r7ERDbvS4q8yLKENcj6Yecr7QQTqWApbZdfAUTEC947d+PEha7PCqhm//9oxaLYL7TWRekwhoXl2s6fg==",
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/it-map": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/it-map/-/it-map-2.0.1.tgz",
@ -14437,6 +14510,22 @@
"npm": ">=7.0.0"
}
},
"node_modules/it-pb-stream/node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/it-pipe": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.5.tgz",
@ -15169,6 +15258,22 @@
"npm": ">=7.0.0"
}
},
"node_modules/libp2p/node_modules/it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"dependencies": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/lilconfig": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz",
@ -29182,7 +29287,7 @@
"@waku/utils": "0.0.4",
"debug": "^4.3.4",
"it-all": "^3.0.1",
"it-length-prefixed": "^8.0.4",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5",
"p-event": "^5.0.1",
"uint8arraylist": "^2.4.3",
@ -29594,7 +29699,7 @@
},
"packages/message-hash": {
"name": "@waku/message-hash",
"version": "0.0.10",
"version": "0.1.0",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@noble/hashes": "^1.2.0",
@ -29653,7 +29758,7 @@
"@waku/utils": "0.0.4",
"debug": "^4.3.4",
"it-all": "^3.0.1",
"it-length-prefixed": "^8.0.4",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5"
},
"devDependencies": {
@ -30880,6 +30985,20 @@
"protobufjs": "^6.11.2",
"uint8arraylist": "^2.3.2",
"uint8arrays": "^4.0.2"
},
"dependencies": {
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
}
}
}
},
"@chainsafe/libp2p-noise": {
@ -30906,6 +31025,20 @@
"protons-runtime": "^4.0.1",
"uint8arraylist": "^2.3.2",
"uint8arrays": "^4.0.2"
},
"dependencies": {
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
}
}
}
},
"@chainsafe/netmask": {
@ -32304,6 +32437,20 @@
"p-defer": "^4.0.0",
"uint8arraylist": "^2.3.1",
"uint8arrays": "^4.0.2"
},
"dependencies": {
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
}
}
}
},
"@libp2p/peer-collections": {
@ -32532,6 +32679,20 @@
"p-queue": "^7.2.0",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"dependencies": {
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
}
}
}
},
"@libp2p/topology": {
@ -34409,7 +34570,7 @@
"ignore-loader": "^0.1.2",
"isomorphic-fetch": "^3.0.0",
"it-all": "^3.0.1",
"it-length-prefixed": "^8.0.4",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
@ -34798,7 +34959,7 @@
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"it-all": "^3.0.1",
"it-length-prefixed": "^8.0.4",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
@ -40988,15 +41149,22 @@
}
},
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-9.0.1.tgz",
"integrity": "sha512-ZBD8ZFLERj8d1q9CeBtk0eJ4EpeI3qwnkmWtemBSm3ZI2dM8PUweNVk5haZ2vw3EIq2uYQiabV9YwNm6EASM4A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"it-stream-types": "^2.0.1",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
},
"dependencies": {
"it-stream-types": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/it-stream-types/-/it-stream-types-2.0.1.tgz",
"integrity": "sha512-6DmOs5r7ERDbvS4q8yLKENcj6Yecr7QQTqWApbZdfAUTEC947d+PEha7PCqhm//9oxaLYL7TWRekwhoXl2s6fg=="
}
}
},
"it-map": {
@ -41030,6 +41198,20 @@
"it-length-prefixed": "^8.0.2",
"it-stream-types": "^1.0.4",
"uint8arraylist": "^2.0.0"
},
"dependencies": {
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
}
}
}
},
"it-pipe": {
@ -41599,6 +41781,18 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/it-all/-/it-all-2.0.1.tgz",
"integrity": "sha512-9UuJcCRZsboz+HBQTNOau80Dw+ryGaHYFP/cPYzFBJBFcfDathMYnhHk4t52en9+fcyDGPTdLB+lFc1wzQIroA=="
},
"it-length-prefixed": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-8.0.4.tgz",
"integrity": "sha512-5OJ1lxH+IaqJB7lxe8IAIwt9UfSfsmjKJoAI/RO9djYoBDt1Jfy9PeVHUmOfqhqyu/4kJvWBFAJUaG1HhLQ12A==",
"requires": {
"err-code": "^3.0.1",
"it-stream-types": "^1.0.4",
"uint8-varint": "^1.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^4.0.2"
}
}
}
},

View File

@ -82,7 +82,7 @@
"@waku/utils": "0.0.4",
"debug": "^4.3.4",
"it-all": "^3.0.1",
"it-length-prefixed": "^8.0.4",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5",
"p-event": "^5.0.1",
"uint8arraylist": "^2.4.3",

View File

@ -92,9 +92,9 @@ class Filter extends BaseProtocol implements IFilter {
try {
const res = await pipe(
[request.encode()],
lp.encode(),
lp.encode,
stream,
lp.decode(),
lp.decode,
async (source) => await all(source)
);
@ -143,7 +143,7 @@ class Filter extends BaseProtocol implements IFilter {
private onRequest(streamData: IncomingStreamData): void {
log("Receiving message push");
try {
pipe(streamData.stream, lp.decode(), async (source) => {
pipe(streamData.stream, lp.decode, async (source) => {
for await (const bytes of source) {
const res = FilterRpc.decode(bytes.slice());
if (res.requestId && res.push?.messages?.length) {
@ -225,7 +225,7 @@ class Filter extends BaseProtocol implements IFilter {
const stream = await this.newStream(peer);
try {
await pipe([unsubscribeRequest.encode()], lp.encode(), stream.sink);
await pipe([unsubscribeRequest.encode()], lp.encode, stream.sink);
} catch (e) {
log("Error unsubscribing", e);
throw e;

View File

@ -57,9 +57,9 @@ class LightPush extends BaseProtocol implements ILightPush {
const query = PushRpc.createRequest(protoMessage, pubSubTopic);
const res = await pipe(
[query.encode()],
lp.encode(),
lp.encode,
stream,
lp.decode(),
lp.decode,
async (source) => await all(source)
);
try {

View File

@ -274,9 +274,9 @@ async function* paginate<T extends IDecodedMessage>(
const res = await pipe(
[historyRpcQuery.encode()],
lp.encode(),
lp.encode,
stream,
lp.decode(),
lp.decode,
async (source) => await all(source)
);

View File

@ -56,7 +56,7 @@
"@waku/utils": "0.0.4",
"debug": "^4.3.4",
"it-all": "^3.0.1",
"it-length-prefixed": "^8.0.4",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5"
},
"devDependencies": {

View File

@ -63,9 +63,9 @@ export class WakuPeerExchange extends BaseProtocol implements IPeerExchange {
const res = await pipe(
[rpcQuery.encode()],
lp.encode(),
lp.encode,
stream,
lp.decode(),
lp.decode,
async (source) => await all(source)
);