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: Adds null check for param in validation #2682

Conversation

konstantinabl
Copy link
Collaborator

@konstantinabl konstantinabl commented Jul 8, 2024

Description:
Currently, when we pass null as a param for getCode or any other endpoint, we do not return a descriptive response to the user. Thus, this PR adds a check in the validator, that throws an error when the param passed is null.

Files Changed :

  1. src/validator/utils.ts - Added a null check for the parameters
  2. rpc_batch2.spec.ts - Fixed few failing tests

Type of Change:

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Related issue(s):
Fixes #2376

Copy link

github-actions bot commented Jul 8, 2024

Acceptance Tests

  19 files  228 suites   33m 23s ⏱️
612 tests 602 ✔️ 4 💤 6
676 runs  666 ✔️ 4 💤 6

Results for commit 7c3a07e.

♻️ This comment has been updated with latest results.

@konstantinabl konstantinabl changed the title Adds null check for param in validation fix: Adds null check for param in validation Jul 15, 2024
@konstantinabl konstantinabl added the bug Something isn't working label Jul 15, 2024
@konstantinabl konstantinabl added this to the 0.52.0 milestone Jul 15, 2024
@quiet-node quiet-node modified the milestones: 0.52.0, 0.53.0 Jul 15, 2024
@konstantinabl konstantinabl marked this pull request as ready for review July 16, 2024 15:45
victor-yanev
victor-yanev previously approved these changes Jul 29, 2024
Copy link
Contributor

@victor-yanev victor-yanev left a comment

Choose a reason for hiding this comment

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

LGTM, just one small nit

packages/server/src/validator/utils.ts Show resolved Hide resolved
@konstantinabl konstantinabl force-pushed the 2376-error-raised-during-getcode-for-address-null-is-not-returned-in-the-response-to-the-client-and-can-cause-confusion branch 3 times, most recently from 0fe53b7 to a6fbb72 Compare August 1, 2024 15:42
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
This reverts commit fb4ac2f.

Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
@konstantinabl konstantinabl force-pushed the 2376-error-raised-during-getcode-for-address-null-is-not-returned-in-the-response-to-the-client-and-can-cause-confusion branch 2 times, most recently from cd3faee to ce7bc07 Compare August 1, 2024 16:15
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
This reverts commit ce7bc07.

Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
@konstantinabl konstantinabl force-pushed the 2376-error-raised-during-getcode-for-address-null-is-not-returned-in-the-response-to-the-client-and-can-cause-confusion branch 3 times, most recently from 37c1e8d to 7171bfd Compare August 5, 2024 11:47
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
@konstantinabl konstantinabl force-pushed the 2376-error-raised-during-getcode-for-address-null-is-not-returned-in-the-response-to-the-client-and-can-cause-confusion branch from 7171bfd to 62d0cb8 Compare August 5, 2024 13:43
Copy link

github-actions bot commented Aug 5, 2024

Tests

    3 files  165 suites   13s ⏱️
885 tests 884 ✔️ 1 💤 0
898 runs  897 ✔️ 1 💤 0

Results for commit 7c3a07e.

♻️ This comment has been updated with latest results.

victor-yanev
victor-yanev previously approved these changes Aug 5, 2024
Copy link
Contributor

@victor-yanev victor-yanev left a comment

Choose a reason for hiding this comment

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

LGTM, I left a reminder and one small suggestion:

packages/server/tests/integration/server.spec.ts Outdated Show resolved Hide resolved
packages/server/src/validator/utils.ts Show resolved Hide resolved
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
victor-yanev
victor-yanev previously approved these changes Aug 5, 2024
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.27%. Comparing base (70e1be1) to head (9df7404).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2682      +/-   ##
==========================================
+ Coverage   77.51%   78.27%   +0.75%     
==========================================
  Files          41       27      -14     
  Lines        3269     2637     -632     
  Branches      698      579     -119     
==========================================
- Hits         2534     2064     -470     
+ Misses        487      373     -114     
+ Partials      248      200      -48     
Flag Coverage Δ
relay 78.27% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 18 files with indirect coverage changes

@konstantinabl konstantinabl force-pushed the 2376-error-raised-during-getcode-for-address-null-is-not-returned-in-the-response-to-the-client-and-can-cause-confusion branch from 9df7404 to 7c3a07e Compare August 5, 2024 21:34
Copy link

sonarcloud bot commented Aug 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
6.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@konstantinabl konstantinabl merged commit d895e27 into main Aug 6, 2024
60 of 65 checks passed
@konstantinabl konstantinabl deleted the 2376-error-raised-during-getcode-for-address-null-is-not-returned-in-the-response-to-the-client-and-can-cause-confusion branch August 6, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
5 participants