-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/base-protocol
- Loading branch information
Showing
26 changed files
with
315 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.