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

Change JSON RPC Error-32602 (Invalid Params) to return with http status code 200 #4967

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Breaking Changes

- Changed JsonRpc http service to return the error -32602 (Invalid params) with a 200 http status code
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: from 400 to 200


### Additions and Improvements
- Added option to evm CLI tool to allow code execution at specific forks [#4913](https://github.com/hyperledger/besu/pull/4913)
- Improve get account performance by using the world state updater cache [#4897](https://github.com/hyperledger/besu/pull/4897)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ private static HttpResponseStatus status(final JsonRpcResponse response) {
private static HttpResponseStatus statusCodeFromError(final JsonRpcError error) {
switch (error) {
case INVALID_REQUEST:
case INVALID_PARAMS:
case PARSE_ERROR:
return HttpResponseStatus.BAD_REQUEST;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ public void getBlockByHashWithMissingHashParameter() throws Exception {
.thenReturn(Optional.empty());

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand All @@ -783,7 +783,7 @@ public void getBlockByHashWithMissingBooleanParameter() throws Exception {
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand All @@ -806,7 +806,7 @@ public void getBlockByHashWithInvalidHashParameterWithOddLength() throws Excepti
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand All @@ -829,7 +829,7 @@ public void getBlockByHashWithInvalidHashParameterThatIsTooShort() throws Except
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand All @@ -853,7 +853,7 @@ public void getBlockByHashWithInvalidBooleanParameter() throws Exception {
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand All @@ -873,7 +873,7 @@ public void getBlockByHashWithAllParametersMissing() throws Exception {
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand All @@ -893,7 +893,7 @@ public void getBlockByHashWithNoParameters() throws Exception {
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand Down Expand Up @@ -978,7 +978,7 @@ public void getBlockByNumberForInvalidBlockParameter() throws Exception {
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final String respBody = resp.body().string();
final JsonObject json = new JsonObject(respBody);
Expand Down Expand Up @@ -2035,7 +2035,7 @@ public void ethGetStorageAtInvalidParameterStorageIndex() throws Exception {
JSON);

try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(400);
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final JsonRpcError expectedError = JsonRpcError.INVALID_PARAMS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message":"Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"message" : "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"message": "Invalid params"
}
},
"statusCode": 400
"statusCode": 200
}