From f9048cf3e2f772ba70802f19f37320cdff85bc49 Mon Sep 17 00:00:00 2001 From: Matilda-Clerke Date: Mon, 19 Aug 2024 15:50:57 +1000 Subject: [PATCH] 5098 branch 23 rename is complete transaction (#7479) * 5098: Add RpcErrorTypes Signed-off-by: Matilda Clerke --------- Signed-off-by: Matilda Clerke Signed-off-by: Matilda-Clerke Co-authored-by: Sally MacFarlane --- .../fork/frontier/EthGetBlockByNumberIntegrationTest.java | 2 +- .../api/jsonrpc/execution/TracedJsonRpcProcessor.java | 2 +- .../api/jsonrpc/internal/methods/DebugTraceBlockByHash.java | 2 +- .../ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java | 2 +- .../api/jsonrpc/internal/methods/EthGetBlockByHash.java | 4 ++-- .../api/jsonrpc/internal/methods/EthGetBlockByNumber.java | 4 ++-- .../besu/ethereum/api/jsonrpc/internal/methods/TraceGet.java | 2 +- .../ethereum/api/jsonrpc/internal/response/RpcErrorType.java | 4 ++-- .../besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java | 4 ++-- .../api/jsonrpc/internal/methods/EthGetBlockByHashTest.java | 4 ++-- .../api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetBlockByNumberIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetBlockByNumberIntegrationTest.java index 966cda1200..3798cbe507 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetBlockByNumberIntegrationTest.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetBlockByNumberIntegrationTest.java @@ -437,7 +437,7 @@ public class EthGetBlockByNumberIntegrationTest { assertThat(thrown) .isInstanceOf(InvalidJsonRpcParameters.class) - .hasMessage("Invalid is transaction complete parameter (index 1)"); + .hasMessage("Invalid return complete transaction parameter (index 1)"); } /** diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/execution/TracedJsonRpcProcessor.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/execution/TracedJsonRpcProcessor.java index f1a799cf63..ec0e6aef64 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/execution/TracedJsonRpcProcessor.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/execution/TracedJsonRpcProcessor.java @@ -84,7 +84,7 @@ public class TracedJsonRpcProcessor implements JsonRpcProcessor { case INVALID_GAS_PRICE_PARAMS: case INVALID_HASH_RATE_PARAMS: case INVALID_ID_PARAMS: - case INVALID_IS_TRANSACTION_COMPLETE_PARAMS: + case INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS: case INVALID_LOG_FILTER_PARAMS: case INVALID_LOG_LEVEL_PARAMS: case INVALID_MAX_RESULTS_PARAMS: diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHash.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHash.java index da795439cf..4c1d3bfc2a 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHash.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHash.java @@ -68,7 +68,7 @@ public class DebugTraceBlockByHash implements JsonRpcMethod { .orElse(TraceOptions.DEFAULT); } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException throw new InvalidJsonRpcParameters( - "Invalid transaction trace parameters (index 1)", + "Invalid transaction trace parameter (index 1)", RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS, e); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java index ad46d981ac..d309f8dfdd 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java @@ -62,7 +62,7 @@ public class DebugTraceCall extends AbstractTraceCall { .orElse(TraceOptions.DEFAULT); } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException throw new InvalidJsonRpcParameters( - "Invalid transaction trace parameters (index 2)", + "Invalid transaction trace parameter (index 2)", RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS, e); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHash.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHash.java index 09b1c2f952..875daea7f1 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHash.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHash.java @@ -97,8 +97,8 @@ public class EthGetBlockByHash implements JsonRpcMethod { return requestContext.getRequiredParameter(1, Boolean.class); } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException throw new InvalidJsonRpcParameters( - "Invalid is complete transaction parameter (index 1)", - RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS, + "Invalid return complete transaction parameter (index 1)", + RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS, e); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumber.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumber.java index 5e0bc9c7ab..8e0954144d 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumber.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumber.java @@ -128,8 +128,8 @@ public class EthGetBlockByNumber extends AbstractBlockParameterMethod { return request.getRequiredParameter(1, Boolean.class); } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException throw new InvalidJsonRpcParameters( - "Invalid is transaction complete parameter (index 1)", - RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS, + "Invalid return complete transaction parameter (index 1)", + RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS, e); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceGet.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceGet.java index a1460c5aa2..b346637ec2 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceGet.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceGet.java @@ -60,7 +60,7 @@ public class TraceGet extends AbstractTraceByHash implements JsonRpcMethod { transactionHash = requestContext.getRequiredParameter(0, Hash.class); } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException throw new InvalidJsonRpcParameters( - "Invalid transaction has parameter (index 0)", + "Invalid transaction hash parameter (index 0)", RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS, e); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/RpcErrorType.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/RpcErrorType.java index cb19d2e7a3..009fca38fc 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/RpcErrorType.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/RpcErrorType.java @@ -66,8 +66,8 @@ public enum RpcErrorType implements RpcMethodError { INVALID_GAS_PRICE_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid gas price params"), INVALID_HASH_RATE_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid hash rate params"), INVALID_ID_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid ID params"), - INVALID_IS_TRANSACTION_COMPLETE_PARAMS( - INVALID_PARAMS_ERROR_CODE, "Invalid is transaction complete params"), + INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS( + INVALID_PARAMS_ERROR_CODE, "Invalid return complete transaction params"), INVALID_LOG_FILTER_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid log filter params"), INVALID_LOG_LEVEL_PARAMS( INVALID_PARAMS_ERROR_CODE, "Invalid log level params (missing or incorrect)"), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java index dcfd198d6e..bb5cb68a2a 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java @@ -784,7 +784,7 @@ public class JsonRpcHttpServiceTest extends JsonRpcHttpServiceTestBase { assertThat(resp.code()).isEqualTo(200); // Check general format of result final JsonObject json = new JsonObject(resp.body().string()); - final RpcErrorType expectedError = RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS; + final RpcErrorType expectedError = RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS; testHelper.assertValidJsonRpcError( json, id, expectedError.getCode(), expectedError.getMessage()); } @@ -854,7 +854,7 @@ public class JsonRpcHttpServiceTest extends JsonRpcHttpServiceTestBase { assertThat(resp.code()).isEqualTo(200); // Check general format of result final JsonObject json = new JsonObject(resp.body().string()); - final RpcErrorType expectedError = RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS; + final RpcErrorType expectedError = RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS; testHelper.assertValidJsonRpcError( json, id, expectedError.getCode(), expectedError.getMessage()); } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHashTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHashTest.java index 0fc8969c93..e79fff04f7 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHashTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHashTest.java @@ -69,7 +69,7 @@ public class EthGetBlockByHashTest { public void exceptionWhenNoBoolSupplied() { assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH))) .isInstanceOf(InvalidJsonRpcParameters.class) - .hasMessage("Invalid is complete transaction parameter (index 1)"); + .hasMessage("Invalid return complete transaction parameter (index 1)"); verifyNoMoreInteractions(blockchainQueries); } @@ -85,7 +85,7 @@ public class EthGetBlockByHashTest { public void exceptionWhenBoolParamInvalid() { assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH, "maybe"))) .isInstanceOf(InvalidJsonRpcParameters.class) - .hasMessage("Invalid is complete transaction parameter (index 1)"); + .hasMessage("Invalid return complete transaction parameter (index 1)"); verifyNoMoreInteractions(blockchainQueries); } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java index bc6ec997f3..254d0fbe9e 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java @@ -121,7 +121,7 @@ public class EthGetBlockByNumberTest { public void exceptionWhenNoBoolSupplied() { assertThatThrownBy(() -> method.response(requestWithParams("0"))) .isInstanceOf(InvalidJsonRpcParameters.class) - .hasMessage("Invalid is transaction complete parameter (index 1)"); + .hasMessage("Invalid return complete transaction parameter (index 1)"); verifyNoMoreInteractions(blockchainQueries); } @@ -137,7 +137,7 @@ public class EthGetBlockByNumberTest { public void exceptionWhenBoolParamInvalid() { assertThatThrownBy(() -> method.response(requestWithParams("0", "maybe"))) .isInstanceOf(InvalidJsonRpcParameters.class) - .hasMessage("Invalid is transaction complete parameter (index 1)"); + .hasMessage("Invalid return complete transaction parameter (index 1)"); verifyNoMoreInteractions(blockchainQueries); }