-
Notifications
You must be signed in to change notification settings - Fork 810
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
5098 branch 19 update more invalid params #7460
5098 branch 19 update more invalid params #7460
Conversation
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…ion, apply spotless Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…ion, apply spotless Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…-branch-2-update-invalid-accounts-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…' into 5098-branch-3-update-invalid-address-hash-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…-branch-2-update-invalid-accounts-params
…' into 5098-branch-3-update-invalid-address-hash-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…-branch-2-update-invalid-accounts-params
…' into 5098-branch-3-update-invalid-address-hash-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…ounts-params' into 5098-branch-2-update-invalid-accounts-params
…' into 5098-branch-3-update-invalid-address-hash-params
…rams' into 5098-branch-4-update-invalid-address-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…' into 5098-branch-3-update-invalid-address-hash-params
…rams' into 5098-branch-4-update-invalid-address-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…ne-params Signed-off-by: Matilda-Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…ss-blob-gas-params Signed-off-by: Matilda-Clerke <matilda.clerke@consensys.net>
…ss-blob-gas-params
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…ss-blob-gas-params
…ss-blob-gas-params' into 5098-branch-17-update-extra-data-and-filter-params
…params' into 5098-branch-18-update-more-invalid-params
…nto 5098-branch-19-update-more-invalid-params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments for the files up to MinerSetMinGasPriceTest
@@ -437,7 +437,7 @@ public void missingHashesOrTransactionParameter() { | |||
|
|||
assertThat(thrown) | |||
.isInstanceOf(InvalidJsonRpcParameters.class) | |||
.hasMessage("Missing required json rpc parameter at index 1"); | |||
.hasMessage("Invalid is transaction complete parameter (index 1)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.hasMessage("Invalid is transaction complete parameter (index 1)"); | |
.hasMessage("Invalid return complete transactions parameter (index 1)"); |
@@ -75,7 +75,13 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { | |||
throw new InvalidJsonRpcParameters( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the param at index 1, transaction index, is ignored. Should we document that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where these Debug* methods would be documented. I searched in besu-docs for DebugAccountRange and couldn't find anything.
@@ -85,8 +85,13 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { | |||
throw new InvalidJsonRpcParameters( | |||
"Invalid account address parameter (index 2)", RpcErrorType.INVALID_ADDRESS_PARAMS, e); | |||
} | |||
final Hash startKey = | |||
Hash.fromHexStringLenient(requestContext.getRequiredParameter(3, String.class)); | |||
final Hash startKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not try catch for the two Integer.class required parameters? Lines 80 and 95?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They'll be covered in later PRs
return requestContext.getRequiredParameter(1, Boolean.class); | ||
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException | ||
throw new InvalidJsonRpcParameters( | ||
"Invalid is complete transaction parameter (index 1)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Invalid is complete transaction parameter (index 1)", | |
"Invalid return complete transactions parameter (index 1)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely worth another PR to update. I wasn't really sure what to call it.
return request.getRequiredParameter(1, Boolean.class); | ||
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException | ||
throw new InvalidJsonRpcParameters( | ||
"Invalid is transaction complete parameter (index 1)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Invalid is transaction complete parameter (index 1)", | |
"Invalid return complete transactions parameter (index 1)", |
@@ -52,7 +53,13 @@ public String getName() { | |||
@Override | |||
public JsonRpcResponse response(final JsonRpcRequestContext request) { | |||
final String privacyGroupId = request.getRequiredParameter(0, String.class); | |||
final String filterId = request.getRequiredParameter(1, String.class); | |||
final String filterId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 55 no try/catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in a later PR
@@ -46,7 +48,13 @@ public String getName() { | |||
@Override | |||
public JsonRpcResponse response(final JsonRpcRequestContext request) { | |||
final String privacyGroupId = request.getRequiredParameter(0, String.class); | |||
final String filterId = request.getRequiredParameter(1, String.class); | |||
final String filterId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.a.
@@ -62,11 +63,17 @@ public String getName() { | |||
@Override | |||
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { | |||
final String privacyGroupId = requestContext.getRequiredParameter(0, String.class); | |||
final FilterParameter filter = requestContext.getRequiredParameter(1, FilterParameter.class); | |||
final FilterParameter filter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.a.
@@ -50,7 +51,13 @@ public String getName() { | |||
@Override | |||
public JsonRpcResponse response(final JsonRpcRequestContext request) { | |||
final String privacyGroupId = request.getRequiredParameter(0, String.class); | |||
final FilterParameter filter = request.getRequiredParameter(1, FilterParameter.class); | |||
final FilterParameter filter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.a.
@@ -784,7 +784,7 @@ public void getBlockByHashWithMissingBooleanParameter() throws Exception { | |||
assertThat(resp.code()).isEqualTo(200); | |||
// Check general format of result | |||
final JsonObject json = new JsonObject(resp.body().string()); | |||
final RpcErrorType expectedError = RpcErrorType.INVALID_PARAMS; | |||
final RpcErrorType expectedError = RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably rename this. If this parameter is true besu returns the complete transaction objects, if false only the tx hashes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS sounds much better
* 5098: Add RpcErrorTypes Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net> --------- Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net> Signed-off-by: Matilda-Clerke <matilda.clerke@consensys.net> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com> Signed-off-by: gconnect <agatevureglory@gmail.com>
PR description
Update several more RpcErrorTypes
Fixed Issue(s)
#5098