@waku/core 0.0.26 → 0.0.28-070b625.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/bundle/{base_protocol-pDODy0G6.js → base_protocol-D0Zdzb-v.js} +134 -89
- package/bundle/{browser-mTOOnVZp.js → browser-DoQRY-an.js} +518 -712
- package/bundle/{index-cmONXM-V.js → index-BJwgMx4y.js} +116 -88
- package/bundle/index.js +2967 -21667
- package/bundle/lib/base_protocol.js +3 -3
- package/bundle/lib/message/version_0.js +3 -3
- package/bundle/lib/predefined_bootstrap_nodes.js +17 -17
- package/bundle/version_0-C6o0DvNW.js +4055 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/base_protocol.d.ts +15 -13
- package/dist/lib/base_protocol.js +35 -22
- package/dist/lib/base_protocol.js.map +1 -1
- package/dist/lib/connection_manager.d.ts +2 -2
- package/dist/lib/connection_manager.js +16 -6
- package/dist/lib/connection_manager.js.map +1 -1
- package/dist/lib/filter/index.d.ts +1 -1
- package/dist/lib/filter/index.js +144 -82
- package/dist/lib/filter/index.js.map +1 -1
- package/dist/lib/filterPeers.d.ts +8 -5
- package/dist/lib/filterPeers.js +12 -5
- package/dist/lib/filterPeers.js.map +1 -1
- package/dist/lib/keep_alive_manager.d.ts +2 -3
- package/dist/lib/keep_alive_manager.js.map +1 -1
- package/dist/lib/light_push/index.d.ts +12 -2
- package/dist/lib/light_push/index.js +80 -80
- package/dist/lib/light_push/index.js.map +1 -1
- package/dist/lib/message/version_0.js +1 -1
- package/dist/lib/message/version_0.js.map +1 -1
- package/dist/lib/metadata/index.d.ts +2 -2
- package/dist/lib/metadata/index.js +58 -16
- package/dist/lib/metadata/index.js.map +1 -1
- package/dist/lib/predefined_bootstrap_nodes.d.ts +11 -11
- package/dist/lib/predefined_bootstrap_nodes.js +16 -16
- package/dist/lib/predefined_bootstrap_nodes.js.map +1 -1
- package/dist/lib/store/history_rpc.js +1 -1
- package/dist/lib/store/history_rpc.js.map +1 -1
- package/dist/lib/store/index.d.ts +14 -6
- package/dist/lib/store/index.js +51 -235
- package/dist/lib/store/index.js.map +1 -1
- package/dist/lib/stream_manager.d.ts +2 -2
- package/dist/lib/stream_manager.js.map +1 -1
- package/dist/lib/wait_for_remote_peer.d.ts +1 -1
- package/dist/lib/wait_for_remote_peer.js +42 -10
- package/dist/lib/wait_for_remote_peer.js.map +1 -1
- package/package.json +1 -127
- package/src/index.ts +3 -7
- package/src/lib/base_protocol.ts +57 -37
- package/src/lib/connection_manager.ts +17 -10
- package/src/lib/filter/index.ts +234 -136
- package/src/lib/filterPeers.ts +15 -7
- package/src/lib/keep_alive_manager.ts +2 -3
- package/src/lib/light_push/index.ts +104 -124
- package/src/lib/metadata/index.ts +92 -30
- package/src/lib/predefined_bootstrap_nodes.ts +22 -22
- package/src/lib/store/index.ts +79 -344
- package/src/lib/stream_manager.ts +2 -3
- package/src/lib/wait_for_remote_peer.ts +68 -12
- package/bundle/version_0-LQTFNC7k.js +0 -5008
- package/dist/lib/waku.d.ts +0 -57
- package/dist/lib/waku.js +0 -130
- package/dist/lib/waku.js.map +0 -1
- package/src/lib/waku.ts +0 -214
package/dist/lib/store/index.js
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
import { sha256 } from "@noble/hashes/sha256";
|
2
1
|
import { proto_store as proto } from "@waku/proto";
|
3
|
-
import { ensurePubsubTopicIsConfigured, isDefined } from "@waku/utils";
|
4
2
|
import { Logger } from "@waku/utils";
|
5
|
-
import { concat, utf8ToBytes } from "@waku/utils/bytes";
|
6
3
|
import all from "it-all";
|
7
4
|
import * as lp from "it-length-prefixed";
|
8
5
|
import { pipe } from "it-pipe";
|
@@ -13,254 +10,73 @@ import { HistoryRpc, PageDirection } from "./history_rpc.js";
|
|
13
10
|
var HistoryError = proto.HistoryResponse.HistoryError;
|
14
11
|
const log = new Logger("store");
|
15
12
|
export const StoreCodec = "/vac/waku/store/2.0.0-beta4";
|
16
|
-
export const DefaultPageSize = 10;
|
17
13
|
export { PageDirection };
|
18
14
|
/**
|
19
15
|
* Implements the [Waku v2 Store protocol](https://rfc.vac.dev/spec/13/).
|
20
16
|
*
|
21
17
|
* The Waku Store protocol can be used to retrieved historical messages.
|
22
18
|
*/
|
23
|
-
class
|
24
|
-
pubsubTopics;
|
25
|
-
NUM_PEERS_PROTOCOL = 1;
|
19
|
+
export class StoreCore extends BaseProtocol {
|
26
20
|
constructor(libp2p, options) {
|
27
|
-
super(StoreCodec, libp2p.components);
|
28
|
-
this.pubsubTopics = this.initializePubsubTopic(options);
|
21
|
+
super(StoreCodec, libp2p.components, log, options.pubsubTopics, options);
|
29
22
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
async processMessages(messages, callback, options) {
|
35
|
-
let abort = false;
|
36
|
-
const messagesOrUndef = await Promise.all(messages);
|
37
|
-
let processedMessages = messagesOrUndef.filter(isDefined);
|
38
|
-
if (this.shouldReverseOrder(options)) {
|
39
|
-
processedMessages = processedMessages.reverse();
|
23
|
+
async *queryPerPage(queryOpts, decoders, peer) {
|
24
|
+
if (queryOpts.contentTopics.toString() !==
|
25
|
+
Array.from(decoders.keys()).toString()) {
|
26
|
+
throw new Error("Internal error, the decoders should match the query's content topics");
|
40
27
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
28
|
+
let currentCursor = queryOpts.cursor;
|
29
|
+
while (true) {
|
30
|
+
queryOpts.cursor = currentCursor;
|
31
|
+
const historyRpcQuery = HistoryRpc.createQuery(queryOpts);
|
32
|
+
const stream = await this.getStream(peer);
|
33
|
+
const res = await pipe([historyRpcQuery.encode()], lp.encode, stream, lp.decode, async (source) => await all(source));
|
34
|
+
const bytes = new Uint8ArrayList();
|
35
|
+
res.forEach((chunk) => {
|
36
|
+
bytes.append(chunk);
|
37
|
+
});
|
38
|
+
const reply = historyRpcQuery.decode(bytes);
|
39
|
+
if (!reply.response) {
|
40
|
+
log.warn("Stopping pagination due to store `response` field missing");
|
41
|
+
break;
|
44
42
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
* Messages in pages are ordered from oldest (first) to most recent (last).
|
52
|
-
* https://github.com/vacp2p/rfc/issues/533
|
53
|
-
*
|
54
|
-
* @private
|
55
|
-
*/
|
56
|
-
shouldReverseOrder(options) {
|
57
|
-
return (typeof options?.pageDirection === "undefined" ||
|
58
|
-
options?.pageDirection === PageDirection.BACKWARD);
|
59
|
-
}
|
60
|
-
/**
|
61
|
-
* @deprecated Use `queryWithOrderedCallback` instead
|
62
|
-
**/
|
63
|
-
queryOrderedCallback = this.queryWithOrderedCallback;
|
64
|
-
/**
|
65
|
-
* Do a query to a Waku Store to retrieve historical/missed messages.
|
66
|
-
*
|
67
|
-
* The callback function takes a `WakuMessage` in input,
|
68
|
-
* messages are processed in order:
|
69
|
-
* - oldest to latest if `options.pageDirection` == { @link PageDirection.FORWARD }
|
70
|
-
* - latest to oldest if `options.pageDirection` == { @link PageDirection.BACKWARD }
|
71
|
-
*
|
72
|
-
* The ordering may affect performance.
|
73
|
-
* The ordering depends on the behavior of the remote store node.
|
74
|
-
* If strong ordering is needed, you may need to handle this at application level
|
75
|
-
* and set your own timestamps too (the WakuMessage timestamps are not certified).
|
76
|
-
*
|
77
|
-
* @throws If not able to reach a Waku Store peer to query,
|
78
|
-
* or if an error is encountered when processing the reply,
|
79
|
-
* or if two decoders with the same content topic are passed.
|
80
|
-
*/
|
81
|
-
async queryWithOrderedCallback(decoders, callback, options) {
|
82
|
-
for await (const promises of this.queryGenerator(decoders, options)) {
|
83
|
-
if (await this.processMessages(promises, callback, options))
|
43
|
+
const response = reply.response;
|
44
|
+
if (response.error && response.error !== HistoryError.NONE) {
|
45
|
+
throw "History response contains an Error: " + response.error;
|
46
|
+
}
|
47
|
+
if (!response.messages || !response.messages.length) {
|
48
|
+
log.warn("Stopping pagination due to store `response.messages` field missing or empty");
|
84
49
|
break;
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
* Do note that the resolution of the `Promise<WakuMessage | undefined` may
|
97
|
-
* break the order as it may rely on the browser decryption API, which in turn,
|
98
|
-
* may have a different speed depending on the type of decryption.
|
99
|
-
*
|
100
|
-
* @throws If not able to reach a Waku Store peer to query,
|
101
|
-
* or if an error is encountered when processing the reply,
|
102
|
-
* or if two decoders with the same content topic are passed.
|
103
|
-
*/
|
104
|
-
async queryWithPromiseCallback(decoders, callback, options) {
|
105
|
-
let abort = false;
|
106
|
-
for await (const page of this.queryGenerator(decoders, options)) {
|
107
|
-
const _promises = page.map(async (msgPromise) => {
|
108
|
-
if (abort)
|
109
|
-
return;
|
110
|
-
abort = Boolean(await callback(msgPromise));
|
50
|
+
}
|
51
|
+
log.error(`${response.messages.length} messages retrieved from store`);
|
52
|
+
yield response.messages.map((protoMsg) => {
|
53
|
+
const contentTopic = protoMsg.contentTopic;
|
54
|
+
if (typeof contentTopic !== "undefined") {
|
55
|
+
const decoder = decoders.get(contentTopic);
|
56
|
+
if (decoder) {
|
57
|
+
return decoder.fromProtoObj(queryOpts.pubsubTopic, toProtoMessage(protoMsg));
|
58
|
+
}
|
59
|
+
}
|
60
|
+
return Promise.resolve(undefined);
|
111
61
|
});
|
112
|
-
|
113
|
-
if (
|
62
|
+
const nextCursor = response.pagingInfo?.cursor;
|
63
|
+
if (typeof nextCursor === "undefined") {
|
64
|
+
// If the server does not return cursor then there is an issue,
|
65
|
+
// Need to abort, or we end up in an infinite loop
|
66
|
+
log.warn("Stopping pagination due to `response.pagingInfo.cursor` missing from store response");
|
114
67
|
break;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
/**
|
118
|
-
* Do a query to a Waku Store to retrieve historical/missed messages.
|
119
|
-
*
|
120
|
-
* This is a generator, useful if you want most control on how messages
|
121
|
-
* are processed.
|
122
|
-
*
|
123
|
-
* The order of the messages returned by the remote Waku node SHOULD BE
|
124
|
-
* as follows:
|
125
|
-
* - within a page, messages SHOULD be ordered from oldest to most recent
|
126
|
-
* - pages direction depends on { @link QueryOptions.pageDirection }
|
127
|
-
* @throws If not able to reach a Waku Store peer to query,
|
128
|
-
* or if an error is encountered when processing the reply,
|
129
|
-
* or if two decoders with the same content topic are passed.
|
130
|
-
*
|
131
|
-
* This API only supports querying a single pubsub topic at a time.
|
132
|
-
* If multiple decoders are provided, they must all have the same pubsub topic.
|
133
|
-
* @throws If multiple decoders with different pubsub topics are provided.
|
134
|
-
* @throws If no decoders are provided.
|
135
|
-
* @throws If no decoders are found for the provided pubsub topic.
|
136
|
-
*/
|
137
|
-
async *queryGenerator(decoders, options) {
|
138
|
-
if (decoders.length === 0) {
|
139
|
-
throw new Error("No decoders provided");
|
140
|
-
}
|
141
|
-
let startTime, endTime;
|
142
|
-
if (options?.timeFilter) {
|
143
|
-
startTime = options.timeFilter.startTime;
|
144
|
-
endTime = options.timeFilter.endTime;
|
145
|
-
}
|
146
|
-
// convert array to set to remove duplicates
|
147
|
-
const uniquePubsubTopicsInQuery = Array.from(new Set(decoders.map((decoder) => decoder.pubsubTopic)));
|
148
|
-
// If multiple pubsub topics are provided, throw an error
|
149
|
-
if (uniquePubsubTopicsInQuery.length > 1) {
|
150
|
-
throw new Error("API does not support querying multiple pubsub topics at once");
|
151
|
-
}
|
152
|
-
// we can be certain that there is only one pubsub topic in the query
|
153
|
-
const pubsubTopicForQuery = uniquePubsubTopicsInQuery[0];
|
154
|
-
ensurePubsubTopicIsConfigured(pubsubTopicForQuery, this.pubsubTopics);
|
155
|
-
// check that the pubsubTopic from the Cursor and Decoder match
|
156
|
-
if (options?.cursor?.pubsubTopic &&
|
157
|
-
options.cursor.pubsubTopic !== pubsubTopicForQuery) {
|
158
|
-
throw new Error(`Cursor pubsub topic (${options?.cursor?.pubsubTopic}) does not match decoder pubsub topic (${pubsubTopicForQuery})`);
|
159
|
-
}
|
160
|
-
const decodersAsMap = new Map();
|
161
|
-
decoders.forEach((dec) => {
|
162
|
-
if (decodersAsMap.has(dec.contentTopic)) {
|
163
|
-
throw new Error("API does not support different decoder per content topic");
|
164
68
|
}
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
pubsubTopic: pubsubTopicForQuery,
|
175
|
-
pageDirection: PageDirection.BACKWARD,
|
176
|
-
pageSize: DefaultPageSize
|
177
|
-
}, options, { contentTopics, startTime, endTime });
|
178
|
-
const peer = (await this.getPeers({
|
179
|
-
numPeers: this.NUM_PEERS_PROTOCOL,
|
180
|
-
maxBootstrapPeers: 1
|
181
|
-
}))[0];
|
182
|
-
for await (const messages of paginate(this.getStream.bind(this, peer), queryOpts, decodersAsMap, options?.cursor)) {
|
183
|
-
yield messages;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
}
|
187
|
-
async function* paginate(streamFactory, queryOpts, decoders, cursor) {
|
188
|
-
if (queryOpts.contentTopics.toString() !==
|
189
|
-
Array.from(decoders.keys()).toString()) {
|
190
|
-
throw new Error("Internal error, the decoders should match the query's content topics");
|
191
|
-
}
|
192
|
-
let currentCursor = cursor;
|
193
|
-
while (true) {
|
194
|
-
queryOpts.cursor = currentCursor;
|
195
|
-
const historyRpcQuery = HistoryRpc.createQuery(queryOpts);
|
196
|
-
log.info("Querying store peer", `for (${queryOpts.pubsubTopic})`, queryOpts.contentTopics);
|
197
|
-
const stream = await streamFactory();
|
198
|
-
const res = await pipe([historyRpcQuery.encode()], lp.encode, stream, lp.decode, async (source) => await all(source));
|
199
|
-
const bytes = new Uint8ArrayList();
|
200
|
-
res.forEach((chunk) => {
|
201
|
-
bytes.append(chunk);
|
202
|
-
});
|
203
|
-
const reply = historyRpcQuery.decode(bytes);
|
204
|
-
if (!reply.response) {
|
205
|
-
log.warn("Stopping pagination due to store `response` field missing");
|
206
|
-
break;
|
207
|
-
}
|
208
|
-
const response = reply.response;
|
209
|
-
if (response.error && response.error !== HistoryError.NONE) {
|
210
|
-
throw "History response contains an Error: " + response.error;
|
211
|
-
}
|
212
|
-
if (!response.messages || !response.messages.length) {
|
213
|
-
log.warn("Stopping pagination due to store `response.messages` field missing or empty");
|
214
|
-
break;
|
215
|
-
}
|
216
|
-
log.error(`${response.messages.length} messages retrieved from store`);
|
217
|
-
yield response.messages.map((protoMsg) => {
|
218
|
-
const contentTopic = protoMsg.contentTopic;
|
219
|
-
if (typeof contentTopic !== "undefined") {
|
220
|
-
const decoder = decoders.get(contentTopic);
|
221
|
-
if (decoder) {
|
222
|
-
return decoder.fromProtoObj(queryOpts.pubsubTopic, toProtoMessage(protoMsg));
|
223
|
-
}
|
69
|
+
currentCursor = nextCursor;
|
70
|
+
const responsePageSize = response.pagingInfo?.pageSize;
|
71
|
+
const queryPageSize = historyRpcQuery.query?.pagingInfo?.pageSize;
|
72
|
+
if (
|
73
|
+
// Response page size smaller than query, meaning this is the last page
|
74
|
+
responsePageSize &&
|
75
|
+
queryPageSize &&
|
76
|
+
responsePageSize < queryPageSize) {
|
77
|
+
break;
|
224
78
|
}
|
225
|
-
return Promise.resolve(undefined);
|
226
|
-
});
|
227
|
-
const nextCursor = response.pagingInfo?.cursor;
|
228
|
-
if (typeof nextCursor === "undefined") {
|
229
|
-
// If the server does not return cursor then there is an issue,
|
230
|
-
// Need to abort, or we end up in an infinite loop
|
231
|
-
log.warn("Stopping pagination due to `response.pagingInfo.cursor` missing from store response");
|
232
|
-
break;
|
233
|
-
}
|
234
|
-
currentCursor = nextCursor;
|
235
|
-
const responsePageSize = response.pagingInfo?.pageSize;
|
236
|
-
const queryPageSize = historyRpcQuery.query?.pagingInfo?.pageSize;
|
237
|
-
if (
|
238
|
-
// Response page size smaller than query, meaning this is the last page
|
239
|
-
responsePageSize &&
|
240
|
-
queryPageSize &&
|
241
|
-
responsePageSize < queryPageSize) {
|
242
|
-
break;
|
243
79
|
}
|
244
80
|
}
|
245
81
|
}
|
246
|
-
export async function createCursor(message) {
|
247
|
-
if (!message ||
|
248
|
-
!message.timestamp ||
|
249
|
-
!message.payload ||
|
250
|
-
!message.contentTopic) {
|
251
|
-
throw new Error("Message is missing required fields");
|
252
|
-
}
|
253
|
-
const contentTopicBytes = utf8ToBytes(message.contentTopic);
|
254
|
-
const digest = sha256(concat([contentTopicBytes, message.payload]));
|
255
|
-
const messageTime = BigInt(message.timestamp.getTime()) * BigInt(1000000);
|
256
|
-
return {
|
257
|
-
digest,
|
258
|
-
pubsubTopic: message.pubsubTopic,
|
259
|
-
senderTime: messageTime,
|
260
|
-
receiverTime: messageTime
|
261
|
-
};
|
262
|
-
}
|
263
|
-
export function wakuStore(init = {}) {
|
264
|
-
return (libp2p) => new Store(libp2p, init);
|
265
|
-
}
|
266
82
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/store/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/store/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAU,MAAM,kBAAkB,CAAC;AAErE,IAAO,YAAY,GAAG,KAAK,CAAC,eAAe,C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AAQ,CAAC,UAAU,EAAE,MAAM,CAAC;YAC/C,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;gBACtC,+DAA+D;gBAC/D,kDAAkD;gBAClD,GAAG,CAAC,IAAI,CACN,qFAAqF,CACtF,CAAC;gBACF,MAAM;YACR,CAAC;YAED,aAAa,GAAG,UAAU,CAAC;YAE3B,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC;YACvD,MAAM,aAAa,GAAG,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC;YAClE;YACE,uEAAuE;YACvE,gBAAgB;gBAChB,aAAa;gBACb,gBAAgB,GAAG,aAAa,EAChC,CAAC;gBACD,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Stream } from "@libp2p/interface
|
2
|
-
import { Peer } from "@libp2p/interface
|
1
|
+
import type { Stream } from "@libp2p/interface";
|
2
|
+
import { Peer } from "@libp2p/interface";
|
3
3
|
import { Libp2p } from "@waku/interfaces";
|
4
4
|
export declare class StreamManager {
|
5
5
|
multicodec: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stream_manager.js","sourceRoot":"","sources":["../../src/lib/stream_manager.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"stream_manager.js","sourceRoot":"","sources":["../../src/lib/stream_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,OAAO,aAAa;IAKf;IACA;IACA;IAND,UAAU,CAAsC;IACvC,GAAG,CAAS;IAE7B,YACS,UAAkB,EAClB,cAAwC,EACxC,gBAA4C;QAF5C,eAAU,GAAV,UAAU,CAAQ;QAClB,mBAAc,GAAd,cAAc,CAA0B;QACxC,qBAAgB,GAAhB,gBAAgB,CAA4B;Q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AAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAEO,gBAAgB,CAAC,IAAU;QACjC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACpD,4DAA4D;YAC5D,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,sCAAsC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAC3D,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,CAAC;IACzD,CAAC;IAEO,0BAA0B,GAAG,CAAC,GAA4B,EAAQ,EAAE;QAC1E,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oCAAoC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACxE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC;CACH"}
|
@@ -3,7 +3,7 @@ import { Protocols } from "@waku/interfaces";
|
|
3
3
|
/**
|
4
4
|
* Wait for a remote peer to be ready given the passed protocols.
|
5
5
|
* Must be used after attempting to connect to nodes, using
|
6
|
-
* {@link @waku/
|
6
|
+
* {@link @waku/sdk!WakuNode.dial} or a bootstrap method with
|
7
7
|
* {@link @waku/sdk!createLightNode}.
|
8
8
|
*
|
9
9
|
* If the passed protocols is a GossipSub protocol, then it resolves only once
|
@@ -2,10 +2,11 @@ import { Protocols } from "@waku/interfaces";
|
|
2
2
|
import { Logger } from "@waku/utils";
|
3
3
|
import { pEvent } from "p-event";
|
4
4
|
const log = new Logger("wait-for-remote-peer");
|
5
|
+
//TODO: move this function within the Waku class: https://github.com/waku-org/js-waku/issues/1761
|
5
6
|
/**
|
6
7
|
* Wait for a remote peer to be ready given the passed protocols.
|
7
8
|
* Must be used after attempting to connect to nodes, using
|
8
|
-
* {@link @waku/
|
9
|
+
* {@link @waku/sdk!WakuNode.dial} or a bootstrap method with
|
9
10
|
* {@link @waku/sdk!createLightNode}.
|
10
11
|
*
|
11
12
|
* If the passed protocols is a GossipSub protocol, then it resolves only once
|
@@ -34,17 +35,17 @@ export async function waitForRemotePeer(waku, protocols, timeoutMs) {
|
|
34
35
|
if (protocols.includes(Protocols.Store)) {
|
35
36
|
if (!waku.store)
|
36
37
|
throw new Error("Cannot wait for Store peer: protocol not mounted");
|
37
|
-
promises.push(waitForConnectedPeer(waku.store));
|
38
|
+
promises.push(waitForConnectedPeer(waku.store.protocol, waku.libp2p.services.metadata));
|
38
39
|
}
|
39
40
|
if (protocols.includes(Protocols.LightPush)) {
|
40
41
|
if (!waku.lightPush)
|
41
42
|
throw new Error("Cannot wait for LightPush peer: protocol not mounted");
|
42
|
-
promises.push(waitForConnectedPeer(waku.lightPush));
|
43
|
+
promises.push(waitForConnectedPeer(waku.lightPush.protocol, waku.libp2p.services.metadata));
|
43
44
|
}
|
44
45
|
if (protocols.includes(Protocols.Filter)) {
|
45
46
|
if (!waku.filter)
|
46
47
|
throw new Error("Cannot wait for Filter peer: protocol not mounted");
|
47
|
-
promises.push(waitForConnectedPeer(waku.filter));
|
48
|
+
promises.push(waitForConnectedPeer(waku.filter, waku.libp2p.services.metadata));
|
48
49
|
}
|
49
50
|
if (timeoutMs) {
|
50
51
|
await rejectOnTimeout(Promise.all(promises), timeoutMs, "Timed out waiting for a remote peer.");
|
@@ -53,21 +54,52 @@ export async function waitForRemotePeer(waku, protocols, timeoutMs) {
|
|
53
54
|
await Promise.all(promises);
|
54
55
|
}
|
55
56
|
}
|
57
|
+
//TODO: move this function within protocol SDK class: https://github.com/waku-org/js-waku/issues/1761
|
56
58
|
/**
|
57
59
|
* Wait for a peer with the given protocol to be connected.
|
60
|
+
* If sharding is enabled on the node, it will also wait for the peer to be confirmed by the metadata service.
|
58
61
|
*/
|
59
|
-
async function waitForConnectedPeer(protocol) {
|
62
|
+
async function waitForConnectedPeer(protocol, metadataService) {
|
60
63
|
const codec = protocol.multicodec;
|
61
|
-
const peers = await protocol.
|
64
|
+
const peers = await protocol.connectedPeers();
|
62
65
|
if (peers.length) {
|
63
|
-
|
64
|
-
|
66
|
+
if (!metadataService) {
|
67
|
+
log.info(`${codec} peer found: `, peers[0].id.toString());
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
// once a peer is connected, we need to confirm the metadata handshake with at least one of those peers if sharding is enabled
|
71
|
+
try {
|
72
|
+
await Promise.any(peers.map((peer) => metadataService.confirmOrAttemptHandshake(peer.id)));
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
catch (e) {
|
76
|
+
if (e.code === "ERR_CONNECTION_BEING_CLOSED")
|
77
|
+
log.error(`Connection with the peer was closed and possibly because it's on a different shard. Error: ${e}`);
|
78
|
+
log.error(`Error waiting for handshake confirmation: ${e}`);
|
79
|
+
}
|
65
80
|
}
|
81
|
+
log.info(`Waiting for ${codec} peer`);
|
82
|
+
// else we'll just wait for the next peer to connect
|
66
83
|
await new Promise((resolve) => {
|
67
84
|
const cb = (evt) => {
|
68
85
|
if (evt.detail?.protocols?.includes(codec)) {
|
69
|
-
|
70
|
-
|
86
|
+
if (metadataService) {
|
87
|
+
metadataService
|
88
|
+
.confirmOrAttemptHandshake(evt.detail.peerId)
|
89
|
+
.then(() => {
|
90
|
+
protocol.removeLibp2pEventListener("peer:identify", cb);
|
91
|
+
resolve();
|
92
|
+
})
|
93
|
+
.catch((e) => {
|
94
|
+
if (e.code === "ERR_CONNECTION_BEING_CLOSED")
|
95
|
+
log.error(`Connection with the peer was closed and possibly because it's on a different shard. Error: ${e}`);
|
96
|
+
log.error(`Error waiting for handshake confirmation: ${e}`);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
else {
|
100
|
+
protocol.removeLibp2pEventListener("peer:identify", cb);
|
101
|
+
resolve();
|
102
|
+
}
|
71
103
|
}
|
72
104
|
};
|
73
105
|
protocol.addLibp2pEventListener("peer:identify", cb);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"wait_for_remote_peer.js","sourceRoot":"","sources":["../../src/lib/wait_for_remote_peer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"wait_for_remote_peer.js","sourceRoot":"","sources":["../../src/lib/wait_for_remote_peer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE/C,iGAAiG;AACjG;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAU,EACV,SAAuB,EACvB,SAAkB;IAElB,SAAS,GAAG,SAAS,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,KAAK;YACb,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,SAA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oB;IAEpB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAU;IACrC,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
@@ -1,127 +1 @@
|
|
1
|
-
{
|
2
|
-
"name": "@waku/core",
|
3
|
-
"version": "0.0.26",
|
4
|
-
"description": "TypeScript implementation of the Waku v2 protocol",
|
5
|
-
"types": "./dist/index.d.ts",
|
6
|
-
"module": "./dist/index.js",
|
7
|
-
"exports": {
|
8
|
-
".": {
|
9
|
-
"types": "./dist/index.d.ts",
|
10
|
-
"import": "./dist/index.js"
|
11
|
-
},
|
12
|
-
"./lib/predefined_bootstrap_nodes": {
|
13
|
-
"types": "./dist/lib/predefined_bootstrap_nodes.d.ts",
|
14
|
-
"import": "./dist/lib/predefined_bootstrap_nodes.js"
|
15
|
-
},
|
16
|
-
"./lib/message/version_0": {
|
17
|
-
"types": "./dist/lib/message/version_0.d.ts",
|
18
|
-
"import": "./dist/lib/message/version_0.js"
|
19
|
-
},
|
20
|
-
"./lib/base_protocol": {
|
21
|
-
"types": "./dist/lib/base_protocol.d.ts",
|
22
|
-
"import": "./dist/lib/base_protocol.js"
|
23
|
-
}
|
24
|
-
},
|
25
|
-
"typesVersions": {
|
26
|
-
"*": {
|
27
|
-
"lib/*": [
|
28
|
-
"dist/lib/*"
|
29
|
-
],
|
30
|
-
"constants/*": [
|
31
|
-
"dist/constants/*"
|
32
|
-
]
|
33
|
-
}
|
34
|
-
},
|
35
|
-
"type": "module",
|
36
|
-
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/core#readme",
|
37
|
-
"repository": {
|
38
|
-
"type": "git",
|
39
|
-
"url": "https://github.com/waku-org/js-waku.git"
|
40
|
-
},
|
41
|
-
"bugs": {
|
42
|
-
"url": "https://github.com/waku-org/js-waku/issues"
|
43
|
-
},
|
44
|
-
"license": "MIT OR Apache-2.0",
|
45
|
-
"keywords": [
|
46
|
-
"waku",
|
47
|
-
"decentralised",
|
48
|
-
"communication",
|
49
|
-
"web3",
|
50
|
-
"ethereum",
|
51
|
-
"dapps"
|
52
|
-
],
|
53
|
-
"scripts": {
|
54
|
-
"build": "run-s build:**",
|
55
|
-
"build:esm": "tsc",
|
56
|
-
"build:bundle": "rollup --config rollup.config.js",
|
57
|
-
"fix": "run-s fix:*",
|
58
|
-
"fix:lint": "eslint src *.js --fix",
|
59
|
-
"check": "run-s check:*",
|
60
|
-
"check:tsc": "tsc -p tsconfig.dev.json",
|
61
|
-
"check:lint": "eslint src *.js",
|
62
|
-
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
63
|
-
"test": "NODE_ENV=test run-s test:*",
|
64
|
-
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
|
65
|
-
"test:browser": "NODE_ENV=test karma start karma.conf.cjs",
|
66
|
-
"watch:build": "tsc -p tsconfig.json -w",
|
67
|
-
"watch:test": "mocha --watch",
|
68
|
-
"prepublish": "npm run build",
|
69
|
-
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
70
|
-
},
|
71
|
-
"engines": {
|
72
|
-
"node": ">=18"
|
73
|
-
},
|
74
|
-
"dependencies": {
|
75
|
-
"@noble/hashes": "^1.3.2",
|
76
|
-
"@waku/enr": "^0.0.20",
|
77
|
-
"@waku/interfaces": "0.0.21",
|
78
|
-
"@waku/proto": "0.0.6",
|
79
|
-
"@waku/utils": "0.0.14",
|
80
|
-
"debug": "^4.3.4",
|
81
|
-
"it-all": "^3.0.4",
|
82
|
-
"it-length-prefixed": "^9.0.1",
|
83
|
-
"it-pipe": "^3.0.1",
|
84
|
-
"p-event": "^6.0.0",
|
85
|
-
"uint8arraylist": "^2.4.3",
|
86
|
-
"uuid": "^9.0.0"
|
87
|
-
},
|
88
|
-
"devDependencies": {
|
89
|
-
"@multiformats/multiaddr": "^12.0.0",
|
90
|
-
"@rollup/plugin-commonjs": "^25.0.7",
|
91
|
-
"@rollup/plugin-json": "^6.0.0",
|
92
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
93
|
-
"@types/chai": "^4.3.11",
|
94
|
-
"@types/debug": "^4.1.12",
|
95
|
-
"@types/mocha": "^10.0.1",
|
96
|
-
"@types/uuid": "^9.0.7",
|
97
|
-
"@waku/build-utils": "*",
|
98
|
-
"chai": "^4.3.10",
|
99
|
-
"cspell": "^7.3.2",
|
100
|
-
"fast-check": "^3.14.0",
|
101
|
-
"ignore-loader": "^0.1.2",
|
102
|
-
"isomorphic-fetch": "^3.0.0",
|
103
|
-
"mocha": "^10.2.0",
|
104
|
-
"npm-run-all": "^4.1.5",
|
105
|
-
"process": "^0.11.10",
|
106
|
-
"rollup": "^4.6.0"
|
107
|
-
},
|
108
|
-
"peerDependencies": {
|
109
|
-
"@multiformats/multiaddr": "^12.0.0",
|
110
|
-
"libp2p": "^0.46.3"
|
111
|
-
},
|
112
|
-
"peerDependenciesMeta": {
|
113
|
-
"@multiformats/multiaddr": {
|
114
|
-
"optional": true
|
115
|
-
}
|
116
|
-
},
|
117
|
-
"files": [
|
118
|
-
"dist",
|
119
|
-
"bundle",
|
120
|
-
"src/**/*.ts",
|
121
|
-
"!**/*.spec.*",
|
122
|
-
"!**/*.json",
|
123
|
-
"CHANGELOG.md",
|
124
|
-
"LICENSE",
|
125
|
-
"README.md"
|
126
|
-
]
|
127
|
-
}
|
1
|
+
{"name":"@waku/core","version":"0.0.28-070b625.0","description":"TypeScript implementation of the Waku v2 protocol","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./lib/predefined_bootstrap_nodes":{"types":"./dist/lib/predefined_bootstrap_nodes.d.ts","import":"./dist/lib/predefined_bootstrap_nodes.js"},"./lib/message/version_0":{"types":"./dist/lib/message/version_0.d.ts","import":"./dist/lib/message/version_0.js"},"./lib/base_protocol":{"types":"./dist/lib/base_protocol.d.ts","import":"./dist/lib/base_protocol.js"}},"typesVersions":{"*":{"lib/*":["dist/lib/*"],"constants/*":["dist/constants/*"]}},"type":"module","homepage":"https://github.com/waku-org/js-waku/tree/master/packages/core#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","decentralised","communication","web3","ethereum","dapps"],"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:tsc":"tsc -p tsconfig.dev.json","check:lint":"eslint src *.js","check:spelling":"cspell \"{README.md,src/**/*.ts}\"","test":"NODE_ENV=test run-s test:*","test:node":"NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha","test:browser":"NODE_ENV=test karma start karma.conf.cjs","watch:build":"tsc -p tsconfig.json -w","watch:test":"mocha --watch","prepublish":"npm run build","reset-hard":"git clean -dfx -e .idea && git reset --hard && npm i && npm run build"},"engines":{"node":">=18"},"dependencies":{"@libp2p/ping":"^1.0.12","@waku/enr":"0.0.22-070b625.0","@waku/interfaces":"0.0.23-070b625.0","@waku/message-hash":"0.1.12-070b625.0","@waku/proto":"0.0.7-070b625.0","@waku/utils":"0.0.16-070b625.0","debug":"^4.3.4","it-all":"^3.0.4","it-length-prefixed":"^9.0.4","it-pipe":"^3.0.1","p-event":"^6.0.1","uint8arraylist":"^2.4.3","uuid":"^9.0.0"},"devDependencies":{"@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/debug":"^4.1.12","@types/mocha":"^10.0.6","@types/uuid":"^9.0.8","@waku/build-utils":"*","chai":"^4.3.10","cspell":"^8.6.1","fast-check":"^3.15.1","ignore-loader":"^0.1.2","isomorphic-fetch":"^3.0.0","mocha":"^10.3.0","npm-run-all":"^4.1.5","process":"^0.11.10","rollup":"^4.12.0"},"peerDependencies":{"@multiformats/multiaddr":"^12.0.0","libp2p":"^1.1.2","@waku/enr":"0.0.22-070b625.0","@waku/interfaces":"0.0.23-070b625.0","@waku/message-hash":"0.1.12-070b625.0","@waku/proto":"0.0.7-070b625.0","@waku/utils":"0.0.16-070b625.0"},"peerDependenciesMeta":{"@multiformats/multiaddr":{"optional":true},"@waku/interfaces":{"optional":true}},"files":["dist","bundle","src/**/*.ts","!**/*.spec.*","!**/*.json","CHANGELOG.md","LICENSE","README.md"]}
|