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

5098 branch 19 update more invalid params #7460

Conversation

Matilda-Clerke
Copy link
Contributor

PR description

Update several more RpcErrorTypes

Fixed Issue(s)

#5098

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>
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>
…' 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>
…' 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>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…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
@macfarla macfarla enabled auto-merge (squash) August 15, 2024 23:53
@macfarla macfarla merged commit 68d7bd0 into hyperledger:main Aug 16, 2024
40 checks passed
Copy link
Contributor

@pinges pinges left a 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)");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.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(
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Invalid is complete transaction parameter (index 1)",
"Invalid return complete transactions parameter (index 1)",

Copy link
Contributor Author

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)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"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;
Copy link
Contributor

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

Copy link
Contributor Author

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;
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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

gconnect pushed a commit to gconnect/besu that referenced this pull request Aug 26, 2024
* 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>
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.

3 participants