@waku/core 0.0.29-fd60cc2.0 → 0.0.30-00c77c6.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 CHANGED
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
5
5
  The file is maintained by [Release Please](https://github.com/googleapis/release-please) based on [Conventional Commits](https://www.conventionalcommits.org) specification,
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.29](https://github.com/waku-org/js-waku/compare/core-v0.0.28...core-v0.0.29) (2024-04-30)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * use ShardingParams on subscriptions, make Decoder/Encoder auto sharding friendly by default ([#1958](https://github.com/waku-org/js-waku/issues/1958))
14
+ * **lightpush:** move protocol implementation to `@waku/sdk` (1/n) ([#1964](https://github.com/waku-org/js-waku/issues/1964))
15
+
16
+ ### Features
17
+
18
+ * Use ShardingParams on subscriptions, make Decoder/Encoder auto sharding friendly by default ([#1958](https://github.com/waku-org/js-waku/issues/1958)) ([f3627c4](https://github.com/waku-org/js-waku/commit/f3627c46a4c231013c5ffa4aa6f1ecbe3c06c5e3))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * Only override ping metadata in peer store ([#1984](https://github.com/waku-org/js-waku/issues/1984)) ([fb34b72](https://github.com/waku-org/js-waku/commit/fb34b7262a8d85fdf76cb30774d14bcd3a150f58))
24
+ * Use correct shard index when creating encoder ([9514653](https://github.com/waku-org/js-waku/commit/95146534288f842ff1cf180fc62850d539937a05))
25
+
26
+
27
+ ### Miscellaneous Chores
28
+
29
+ * **lightpush:** Move protocol implementation to `@waku/sdk` (1/n) ([#1964](https://github.com/waku-org/js-waku/issues/1964)) ([5fb1006](https://github.com/waku-org/js-waku/commit/5fb100602b347ad13718c85c52d22a932c15aa18))
30
+
31
+
32
+ ### Dependencies
33
+
34
+ * The following workspace dependencies were updated
35
+ * dependencies
36
+ * @waku/enr bumped from ^0.0.22 to ^0.0.23
37
+ * @waku/interfaces bumped from 0.0.23 to 0.0.24
38
+ * @waku/proto bumped from 0.0.6 to 0.0.7
39
+ * @waku/utils bumped from 0.0.16 to 0.0.17
40
+
8
41
  ## [0.0.28](https://github.com/waku-org/js-waku/compare/core-v0.0.27...core-v0.0.28) (2024-04-09)
9
42
 
10
43
 
@@ -1,5 +1,5 @@
1
- import { b as bytesToUtf8, L as Logger, j as ensureShardingConfigured } from './index-DBP1NHED.js';
2
- import { T as Tags } from './browser-DoQRY-an.js';
1
+ import { c as bytesToUtf8, L as Logger, e as ensureShardingConfigured } from './index-egXdK_Fb.js';
2
+ import { T as Tags } from './browser-B9234RhB.js';
3
3
 
4
4
  const decodeRelayShard = (bytes) => {
5
5
  // explicitly converting to Uint8Array to avoid Buffer
@@ -656,6 +656,11 @@ var ProtocolError;
656
656
  * Please ensure that the PubsubTopic is used when initializing the Waku node.
657
657
  */
658
658
  ProtocolError["TOPIC_NOT_CONFIGURED"] = "Topic not configured";
659
+ /**
660
+ * The pubsub topic configured on the decoder does not match the pubsub topic setup on the protocol.
661
+ * Ensure that the pubsub topic used for decoder creation is the same as the one used for protocol.
662
+ */
663
+ ProtocolError["TOPIC_DECODER_MISMATCH"] = "Topic decoder mismatch";
659
664
  /**
660
665
  * Failure to find a peer with suitable protocols. This may due to a connection issue.
661
666
  * Mitigation can be: retrying after a given time period, display connectivity issue
@@ -1,4 +1,4 @@
1
- import { i as identityBase, c as base2, d as base8, e as base10, f as base16, h as base32, j as base36, k as base58, l as base64, m as base256emoji, n as debug } from './browser-DoQRY-an.js';
1
+ import { i as identityBase, c as base2, d as base8, e as base10, f as base16, h as base32, j as base36, k as base58, l as base64, m as base256emoji, n as debug } from './browser-B9234RhB.js';
2
2
 
3
3
  /**
4
4
  * Returns a `Uint8Array` of the requested size. Referenced memory will
@@ -379,7 +379,6 @@ const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
379
379
  /**
380
380
  * DefaultPubsubTopic is the default gossipsub topic to use for Waku.
381
381
  */
382
- const DefaultPubsubTopic = "/waku/2/default-waku/proto";
383
382
  /**
384
383
  * The default cluster ID for The Waku Network
385
384
  */
@@ -424,9 +423,9 @@ function concat(byteArrays, totalLength) {
424
423
  }
425
424
 
426
425
  const singleShardInfoToPubsubTopic = (shardInfo) => {
427
- if (shardInfo.clusterId === undefined || shardInfo.shard === undefined)
426
+ if (shardInfo.shard === undefined)
428
427
  throw new Error("Invalid shard");
429
- return `/waku/2/rs/${shardInfo.clusterId}/${shardInfo.shard}`;
428
+ return `/waku/2/rs/${shardInfo.clusterId ?? DEFAULT_CLUSTER_ID}/${shardInfo.shard}`;
430
429
  };
431
430
  const shardInfoToPubsubTopics = (shardInfo) => {
432
431
  if ("contentTopics" in shardInfo && shardInfo.contentTopics) {
@@ -465,13 +464,6 @@ const pubsubTopicToSingleShardInfo = (pubsubTopics) => {
465
464
  shard
466
465
  };
467
466
  };
468
- //TODO: move part of BaseProtocol instead of utils
469
- // return `ProtocolError.TOPIC_NOT_CONFIGURED` instead of throwing
470
- function ensurePubsubTopicIsConfigured(pubsubTopic, configuredTopics) {
471
- if (!configuredTopics.includes(pubsubTopic)) {
472
- throw new Error(`Pubsub topic ${pubsubTopic} has not been configured on this instance. Configured topics are: ${configuredTopics}. Please update your configuration by passing in the topic during Waku node instantiation.`);
473
- }
474
- }
475
467
  /**
476
468
  * Given a string, will throw an error if it is not formatted as a valid content topic for autosharding based on https://rfc.vac.dev/spec/51/
477
469
  * @param contentTopic String to validate
@@ -543,9 +535,9 @@ function determinePubsubTopic(contentTopic, pubsubTopicShardInfo) {
543
535
  if (typeof pubsubTopicShardInfo == "string") {
544
536
  return pubsubTopicShardInfo;
545
537
  }
546
- return pubsubTopicShardInfo?.shard
538
+ return pubsubTopicShardInfo?.shard !== undefined
547
539
  ? singleShardInfoToPubsubTopic(pubsubTopicShardInfo)
548
- : contentTopicToPubsubTopic(contentTopic, pubsubTopicShardInfo?.clusterId || DEFAULT_CLUSTER_ID);
540
+ : contentTopicToPubsubTopic(contentTopic, pubsubTopicShardInfo?.clusterId ?? DEFAULT_CLUSTER_ID);
549
541
  }
550
542
  /**
551
543
  * Validates sharding configuration and sets defaults where possible.
@@ -619,4 +611,4 @@ class Logger {
619
611
  }
620
612
  }
621
613
 
622
- export { DefaultPubsubTopic as D, Logger as L, allocUnsafe as a, bytesToUtf8 as b, concat as c, alloc as d, singleShardInfoToPubsubTopic as e, ensurePubsubTopicIsConfigured as f, shardInfoToPubsubTopics as g, fromString as h, determinePubsubTopic as i, ensureShardingConfigured as j, pubsubTopicToSingleShardInfo as p, sha256 as s, utf8ToBytes as u };
614
+ export { Logger as L, allocUnsafe as a, alloc as b, bytesToUtf8 as c, determinePubsubTopic as d, ensureShardingConfigured as e, fromString as f, pubsubTopicToSingleShardInfo as p, shardInfoToPubsubTopics as s, utf8ToBytes as u };