5098 branch 23 rename is complete transaction (#7479)

* 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>
pull/7482/head
Matilda-Clerke 3 months ago committed by GitHub
parent 4acd7f120c
commit f9048cf3e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetBlockByNumberIntegrationTest.java
  2. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/execution/TracedJsonRpcProcessor.java
  3. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHash.java
  4. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java
  5. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHash.java
  6. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumber.java
  7. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceGet.java
  8. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/RpcErrorType.java
  9. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java
  10. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByHashTest.java
  11. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java

@ -437,7 +437,7 @@ public class EthGetBlockByNumberIntegrationTest {
assertThat(thrown) assertThat(thrown)
.isInstanceOf(InvalidJsonRpcParameters.class) .isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is transaction complete parameter (index 1)"); .hasMessage("Invalid return complete transaction parameter (index 1)");
} }
/** /**

@ -84,7 +84,7 @@ public class TracedJsonRpcProcessor implements JsonRpcProcessor {
case INVALID_GAS_PRICE_PARAMS: case INVALID_GAS_PRICE_PARAMS:
case INVALID_HASH_RATE_PARAMS: case INVALID_HASH_RATE_PARAMS:
case INVALID_ID_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_FILTER_PARAMS:
case INVALID_LOG_LEVEL_PARAMS: case INVALID_LOG_LEVEL_PARAMS:
case INVALID_MAX_RESULTS_PARAMS: case INVALID_MAX_RESULTS_PARAMS:

@ -68,7 +68,7 @@ public class DebugTraceBlockByHash implements JsonRpcMethod {
.orElse(TraceOptions.DEFAULT); .orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters( throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 1)", "Invalid transaction trace parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS, RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e); e);
} }

@ -62,7 +62,7 @@ public class DebugTraceCall extends AbstractTraceCall {
.orElse(TraceOptions.DEFAULT); .orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters( throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 2)", "Invalid transaction trace parameter (index 2)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS, RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e); e);
} }

@ -97,8 +97,8 @@ public class EthGetBlockByHash implements JsonRpcMethod {
return requestContext.getRequiredParameter(1, Boolean.class); return requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters( throw new InvalidJsonRpcParameters(
"Invalid is complete transaction parameter (index 1)", "Invalid return complete transaction parameter (index 1)",
RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS, RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS,
e); e);
} }
} }

@ -128,8 +128,8 @@ public class EthGetBlockByNumber extends AbstractBlockParameterMethod {
return request.getRequiredParameter(1, Boolean.class); return request.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters( throw new InvalidJsonRpcParameters(
"Invalid is transaction complete parameter (index 1)", "Invalid return complete transaction parameter (index 1)",
RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS, RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS,
e); e);
} }
} }

@ -60,7 +60,7 @@ public class TraceGet extends AbstractTraceByHash implements JsonRpcMethod {
transactionHash = requestContext.getRequiredParameter(0, Hash.class); transactionHash = requestContext.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException } catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters( throw new InvalidJsonRpcParameters(
"Invalid transaction has parameter (index 0)", "Invalid transaction hash parameter (index 0)",
RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS, RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS,
e); e);
} }

@ -66,8 +66,8 @@ public enum RpcErrorType implements RpcMethodError {
INVALID_GAS_PRICE_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid gas price params"), 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_HASH_RATE_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid hash rate params"),
INVALID_ID_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid ID params"), INVALID_ID_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid ID params"),
INVALID_IS_TRANSACTION_COMPLETE_PARAMS( INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS(
INVALID_PARAMS_ERROR_CODE, "Invalid is transaction complete params"), INVALID_PARAMS_ERROR_CODE, "Invalid return complete transaction params"),
INVALID_LOG_FILTER_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid log filter params"), INVALID_LOG_FILTER_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid log filter params"),
INVALID_LOG_LEVEL_PARAMS( INVALID_LOG_LEVEL_PARAMS(
INVALID_PARAMS_ERROR_CODE, "Invalid log level params (missing or incorrect)"), INVALID_PARAMS_ERROR_CODE, "Invalid log level params (missing or incorrect)"),

@ -784,7 +784,7 @@ public class JsonRpcHttpServiceTest extends JsonRpcHttpServiceTestBase {
assertThat(resp.code()).isEqualTo(200); assertThat(resp.code()).isEqualTo(200);
// Check general format of result // Check general format of result
final JsonObject json = new JsonObject(resp.body().string()); 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( testHelper.assertValidJsonRpcError(
json, id, expectedError.getCode(), expectedError.getMessage()); json, id, expectedError.getCode(), expectedError.getMessage());
} }
@ -854,7 +854,7 @@ public class JsonRpcHttpServiceTest extends JsonRpcHttpServiceTestBase {
assertThat(resp.code()).isEqualTo(200); assertThat(resp.code()).isEqualTo(200);
// Check general format of result // Check general format of result
final JsonObject json = new JsonObject(resp.body().string()); 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( testHelper.assertValidJsonRpcError(
json, id, expectedError.getCode(), expectedError.getMessage()); json, id, expectedError.getCode(), expectedError.getMessage());
} }

@ -69,7 +69,7 @@ public class EthGetBlockByHashTest {
public void exceptionWhenNoBoolSupplied() { public void exceptionWhenNoBoolSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH))) assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH)))
.isInstanceOf(InvalidJsonRpcParameters.class) .isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is complete transaction parameter (index 1)"); .hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries); verifyNoMoreInteractions(blockchainQueries);
} }
@ -85,7 +85,7 @@ public class EthGetBlockByHashTest {
public void exceptionWhenBoolParamInvalid() { public void exceptionWhenBoolParamInvalid() {
assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH, "maybe"))) assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH, "maybe")))
.isInstanceOf(InvalidJsonRpcParameters.class) .isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is complete transaction parameter (index 1)"); .hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries); verifyNoMoreInteractions(blockchainQueries);
} }

@ -121,7 +121,7 @@ public class EthGetBlockByNumberTest {
public void exceptionWhenNoBoolSupplied() { public void exceptionWhenNoBoolSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams("0"))) assertThatThrownBy(() -> method.response(requestWithParams("0")))
.isInstanceOf(InvalidJsonRpcParameters.class) .isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is transaction complete parameter (index 1)"); .hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries); verifyNoMoreInteractions(blockchainQueries);
} }
@ -137,7 +137,7 @@ public class EthGetBlockByNumberTest {
public void exceptionWhenBoolParamInvalid() { public void exceptionWhenBoolParamInvalid() {
assertThatThrownBy(() -> method.response(requestWithParams("0", "maybe"))) assertThatThrownBy(() -> method.response(requestWithParams("0", "maybe")))
.isInstanceOf(InvalidJsonRpcParameters.class) .isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is transaction complete parameter (index 1)"); .hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries); verifyNoMoreInteractions(blockchainQueries);
} }

Loading…
Cancel
Save