Skip to content
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

fix: Added the web3_clientVersion to the websocket server. #2486

Merged
merged 7 commits into from
May 15, 2024

Conversation

ebadiere
Copy link
Contributor

Added the web3_clientVersion to the websocket server.

Fixes #2462

Copy link

github-actions bot commented May 13, 2024

Tests

    2 files  147 suites   13s ⏱️
819 tests 818 ✔️ 1 💤 0
831 runs  830 ✔️ 1 💤 0

Results for commit cd95d51.

♻️ This comment has been updated with latest results.

Copy link
Member

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's necessary to add WEB3_CLIENTVERSION: 'web3_clientVersion' in WS_CONSTANTS.METHODS or else the server will return Method web3_clientVersion not found

AlfredoG87

This comment was marked as outdated.

Copy link
Collaborator

@AlfredoG87 AlfredoG87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an acceptance test aswell?

Copy link

github-actions bot commented May 13, 2024

Acceptance Tests

     32 files     411 suites   55m 51s ⏱️
   584 tests    573 ✔️   3 💤   8
1 900 runs  1 866 ✔️ 11 💤 23

Results for commit cd95d51.

♻️ This comment has been updated with latest results.

ebadiere added 2 commits May 13, 2024 14:41
Signed-off-by: ebadiere <[email protected]>
Signed-off-by: ebadiere <[email protected]>
quiet-node
quiet-node previously approved these changes May 13, 2024
Copy link
Member

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG.
Execution pathway logic should be improved

packages/ws-server/src/controllers/index.ts Outdated Show resolved Hide resolved
AlfredoG87
AlfredoG87 previously approved these changes May 14, 2024
Copy link
Collaborator

@AlfredoG87 AlfredoG87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question, otherwise looks good

case 'eth':
txRes = await relay.eth()[methodName](...resolvedParams, requestIdPrefix);
break;
case 'get':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we supporting any get or debug pathways yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nana-EC asked that the pathways be specific, in the above comments.

Copy link
Member

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a simple improvement

const txRes = await relay.eth()[method.split('_')[1]](...resolvedParams, requestIdPrefix);
const [service, methodName] = method.split('_');
let txRes;
switch (service) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a possible replacement for this whole switch statement is this below:

Suggested change
switch (service) {
const txRes = await relay[service]()[methodName](...resolvedParams, requestIdPrefix);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we don't have to worry about throwing new Error(Unsupported JSON RPC service type: ${service}); as there's already an unsupported method check (verifySupportedMethod()) to check validity of the methods before it gets to this step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

quiet-node
quiet-node previously approved these changes May 15, 2024
AlfredoG87
AlfredoG87 previously approved these changes May 15, 2024
Copy link
Collaborator

@AlfredoG87 AlfredoG87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Nana-EC
Nana-EC previously approved these changes May 15, 2024
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG
An extra comment would be good

packages/ws-server/src/controllers/index.ts Show resolved Hide resolved
@ebadiere ebadiere dismissed stale reviews from AlfredoG87 and quiet-node via cd95d51 May 15, 2024 18:26
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ebadiere ebadiere merged commit d3e4508 into main May 15, 2024
33 checks passed
@ebadiere ebadiere deleted the 2462-web3-clientVersion-websocketServer branch May 15, 2024 22:09
AlfredoG87 pushed a commit that referenced this pull request May 20, 2024
* fix:  Added the web3_clientVersion to the websocket server.

Signed-off-by: ebadiere <[email protected]>

* fix: Updated web3_clientVersion and test.

Signed-off-by: ebadiere <[email protected]>

* fix: Removed only.

Signed-off-by: ebadiere <[email protected]>

* fix: applied feedback

Signed-off-by: ebadiere <[email protected]>

* fix: Added addition service method handling paths.

Signed-off-by: ebadiere <[email protected]>

* fix: Reduced the switch statement to one line.

Signed-off-by: ebadiere <[email protected]>

* fix:  Added comment describing JSON RPC validation method.

Signed-off-by: ebadiere <[email protected]>

---------

Signed-off-by: ebadiere <[email protected]>
@AlfredoG87 AlfredoG87 mentioned this pull request May 20, 2024
2 tasks
AlfredoG87 pushed a commit that referenced this pull request May 20, 2024
* fix:  Added the web3_clientVersion to the websocket server.

Signed-off-by: ebadiere <[email protected]>

* fix: Updated web3_clientVersion and test.

Signed-off-by: ebadiere <[email protected]>

* fix: Removed only.

Signed-off-by: ebadiere <[email protected]>

* fix: applied feedback

Signed-off-by: ebadiere <[email protected]>

* fix: Added addition service method handling paths.

Signed-off-by: ebadiere <[email protected]>

* fix: Reduced the switch statement to one line.

Signed-off-by: ebadiere <[email protected]>

* fix:  Added comment describing JSON RPC validation method.

Signed-off-by: ebadiere <[email protected]>

---------

Signed-off-by: ebadiere <[email protected]>
Signed-off-by: Alfredo Gutierrez <[email protected]>
quiet-node pushed a commit that referenced this pull request May 20, 2024
fix:  Added the web3_clientVersion to the websocket server. (#2486)

* fix:  Added the web3_clientVersion to the websocket server.



* fix: Updated web3_clientVersion and test.



* fix: Removed only.



* fix: applied feedback



* fix: Added addition service method handling paths.



* fix: Reduced the switch statement to one line.



* fix:  Added comment describing JSON RPC validation method.



---------

Signed-off-by: ebadiere <[email protected]>
Signed-off-by: Alfredo Gutierrez <[email protected]>
Co-authored-by: Eric Badiere <[email protected]>
@quiet-node quiet-node added enhancement New feature or request and removed bug Something isn't working labels May 23, 2024
@quiet-node quiet-node added this to the 0.48.0 milestone May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

web3_clientVersion returns null with websocket endpoint
4 participants