Skip to content

Commit

Permalink
Merge branch 'master' into fix/base-protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
weboko authored Aug 30, 2024
2 parents 5226d3e + f9361bf commit 5d0434d
Show file tree
Hide file tree
Showing 26 changed files with 315 additions and 57 deletions.
20 changes: 10 additions & 10 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"packages/utils": "0.0.18",
"packages/proto": "0.0.7",
"packages/interfaces": "0.0.25",
"packages/message-hash": "0.1.14",
"packages/enr": "0.0.24",
"packages/core": "0.0.30",
"packages/message-encryption": "0.0.28",
"packages/relay": "0.0.13",
"packages/sdk": "0.0.26",
"packages/discovery": "0.0.3",
"packages/utils": "0.0.19",
"packages/proto": "0.0.8",
"packages/interfaces": "0.0.26",
"packages/message-hash": "0.1.15",
"packages/enr": "0.0.25",
"packages/core": "0.0.31",
"packages/message-encryption": "0.0.29",
"packages/relay": "0.0.14",
"packages/sdk": "0.0.27",
"packages/discovery": "0.0.4",
"packages/react-native-polyfills": "0.0.1"
}
29 changes: 29 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@ 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).

## [0.0.31](https://github.com/waku-org/js-waku/compare/core-v0.0.30...core-v0.0.31) (2024-08-29)


### ⚠ BREAKING CHANGES

* **lightpush:** return new error messages ([#2115](https://github.com/waku-org/js-waku/issues/2115))
* deprecate named pubsub topics and use static/auto sharding ([#2097](https://github.com/waku-org/js-waku/issues/2097))
* store v3 ([#2036](https://github.com/waku-org/js-waku/issues/2036))

### Features

* Deprecate named pubsub topics and use static/auto sharding ([#2097](https://github.com/waku-org/js-waku/issues/2097)) ([5ce36c8](https://github.com/waku-org/js-waku/commit/5ce36c8f187f218df8af66e0643ab277e909b227))
* Fix peer renewal, change Filter keep alive ([#2065](https://github.com/waku-org/js-waku/issues/2065)) ([00635b7](https://github.com/waku-org/js-waku/commit/00635b7afe60c2ed739f2ccd1f07b2a6cc04f797))
* **lightpush:** Return new error messages ([#2115](https://github.com/waku-org/js-waku/issues/2115)) ([a022433](https://github.com/waku-org/js-waku/commit/a022433851e6e187679b8c40bb465b431854809b))
* Node and protocols health ([#2080](https://github.com/waku-org/js-waku/issues/2080)) ([d464af3](https://github.com/waku-org/js-waku/commit/d464af3645d769034d6c6293607de5b00e904ae4))
* Offline state recovery for Filter subscription ([#2049](https://github.com/waku-org/js-waku/issues/2049)) ([eadb85a](https://github.com/waku-org/js-waku/commit/eadb85ab8367c0e0d8fa9f9fd012eebc71200b6c))
* Store v3 ([#2036](https://github.com/waku-org/js-waku/issues/2036)) ([86f730f](https://github.com/waku-org/js-waku/commit/86f730f9587e3688b79c8e846e5c005bb4d5fae4))
* Validate messages for individual filter nodes & perform renewals ([#2057](https://github.com/waku-org/js-waku/issues/2057)) ([9b0f1e8](https://github.com/waku-org/js-waku/commit/9b0f1e855aa3a1f7b9aec3a4c726568d37595c28))


### Dependencies

* The following workspace dependencies were updated
* dependencies
* @waku/enr bumped from ^0.0.24 to ^0.0.25
* @waku/interfaces bumped from 0.0.25 to 0.0.26
* @waku/proto bumped from 0.0.7 to 0.0.8
* @waku/utils bumped from 0.0.18 to 0.0.19

## [0.0.30](https://github.com/waku-org/js-waku/compare/core-v0.0.29...core-v0.0.30) (2024-07-10)


Expand Down
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@waku/core",
"version": "0.0.30",
"version": "0.0.31",
"description": "TypeScript implementation of the Waku v2 protocol",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
Expand Down Expand Up @@ -69,10 +69,10 @@
},
"dependencies": {
"@libp2p/ping": "^1.1.2",
"@waku/enr": "^0.0.24",
"@waku/interfaces": "0.0.25",
"@waku/proto": "0.0.7",
"@waku/utils": "0.0.18",
"@waku/enr": "^0.0.25",
"@waku/interfaces": "0.0.26",
"@waku/proto": "0.0.8",
"@waku/utils": "0.0.19",
"debug": "^4.3.4",
"it-all": "^3.0.4",
"it-length-prefixed": "^9.0.4",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/lib/filter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class FilterCore extends BaseProtocol implements IBaseProtocolCore {
return {
success: null,
failure: {
error: ProtocolError.REMOTE_PEER_FAULT,
error: ProtocolError.NO_STREAM_AVAILABLE,
peerId: peer.id
}
};
Expand Down Expand Up @@ -170,7 +170,7 @@ export class FilterCore extends BaseProtocol implements IBaseProtocolCore {
if (!res || !res.length) {
return {
failure: {
error: ProtocolError.REMOTE_PEER_FAULT,
error: ProtocolError.NO_RESPONSE,
peerId: peer.id
},
success: null
Expand Down Expand Up @@ -211,7 +211,7 @@ export class FilterCore extends BaseProtocol implements IBaseProtocolCore {
return {
success: null,
failure: {
error: ProtocolError.REMOTE_PEER_FAULT,
error: ProtocolError.NO_STREAM_AVAILABLE,
peerId: peer.id
}
};
Expand Down Expand Up @@ -243,7 +243,7 @@ export class FilterCore extends BaseProtocol implements IBaseProtocolCore {
return {
success: null,
failure: {
error: ProtocolError.REMOTE_PEER_FAULT,
error: ProtocolError.NO_RESPONSE,
peerId: peer.id
}
};
Expand Down
15 changes: 14 additions & 1 deletion packages/core/src/lib/light_push/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Uint8ArrayList } from "uint8arraylist";
import { BaseProtocol } from "../base_protocol.js";

import { PushRpc } from "./push_rpc.js";
import { isRLNResponseError, matchRLNErrorMessage } from "./utils.js";

const log = new Logger("light-push");

Expand Down Expand Up @@ -153,7 +154,19 @@ export class LightPushCore extends BaseProtocol implements IBaseProtocolCore {
return {
success: null,
failure: {
error: ProtocolError.REMOTE_PEER_FAULT,
error: ProtocolError.NO_RESPONSE,
peerId: peer.id
}
};
}

if (isRLNResponseError(response.info)) {
const rlnErrorCase = matchRLNErrorMessage(response.info!);
log.error("Remote peer rejected the message: ", rlnErrorCase);
return {
success: null,
failure: {
error: rlnErrorCase,
peerId: peer.id
}
};
Expand Down
31 changes: 31 additions & 0 deletions packages/core/src/lib/light_push/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ProtocolError } from "@waku/interfaces";

// should match nwaku
// https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/rln_relay.nim#L309
// https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/tests/waku_rln_relay/rln/waku_rln_relay_utils.nim#L20
const RLN_GENERATION_PREFIX_ERROR = "could not generate rln-v2 proof";

export const isRLNResponseError = (info?: string): boolean => {
if (!info) {
return false;
}

return info.includes(RLN_GENERATION_PREFIX_ERROR);
};

export const matchRLNErrorMessage = (info: string): ProtocolError => {
const rlnErrorMap: { [key: string]: ProtocolError } = {
[ProtocolError.RLN_IDENTITY_MISSING]: ProtocolError.RLN_IDENTITY_MISSING,
[ProtocolError.RLN_MEMBERSHIP_INDEX]: ProtocolError.RLN_MEMBERSHIP_INDEX,
[ProtocolError.RLN_LIMIT_MISSING]: ProtocolError.RLN_LIMIT_MISSING
};

const infoLowerCase = info.toLowerCase();
for (const errorKey in rlnErrorMap) {
if (infoLowerCase.includes(errorKey.toLowerCase())) {
return rlnErrorMap[errorKey];
}
}

return ProtocolError.RLN_PROOF_GENERATION;
};
18 changes: 18 additions & 0 deletions packages/discovery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [0.0.4](https://github.com/waku-org/js-waku/compare/discovery-v0.0.3...discovery-v0.0.4) (2024-08-29)


### Features

* **peer-exchange:** Support continuous peer information updates ([#2088](https://github.com/waku-org/js-waku/issues/2088)) ([defe41b](https://github.com/waku-org/js-waku/commit/defe41bb9a826ab6d06f9aace283c0e90b7af56c))


### Dependencies

* The following workspace dependencies were updated
* dependencies
* @waku/interfaces bumped from 0.0.25 to 0.0.26
* @waku/proto bumped from ^0.0.7 to ^0.0.8
* @waku/enr bumped from 0.0.24 to 0.0.25
* @waku/core bumped from 0.0.30 to 0.0.31
* @waku/utils bumped from 0.0.18 to 0.0.19

## [0.0.3](https://github.com/waku-org/js-waku/compare/discovery-v0.0.2...discovery-v0.0.3) (2024-07-10)


Expand Down
12 changes: 6 additions & 6 deletions packages/discovery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@waku/discovery",
"version": "0.0.3",
"version": "0.0.4",
"description": "Contains various discovery mechanisms: DNS Discovery (EIP-1459, Peer Exchange, Local Peer Cache Discovery.",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
Expand Down Expand Up @@ -51,11 +51,11 @@
"node": ">=20"
},
"dependencies": {
"@waku/interfaces": "0.0.25",
"@waku/proto": "^0.0.7",
"@waku/enr": "0.0.24",
"@waku/core": "0.0.30",
"@waku/utils": "0.0.18",
"@waku/interfaces": "0.0.26",
"@waku/proto": "^0.0.8",
"@waku/enr": "0.0.25",
"@waku/core": "0.0.31",
"@waku/utils": "0.0.19",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
Expand Down
8 changes: 8 additions & 0 deletions packages/enr/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* devDependencies
* @waku/interfaces bumped from 0.0.24 to 0.0.25

### Dependencies

* The following workspace dependencies were updated
* dependencies
* @waku/utils bumped from 0.0.18 to 0.0.19
* devDependencies
* @waku/interfaces bumped from 0.0.25 to 0.0.26

## [0.0.22](https://github.com/waku-org/js-waku/compare/enr-v0.0.21...enr-v0.0.22) (2024-04-09)


Expand Down
6 changes: 3 additions & 3 deletions packages/enr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@waku/enr",
"version": "0.0.24",
"version": "0.0.25",
"description": "ENR (EIP-778) for Waku",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
Expand Down Expand Up @@ -56,7 +56,7 @@
"@libp2p/peer-id": "^4.2.1",
"@multiformats/multiaddr": "^12.0.0",
"@noble/secp256k1": "^1.7.1",
"@waku/utils": "0.0.18",
"@waku/utils": "0.0.19",
"debug": "^4.3.4",
"js-sha3": "^0.9.2"
},
Expand All @@ -68,7 +68,7 @@
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@waku/build-utils": "*",
"@waku/interfaces": "0.0.25",
"@waku/interfaces": "0.0.26",
"chai": "^4.3.10",
"cspell": "^8.6.1",
"fast-check": "^3.19.0",
Expand Down
26 changes: 26 additions & 0 deletions packages/interfaces/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ 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).

## [0.0.26](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.25...interfaces-v0.0.26) (2024-08-29)


### ⚠ BREAKING CHANGES

* **lightpush:** return new error messages ([#2115](https://github.com/waku-org/js-waku/issues/2115))
* deprecate named pubsub topics and use static/auto sharding ([#2097](https://github.com/waku-org/js-waku/issues/2097))
* store v3 ([#2036](https://github.com/waku-org/js-waku/issues/2036))
* **filter:** new simpler filter API ([#2092](https://github.com/waku-org/js-waku/issues/2092))

### Features

* Deprecate named pubsub topics and use static/auto sharding ([#2097](https://github.com/waku-org/js-waku/issues/2097)) ([5ce36c8](https://github.com/waku-org/js-waku/commit/5ce36c8f187f218df8af66e0643ab277e909b227))
* **filter:** New simpler filter API ([#2092](https://github.com/waku-org/js-waku/issues/2092)) ([fdd9dc4](https://github.com/waku-org/js-waku/commit/fdd9dc44a44c6680024fb51e9bbb5fe17190dcbd))
* **lightpush:** Return new error messages ([#2115](https://github.com/waku-org/js-waku/issues/2115)) ([a022433](https://github.com/waku-org/js-waku/commit/a022433851e6e187679b8c40bb465b431854809b))
* Node and protocols health ([#2080](https://github.com/waku-org/js-waku/issues/2080)) ([d464af3](https://github.com/waku-org/js-waku/commit/d464af3645d769034d6c6293607de5b00e904ae4))
* Store v3 ([#2036](https://github.com/waku-org/js-waku/issues/2036)) ([86f730f](https://github.com/waku-org/js-waku/commit/86f730f9587e3688b79c8e846e5c005bb4d5fae4))
* Validate messages for individual filter nodes & perform renewals ([#2057](https://github.com/waku-org/js-waku/issues/2057)) ([9b0f1e8](https://github.com/waku-org/js-waku/commit/9b0f1e855aa3a1f7b9aec3a4c726568d37595c28))


### Dependencies

* The following workspace dependencies were updated
* dependencies
* @waku/proto bumped from ^0.0.7 to ^0.0.8

## [0.0.25](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.24...interfaces-v0.0.25) (2024-07-10)


Expand Down
4 changes: 2 additions & 2 deletions packages/interfaces/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@waku/interfaces",
"version": "0.0.25",
"version": "0.0.26",
"description": "Definition of Waku interfaces",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
Expand Down Expand Up @@ -64,6 +64,6 @@
"README.md"
],
"dependencies": {
"@waku/proto": "^0.0.7"
"@waku/proto": "^0.0.8"
}
}
24 changes: 22 additions & 2 deletions packages/interfaces/src/protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export enum ProtocolError {
* The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`
* or `DECODE_FAILED` can be used.
*/
REMOTE_PEER_FAULT = "Remote peer fault",
NO_RESPONSE = "No response received",
/**
* The remote peer rejected the message. Information provided by the remote peer
* is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`
Expand All @@ -190,7 +190,27 @@ export enum ProtocolError {
* The protocol request timed out without a response. This may be due to a connection issue.
* Mitigation can be: retrying after a given time period
*/
REQUEST_TIMEOUT = "Request timeout"
REQUEST_TIMEOUT = "Request timeout",
/**
* Missing credentials info message.
* nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L186
*/
RLN_IDENTITY_MISSING = "Identity credentials are not set",
/**
* Membership index missing info message.
* nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L188
*/
RLN_MEMBERSHIP_INDEX = "Membership index is not set",
/**
* Message limit is missing.
* nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L190
*/
RLN_LIMIT_MISSING = "User message limit is not set",
/**
* General proof generation error message.
* nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L201C19-L201C42
*/
RLN_PROOF_GENERATION = "Proof generation failed"
}

export interface Failure {
Expand Down
9 changes: 9 additions & 0 deletions packages/message-encryption/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* @waku/interfaces bumped from 0.0.24 to 0.0.25
* @waku/utils bumped from 0.0.17 to 0.0.18

### Dependencies

* The following workspace dependencies were updated
* dependencies
* @waku/core bumped from 0.0.30 to 0.0.31
* @waku/interfaces bumped from 0.0.25 to 0.0.26
* @waku/proto bumped from 0.0.7 to 0.0.8
* @waku/utils bumped from 0.0.18 to 0.0.19

## [0.0.27](https://github.com/waku-org/js-waku/compare/message-encryption-v0.0.26...message-encryption-v0.0.27) (2024-04-30)


Expand Down
10 changes: 5 additions & 5 deletions packages/message-encryption/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@waku/message-encryption",
"version": "0.0.28",
"version": "0.0.29",
"description": "Waku Message Payload Encryption",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
Expand Down Expand Up @@ -76,10 +76,10 @@
},
"dependencies": {
"@noble/secp256k1": "^1.7.1",
"@waku/core": "0.0.30",
"@waku/interfaces": "0.0.25",
"@waku/proto": "0.0.7",
"@waku/utils": "0.0.18",
"@waku/core": "0.0.31",
"@waku/interfaces": "0.0.26",
"@waku/proto": "0.0.8",
"@waku/utils": "0.0.19",
"debug": "^4.3.4",
"js-sha3": "^0.9.2",
"uint8arrays": "^5.0.1"
Expand Down
Loading

0 comments on commit 5d0434d

Please sign in to comment.