PAN-3175: Private tx nonce errors return same msg as any tx (#48)

Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
pull/51/head
Lucas Saldanha 5 years ago committed by GitHub
parent aa264b3c0c
commit 97a5c61f25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/response/GraphQLError.java
  2. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcErrorConverter.java
  3. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java

@ -73,8 +73,10 @@ public enum GraphQLError {
case UPFRONT_COST_EXCEEDS_BALANCE: case UPFRONT_COST_EXCEEDS_BALANCE:
return TRANSACTION_UPFRONT_COST_EXCEEDS_BALANCE; return TRANSACTION_UPFRONT_COST_EXCEEDS_BALANCE;
case NONCE_TOO_LOW: case NONCE_TOO_LOW:
case PRIVATE_NONCE_TOO_LOW:
return NONCE_TOO_LOW; return NONCE_TOO_LOW;
case INCORRECT_NONCE: case INCORRECT_NONCE:
case INCORRECT_PRIVATE_NONCE:
return INCORRECT_NONCE; return INCORRECT_NONCE;
case INTRINSIC_GAS_EXCEEDS_GAS_LIMIT: case INTRINSIC_GAS_EXCEEDS_GAS_LIMIT:
return INTRINSIC_GAS_EXCEEDS_LIMIT; return INTRINSIC_GAS_EXCEEDS_LIMIT;
@ -87,10 +89,6 @@ public enum GraphQLError {
// Private Transaction Invalid Reasons // Private Transaction Invalid Reasons
case PRIVATE_TRANSACTION_FAILED: case PRIVATE_TRANSACTION_FAILED:
return PRIVATE_TRANSACTION_FAILED; return PRIVATE_TRANSACTION_FAILED;
case PRIVATE_NONCE_TOO_LOW:
return PRIVATE_NONCE_TOO_LOW;
case INCORRECT_PRIVATE_NONCE:
return INCORRECT_PRIVATE_NONCE;
case GAS_PRICE_TOO_LOW: case GAS_PRICE_TOO_LOW:
return GAS_PRICE_TOO_LOW; return GAS_PRICE_TOO_LOW;
default: default:

@ -23,8 +23,10 @@ public class JsonRpcErrorConverter {
final TransactionInvalidReason reason) { final TransactionInvalidReason reason) {
switch (reason) { switch (reason) {
case NONCE_TOO_LOW: case NONCE_TOO_LOW:
case PRIVATE_NONCE_TOO_LOW:
return JsonRpcError.NONCE_TOO_LOW; return JsonRpcError.NONCE_TOO_LOW;
case INCORRECT_NONCE: case INCORRECT_NONCE:
case INCORRECT_PRIVATE_NONCE:
return JsonRpcError.INCORRECT_NONCE; return JsonRpcError.INCORRECT_NONCE;
case INVALID_SIGNATURE: case INVALID_SIGNATURE:
return JsonRpcError.INVALID_TRANSACTION_SIGNATURE; return JsonRpcError.INVALID_TRANSACTION_SIGNATURE;
@ -39,10 +41,6 @@ public class JsonRpcErrorConverter {
// Private Transaction Invalid Reasons // Private Transaction Invalid Reasons
case CHAIN_HEAD_WORLD_STATE_NOT_AVAILABLE: case CHAIN_HEAD_WORLD_STATE_NOT_AVAILABLE:
return JsonRpcError.CHAIN_HEAD_WORLD_STATE_NOT_AVAILABLE; return JsonRpcError.CHAIN_HEAD_WORLD_STATE_NOT_AVAILABLE;
case PRIVATE_NONCE_TOO_LOW:
return JsonRpcError.PRIVATE_NONCE_TOO_LOW;
case INCORRECT_PRIVATE_NONCE:
return JsonRpcError.INCORRECT_PRIVATE_NONCE;
case GAS_PRICE_TOO_LOW: case GAS_PRICE_TOO_LOW:
return JsonRpcError.GAS_PRICE_TOO_LOW; return JsonRpcError.GAS_PRICE_TOO_LOW;

@ -106,8 +106,6 @@ public enum JsonRpcError {
// Private transaction errors // Private transaction errors
ENCLAVE_ERROR(-50100, "Error communicating with enclave"), ENCLAVE_ERROR(-50100, "Error communicating with enclave"),
PRIVATE_NONCE_TOO_LOW(-50100, "Private transaction nonce too low"),
INCORRECT_PRIVATE_NONCE(-50100, "Private transaction nonce is incorrect"),
UNIMPLEMENTED_PRIVATE_TRANSACTION_TYPE(-50100, "Unimplemented private transaction type"), UNIMPLEMENTED_PRIVATE_TRANSACTION_TYPE(-50100, "Unimplemented private transaction type"),
PRIVACY_NOT_ENABLED(-50100, "Privacy is not enabled to get the precompiled address"), PRIVACY_NOT_ENABLED(-50100, "Privacy is not enabled to get the precompiled address"),
CREATE_PRIVACY_GROUP_ERROR(-50100, "Error creating privacy group"), CREATE_PRIVACY_GROUP_ERROR(-50100, "Error creating privacy group"),

Loading…
Cancel
Save