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

Implement json param validation #2121

Merged
merged 6 commits into from Sep 8, 2023

Conversation

rmoreliovlabs
Copy link
Contributor

Description

  • Implemented deserializers added in #2097.
  • Updated affected tests.

Motivation and Context

We want to align GETH's and RSKJ's behavior when handling requests errors to avoid returning "Internal server error" from RSKJ.

How Has This Been Tested?

Using the payloads from the notion document linked in the ticket CORE-3026 for the methods, for the payloads that should return an error, said error should not be "Internal server error". For example:

curl --location 'http://localhost:4444' \
--header 'Content-Type: application/json' \
--data '{
	"jsonrpc":"2.0",
	"method":"eth_getTransactionCount",
	"params":[
		"0xefd2de7da3e0cc04fa07654f34b8bcb8ebbf1015",
		"first" 
	],
	"id":1
}'

Should return:
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid block identifier 'first'"}}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)
  • Other information:

@rmoreliovlabs
Copy link
Contributor Author

Adding link to old PR to conserve the conversations: #2118

@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

92.3% 92.3% Coverage
0.0% 0.0% Duplication

@Vovchyk Vovchyk merged commit f36a9fc into json_rpc_param_validation Sep 8, 2023
6 checks passed
@Vovchyk Vovchyk deleted the implement_json_param_validation branch September 8, 2023 13:58
@aeidelman aeidelman added this to the Fingerroot 5.4.0 milestone Jan 23, 2024
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.

None yet

3 participants