-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: switches to REST for calling nwaku messages/subscription endpoints #1852
Conversation
dee052c
to
6bde07c
Compare
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -255,7 +283,7 @@ export class ServiceNode { | |||
]); | |||
} | |||
|
|||
async messages( | |||
async messagesRpc( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do we need to update the new function name within any tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we even need to keep it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
throw error; | ||
} | ||
}, | ||
{ retries: 5 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering why 5 retries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied from old function. removed and it doesn't break tests
3547160
to
6cd419b
Compare
This commit modifies functions in ServiceNode to use the REST API instead of JSON RPC when reading messages for a pubsub topic or content topic, and when ensuring a nwaku node is subscribed to a pubsub topic. Also modifies default Docker params to enable the rest API and provide a port.
6cd419b
to
739f2bc
Compare
@@ -109,6 +109,7 @@ export default class Dockerode { | |||
HostConfig: { | |||
AutoRemove: true, | |||
PortBindings: { | |||
[`${restPort}/tcp`]: [{ HostPort: restPort.toString() }], | |||
[`${rpcPort}/tcp`]: [{ HostPort: rpcPort.toString() }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsure how this is used but rpc
wont longer exist. eg rpcPort.toString().
@@ -49,6 +50,7 @@ export class ServiceNode { | |||
private websocketPort?: number; | |||
private readonly logPath: string; | |||
private rpcPort?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
if (err) reject(err); | ||
resolve(ports); | ||
resolve({ | ||
rpcPort: ports[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, remove?
@@ -138,13 +148,15 @@ export class ServiceNode { | |||
Object.assign( | |||
mergedArgs, | |||
{ | |||
rest: true, | |||
restPort, | |||
rpcPort, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same?
Problem
nwaku will be deprecating JSON RPC API. We will no longer be able to use those endpoints in e2e tests and must switch to using the REST API.
Solution
This PR migrates two endpoints used in e2e from RPC to REST:
GET /relay/v1/messages/
andPOST /relay/v1/subscriptions
Also updates utils for running the Docker image to provide arguments to enable
rest
and run it onrestPort
Notes