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

[api]fix JsonRPC api response id type doesn't match request type #4168

Merged
merged 6 commits into from
Apr 15, 2024
Merged

[api]fix JsonRPC api response id type doesn't match request type #4168

merged 6 commits into from
Apr 15, 2024

Conversation

millken
Copy link
Contributor

@millken millken commented Mar 6, 2024

Description

The id field's type should be match the request type.
if request id is string, the response id should be string, if request id is number, the response id should be number too.

Fixes #4154

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.20%. Comparing base (d716bb9) to head (01ede7d).
Report is 25 commits behind head on master.

❗ Current head 01ede7d differs from pull request most recent head b1e9e03. Consider uploading reports for the commit b1e9e03 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4168      +/-   ##
==========================================
- Coverage   76.51%   76.20%   -0.31%     
==========================================
  Files         340      340              
  Lines       29273    29108     -165     
==========================================
- Hits        22397    22182     -215     
- Misses       5761     5826      +65     
+ Partials     1115     1100      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Liuhaai
Copy link
Member

Liuhaai commented Mar 6, 2024

what type of id is used in geth?

@millken
Copy link
Contributor Author

millken commented Mar 7, 2024

what type of id is used in geth?

json.RawMessage, It also gets the id from the request, checks if the id is valid (not an object or array), and returns it as it is

Copy link
Member

@envestcc envestcc left a comment

Choose a reason for hiding this comment

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

need to add tests

Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@Liuhaai
Copy link
Member

Liuhaai commented Mar 29, 2024

what type of id is used in geth?

json.RawMessage, It also gets the id from the request, checks if the id is valid (not an object or array), and returns it as it is

Could any be replaced with json.RawMessage type?

Copy link

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

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

See analysis details on SonarCloud

@dustinxie dustinxie merged commit 7837f22 into iotexproject:master Apr 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JsonRPC api response type doesn't match request type
4 participants